feat(agent-rules): stall-watching rule + AgentWorkforce orchestration overlay (Phase 3)

AG
3d ago
+112-4

Phase 3 of docs/specs/grok-bot-dynamic-prompt.md. Stacked on #237, which is stacked on #236. Rules version 2026.11.1.

Rules

  • Stall watching (agent-rules/sections/stall-watch.md, base, audiences grok-bot and lead). A bot keeps a list of the work it has delegated. It follows up on agents that have not reported: 30 minutes since the last message, or 10 minutes after a spawn with no acknowledgement. It routes blockers, and it tells the person who owns the work, without waiting to be asked, when an agent is gone, failed or silent after one follow-up, or when work is blocked on a decision, credential, approval or outage. It also runs the check on runs with no new messages. At most one follow-up per agent per interval, and one summary note per run.
  • Orchestration only (agent-rules/overlays/agentworkforce-grok-bot.md). Grok bots do no coding work and make no real decisions; all coding goes to Claude and Codex coding agents; they only spawn, route and relay. Problems go to Khaliq (khaliq-gant).

Decisions applied

  • D7 (spec recommendation): stall-watching is in the base rules for every tenant, with a generic escalation target. Orchestration-only is AgentWorkforce policy, so it ships as the reviewed overlay text. That text is not active until an AgentWorkforce owner or admin PUTs it (command in docs/agent-rules.md). Applying it in production needs Khaliq's OK, so I did not apply it.
  • D6 (no option stated; conservative pick, Khaliq can override): no automatic heartbeat routine. The docs say a bot needs an opt-in scheduled routine to catch stalls when no messages arrive.

Verification

  • npx tsc --noEmit: pass.
  • test/agent-rules.test.ts: 7 tests pass, including the new Phase 3 test. It checks that stall-watch reaches grok-bot and lead but not worker, that the overlay text passes the lint and composes under "Organization rules" after stall-watch, and that the pin, version and CHANGELOG checks hold for 2026.11.1.
  • test/mcp.test.ts and both Grok test files: 79 tests pass. This PR has no code or migration changes.

No merge, deploy or flag flip without Khaliq's direct OK.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Adds Phase 3 of the grok-bot dynamic prompt spec: a stall-watching rule so bots follow up on delegated work that stalls, plus a reviewed orchestration-only overlay for AgentWorkforce. Rules version bumps to 2026.11.1; there are no code or migration changes.

New rules

  • stall-watch (base, audiences grok-bot and lead): bots track delegated work, follow up on agents silent for 30 minutes or unacknowledged 10 minutes after a spawn, route blockers, and proactively tell the work owner when an agent is gone, failed, or still silent after one follow-up, or when work is blocked on a decision, credential, approval, or outage. Runs with no new messages still do the check; at most one follow-up per agent per interval and one summary note per run.
  • overlays/agentworkforce-grok-bot.md: Grok bots do no coding and make no real decisions; all coding goes to Claude or Codex coding agents, and problems surface to Khaliq. It is not in the base bundle; it takes effect only when an AgentWorkforce owner or admin PUTs it (command in docs/agent-rules.md), which on production needs Khaliq's direct OK.

Decisions applied

  • D7: stall-watching ships in the base rules for every tenant; orchestration-only is AgentWorkforce policy and ships as the overlay text.
  • D6 (conservative): no automatic heartbeat routine; the docs note that catching stalls in quiet periods needs an opt-in scheduled routine.