principle-guard-the-context-window
Skill9 starsChanged 37 days agoMITView on GitHub
Apply before a large read, a long command output, or a subagent brief, not only when context is filling up. Route bulk to subagents, take thin reports back, and keep summaries in the main thread, not raw payloads.
49 other projects use a version of this, 46 of them edited.
Adopted by
Most recently taken up by
- sammyjoyce/prime-pstackedited, first seen Nov 15, 2026
- pronvis/skillsedited, first seen Nov 15, 2026
- upamune/skillsedited, first seen Nov 15, 2026
- paramcodes/skillsedited, first seen Nov 8, 2026
- tristanphvn/keeledited, first seen Nov 8, 2026
- hidenobunagai/astacktheir own version, first seen Nov 8, 2026
Other versions49 projects use a version of this.
Word for word · 0
None found.
Edited · 46
- backnotprop/pstack★ 3.8k46% same
- jtaroreh/agystack★ 12843% same
- uzairansaruzi/p3-stack★ 12670% same
- dsebban/skills★ 7146% same
- creedants/pstack-t3★ 1855% same
- painhardcore/pstack★ 1855% same
- Scino/fstack★ 1850% same
- mariusflorescu/pstack-t3★ 1346% same
- adjohn/pstack★ 946% same
- kkgogogo17/pi-pstack★ 951% same
36 more not listed
Wrote their own version · 3
- TheOnlyFusionCube/potetos-for-everyone★ 21same name
- requie/endostack★ 4same name
- hidenobunagai/astack★ 1same 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 repository64 other files it gives its agents.
- architectSkill
- arenaSkill
- automate-meSkill
- benchmark-checklistSkill
- blast-radiusSkill
- broSkill
- correctSkill
- create-formal-verification-skillSkill
- create-verification-skillSkill
- deslopSkill
- documentation-impactSkill
- figure-it-outSkill
- howSkill
- interrogateSkill
- in-your-own-wordsSkill
- ketchupSkill
- ketchup-videoSkill
- maintain-formal-verification-skillSkill
- maintain-verification-skillSkill
- make-bot-uiSkill
- no-commentsSkill
- poteto-helpSkill
- poteto-modeSkill
- poteto-tddSkill
- poteto-teachSkill
- principle-attack-the-premiseSkill
- principle-boundary-disciplineSkill
- principle-build-the-leverSkill
- principle-encode-lessons-in-structureSkill
- principle-exhaust-the-design-spaceSkill
- principle-experience-firstSkill
- principle-explain-the-numberSkill
- principle-fix-root-causesSkill
- principle-foundational-thinkingSkill
- principle-laziness-protocolSkill
- principle-make-operations-idempotentSkill
- principle-migrate-callers-then-delete-legacy-apisSkill
- principle-minimize-reader-loadSkill
- principle-model-the-domainSkill
- principle-never-block-on-the-humanSkill
- principle-outcome-oriented-executionSkill
- principle-prove-it-worksSkill
- principle-redesign-from-first-principlesSkill
- principle-separate-before-serializing-shared-stateSkill
- principle-sequence-verifiable-unitsSkill
- principle-subtract-before-you-addSkill
- principle-test-behavior-not-implementationSkill
- principle-type-system-disciplineSkill
- pr-recapSkill
- pstack-harnessSkill
- recallSkill
- reflectSkill
- runtime-probesSkill
- setup-pstackSkill
- sharpenSkill
- show-me-your-workSkill
- spec-probesSkill
- statechartSkill
- swarmSkill
- technical-writingSkill
- The first 60 shown.
The file
Files
Guard the Context Window
The context window is finite and non-renewable within a session. Every token should be worth its cost.
Why: Context overflow degrades reasoning quality, creates compression artifacts, and halts progress.
Pattern:
- Isolate large payloads. Route verbose outputs, screenshots, and large documents to subagents. The main context gets summaries, not raw data. A read-only scan or parse that returns a reduced finding runs on the
routinerole, unless the calling skill names another role. Call the Skill tool withpstack-harness, then follow its Spawn a role section to resolve the role. - Keep frequently used content inline. Templates and references used on every invocation belong in the skill file, not in separate files that cost a read each time.
- Size phases and cap scope. Limit files per phase, set turn budgets, account for mechanism costs.
- Return thin. When a subagent's report feeds your next step, its brief names where the full report goes, a file the subagent writes or the PR, and asks for only the verdict or status line, any blockers, and that path or URL. Read the full report only to act on a blocker. A subagent whose output is the deliverable you relay, such as a
howexplanation, awhysynthesis, the trail reviewer's flags, or an arena cross-judge's scores, returns it in full. - Budget the lead's reads. Send a file or command output longer than about 150 lines to a subagent unless you will edit it. Cut command output with
head,tail,grep, or--jqbefore it reaches you. Do not reread a file ahowpass already mapped unless you are about to edit it. A read that a playbook or skill step assigns to you, such as Code review's changed files, Eval's candidate outputs, or show-me-your-work's transcript audit, is exempt. - Read steps, not whole playbooks. Open a playbook's worklist from the output of the mode entry's plan script, which prints the opening prose and each step's outcome. When a step starts, print it with that script's
--step <number>. Without the script, print the playbook's prose before step 1 and its numbered steps with their indented sub-items (awk '/^[0-9]+\. /{p=1} !p && !/^#/ && NF {print; next} p && /^[^ ]/ && !/^[0-9]+\. /{exit} p' <playbook>). When that prose says to read the playbook in full, read it in full.
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.

