RepoCode packs a repository's source code into a token-budgeted context file for AI coding assistants — ChatGPT, Claude, Gemini, and others. It ranks files by structural importance, import relationships, and recency, then fits the highest-ranked files into your token budget through compression rather than silently dropping them.
This is the first public release, published as three packages:
| Package | Install |
|---|---|
repocode |
npm install -g repocode |
@repocode/core |
npm install @repocode/core |
@repocode/mcp |
npx -p @repocode/mcp repocode-mcp |
Highlights
Pipeline
- File discovery + ranking by structural importance, import centrality, recency, and keyword density
- Token-budget fitting with a compression cascade:
tier1(strip comments) →tier2(strip function bodies) →tier3-llm(LLM semantic summary) →partial(trim to fit) - Import tracing across TypeScript, JavaScript, Python, Go, Rust, Ruby, Java, C, C++, PHP, and C#
- Output as XML, Markdown, JSON, or plain text
CLI
- Git-aware modes:
--diff,--staged,--branch,--pr,--log,--range - Query-aware re-ranking (
--query) and a built-in instruction library (--instruction review|bugfix|security-audit|...) - Interactive TUI for hand-picking files, and
--watchmode for continuously updated context --explainto inspect ranking and inclusion decisions before packing
MCP Server
- Exposes
pack_repository,search_files,get_file_context,get_git_context, andget_architectureas MCP tools for editor/assistant integration
Security
- Secret scanning with redaction before any LLM call, configurable per security mode (
warn/exclude/redact/fail) - Repository config execution blocked by default in MCP mode
- Runs entirely locally unless
tier3-llmcompression or semantic query mode is explicitly enabled
Reliability
- Consistent stderr warning/error reporting throughout the pipeline
- Exponential backoff with jitter on LLM compression retries
- Lock-protected, atomic cache writes safe against concurrent
repocodeprocesses - Backed by 400+ automated tests across all three packages
Requirements
Node.js ≥ 22