Skip to content

thromel/ctxpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Repo Context Packer

Repo Context Packer is a local-first, read-only context broker for coding agents.

The MVP exposes compact task context through:

  • AGENTS.md for portable static instructions
  • MCP tools/resources/prompts for dynamic context
  • Thin native adapter files for Codex, Claude Code, Cursor, and OpenCode

Development

cargo test --workspace
cargo run -p ctxpack -- --help

Initialization

Initialize a repository with the portable AGENTS.md guidance and .ctxpack/ctxpack.toml:

cargo run -p ctxpack -- init --repo /path/to/repo

Generate optional native adapter files:

cargo run -p ctxpack -- init --repo /path/to/repo --cursor --claude --opencode

ctxpack init writes only repo-local files. It prints Codex MCP setup guidance but does not mutate global Codex configuration.

MCP Runtime

Start the local stdio MCP server:

cargo run -p ctxpack -- serve-mcp

Implemented MCP tools:

  • prepare_task
  • search
  • related
  • get_pack
  • related_tests
  • current_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.

Safe Inventory

Build the local file inventory for a repository:

cargo run -p ctxpack -- index --repo /path/to/repo

The 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-sensitive

Lexical Search

Search the safe inventory:

cargo run -p ctxpack -- search "requireSession" --repo /path/to/repo --limit 5

If no inventory exists for the repo, ctxpack search builds one using the safe default inventory rules before searching.

Related Tests

Find likely tests for changed source files:

cargo run -p ctxpack -- related-tests src/auth/session.ts --repo /path/to/repo

The result includes confidence, a reason, and a best-effort targeted test command.

Git Co-Change Hints

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 5

Co-change hints read only local git metadata and are filtered through the safe inventory.

Context Plan

Prepare a task-conditioned context plan:

cargo run -p ctxpack -- prepare-task "fix requireSession bug" --repo /path/to/repo --mode bug-fix

The plan fuses lexical search, related tests, and local co-change hints into target files, validation commands, risk flags, and pack resource options.

Context Pack

Materialize a budgeted context pack:

cargo run -p ctxpack -- get-pack "fix requireSession bug" --repo /path/to/repo --mode bug-fix --budget brief

Use --format json for structured output.

Local Eval Traces

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 20

Traces 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.

About

Local-first context compiler and MCP context broker for AI coding agents

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages