Your AI finally knows what you've already built.
contextsnap snapshots your codebase exports in one command. Paste into Claude, ChatGPT, or Gemini and get code that actually reuses what you have.
or try it now: npx contextsnap src/utils
The problem
You prompt. Your AI reimplements.
Every time you open a new chat, your LLM starts from scratch. It writes a formatDate function even though you have one in src/utils/date.ts. Duplicate logic, subtle differences, hours of debugging.
The fix
One command. Full codebase awareness.
contextsnap reads your exports, strips function bodies, and hands the AI a compact map of everything available. No wasted tokens on implementation detail — just the contract your AI needs to make the right call.
What's inside
Everything you need, nothing you don't.
Run contextsnap with no arguments. It auto-detects src/utils, lib, or src and scans everything.
contextsnap --mcp starts a Model Context Protocol server. Claude, Cursor, and Windsurf call it automatically — no clipboard needed.
contextsnap --watch re-runs every time you save a file. Your context snapshot stays fresh without lifting a finger.
Extracts signatures only — function names, params, return types, JSDoc. Bodies stripped. ~4× fewer tokens than pasting raw source.
Every signature carries a // :N source line. AI agents jump straight to an implementation instead of reading the whole file.
Every file is cross-checked against es-module-lexer. An export the fast parser misses still shows up as a stub with a warning — never a silent gap.
Set default dirs, ignore patterns, and output format in .contextsnaprc.json. CLI flags always override.
uses: myothuko98/contextsnap@v2 auto-commits .ai-context.md on every push so your whole team benefits.
search_exports finds a utility by name or JSDoc and answers with file:line. get_file_context returns one file's contract — far cheaper than a full snapshot.
contextsnap --inject writes the snapshot between markers in CLAUDE.md or AGENTS.md. Every AI session picks it up — no clipboard, no setup.
contextsnap --check exits 1 when the committed snapshot is stale. Version-stamped, so a generator mismatch is reported clearly. Runs in CI like a lint step.
--budget=2000 trims the least-imported exports until the snapshot fits your ceiling. Usage ranking ignores npm-package name collisions.
--dupes flags formatDate vs dateFormat style duplicates across files with file:line pairs, and exits 1 for CI. Stop duplication before your AI adds more.
npm, yarn, and pnpm workspaces auto-detected. Cross-package import hints say '@acme/ui' — never a brittle ../../packages path.
Claude sees your codebase automatically.
contextsnap --mcp starts a Model Context Protocol server. Add it to Claude Desktop, Claude Code, or Cursor once — and from then on your AI calls it on its own. No clipboard. No copy-paste. Just context, on demand.
{
"mcpServers": {
"contextsnap": {
"command": "contextsnap",
"args": ["--mcp"]
}
}
}Get started
Up and running in seconds.
npx contextsnap src/utilsnpm install -g contextsnap{
"mcpServers": {
"contextsnap": {
"command": "contextsnap",
"args": ["--mcp"]
}
}
}Zero config to start. Drop a .contextsnaprc.json in your project root to set default directories, ignore patterns, and output format. Commit it so your whole team uses the same settings.
How it works
The pipeline, in four steps.
Walks your target directories for .js, .ts, .jsx, .tsx files. Respects .contextsnapignore and --ignore patterns.
Extracts exported names, signatures, source lines, and JSDoc. Handles ESM and CommonJS — and cross-checks every file against es-module-lexer so nothing is silently missed.
Builds a markdown (or JSON) snapshot with per-file import hints and an AI reuse preamble. Contracts only — no bodies.
Copies to clipboard, writes .ai-context.md, streams to stdout, or serves via MCP — depending on how you invoked it.
Stop teaching your AI what you've built.
One command and your LLM knows your entire utility layer. Your stack. Your contracts. Your code.