Repository navigation
feat(protocol,loop): agent-owned context, operator-owned record - #47
Merged
Merged
Conversation
Separate the agent's working context from the operator's canonical conversation record. The agent is free to inject scaffolding (<compacted_context>, turn markers, nudges) without polluting what the operator persists. Protocol changes: - turn/end.messages deprecated (empty, omitted on wire) - New context/compacted notification carries summary + surviving canonical messages after compaction Compaction rewrite: - Returns CompactionResult with working_messages (for LLM) and canonical_messages (for operator) - Uses <compacted_context> system message instead of synthetic user/assistant pair - Configurable thresholds via env vars (CONTEXT_WINDOW, COMPACTION_THRESHOLD, COMPACTION_KEEP_RECENT, MAX_COMPACTIONS) - Per-session compaction cap (default 3) Broker: context/compacted added to notification passthrough. Docs: new docs/design/context-management.md; updated SPEC, protocol, STATUS, TODO. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #47 +/- ##
==========================================
- Coverage 91.78% 91.62% -0.17%
==========================================
Files 50 50
Lines 6857 6949 +92
==========================================
+ Hits 6294 6367 +73
- Misses 563 582 +19
🚀 New features to boost your workflow:
|
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
turn/end.messagesdeprecated — agents send onlyusage; operators reconstruct fromstream/*notificationscontext/compactednotification — emitted after auto-compaction with a prose summary and surviving canonical messages for the operator to persistCompactionResultwithworking_messages(for LLM, includes<compacted_context>system scaffolding) andcanonical_messages(for operator, no scaffolding)CONTEXT_WINDOW,COMPACTION_THRESHOLD,COMPACTION_KEEP_RECENT,MAX_COMPACTIONSdocs/design/context-management.mdTest plan
ContextCompactedParamsand usage-onlyTurnEndParamsCompactionResultstructure, canonical-excludes-scaffoldingturn_endsends no messages,context_compactedround-trips correctlycontext/compactedpasses through as notificationstream/*frames instead ofturn/end.messages🤖 Generated with Claude Code