fix(context): eliminate redundant context injection causing overflow#35
Merged
fix(context): eliminate redundant context injection causing overflow#35
Conversation
Two remaining issues were causing context overflow for clawdbot_cipher: 1. Double injection: mission briefing was injected via BOTH before_agent_start hook (prependContext) AND agent:bootstrap hook (AX_MISSION.md bootstrap file). Disabled bootstrap hook — single injection point is now before_agent_start in index.ts. 2. Redundant conversation history: briefing re-injected up to 10 messages (~3-5k tokens) per dispatch, duplicating Clawdbot's native session history. Removed history section entirely — Clawdbot handles this natively. Briefing now contains only identity + collaborators. Result: ~100-200 tokens per dispatch (down from 2-5k). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hooks/ax-bootstrap/handler.ts) — mission briefing was being injected twice: once viabefore_agent_start(prependContext) and once viaagent:bootstrap(AX_MISSION.md). Now single injection point only.lib/context.ts) — Clawdbot's native session history already provides this. The briefing was re-injecting up to 10 messages (~3-5k tokens) per dispatch, duplicating what Clawdbot already tracks.Addresses P0 context overflow issue for @clawdbot_cipher (task ada8f9) and task d640c0 (optimize plugin to <500 tokens).
Test plan
🤖 Generated with Claude Code