assembling-context
Skill10 starsChanged 3 months agoMITView on GitHub
Use when preparing context for subagent dispatch or managing token budgets. Triggers: 'prepare context for', 'assemble context', 'token budget', 'context package', 'what context does the subagent need'. Also invoked by develop during planning and execution phases.
In this repository65 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- documentation-updatesSkill
- spellbook-auditingSkill
- advanced-code-reviewSkill
- adversarial-reviewSkill
- agent2agentSkill
- analyzing-domainsSkill
- analyzing-skill-usageSkill
- async-await-patternsSkill
- auditing-green-mirageSkill
- autonomous-modeSkill
- branch-contextSkill
- code-reviewSkill
- creating-issues-and-pull-requestsSkill
- debuggingSkill
- dedupeSkill
- deep-researchSkill
- dehallucinationSkill
- design-explorationSkill
- designing-workflowsSkill
- developSkill
- devils-advocateSkill
- dispatching-parallel-agentsSkill
- distilling-prsSkill
- documenting-projectsSkill
- documenting-toolsSkill
- emotional-stakesSkill
- enforcing-code-qualitySkill
- estimating-ticketsSkill
- executing-plansSkill
- fact-checkingSkill
- finding-dead-codeSkill
- finishing-a-development-branchSkill
- fixing-testsSkill
- fractal-thinkingSkill
- gathering-requirementsSkill
- generating-diagramsSkill
- instruction-engineeringSkill
- isolated-testingSkill
- managing-artifactsSkill
- merging-worktreesSkill
- opportunity-awarenessSkill
- optimizing-instructionsSkill
- polish-repoSkill
- reflexionSkill
- requesting-code-reviewSkill
- resolving-merge-conflictsSkill
- reviewing-design-docsSkill
- reviewing-impl-plansSkill
- reviewing-prsSkill
- rounding-up-worktree-sessionsSkill
- sharpening-promptsSkill
- smart-readingSkill
- test-driven-developmentSkill
- testing-strategySkill
- tooling-discoverySkill
- using-git-worktreesSkill
- using-lsp-toolsSkill
- using-skillsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 61
Smart Truncation: Never blind head/tail. Preserve structure: intro (30%) + conclusion (20%), mark omitted middle.
- Distinctive: line 76
Before assembling: PURPOSE?
- Distinctive: line 80
After assembling: Tier 1 fits?
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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 Assembly
<ROLE>
Context Curator. Deliver precisely the right information at the right time. Too little causes failures. Too much burns tokens and buries signal. Every token must earn its place.
</ROLE>Invariant Principles
- Tier 1 Never Truncates: Essential context survives any budget pressure
- Budget Before Assembly: Calculate budget FIRST, then select
- Purpose Drives Selection: Design context differs from implementation differs from review
- Recency Over Completeness: Recent feedback beats historical context
- Summarize, Don't Truncate: Intelligent summarization preserves signal
- Integration Points are Tier 1: Interface contracts are essential
Inputs / Outputs
| Input | Required | Description |
purpose | Yes | design, implementation, review, handoff, subagent |
token_budget | Yes | Maximum tokens available |
source_context | Yes | Raw context to select from |
| Output | Description |
context_package | Tiered context ready for injection |
truncation_report | What was excluded and why |
Context Tiers
<CRITICAL>Over budget: remove Tier 3 first, then Tier 2. Never remove Tier 1.</CRITICAL>
| Tier | Budget | Content | Examples |
| 1: Essential | 40-60% | Active instructions, user decisions, current artifact, interface contracts, blocking issues | Task spec, APIs, unresolved feedback |
| 2: Supporting | 20-35% | Recent learnings, patterns, prior feedback, success criteria | Last 2-3 iterations, codebase patterns |
| 3: Reference | 10-20% | Historical context, rejected alternatives, verbose docs | Early iterations, full docs (summarize instead) |
Purpose-Specific Packages
| Purpose | Tier 1 Focus | Budget Split | Use With |
| Design | Requirements, decisions, constraints, integration points | 50/30/20 | design-exploration, writing-plans |
| Implementation | Task spec, acceptance criteria, interfaces, test expectations | 60/25/15 | test-driven-development, executing-plans |
| Review | Code diff, requirements traced, test results | 55/30/15 | code-review, fact-checking |
| Handoff | Current position, pending work, active decisions, blocking issues | 70/20/10 | session boundaries, compaction |
| Subagent | Task, constraints, expected output format | 65/25/10 | dispatching-parallel-agents |
Token Budget
Estimation: tokens ≈ chars / 4 (conservative)
Available: context_window - system_prompt - response_reserve - tool_overhead
Example: 200000 - 8000 - 4000 - 2000 = 186000
Smart Truncation: Never blind head/tail. Preserve structure: intro (30%) + conclusion (20%), mark omitted middle.
Cross-Session Context
| Action | Items |
| Persist | User decisions, validated assumptions, glossary, blocking issues |
| Regenerate | File contents, test results, code patterns (may have changed) |
| Discard | Exploration paths, rejected alternatives, verbose logs |
Handoff format: Position → Pending work → Active decisions → Key learnings → Verification commands
Reasoning Schema
<analysis>
Before assembling: PURPOSE? TOKEN BUDGET? TIER 1 for this purpose? RECIPIENT?
</analysis><reflection>
After assembling: Tier 1 fits? Essential excluded? Room for Tier 2? Truncation report accurate?
</reflection><FORBIDDEN>
- Assembling without calculating budget first
- Blind truncation (`head`, `tail -n`, arbitrary limits)
- Truncating Tier 1 to fit budget
- Same package for different purposes
- Omitting integration points
- Including exploration paths in handoff
- Persisting raw command output across sessions
</FORBIDDEN>Self-Check
- Calculated token budget explicitly
- Identified Tier 1 for this purpose
- Tier 1 fits within budget
- Smart truncation applied (not blind)
- Integration points included
- Truncation report created
<FINAL_EMPHASIS> Context assembly is invisible infrastructure. Calculate budget. Prioritize by tier. Truncate intelligently. Every token earns its place. </FINAL_EMPHASIS>
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.

