Repo Context Packer is a local-first, read-only context broker for coding agents.
The MVP exposes compact task context through:
AGENTS.mdfor portable static instructions- MCP tools/resources/prompts for dynamic context
- Thin native adapter files for Codex, Claude Code, Cursor, and OpenCode
cargo test --workspace
cargo run -p ctxpack -- --helpInitialize a repository with the portable AGENTS.md guidance and .ctxpack/ctxpack.toml:
cargo run -p ctxpack -- init --repo /path/to/repoGenerate optional native adapter files:
cargo run -p ctxpack -- init --repo /path/to/repo --cursor --claude --opencodectxpack init writes only repo-local files. It prints Codex MCP setup guidance but does not mutate global Codex configuration.
Start the local stdio MCP server:
cargo run -p ctxpack -- serve-mcpImplemented MCP tools:
prepare_tasksearchrelatedget_packrelated_testscurrent_diff
Implemented MCP resources include ctxpack://repo/summary, ctxpack://repo/test-map, ctxpack://pack/guide, safe file slices, and symbol search. Implemented prompts cover bugfix, feature, refactor, review, test-writing, and explanation workflows.
Build the local file inventory for a repository:
cargo run -p ctxpack -- index --repo /path/to/repoThe inventory respects .gitignore, .ctxpackignore, and .cursorignore, excludes sensitive/generated files by default, and writes JSON under ~/.ctxpack/repos/<repo-id>/inventory.json.
Generated and sensitive files require explicit opt-in:
cargo run -p ctxpack -- index --repo /path/to/repo --include-generated --include-sensitiveSearch the safe inventory:
cargo run -p ctxpack -- search "requireSession" --repo /path/to/repo --limit 5If no inventory exists for the repo, ctxpack search builds one using the safe default inventory rules before searching.
Find likely tests for changed source files:
cargo run -p ctxpack -- related-tests src/auth/session.ts --repo /path/to/repoThe result includes confidence, a reason, and a best-effort targeted test command.
Find files that have changed together in local git history:
cargo run -p ctxpack -- co-changes src/auth/session.ts --repo /path/to/repo --limit 5Co-change hints read only local git metadata and are filtered through the safe inventory.
Prepare a task-conditioned context plan:
cargo run -p ctxpack -- prepare-task "fix requireSession bug" --repo /path/to/repo --mode bug-fixThe plan fuses lexical search, related tests, and local co-change hints into target files, validation commands, risk flags, and pack resource options.
Materialize a budgeted context pack:
cargo run -p ctxpack -- get-pack "fix requireSession bug" --repo /path/to/repo --mode bug-fix --budget briefUse --format json for structured output.
prepare-task, get-pack, and the matching MCP tools append source-free local traces under ~/.ctxpack/repos/<repo-id>/traces.jsonl.
Inspect recent traces:
cargo run -p ctxpack -- eval traces --repo /path/to/repo --limit 20Traces store task hashes, task type, target agent label, recommended files/tests/commands, optional pack id, optional budget, and created time. They do not store task text or source snippets.