llm-ctxpack
v0.2.2
Published
Pack a repo into LLM-ready context — git-diff-aware and token-budget-aware, unlike full-dump tools.
Maintainers
Readme
llm-ctxpack
Pack a repo into LLM-ready context — git-diff-aware and token-budget-aware, so you're not pasting your whole codebase into a chat window every time.
Most repo-to-context tools dump everything, as-is. llm-ctxpack adds three things they don't:
--since <ref>— only include files that changed since a git ref. Perfect for handing an agent "what changed" instead of "everything."--budget <tokens>— cap total output to a token budget, keeping the most recently modified files and telling you exactly what got dropped.- Secret redaction, on by default — API keys, private key blocks, tokens, and
SECRET=/PASSWORD=-style env values get redacted before anything is written out, so you don't accidentally paste a live credential into a chat window. Use--no-redactif you really want raw output.
Install
No install needed:
npx llm-ctxpack .Or install globally:
npm install -g llm-ctxpackUsage
llm-ctxpack . # pack whole repo
llm-ctxpack . --since main # only what changed vs main
llm-ctxpack . --budget 50000 # fit within a 50k token budget
llm-ctxpack . --since main --budget 20000 -o context.mdOutput is Markdown: a file tree with per-file token counts, then fenced code blocks for each file, ready to paste into any LLM chat or agent context.
Respects .gitignore automatically, plus sensible defaults (node_modules, lockfiles, binaries, build output).
Options
| Flag | Description |
|---|---|
| --since <ref> | Only include files changed since this git ref (e.g. main, HEAD~5) |
| --budget <tokens> | Cap total output tokens, keeping most recently modified files first |
| --out, -o <file> | Write to a file instead of stdout |
| --no-redact | Disable secret redaction (on by default) |
Token counts use the same tokenizer family as GPT/Claude-class models (gpt-tokenizer), so budgets are a close real-world estimate, not a guess.
Works with
Any tool that takes pasted-in text as context: Claude, Claude Code, ChatGPT, Cursor, GitHub Copilot Chat, or a custom agent's system prompt. --model presets cover the common ones; --budget works for anything else.
Why
Every "dump repo to text" tool assumes you want everything. In practice, agentic coding workflows usually want the diff (what changed) trimmed to what fits (the model's context window). llm-ctxpack does both without extra flags or config files.
License
MIT
Support this project
llm-ctxpack is free, MIT-licensed, and has no paid tier. If it saved you time, you can send a tip to the project wallet — no account or sign-up needed on either end.
dacode-dev.github.io — QR code + copy-paste address, one page, no tracking.
Or directly: 0xc4e8021CdFf1a11946Ed16bd264f77D6B3C0C0e9
Ethereum, Base, Arbitrum, Optimism, Polygon, BNB Chain, Avalanche C-Chain — same address on all of them, native token or stablecoins (USDC/USDT). Pick whichever has the lowest fee for you (Base/Arbitrum/Polygon are cheapest).
