Summary
Large Archon sessions can become unusable even when the TUI reports they are below the context-window threshold, for example:
ctx main 470k/1000k (47% bundled-catalog) | cache 33/135k
body around 1.87MB
rate limited, retrying in 30s (attempt 1/3)
rate limited, retrying in 30s (attempt 2/3)
rate limited, retrying in 30s (attempt 3/3)
This is not a context-window overflow. It is token-per-minute/request-pressure failure. The provider retry loop resends the same huge request body, /compact refuses to run below 60%, and compaction can fail to survive restart because persisted stale message rows are not removed.
PRD: /home/unixdude/Archon-projects/archon/prds/finalisation/TASK-COMPACTION-TPM-PERSISTENCE-RECOVERY-v1.0.md
Source-verified contributing bugs
crates/archon-core/src/agent/memory_integration.rs still sends speed: "fast", which Anthropic rejects for claude-sonnet-4-6.
crates/archon-core/src/agent/autocompact.rs also sends speed: "fast" for compaction summaries.
crates/archon-llm/src/anthropic.rs retries 429s with the same large request body up to three times.
crates/archon-core/src/agent/compaction.rs makes bare /compact threshold-gated below 60%.
src/session_loop/mod.rs persists current messages by upserting indexes but does not delete stale tail rows after compaction.
crates/archon-session/src/storage.rs has truncate_messages_after, but normal persistence/manual compact do not use replace/truncate semantics.
- Slash-command permission events can write governed-learning relations through the project
.archon/learning.db handle instead of the governed-learning DB handle, causing missing relation warnings.
AgentTool::with_agent_listing injects all discovered agents into the tool description, so the tool schema grows with the local agent catalog and is sent every request.
Expected behavior
- Large request pressure should be able to trigger compaction even below context-window percentage thresholds.
- A huge request that receives 429 should not be retried unchanged three times.
- Bare
/compact should force a useful compaction strategy; /compact auto can remain threshold-gated.
- Successful compaction should persist atomically and survive
/resume/restart.
- Unsupported provider parameters should be capability-gated or omitted.
- Governed-learning event writes should use the governed-learning DB handle.
- Agent discovery should be lazy/paginated instead of embedded wholesale in every Agent tool description.
/context/status should distinguish context-window source from fixed prompt/tool overhead and latest request-body pressure.
Acceptance criteria
- No
speed parameter is sent to unsupported Anthropic model requests for memory extraction or compaction summaries.
- No permission-mode event logs
Cannot find requested stored relation 'permission_runtime_events' due to DB handle mismatch.
- After compaction and restart,
load_messages() returns only the compacted message set, with no stale tail rows.
- At
ctx 470k/1000k, bare /compact attempts compaction rather than returning below-threshold.
- Large 429-limited requests do not retry the exact same body three times.
- Agent tool schema no longer embeds all discovered agent definitions.
Summary
Large Archon sessions can become unusable even when the TUI reports they are below the context-window threshold, for example:
This is not a context-window overflow. It is token-per-minute/request-pressure failure. The provider retry loop resends the same huge request body,
/compactrefuses to run below 60%, and compaction can fail to survive restart because persisted stale message rows are not removed.PRD:
/home/unixdude/Archon-projects/archon/prds/finalisation/TASK-COMPACTION-TPM-PERSISTENCE-RECOVERY-v1.0.mdSource-verified contributing bugs
crates/archon-core/src/agent/memory_integration.rsstill sendsspeed: "fast", which Anthropic rejects forclaude-sonnet-4-6.crates/archon-core/src/agent/autocompact.rsalso sendsspeed: "fast"for compaction summaries.crates/archon-llm/src/anthropic.rsretries 429s with the same large request body up to three times.crates/archon-core/src/agent/compaction.rsmakes bare/compactthreshold-gated below 60%.src/session_loop/mod.rspersists current messages by upserting indexes but does not delete stale tail rows after compaction.crates/archon-session/src/storage.rshastruncate_messages_after, but normal persistence/manual compact do not use replace/truncate semantics..archon/learning.dbhandle instead of the governed-learning DB handle, causing missing relation warnings.AgentTool::with_agent_listinginjects all discovered agents into the tool description, so the tool schema grows with the local agent catalog and is sent every request.Expected behavior
/compactshould force a useful compaction strategy;/compact autocan remain threshold-gated./resume/restart./context/status should distinguish context-window source from fixed prompt/tool overhead and latest request-body pressure.Acceptance criteria
speedparameter is sent to unsupported Anthropic model requests for memory extraction or compaction summaries.Cannot find requested stored relation 'permission_runtime_events'due to DB handle mismatch.load_messages()returns only the compacted message set, with no stale tail rows.ctx 470k/1000k, bare/compactattempts compaction rather than returning below-threshold.