Code Context Slicing
trailofbits/skills
Picks a small, graph-based slice of source with Trailmark and hands a focused code task to a smaller or local model without exposing the whole repository.
Checks every subagent prompt before spawning, swapping pasted files and context for paths and short summaries and trimming the brief, to avoid multiplied token cost.
$ npx skills add LichAmnesia/lich-skills --skill subagent-brief -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install LichAmnesia/lich-skills subagent-brief --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/subagent-brief .claude/skills/subagent-brief && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "subagent-brief" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/subagent-brief into .claude/skills/subagent-brief/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "subagent-brief", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/LichAmnesia/lich-skills/tree/main/skills/subagent-briefType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add LichAmnesia/lich-skills --skill subagent-brief -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install LichAmnesia/lich-skills subagent-brief --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/subagent-brief .agents/skills/subagent-brief && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "subagent-brief" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/subagent-brief into .agents/skills/subagent-brief/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "subagent-brief", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add LichAmnesia/lich-skills --skill subagent-brief -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install LichAmnesia/lich-skills subagent-brief --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/subagent-brief .cursor/skills/subagent-brief && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "subagent-brief" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/subagent-brief into .cursor/skills/subagent-brief/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "subagent-brief", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/LichAmnesia/lich-skills.git --path skills/subagent-brief--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add LichAmnesia/lich-skills --skill subagent-brief -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install LichAmnesia/lich-skills subagent-brief --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/subagent-brief .gemini/skills/subagent-brief && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "subagent-brief" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/subagent-brief into .gemini/skills/subagent-brief/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "subagent-brief", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install LichAmnesia/lich-skills subagent-briefInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add LichAmnesia/lich-skills --skill subagent-brief -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/subagent-brief .github/skills/subagent-brief && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "subagent-brief" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/subagent-brief into .github/skills/subagent-brief/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "subagent-brief", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add LichAmnesia/lich-skills --skill subagent-brief -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install LichAmnesia/lich-skills subagent-brief --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/subagent-brief .opencode/skills/subagent-brief && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "subagent-brief" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/subagent-brief into .opencode/skills/subagent-brief/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "subagent-brief", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
subagent-briefChecks every subagent prompt before spawning, swapping pasted files and context for paths and short summaries and trimming the brief, to avoid multiplied token cost.
This skill is a pre-flight checklist for the moment an agent is about to call the Task or Agent tool. Its premise, stated in the skill, is that subagents do not share a prompt prefix cache, so each one re-tokenizes everything it is handed and a fan-out of many agents with large context multiplies token cost. The burden of compression therefore falls on the orchestrating agent.
The checklist applies its rules in order to each subagent: strip your own conversation history and reasoning trail, replace file contents with absolute paths the subagent can read itself, replace big context dumps with a summary of one to three sentences, and compress the final brief to 200 words or fewer. It applies when a prompt is growing long, a full repo dump or PRD is about to be embedded, or many parallel subagents will do similar work on a metered plan. It does not apply to one-line tasks, jobs that truly need the full document, or briefs the user already compressed.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit ebbc355. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Subagent Brief Discipline loads about 1.6k tokens when it runs. Until then it costs about 157 tokens; SKILL.md has 787 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from LichAmnesia/lich-skills at commit ebbc355, republished under its MIT licence (© LichAmnesia). 787 words, ~1,564 tokens.
.claude/skills/subagent-brief/SKILL.md (or your agent's skills folder).Pre-flight checklist for spawning subagents in Claude Code. The single most expensive mistake in multi-agent workflows is treating subagents as free threads. They are not. Each subagent is an independent LLM call that re-tokenizes the entire prompt you hand it.
There is no prefix sharing across subagents in Anthropic's serving stack today. The multi-agent topology is a known optimization opportunity (see arXiv 2604.25899 Pythia: Predictability-Driven Agent-Native LLM Serving, 2026-04) but has not yet shipped in production. Until it does, the burden of compression falls on the orchestrating agent.
The math: 20 subagents × 50K shared context = ~1M tokens per fan-out. One careless Task call exhausts a Max-plan daily quota.
For every subagent you are about to spawn, apply these five rules in order.
The subagent gets its own system prompt, its own tool list, and its own task framing automatically. Do not paste your own conversation history, your TODO list, or your reasoning trail into the subagent prompt unless the subagent literally needs them to do its job.
BAD: Here is the full content of foo.py: <800 lines>
GOOD: Read /abs/path/to/foo.py and report the public API.The subagent has Read access. One Read call is cheaper than re-tokenizing 800 lines on every spawn.
BAD: <entire 50K context window dump> — now look for X
GOOD: Project context: <3-line summary>. Look for X in <specific path>.If you genuinely synthesized something useful from your context, summarize it in 1-3 sentences and pass that summary. Never paste the raw window.
The brief should fit in a tweet-length window. If it does not, you are either dumping context the subagent can fetch itself, or handing over a task too large for one subagent — split it.
Before spawning N parallel subagents, ask: do they all share the same long context? If yes, you are about to multiply cost by N. Either:
ROLE: <one line — what this subagent is>
GOAL: <one line — what it should produce>
INPUTS:
- <path or 1-line summary, never raw content>
- <path or 1-line summary>
CONSTRAINTS:
- <output format, what NOT to do>
RETURN: <one line — what to report back>Total ≤ 200 words. If it does not fit, the task is too large for one subagent. Split it.
| Excuse | Reality |
|---|---|
| "Faster to just paste the whole file." | Faster for you. The subagent re-tokenizes 800 lines on every spawn. |
| "Parallelism will be 5× faster." | 5× faster wall-clock, 5× more tokens — and Max plan caps are daily, not hourly. The hourly speedup costs you the rest of the day. |
| "The subagent needs context." | It needs information. A summary is information. The raw window is dump. |
| "I'll just pass the whole repo, it's small." | "Small" repos compound across 10 subagents into a Max-plan kill. |
| "I don't have time to summarize." | Summarizing forces you to clarify what the subagent should do — which is 80% of why subagents fail anyway. |
| "The user wanted parallel." | The user wanted fast. Token-budget parallel ≠ wall-clock parallel. Default to sequential unless tasks are genuinely independent. |
Spawn the subagent. Then evaluate:
Most "subagent failures" are brief failures, not subagent failures.
If you catch yourself writing any of these in a subagent prompt, stop and re-compress:
Multi-agent serving is a 2026 research topic, not a shipped feature. arXiv 2604.25899 (Pythia, 2026-04) demonstrates that exposing multi-agent topology to the serving layer can recover 3-5× of wasted tokens via prefix sharing — but no production LLM provider has shipped this yet. Anthropic, OpenAI, Codex: every subagent today is a cold-start, full-prefix re-tokenization.
Until that changes, the brief is the only knob you have. Use it.
© LichAmnesia, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/subagent-brief of LichAmnesia/lich-skills.
Open the folder on GitHubat commit ebbc355
Subagent Brief Discipline next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Subagent Brief Discipline this skillLichAmnesia/lich-skills | 234 | — | ~1.6k | Automated safety check: Pass | MIT | |
| Code Context Slicingtrailofbits/skills | 7.4k | — | ~2.1k | Automated safety check: Pass | CC-BY-SA-4.0 | |
| Claude Code Masteryborghei/Claude-Skills | 881 | — | ~1.9k | Automated safety check: Pass | MIT | |
| Context DoctorjzOcb/context-doctor | 119 | — | ~642 | Automated safety check: Pass | MIT | |
| Caveman Learn Token FixesJuliusBrussee/caveman | 110k | — | ~2.8k | Automated safety check: Pass | Apache-2.0 | |
| Fable Foremanolsenbrands/fable-foreman | 142 | — | ~5.2k | Automated safety check: Pass | MIT |
trailofbits/skills
Picks a small, graph-based slice of source with Trailmark and hands a focused code task to a smaller or local model without exposing the whole repository.
borghei/Claude-Skills
A skill your agent uses when the user asks to "optimize CLAUDE.md", "create a new skill", "write a custom agent", "configure hooks", "manage context window", "set up MCP servers", "scaffold a skill…
jzOcb/context-doctor
Visualize and diagnose OpenClaw context window usage. An agent skill from jzOcb/context-doctor.
JuliusBrussee/caveman
Acts on a Caveman learn report: reviews ranked token sinks, applies cost-lowering edits one at a time with your consent, and reports what each fix returned.
olsenbrands/fable-foreman
Turns the lead model into a foreman that plans, routes and verifies while cheaper Claude, Codex or Grok workers do the typing, using a per-machine routing card.
MadAppGang/claudish
CRITICAL - Guide for using Claudish CLI ONLY through sub-agents to run Claude Code with any AI model (OpenRouter, Gemini, OpenAI, local models).
LichAmnesia/lich-skills
Pulls Google Analytics 4 data through the Data API with TypeScript scripts and turns it into a daily SEO report or prioritized traffic and bounce-rate recommendations.
LichAmnesia/lich-skills
Generates or edits PNG images with Google's Nano Banana 2 model through a small script, with a choice of 512, 1K, 2K or 4K output.
LichAmnesia/lich-skills
Organizes long-running agent work into a Project, Sprint and Task hierarchy with per-task state files, isolated worktrees, review loops and script-checked rules.
LichAmnesia/lich-skills
Runs headless web searches and single-page extraction through the Tavily API from a Python script, returning cited, summarized results without a browser.
LichAmnesia/lich-skills
Drives a failing build, typecheck, lint or test command to a passing exit code through small, one-fix-at-a-time rounds, stopping at a hard attempt cap instead of looping forever.
LichAmnesia/lich-skills
Replaces trial-and-error fixing with an observe, hypothesize, experiment and conclude loop kept in DEBUG.md, where no fix is allowed before evidence supports a cause.
Categories
Checks every subagent prompt before spawning, swapping pasted files and context for paths and short summaries and trimming the brief, to avoid multiplied token cost. This skill is a pre-flight checklist for the moment an agent is about to call the Task or Agent tool. Its premise, stated in the skill, is that subagents do not share a prompt prefix cache, so each one re-tokenizes everything it is handed and a fan-out of many agents with large context multiplies token cost.
Subagent Brief Discipline fits situations like: about to spawn several parallel subagents on similar tasks; A subagent prompt is growing past a couple of hundred words; preparing to paste a long file or a full PRD into a subagent prompt; working on a metered plan where token usage matters.
Run `npx skills add LichAmnesia/lich-skills --skill subagent-brief -a claude-code`. Or copy the skill folder (skills/subagent-brief in LichAmnesia/lich-skills) into .claude/skills/subagent-brief in your project. Claude Code loads it when a task matches its description.
Run `npx skills add LichAmnesia/lich-skills --skill subagent-brief -a codex`. Or copy the skill folder (skills/subagent-brief in LichAmnesia/lich-skills) into .agents/skills/subagent-brief in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add LichAmnesia/lich-skills --skill subagent-brief -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/subagent-brief, .gemini/skills/subagent-brief, .github/skills/subagent-brief and .opencode/skills/subagent-brief in your project.
SKILL.md names no scripts, command-line tools or credentials: Subagent Brief Discipline is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Subagent Brief Discipline is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Subagent Brief Discipline: Code Context Slicing (trailofbits/skills, 7.4k stars), Claude Code Mastery (borghei/Claude-Skills, 881 stars), Context Doctor (jzOcb/context-doctor, 119 stars) and Caveman Learn Token Fixes (JuliusBrussee/caveman, 110k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
LichAmnesia (a GitHub user) maintains it in LichAmnesia/lich-skills, which has 234 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on June 9, 2026.
Source: LichAmnesia/lich-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.