/engineering-advanced-skills:context-enginefrom engineering-advanced-skills
Manages AI agent context windows: measures token usage, budgets allocations, and decides what stays in-window vs. persistent memory vs. retrieved on demand. Useful for long agent sessions or multi-agent coordination.
Ships in engineering-advanced-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Decide what an agent should have in its context window, what it should keep in persistent memory, and what it should retrieve on demand, then measure and trim the window to fit. The goal is an agent that has the facts it needs for the current step and nothing that crowds them out.
Before designing or analyzing, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
--budget and which packing strategy applies).Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
context_analyzer.py on the files or prompt you plan to load. Token counts are estimates (about 4 characters per token); use the provider's token-counting endpoint when you need exact numbers.context_budget_planner.py with the window size and each component's size. It flags components outside their band and, on overflow, lists what to evict first.memory_indexer.py for a quick lexical index; move to embeddings plus code-aware chunking when lexical search misses.context_pruner.py strips comments, docstrings, import blocks and duplicates from code; for Markdown and text it only removes duplicate blocks and extra blank lines, so headings and structure survive.python3 scripts/context_analyzer.py references/ --budget 128000
python3 scripts/context_budget_planner.py --window-size 200000 --system 4000 --history 60000 --tools 90000 --rag 40000 --reserve-output 8000
python3 scripts/context_pruner.py scripts/memory_indexer.py --aggressive
python3 scripts/memory_indexer.py references/ --query "compaction high-water mark" --top 3
| Tool | What it does | Key flags | Exit codes |
|---|---|---|---|
context_analyzer.py | Estimated tokens, relevance and suggestions for files or a prompt | <path> or --prompt, --budget, --json | 0 ok, 2 nothing to analyze |
context_budget_planner.py | Allocate a window across system, memory, history, tools, RAG and reserved output; flag bands and overflow; eviction order | --window-size (required), component sizes, --json | 0 fits, 1 overflow, 2 bad arguments |
context_pruner.py | Prune code (comments, docstrings, imports, braces, duplicates) or prose (duplicates, blank runs only) | <path> or --stdin [--prose], `--level light | moderate |
memory_indexer.py | TF-IDF index and search over a directory of notes or docs | <dir>, --query, --top, --index-only, --stats | 0 ok, 2 not a directory / nothing indexable |
Mistake: Loading everything that might be relevant "to be safe". Why it happens: Large windows make it possible, and missing context feels riskier than extra context. Instead: Irrelevant tokens dilute attention and cost money on every turn. Load anchors, retrieve the rest, and check the budget.
Mistake: Compacting at the limit. Why it happens: Nothing forces action until the window is full. Instead: Set a high-water mark and compact while there is headroom to write a good summary.
Mistake: Evicting history without saving what was learned. Why it happens: Compaction is treated as deletion. Instead: Write decisions and open questions to memory first; then evict. Compaction is only safe when memory holds the conclusions.
scripts/context_analyzer.py, scripts/context_budget_planner.py, scripts/context_pruner.py, scripts/memory_indexer.py — the tools above. They run on any files; the Quick Start uses this skill's own references/ and scripts/ as input.Load the reference that matches the task — keep this file lean and pull detail on demand:
Covers context budgeting, memory layering, compaction, code retrieval strategy and multi-agent context hand-off. Does not cover vector store or embedding infrastructure, agent role design or orchestration, monitoring, or prompt writing.
Related skills: engineering/rag-architect (vector stores, embeddings), engineering/agent-designer and engineering/agent-workflow-designer (agent roles, orchestration), engineering/llm-cost-optimizer (caching and token cost), engineering/codebase-onboarding (project summaries to bootstrap context).
references/code-retrieval-patterns.md (opens in a new tab)references/context-window-strategies.md (opens in a new tab)references/long-context-strategies.md (opens in a new tab)references/memory-and-context-editing.md (opens in a new tab)references/memory-architecture-guide.md (opens in a new tab)references/workflows-and-quality.md (opens in a new tab)scripts/context_analyzer.py (opens in a new tab)scripts/context_budget_planner.py (opens in a new tab)scripts/context_pruner.py (opens in a new tab)scripts/memory_indexer.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
context-management, agent-memory, token-budget, rag, context-window
100 skills in this plugin
/a11y-auditStatic WCAG scan of HTML files (alt text, headings, labels, ARIA, lang, landmarks) and colour contrast checks for colour pairs or CSS. Use when auditing templates for accessibility, checking contrast, or adding an a11y gate to CI.
/agent-designerDesigns multi-agent system architectures with orchestration patterns, tool schemas, and performance evaluation. Use when building AI agent systems, designing agent workflows, creating tool schemas, or evaluating agent performance.
/agent-harnessTest and evaluation harness for AI agents — scenario suites, deterministic replay, regression diffing, cost and latency budgets. Use when agent quality is vibe-checked, before shipping a prompt or model change, or when evals drift.
/agenthubRuns a multi-agent job as a dependency graph: validates the DAG, tracks each agent's state on a board, then ranks and merges their outputs. Use when spawning parallel agents, monitoring a run, or merging results.
/agentic-evaluation-frameworkBuilds LLM and agent evals: weighted rubrics, LLM-as-judge design, inter-rater agreement and pairwise ranking (Elo, Bradley-Terry) from scores you collect. Use when setting up a judge, scoring outputs, or comparing model or prompt variants.
/agent-protocolDesign AI agent communication protocols: MCP tool schemas, A2A, function calling, and inter- agent messaging. Use when building multi-agent systems, defining tool interfaces, or implementing agent-to-agent communication.
npx claudepluginhub borghei/claude-skills --plugin engineering-advanced-skillsOther plugins' skills for the same job