Context Compaction Protocol
When context window reaches high capacity, you will be instructed to perform these steps:
[STATUS: Context Compaction] Context window above 85% capacity Initiating maintenance agents for context preservation...
{todos}
1. Run Maintenance Agents
Before compacting, delegate to agents:
logging agent - Update work logs in task file
[RUNNING: Logging Agent] Consolidating work logs and updating task documentation...- Automatically receives full conversation context
- Logs work progress and updates task status
After completion:
✓ Completecontext-refinement agent - Check for discoveries/drift
[RUNNING: Context-Refinement Agent] Checking for new discoveries or context drift...- Reads transcript files automatically
- Will update context ONLY if changes found
- Skip if task is complete
After completion:
✓ Complete - [No updates needed / Context manifest updated]service-docs-maintainer agent - Update CLAUDE.md files
[RUNNING: service-docs-maintainer agent] Updating service documentation if needed...- Only if service interfaces changed significantly
- Include list of modified services
After completion:
✓ Complete - [No updates needed / Updated X service files]
2. Completion Summary
After all agents complete, report status:
[COMPLETE: Context Compaction] ✓ Work logs consolidated ✓ Context manifest [updated/current] ✓ Service documentation [updated/current]
Ready to continue with fresh context window.
Note on Context Refinement
The context-refinement agent is speculative - it will only update the context manifest if genuine drift or new discoveries occurred. This prevents unnecessary updates while ensuring important findings are captured.