Docs
Install & run
Nothing to install, nothing to configure. From any git repo:
$ npx contextkit --clipboardWalks the repo, packs to the default 16k-token budget, copies the result to your clipboard. Paste it into any assistant and ask away.
Flags
--budget<tokens>Hard token ceiling for the pack. Lowest-ranked files are stubbed or skipped to fit.
default: 16k
-o, --out<file>Write the packed context to a file instead of stdout.
default: stdout
--clipboardCopy the output straight to the system clipboard, ready to paste into a chat.
default: off
--include<glob>Only pack files matching the glob. Repeatable.
default: **/*
--exclude<glob>Skip files matching the glob, on top of .gitignore. Repeatable.
default: none
--rankhybrid|recency|importsOrdering strategy used when the budget forces trimming.
default: hybrid
--no-gitOmit the recent-commits section from the pack.
default: git on
--keep-noiseKeep lockfiles, minified and generated files at full length instead of stubbing them.
default: strip
--statsPrint a per-file token table to stderr after packing.
default: off
Recipes
Paste a whole repo into a chat
$ npx contextkit --clipboard --budget 32kPacks the repo to fit a 32k window and puts it on your clipboard. Paste, then ask your question.
Fit a small model window
$ npx contextkit --budget 8k --rank imports -o context.mdImport-frequency ranking keeps the load-bearing modules and stubs the leaves when space is tight.
Pack only the backend
$ npx contextkit --include 'src/server/**' --include 'prisma/**'Globs narrow the walk before ranking, so the budget is spent entirely on the code you care about.
Context snapshot in CI
$ npx contextkit --no-git -o "snapshots/$(git rev-parse --short HEAD).md"A deterministic pack per merge. Diff two snapshots to see how your repo's AI context evolves.
The output, section by section
One markdown file, structured so an LLM can navigate it. In order:
- 1
Header
Repo name, description, pack settings and totals — so the model (and you) know exactly what it's looking at.
- 2
File map
The full file list with line counts, even for files that didn't make the budget. The model sees the repo's shape, not just its excerpts.
- 3
Recent git activity
The last commits with messages. "What changed lately" is the single highest-value hint you can give an assistant. Disable with --no-git.
- 4
Files (ranked)
Each file as a section: metadata comment (LOC, import count, recency), a one-line summary, then the code. Highest-ranked files first, so truncation by the model hurts least.
- 5
Skipped list
Anything trimmed to fit the budget is named at the bottom — the pack never silently pretends the repo is smaller than it is.
Want to see a real pack? Generate one in the playground →