guard-the-context
Apply when context is filling up: large outputs, long files, repeated reads, broad searches or fan-out planning. Make every token earn its place; send bulk to subagents and keep conclusions, not raw payloads, in the main thread.
- License 许可
- MIT
- 最近更新
- 2026-11-04
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- guard-the-context
- metadata
- { "layer": "L2", "source": "poteto/brainmaxxing@ec4d8e4:brain/principles/guard-the-context-window.md", "license": "MIT" }
- description
- Apply when context is filling up: large outputs, long files, repeated reads, broad searches or fan-out planning. Make every token earn its place; send bulk to subagents and keep conclusions, not raw payloads, in the main thread.
03 SKILL.md 正文
Guard the Context
The context window is finite and doesn't refill within a session. Every token that enters it should earn its place.
Why: A crowded context degrades reasoning, forces lossy compaction and eventually halts the work. Time and compute can be spent again; context used in a session can't be taken back.
Pattern:
- Send bulk elsewhere. Long logs, full test output, large files, broad searches and wide fan-outs go to a subagent. The main thread gets the conclusion, the file:line references and the evidence, not the raw payload.
- Read for the question. Search first, then read the part you need. Skip files the current task doesn't touch, and don't re-read what you already have.
- Trim output at the source. Ask commands for the failing cases only, the tail of a log, a count instead of a list.
- Keep the always-needed inline. What a skill uses on every run belongs in the skill; detail used sometimes goes in a reference loaded on demand.
- Size phases and cap scope. Limit files per phase, set turn budgets, and count what each mechanism costs before you start it.
- Write state down. Plans, decisions and findings go to a file or the task list, so a fresh session or a compaction loses nothing.
The test: Before pulling something in, ask what you will do with it. If the answer is "skim it", send it to a subagent or don't fetch it.
Stop: Don't starve the work to save tokens. Reading the code a change touches is never waste; reading everything near it usually is.
04 同仓库更多 Skills
yeet
Take every local change green through the repo's own checks, slice it into conventional commits, push, and with --pr open a pull request on the code host. Use only when the user explicitly asks to yeet, or to commit and push everything; never on your own initiative.
write-docs
Write or update documentation from the code: gather facts, pick the shape for the reader, write it plain, and prove every command and path in it. Use when asked to document a repo, module or feature, or to bring stale docs up to date.
why
Find why code is shaped the way it is (design rationale, trade-offs, regressions, odd thresholds) from history, tickets, docs and chat, citing every claim and stating its confidence. Use for 'why does X work this way', 'why did we pick Y', or before changing code whose purpose is unclear.
verify
Prove a change works with the check that matches its type, do the read-back, and log the pass against the exact tree. Use when a change is ready to call done, before review, commit or stopping, and whenever ven-decisions end refuses an unverified tree.
unslop
Cut AI writing tells (filler, model vocabulary, metaphor nouns, hedging, formatting tics) from text while keeping every fact. Use when editing or checking any prose before it ships: docs, PR bodies, reports, skill text.
type-discipline
Apply when designing types or data shapes, reviewing a signature, or handling outside data, in any language. Make wrong states fail early: in the compiler for typed languages, in validated runtime contracts for untyped ones.