Autonomous Dev Loop (shelved)¶
Status: Shelved 2026-07-28 — planned, never implemented.
Archived changes: openspec/changes/archive/2026-07-28-* (five change folders)
This describes a plan, not a feature
Nothing on this page shipped. It is kept as a record of an idea and of the investigation work that was completed before the idea was set aside. Do not read any of it as a description of how AgentWeave behaves today.
The idea¶
Run a near-continuous development loop on the AgentWeave repo itself, using three
agents — opencode, kimi, and codex — coordinated through a second Hub on
port 8001, separate from the interactive Hub on 8000.
The agents would research, design, implement, review, and document changes on
feature branches. The human role would shrink to two decisions: topic selection
and the final merge to master. The loop would be pausable overnight and
resumable the next morning with a single command.
Planned shape:
- A dev Hub on
:8001with its own database - One git worktree per agent, each on a long-lived agent branch, each with a long-lived CLI session pointed at the dev Hub
- An
autonomous_devrole assigned to all three agents - Staggered cron: kickoff jobs, then steady-state jobs
- A kickoff message template briefing each agent on every wake
- Hub task templates for implementation, peer review, research proposal, escalation
- Reviewer assignment by round-robin among agents that did not author the change
- An operator runbook
Why it was blocked¶
The loop needed three runtime guarantees that AgentWeave did not have:
| # | Required guarantee | Planned fix |
|---|---|---|
| 0 | The Hub can read a trustworthy context-window percentage for every active session | fix-context-tracking |
| 1 | The watchdog can force a checkpoint and fresh session at a context threshold, including force-kill for agents that ignore it | add-auto-reset-mode |
| 2 | The watchdog never silently loses a trigger message | add-durable-trigger-retry |
An investigation change (investigate-blockers, 21/25 tasks complete) shipped
findings only — deliberately no fixes. The three fix changes and the loop itself
never started (0 tasks complete each).
What the investigation actually found¶
The findings are worth keeping. They are in
openspec/changes/archive/2026-07-28-investigate-blockers/findings/
(blocker-0.md, blocker-1.md, blocker-2.md — 732 lines total).
Confirmed defects:
- OpenCode context usage never reaches the Hub.
_parse_opencode_stdout_line(src/agentweave/watchdog.py) returnsusage_data=Noneand ignoresstep_finish.tokens. Becauseusage_data_for_contextstaysNone, the branch that writescontext_usage/<agent>.jsonnever fires for opencode. load_jsonfails on a UTF-8 BOM.src/agentweave/utils.pyopens withencoding="utf-8"; a BOM raisesJSONDecodeErrorand the function returnsNone. The watchdog's_check_context_usagereadsNone or {}as "no data" and silently skips the warning. Found when an external script wrote the file with PowerShellSet-Content, which emits a BOM by default.- The Claude, Kimi-wire, and Codex paths were all left UNTESTED (no CLI available / auth failure at the time), not cleared.
A later finding, not in the investigation¶
The Claude path has a separate bug that the investigation never reached.
_write_context_usage() computes:
…but the result-event parser extracts only input_tokens and output_tokens
from usage, discarding cache_read_input_tokens and
cache_creation_input_tokens. Claude Code uses prompt caching on essentially
every turn, so most of the real context comes back as cache reads and
input_tokens is only the small uncached delta. The percentage is therefore
computed from a fraction of the true context and reads near zero regardless of
how full the window actually is.
The Codex writer (_write_codex_context_usage) does track cached_input_tokens,
so the two runners disagree about what "context usage" means.
Implication: context tracking looks broken because the CLIs hide the data, but at least for Claude the data is present in the stream and is being dropped during parsing.
If this is ever revived¶
Start from the findings, not from the change proposals. Specifically:
- Re-test the three UNTESTED runner paths — the investigation could not.
- Fix the cache-token accounting before anything else; a context percentage that under-reports makes auto-reset actively dangerous, because the watchdog would never fire a reset until the session was already blown.
- Settle what "context usage" means across runners once, then make every writer agree, rather than fixing each path independently.