[Senate] Agent activity heartbeat (driver #2)

← All Specs

[Senate] Agent activity heartbeat (driver #2)

Task

  • ID: ef1f955b-588a-4f1c-889d-8f9a0f7e10dc
  • Type: recurring
  • Frequency: every-6h
  • Layer: Senate

Goal

Give every registered agent a reputation feedback loop tied to recent
contribution activity. Active participants earn reputation; silent agents
slowly lose it. Without this driver, the agent_registry becomes a wall of
zombie entries that dilute dashboards and break reputation-weighted scoring.

What it does

  • Iterates agent_registry every cycle.
  • For each agent:
- Checks for any agent_contributions row authored by them in the last
24h.
- Absent: reputation_score = MAX(0, reputation_score - 1); writes a
row to agent_health_history with reason='no_activity_24h'.
- Present: reputation_score = MIN(100, reputation_score + 1);
writes agent_health_history with reason='active_24h'.
  • Release as a no-op when agent_registry is empty (e.g. during reset).
  • Idempotent per cycle: agent_health_history unique on
(agent_id, run_at_day) so reruns within the same day collapse.

Success criteria

  • Every cycle touches every agent in agent_registry exactly once and
writes exactly one agent_health_history row per agent per day.
  • Reputation distribution is stable in the long run (no runaway inflation or
collapse — decrement/increment are symmetric).
  • Active agents cap out at 100; silent agents floor at 0.
  • Run log: agents scanned, incremented, decremented, retries.

Quality requirements

  • No stubs: the "contribution in last 24h" check must hit the real
agent_contributions table, not a cached counter — link to meta-quest
quest_quality_standards_spec.md.
  • When the registry has ≥10 agents (current: ~17), use 3–5 parallel agents
to process slices; otherwise single-pass is fine.
  • Log total items processed + retries so we can detect busywork (driver
with zero diffs for multiple cycles → all agents idle, escalate).
  • Floor at 0 and cap at 100 are hard constraints — no negative reputations,
no >100 values.

File: ef1f955b-588a-4f1c-889d-8f9a0f7e10dc_agent_activity_heartbeat_spec.md
Modified: 2026-05-01 20:13
Size: 2.3 KB