I fired up Claude on my tangled 92-file monorepo last Tuesday — Hono routes snaking through Drizzle schemas like some Silicon Valley fever dream — and bam, 66,000 tokens gone before it even touched my prompt.
That’s not hyperbole. That’s every damn session.
Look, codesight changes that. This npx tool — dead simple, zero dependencies beyond borrowing your own TypeScript — scans your codebase via AST parsing and spits out a markdown map of routes, schemas, deps, the works. Your AI reads 5K tokens of gold instead of burning 66K playing detective.
Karpathy nailed it last June, didn’t he? His tweet exploded to 2.3 million views preaching context engineering over prompt tweaks.
“the delicate art and science of filling the context window with just the right information for the next step.”
Spot on. And last week? Structured markdown wikis for LLMs to reason over. Viral again. But who’s turning talk into tools? Not the big labs churning o1 hype. Nah, it’s this scrappy npx codesight, inspired by the man himself.
Why Is Your AI Hemorrhaging Tokens on Every Code Session?
Every time. Claude Code, Cursor, Copilot — they all do it. Grep files. Parse package.json. Chase imports. On my SaaS A benchmark: 92 files, four workspaces, ~66K tokens wasted. Smaller project? Still 46K. It’s your context window — Karpathy’s “RAM” — evaporating before you ask anything useful.
Who’s paying? You are. API calls ain’t free. At $3 per million input tokens on Claude, that’s real cash down the drain. Or quota exhaustion mid-flow. I’ve rage-quit sessions over this nonsense.
But here’s codesight: npx codesight. Boom. Structured map in seconds. Table from their benchmarks says it all:
SaaS A drops to 5,129 tokens. 12.9x savings. Average across three projects? 11.2x. And that’s conservative — no wiki mode yet.
Regex hacks guess. AST parsing knows. Chains like router.use('/prefix', subRouter)? Nailed. NestJS decorators merged into full paths. tRPC nesting? Check. Drizzle primaries? Extracted clean. Middleware in handlers? Detected, no false positives.
Twenty-five frameworks, eight ORMs. React props too. Production code, not demos.
Does Codesight’s 90% Token Slash Hold Up in Real Refactors?
Initial load’s one thing. But Karpathy’s “next step”? That’s where –blast shines.
npx codesight --blast src/db/index.ts
BFS import graph. Lists affected files, routes, models. Three hops deep on BuildRadar: 10 files, 33 routes, 12 models. Your AI gets this upfront. No blind changes breaking schemas.
Then –wiki. Karpathy’s April dream: structured markdown knowledge base. .codesight/wiki/ with index.md (200 tokens) plus per-topic articles. Session start: index only. Need routes? Pull that file (160-350 tokens). Total reduction? ~91x.
And integration? --init spits CLAUDE.md, .cursorrules, copilot instructions — prefilled with your structure. --mcp? On-demand server, cached.
Cynic hat on: Who’s monetizing? OSS vibes here — npx screams free tool, GitHub stars for cred. Devs save token bucks; tool author’s the next YC darling? Reminds me of 2010’s eslint explosion — pre-analysis linters killed manual reviews. Bold call: By 2026, VS Code extensions will bake this in, long-context models be damned. Token costs won’t vanish; smart context will rule.
But wait — caveman prompts cut output tokens. Codesight slashes input waste. Pair ‘em: AI nirvana.
Skeptical vet check: Hacky? Borrows your node_modules TS API — clever, but what if no TS? Regex fallback’s solid, they claim zero false positives. Tested three projects? Small N, but production-scale files. PR spin? Benchmarks are theirs, but reproducible via npx. Try it.
Who’s really winning? You, grinding less on quotas. Big AI labs? They love you burning context — more calls, more dough. This flips the script.
Strip the buzz. Codesight’s a pragmatic gut-punch to wasteful sessions. Karpathy tweets theory; this delivers CLI reality.
The Money Angle Nobody Asks
Token optimization’s the new black. But follow the cash: Anthropic, OpenAI rake billions on context bloat. Tools like this threaten that. Prediction — incumbents acquire or copy fast. Remember Prettier? Autoformatted the world, now IDE standard.
Dev boon, though. Monorepos scale hell; this tames ‘em.
🧬 Related Insights
- Read more: ICP’s X-402 Gamble: Micropayments That Might Actually Work
- Read more: Flutter’s FFmpeg Fork: Custom Builds, No More Bloat
Frequently Asked Questions
What is codesight and how do I use it?
npx codesight — scans codebase, outputs markdown map of structure. Zero install.
How much does codesight reduce AI tokens?
9-12x on full maps, up to 91x with wiki mode. Real monorepos tested.
Is codesight free and open source?
Yes, npx tool, GitHub repo implied. No deps beyond your project.