role-context-manager
Skill2 starsChanged 3 months agoMITView on GitHub
Context window management: persisting critical state, checkpointing, and preventing context degradation in long sessions. Trigger at ~60% context usage or before large tasks.
In this repository74 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- lead-producerSkill
- role-analytics-engineerSkill
- role-backend-engineerSkill
- role-behavioral-economistSkill
- role-brand-strategistSkill
- role-code-reduction-engineerSkill
- role-community-developerSkill
- role-cpp-engineerSkill
- role-ctoSkill
- role-database-engineerSkill
- role-data-engineerSkill
- role-devops-engineerSkill
- role-economistSkill
- role-economy-designerSkill
- role-education-researcherSkill
- role-elementary-math-teacherSkill
- role-elementary-teacherSkill
- role-frontend-engineerSkill
- role-game-balance-designerSkill
- role-game-designerSkill
- role-godot-engineerSkill
- role-go-engineerSkill
- role-icelandic-linguistSkill
- role-icelandic-teacherSkill
- role-java-engineerSkill
- role-kotlin-engineerSkill
- role-level-designerSkill
- role-liveops-engineerSkill
- role-move-sui-developerSkill
- role-narrative-designerSkill
- role-open-source-engineerSkill
- role-principal-software-engineerSkill
- role-product-managerSkill
- role-product-marketing-managerSkill
- role-python-engineerSkill
- role-qa-engineerSkill
- role-railway-deploymentSkill
- role-rust-engineerSkill
- role-scalability-engineerSkill
- role-security-engineerSkill
- role-software-architectSkill
- role-technical-product-managerSkill
- role-technical-writerSkill
- role-typescript-engineerSkill
- role-ui-ux-designerSkill
- role-unity-engineerSkill
- team-architecture-reviewSkill
- team-blue-teamSkill
- team-brand-teamSkill
- team-dev-teamSkill
- team-documentationSkill
- team-economy-teamSkill
- team-elementary-educationSkill
- team-frontend-teamSkill
- team-infrastructureSkill
- team-move-teamSkill
- team-open-sourceSkill
- team-product-teamSkill
- team-red-teamSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Keep vs persist vs drop decisions for working memory
- Distinctive: line 28
Keep live task, active files, preferences, next step in context.
- Very specific: line 30
Write _context/SESSION_STATE.md with current task, decisions, active files, blockers, next steps.
- Very specific: line 31
Write _context/HANDOFF.md only when another agent needs to resume.
- Distinctive: line 43
If reference files are unavailable:
- Distinctive: line 44
Context Degradation: When the model starts repeating itself, losing track of decisions, or contradicting earlier conclusions.
- Distinctive: line 47
Handoff Protocol: When transferring to another agent: task, constraints, decisions made, files touched, next step.
- Distinctive: line 52
Do not persist away live user constraints or current next step.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Manager
Use When
- Context usage around 60% or higher
- Long task about to generate noisy output
- Multi-agent coordination needs durable handoff
- Rereading same material due to context degradation
Do NOT Use When
- Session is short and context is comfortable
- Problem is missing external knowledge, not memory hygiene
- Task is documentation authoring or product prioritization
What You Own
- Smallest high-signal persistence before context collapse
_context/SESSION_STATE.mdas recovery entry point_context/HANDOFF.mdfor agent-to-agent transfer- Keep vs persist vs drop decisions for working memory
Reference Map
references/context-hygiene.md— degradation signals, checkpoint timing, smallest-useful persistence
Working Method
- Keep live task, active files, preferences, next step in context.
- Persist only reusable parts: settled decisions, finished findings, blockers.
- Write
_context/SESSION_STATE.mdwith current task, decisions, active files, blockers, next steps. - Write
_context/HANDOFF.mdonly when another agent needs to resume. - On recovery, read SESSION_STATE.md first, then referenced files.
Default Output
CONTEXT CHECKPOINT
==================
Persisted: session state, decisions/findings worth reusing, handoff if needed
Kept In Context: current task, active files, next stepKey Concepts (Inline Fallback)
If reference files are unavailable:
- Context Degradation: When the model starts repeating itself, losing track of decisions, or contradicting earlier conclusions. Signals: asking about something already resolved, re-reading files already summarized.
- Checkpoint Trigger: ~60% context usage, or before any operation that will generate large output (tree dumps, full file reads, multi-file diffs).
- Smallest Useful Persistence: Save decisions and pointers, not transcripts. A 10-line SESSION_STATE.md that lets the next context rebuild > a 200-line dump that wastes budget.
- Handoff Protocol: When transferring to another agent: task, constraints, decisions made, files touched, next step. Nothing else.
- Recovery Priority: On context restore, read SESSION_STATE.md first. Only pull referenced files if actively needed for the next step.
Anti-Drift Rules
- Persist conclusions and pointers, not full tool transcripts.
- Do not persist away live user constraints or current next step.
_context/is working-memory support, not documentation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

