The Problem
When your orchestrator agent (Codex, Claude Code) sends explorer/reviewer sub-agents to investigate the codebase — to understand architecture, figure out how something is implemented, etc. — those sub-agents typically come back with vague, opinion-based summaries rather than precise, factual information.
The orchestrator can’t rely on these summaries and ends up having to dig into the code itself anyway, wasting output tokens and polluting its context window with noise.
The Solution: Context Pack (MCP)
I built context-pack — a small but useful MCP tool that solves this problem by enabling agents to pass real code excerpts instead of opinions.
How it works
- A sub-agent explores the code and places anchors — just a file path + line range (e.g. “add lines 123–243 from
main.py”). No need to copy-paste huge code blocks into output. - The agent adds short section titles for the anchored code, and can group multiple excerpts under one heading.
- The agent can also build architecture/logic diagrams so the context pack gives a complete picture.
- When the orchestrator calls
output get, all anchors are rendered into a single, clean Markdown pack with real code snippets.
The key insight: the sub-agent transmits precise context without noise and without spending expensive output tokens — because anchors (path + line range) are tiny, while the actual code rendering happens onoutput, which counts as input tokens (significantly cheaper).
What this gives you
- Lower cost: drastically fewer output tokens in agent-to-agent handoff
- Higher quality: factual, inspectable code context instead of “trust me” summaries
- Less duplicate work: the orchestrator reads one complete pack instead of re-opening multiple files
- Better accuracy: agents make decisions based on real code, not approximations
Quick setup
The repo includes an Explorer Context Pack skill, so setup is minimal:
- Install and build the server (
cargo build --release) - Add server config to your
config.tomlormcp.json - Tell your sub-agents in the system prompt to hand off context via MCP
context_packusing the Explorer Context Pack skill
That’s it. The skill handles the rest.
Links
GitHub: github dot com / AmirTlinov / context_pack
Written in Rust, MIT licensed. Works with any MCP-compatible client (Codex, Claude Code, etc.)
Would love to hear feedback and ideas from the community. If you’ve been dealing with the same problem of agents giving you vague context — give it a try!