agentleFS
axiomanticaxiomantic/spellbook/skills/assembling-context/SKILL.md

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.

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
  1. Very specific:

    Smart Truncation: Never blind head/tail. Preserve structure: intro (30%) + conclusion (20%), mark omitted middle.

    line 61
  2. Distinctive:

    Before assembling: PURPOSE?

    line 76
  3. Distinctive:

    After assembling: Tier 1 fits?

    line 80

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Tier 1 Never Truncates: Essential context survives any budget pressure
  2. Budget Before Assembly: Calculate budget FIRST, then select
  3. Purpose Drives Selection: Design context differs from implementation differs from review
  4. Recency Over Completeness: Recent feedback beats historical context
  5. Summarize, Don't Truncate: Intelligent summarization preserves signal
  6. Integration Points are Tier 1: Interface contracts are essential

Inputs / Outputs

InputRequiredDescription
purposeYesdesign, implementation, review, handoff, subagent
token_budgetYesMaximum tokens available
source_contextYesRaw context to select from
OutputDescription
context_packageTiered context ready for injection
truncation_reportWhat was excluded and why

Context Tiers

<CRITICAL>Over budget: remove Tier 3 first, then Tier 2. Never remove Tier 1.</CRITICAL>

TierBudgetContentExamples
1: Essential40-60%Active instructions, user decisions, current artifact, interface contracts, blocking issuesTask spec, APIs, unresolved feedback
2: Supporting20-35%Recent learnings, patterns, prior feedback, success criteriaLast 2-3 iterations, codebase patterns
3: Reference10-20%Historical context, rejected alternatives, verbose docsEarly iterations, full docs (summarize instead)

Purpose-Specific Packages

PurposeTier 1 FocusBudget SplitUse With
DesignRequirements, decisions, constraints, integration points50/30/20design-exploration, writing-plans
ImplementationTask spec, acceptance criteria, interfaces, test expectations60/25/15test-driven-development, executing-plans
ReviewCode diff, requirements traced, test results55/30/15code-review, fact-checking
HandoffCurrent position, pending work, active decisions, blocking issues70/20/10session boundaries, compaction
SubagentTask, constraints, expected output format65/25/10dispatching-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

ActionItems
PersistUser decisions, validated assumptions, glossary, blocking issues
RegenerateFile contents, test results, code patterns (may have changed)
DiscardExploration 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>

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.