Assemble the smallest high-quality task context from memory, semantic code search, current files, tool results and user instructions while protecting the model context window from irrelevant material.
Install
npx skillscat add molotroka123-cell/aimaxbossman/context-builder Install via the SkillsCat registry.
Context Builder
Use before difficult reasoning, coding, review or long autonomous work.
Principle
More context is not automatically better context.
Optimize for:
relevance × evidence quality × freshness / token cost
Sources
Possible sources:
- current user/task instruction
- active project instructions
- memory.search
- semantic code search
- exact relevant source files
- current git diff
- test failures
- tool outputs
- reviewer feedback
Priority
- Current explicit user instruction
- Current task acceptance criteria
- Current repository/project instructions
- Relevant current source code
- Verified recent memory
- Relevant prior decisions
- External/general background
Workflow
- Define the immediate decision or action.
- Identify which sources can answer it.
- Retrieve narrowly.
- Deduplicate semantically overlapping evidence.
- Discard low-value context.
- Preserve citations/source paths.
- Fit context to the model-specific budget.
- Keep some headroom for reasoning and tool results.
Token budgeting
Default suggested allocation:
- task/user intent: 10%
- project/repo instructions: 10%
- retrieved evidence/code: 45%
- recent tool results: 15%
- free reasoning/output headroom: 20%
These are guidelines, not hard constants.
Progressive disclosure
Never open ten huge files when code search already identified two relevant functions.
Prefer:
search → focused read → act → retrieve more only if needed
Compaction
When a long mission approaches context pressure:
- write a compact checkpoint
- preserve decisions, state, failures and next step
- drop redundant raw history
- rebuild context from checkpoint + current evidence
Do not depend on conversational history as the only state store.