MCPcopy Index your code
hub / github.com/Houseofmvps/codesight

github.com/Houseofmvps/codesight @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
765 symbols 1,988 edges 232 files 82 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Your AI assistant wastes thousands of tokens every conversation just figuring out your project. codesight fixes that in one command.

4,000+ downloads and counting.

Zero dependencies. AST precision. 30+ framework detectors. 14 ORM parsers. 14 MCP tools. One npx call.

Works with TypeScript, JavaScript, Python, Go, Ruby, Elixir, Java, Kotlin, Rust, PHP, Dart, Swift, C#, and BrightScript/BrighterScript ( Roku). TypeScript projects get full AST precision. Everything else uses battle-tested regex detection across the same 30+ frameworks.

npm version npm downloads npm total GitHub stars License: MIT


Follow @kaileskkhumar LinkedIn houseofmvps.com kailxlabs.co

Built by Kailesk Khumar, founder of HouseofMVPs and Kailxlabs

Also: ultraship (39 expert skills for Claude Code) · claude-rank (SEO/GEO/AEO plugin for Claude Code)


0 dependencies · Node.js >= 18 · 145 tests · 14 MCP tools · MIT · tested on 25+ OSS projects across 14 languages

Works With

Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Windsurf, Cline, Aider, and anything that reads markdown.

Install

npx codesight

That's it. Run it in any project root. No config, no setup, no API keys.

npx codesight --wiki                       # Generate wiki knowledge base (.codesight/wiki/)
npx codesight --init                       # Generate CLAUDE.md, .cursorrules, codex.md, AGENTS.md
npx codesight --open                       # Open interactive HTML report in browser
npx codesight --mcp                        # Start as MCP server (14 tools) for Claude Code / Cursor
npx codesight --blast src/lib/db.ts        # Show blast radius for a file
npx codesight --profile claude-code        # Generate optimized config for a specific AI tool
npx codesight --benchmark                  # Show detailed token savings breakdown
npx codesight --native-ast                 # Opt-in: AST plugins for more languages (see docs/wasm-plugins.md)
npx codesight --mode knowledge             # Map knowledge base (.md notes → KNOWLEDGE.md)
npx codesight --mode knowledge ~/vault     # Map Obsidian vault, ADRs, meeting notes, retros

Wiki Knowledge Base (v1.6.2)

Inspired by Karpathy's LLM wiki pattern — but compiled from AST, not an LLM. Zero API calls. 200ms.

npx codesight --wiki

Generates .codesight/wiki/ — a persistent knowledge base of your codebase that survives across every session:

.codesight/wiki/
  index.md      — catalog of all articles (~200 tokens) — read this at session start
  overview.md   — architecture, subsystems, high-impact files (~500 tokens)
  auth.md       — auth routes, middleware, session flow
  payments.md   — payment routes, webhook handling, billing flow
  database.md   — all models, fields, relations, high-impact DB files
  users.md      — user management routes and related models
  ui.md         — UI components with props
  log.md        — append-only record of every wiki operation

Why this cuts token usage further:

Instead of loading the full 5K token context map every conversation, your AI reads one targeted article:

Question Without wiki With wiki
"How does auth work?" ~12K tokens (reads 8+ files) ~300 tokens (auth.md)
"What models exist?" ~5K tokens (CODESIGHT.md) ~400 tokens (database.md)
New session start ~5K tokens (full reload) ~200 tokens (index.md)

Persistent across sessions. The wiki lives in .codesight/wiki/, committed to git. Every new Claude Code, Cursor, or Codex session starts with full codebase knowledge from the first message.

Auto-regenerates. Use --watch to keep the wiki current as you code. Use --hook to regenerate on every commit.

3 new MCP tools for wiki access:

Tool What it does
codesight_get_wiki_index Get the wiki catalog (~200 tokens) at session start
codesight_get_wiki_article Read one article by name: auth, database, payments, etc.
codesight_lint_wiki Health check: orphan articles, missing cross-links, stale content

The key difference from general-purpose wiki tools: codesight already knows your routes, schema, blast radius, and middleware from AST — no LLM needed to extract code structure. The wiki is a narrative layer on top of data your codebase already contains.

Knowledge Mode (v1.9.3)

Not just code — your decisions, meeting notes, ADRs, and retrospectives carry as much context as the codebase itself. --mode knowledge maps them the same way codesight maps code.

npx codesight --mode knowledge              # Scan current directory for .md files
npx codesight --mode knowledge ~/vault      # Scan an Obsidian vault
npx codesight --mode knowledge ./docs       # Scan a project docs folder

Outputs .codesight/KNOWLEDGE.md — a compact AI context primer:

# Knowledge Map — my-project

> 47 notes · 12 decisions · 8 open questions · 2025-09-01 → 2026-04-01

## Key Decisions (12)

- [2026-03-20] Going with Polar.sh over Stripe Connect — simpler global payments
- [2026-03-15] Decided to use PostgreSQL — better JSON support and Drizzle compatibility
- [2026-02-10] Will use Redis for rate limiting — BullMQ already in stack

## Open Questions (8)

- Should we support PayPal later?
- When do we start the Stripe marketplace application?

## Note Index (47)

### Decision Records (8)

- `decisions/adr-002-payments.md` — 2026-03-20 — Going with Polar.sh over Stripe Connect
- `decisions/adr-001-database.md` — 2026-03-15 — We need a relational database...

### Meeting Notes (14)

### Retrospectives (6)

### Specs & PRDs (5)

### Research (4)

What it detects automatically:

Note type Signals
Decision records ADR format (## Decision), "decided to", "going with", "chose X over Y"
Meeting notes Attendees:, Action items:, filename: standup, sync, 1on1
Retrospectives "What went well", "Stop doing", filename: retro, retrospective
Specs / PRDs ## Goals, ## Requirements, filename: prd, spec, roadmap
Research filename: research, analysis, benchmark, comparison
Session logs filename: session, daily, weekly

Supports:

  • Obsidian vaults (YAML frontmatter, [[backlinks]], #tags)
  • Notion exports (.md files with frontmatter)
  • ADR tooling (adr-tools, Log4brains, raw markdown)
  • Any folder of markdown files

Used together:

Read .codesight/CODESIGHT.md   → what the code does
Read .codesight/KNOWLEDGE.md   → why decisions were made

CI: add npx codesight --mode knowledge alongside your existing codesight step. Both files stay current on every push.

Benchmarks (Real Projects)

Every number below comes from running codesight on real production codebases — both small SaaS projects (v1.6.2) and large open-source platforms with 4K–10K+ files (v1.6.4). Output tokens are measured from actual file size (chars / 4). Exploration tokens are estimated from what was extracted — routes × 400, models × 300, components × 250, etc. Route counts and model counts are cross-checked against actual source files.

Three-Level Token Reduction

codesight saves tokens at two distinct layers. The wiki (v1.6.2) adds a second layer on top of the base savings:

Project Manual exploration codesight scan codesight --wiki (targeted) Total reduction
SaaS A 46,020 tokens 3,936 tokens (11.7x) ~550 tokens 83.7x
SaaS B 26,130 tokens 3,629 tokens (7.2x) ~440 tokens 59.4x
SaaS C 47,450 tokens 4,162 tokens (11.4x) ~360 tokens 131.8x

Average combined reduction: 91x. The wiki's "targeted" number = reading index.md at session start (~200 tokens) + one relevant article (~160-350 tokens depending on project). Your AI never loads the full context map for targeted questions.

The two savings layers are independent and compound:

Layer 1 — codesight scan eliminates manual file exploration. Instead of your AI running glob/grep/read across 40-138 files to understand the project, it reads one pre-compiled map.

Layer 2 — --wiki eliminates loading the full map for every question. Instead of loading 3K-5K tokens of full context at session start, your AI reads a 200-token index and pulls the one relevant article (~160-350 tokens) for each question.

Without codesight:   AI reads 26K-47K tokens per session exploring files
With codesight:      AI reads ~3K-5K tokens (the compiled map)
With --wiki:         AI reads ~200 tokens at start + ~300 per targeted question

Base Scan Results

Project Stack Files Routes Models Components Output Tokens Exploration Tokens Savings Scan Time
SaaS A Hono + Drizzle 138 38 12 0 3,936 46,020 11.7x 186ms
SaaS B Hono + Drizzle, 3 workspaces 53 17 8 10 3,629 26,130 7.2x 201ms
SaaS C FastAPI + MongoDB 40 56 0 0 4,162 47,450 11.4x 890ms

SaaS C has 0 models because it uses MongoDB — no SQL ORM declarations for codesight to parse. This is correct detection, not a false negative.

Token comparison: Without codesight (46K-66K tokens) vs With codesight (3K-5K tokens)

Multi-Language OSS Benchmark (v1.6.7)

Tested against real open-source codebases spanning every supported language and framework. Output tokens are measured from actual file size. Exploration tokens are estimated (routes×400 + models×300 + components×250 + revisit multiplier). Zero false positives across all tests.

Language Stack Files Routes Models Components Output tokens Est. exploration Savings
TypeScript · Next.js Next.js + tRPC + Prisma · 110+ workspaces 7,509 479 173 1,309 158,660 ~1,485,000 ~9x
TypeScript · NestJS NestJS + TypeORM + Mongoose 162 19 8 0 5,300 ~67,500 ~12.7x
TypeScript · Hono Hono 8 0 0
TypeScript · Remix Remix + Prisma 36 11 0 9
TypeScript · SvelteKit SvelteKit 0 23
TypeScript · Nuxt Nuxt 141 8 0 64
JavaScript · Express Express + Mongoose 51 10 5 0 1,241 ~20,800 ~17x
Ruby · Rails Rails + ActiveRecord 4,172 607 116 0 21,711 ~386,100 ~17.8x
PHP · Laravel Laravel + Eloquent 3,896

Extension points exported contracts — how you extend this code

NativeAstCli (Interface)
Accumulated native-AST CLI intent. `none` forces off; empty `languages` = all.
src/index.ts
JsonRpcRequest (Interface)
* MCP server with 8 specialized tools for AI assistants. * Zero dependencies — raw JSON-RPC 2.0 over stdio.
src/mcp-server.ts
FileHashCache (Interface)
(no doc)
src/scanner.ts
GroundTruth (Interface)
(no doc)
src/eval.ts
KnowledgeNote (Interface)
(no doc)
src/types.ts
TelemetryTask (Interface)
(no doc)
src/telemetry.ts
LoadedPlugin (Interface)
(no doc)
src/wasm/plugin-host.ts
OpenAPIResult (Interface)
(no doc)
src/detectors/openapi.ts

Core symbols most depended-on inside this repo

join
called by 334
plugins/ast/rust/src/lib.rs
readFileSafe
called by 85
src/plugins/cicd/index.ts
fileExists
called by 52
src/scanner.ts
describe
called by 44
plugins/ast/rust/src/lib.rs
detectTags
called by 41
src/detectors/routes.ts
getText
called by 40
src/ast/loader.ts
escapeHtml
called by 33
src/generators/html-report.ts
parseYAML
called by 26
src/plugins/cicd/yaml-parser.ts

Shape

Function 639
Interface 76
Class 18
Method 18
Route 10
Struct 4

Languages

TypeScript85%
Rust7%
Python4%
Go4%

Modules by API surface

src/detectors/routes.ts40 symbols
src/scanner.ts39 symbols
plugins/ast/golang/main.go30 symbols
plugins/ast/python/src/lib.rs29 symbols
src/types.ts28 symbols
plugins/ast/rust/src/lib.rs26 symbols
src/mcp-server.ts23 symbols
src/ast/native-loader.ts23 symbols
src/wasm/plugin-host.ts21 symbols
src/generators/wiki.ts20 symbols
src/detectors/schema.ts19 symbols
src/plugins/terraform/extractor.ts17 symbols

Datastores touched

NameCollection · 1 repos

For agents

$ claude mcp add codesight \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact