context-discipline
Skill10 starsChanged 20 days agoMITView on GitHub
Recover from context compaction and keep long agent sessions token-efficient. Load on demand, after a compaction event, or when the session context is filling with tool/MCP output.
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
When context is compacted or truncated mid-task, re-anchor before acting:
- Very specific: line 15
Session state: read AGENTS.md or CLAUDE.md for recorded decisions.
- Very specific: line 18
Recent history: run git log --oneline -10 to see the latest commits and infer phase progress from their prefixes (test: = red, feat: = …
- Distinctive: line 21
Ground truth: run the project test command.
- Very specific: line 23
Artifacts: check specs/ for written specification documents and read the most recently modified files to see what was last changed.
- Distinctive: line 37
After an MCP documentation lookup, keep only the signatures, parameters, and constraints you need.
- Distinctive: line 42
When delegating, pass file paths and one-line conclusions, not the raw output you collected.
- Distinctive: line 47
Keep a running checklist of pipeline phases.
- Distinctive: line 48
After each phase or sub-agent result, write a 3-5 line summary and drop the detail from active use.
- Distinctive: line 50
Write large intermediate products (specs, plans, analyses) to disk and reference them by path.
- Distinctive: line 52
Prefer re-reading a small file over keeping its content in context "just in case".
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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 Discipline Skill
On-demand procedures for context recovery and long-session hygiene. Load this skill only when needed: after a compaction, or when context pressure builds.
Compaction Recovery Procedure
When context is compacted or truncated mid-task, re-anchor before acting:
- Session state: read
AGENTS.mdorCLAUDE.mdfor recorded decisions; in solo sessions, look for=== PHASE: <name> ===markers in the visible context to find your position. - Recent history: run
git log --oneline -10to see the latest commits and infer phase progress from their prefixes (test:= red,feat:= green,refactor:,docs: add spec= spec phase, etc.). - Ground truth: run the project test command; the pass/fail state is a reliable phase indicator.
- Artifacts: check
specs/for written specification documents and read the most recently modified files to see what was last changed. - Resume, don't restart: continue from the last completed phase. Never restart a pipeline from scratch after a compaction.
- Confirm when unsure: tell the user: "Context was compacted. Last commit was X. Shall I continue with [phase]?"
Summarizing Tool and MCP Output
Tool results and MCP responses (Context7 documentation, search results, API lookups) are the fastest way to fill a context window. Rules:
- Extract the relevant findings from any tool output longer than ~30 lines; never leave a full dump in the transcript.
- After an MCP documentation lookup, keep only the signatures, parameters, and constraints you need; drop prose, examples you won't use, and unrelated sections.
- Record what you learned in 3-5 lines in your working notes, then reference the note instead of re-querying.
- When delegating, pass file paths and one-line conclusions, not the raw output you collected.
Working-Notes Protocol for Long Sessions
- Keep a running checklist of pipeline phases; tick them off as they finish.
- After each phase or sub-agent result, write a 3-5 line summary and drop the detail from active use.
- Write large intermediate products (specs, plans, analyses) to disk and reference them by path. The file system is your external memory.
- Prefer re-reading a small file over keeping its content in context "just in case".
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Resgrid/Core★ 229same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- code-reviewSkill
- find-skillsSkill
- pr-descriptionSkill
- sdd-applySkill
- sdd-designSkill
- sdd-exploreSkill
- sdd-proposeSkill
- sdd-specSkill
- sdd-tasksSkill
- sdd-verifySkill
- squadai-init-playbookSkill
- testingSkill
- code-reviewSkill
- context-disciplineSkill
- find-skillsSkill
- pr-descriptionSkill
- sdd-applySkill
- sdd-designSkill
- sdd-exploreSkill
- sdd-proposeSkill
- sdd-specSkill
- sdd-tasksSkill
- sdd-verifySkill
- squadai-init-playbookSkill
- testingSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

