context-discipline
Skill1 starsChanged 5 months agoMITView on GitHub
Context-window economics for long-running agent sessions: keep the orchestrating seat lean, push bulk reads into sub-agents, re-triage when scope changes, and hand off cleanly when a session degrades. Load at the start of any session likely to exceed a few tool calls, and whenever you notice re-reading, re-deriving, or exploration creep. Do NOT use for one-shot lookups or single-file edits — the overhead is the anti-pattern there.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- ios3kov/codex-skillstheir own version, first seen Nov 29, 2026
- anhnguyen0905/codex-mcptheir own version, first seen Nov 22, 2026
- PedroMosquera/squadaitheir own version, first seen Oct 13, 2026
- Resgrid/Coretheir own version, first seen Oct 8, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- Resgrid/Core★ 240same name
- PedroMosquera/squadai★ 10same name
- anhnguyen0905/codex-mcp★ 4same name
- ios3kov/codex-skills★ 0same 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.
- advanced-prd-writerSkill
- calendar-reviewSkill
- challenge-before-buildSkill
- claude-build-hardeningSkill
- claude-memorySkill
- claude-product-demo-videoSkill
- codex-imagegenSkill
- codexSkill
- coding-craftSkill
- computer-controlSkill
- disk-cleanupSkill
- image-generation-craftSkill
- infinite-working-skillSkill
- intelligent-delegationSkill
- linkedin-post-writerSkill
- okr-structuringSkill
- operator-standardSkill
- posthog-design-customizationSkill
- self-performance-reviewSkill
- session-namerSkill
- session-recallSkill
- skill-hardeningSkill
- slack-statusSkill
- slack-writerSkill
- subagent-briefSkill
- testing-standardsSkill
- verification-gatesSkill
- writing-craftSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Delegate reads, keep findings: When answering requires sweeping many files or sources, send a sub-agent and take back its conclusion — not …
- Distinctive: line 26
Read the part, not the file: When you know which section you need from a large file, read that range.
- Distinctive: line 28
Act when you can act: When you have enough to proceed, proceed.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Discipline
A context window is a workspace, not a warehouse. Sessions degrade not because the model gets worse but because the seat fills with raw material that should have stayed in a delegate: whole-file dumps, dead exploration, restated conclusions. The discipline: conclusions live in the seat; raw reads live in sub-agents.
The seat rules
- Delegate reads, keep findings. When answering requires sweeping many files or sources, send a sub-agent and take back its conclusion — not the file contents. A search you've delegated, you don't also run yourself.
- Never re-derive. Facts established earlier in the session are settled. Don't re-open decisions the user already made; don't re-read files you just edited to "verify" an edit the tool already confirmed.
- Read the part, not the file. When you know which section you need from a large file, read that range. Whole-file reads of known files are warehouse behaviour.
- Act when you can act. When you have enough to proceed, proceed. Narrating options you won't pursue, or summarising what you're "about to do" at length, burns the same tokens as doing it.
Re-triage triggers
The delegation decision is not a one-shot at session start. Re-ask "should this fan out?" whenever:
- A follow-up adds scope ("also do X", "apply the same to Y" — replication is parallelism).
- A tool result reveals the surface is bigger than assumed.
- You're about to read a third file in one turn just to orient (hand the exploration to a search agent).
- You catch the thought "this is bigger than I thought" — that thought is the trigger.
Cache-window awareness
Prompt caches have short TTLs (typically ~5 minutes). When waiting on external state, either poll inside the cache window or commit to a long sleep — a wait just past the TTL pays the full re-read for no benefit. Never poll for work the harness will notify you about; polling tracked work is pure waste.
Handoff — when and how
Hand off to a fresh session when the seat is genuinely polluted or the topic pivots — not as a reflex. A handoff must be a self-contained transfer prompt in the chat (no "go read the handoff file"), containing:
## What was done — shipped work, confirmed facts, dead ends proven
## Current state — what exists now, what's live
## Next action — the single concrete first step
## Open unknowns — what's unverified, what could break
## Key files — path + why it matters
## Dead ends — approach + why it fails (so the next session doesn't retry them)The "Dead ends" section is the most commonly omitted and the most valuable: a fresh session re-attempting a proven failure is the costliest handoff defect.
Named failure modes
| Failure mode | What it looks like | Antidote |
| Exploration creep | Fifth file read "to understand the codebase" before any decision | Delegate the sweep; you need the map, not the terrain |
| Context hoarding | Whole files read into the seat "in case" | Read ranges; take conclusions from delegates |
| Re-derivation | Recomputing/reconfirming a settled fact | Trust the session record |
| Double work | Delegating a search, then also doing it yourself | One owner per question |
| Poll spinning | Short sleeps polling harness-tracked work | Wait for the notification |
| Warehouse handoff | Handoff prompt is a transcript, not a distillation | The six-section format, tight |
| Premature handoff | Suggesting a fresh session at the first sign of length | Handoff on pollution or pivot, not on turn count |
Related
operator-standard — the communication discipline the lean seat exists to serve. skill-hardening — applies this economy rule to skill files themselves (R10).
Sync home
Sync home: github.com/justinwilliames/skills — canonical. Installed copies (e.g. ~/.claude/skills/context-discipline) are distribution artifacts: edit the repo, re-copy.
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.

