Skip to content

WindChimeRan/deep_code_research

Repository files navigation

Deep Code Research Agent

"Don't just tell me to add error handling. Show me exactly where my code differs from relevant projects."

npm version GitHub stars

Code "literature review" is tedious. Before building something, you should survey similar projects to learn patterns, avoid known pitfalls, and not reinvent wheels. But reading through 10+ related repositories takes hours. This tool does it for you.

Deep Code Research findings with dual-evidence comparison

The only code review that shows your code side-by-side with 10+ similar repos. Generic advice like "add error handling" is useless. This tool produces grounded findings—showing exactly what related repos do differently and where in your codebase to change.

See a complete real example output in example_deep_code_research.md.

Setup

# Set your API key
export ANTHROPIC_API_KEY=sk-ant-...

# Run directly with npx (no install needed)
npx deep-code-research https://github.com/user/repo

Or clone for development:

git clone https://github.com/WindChimeRan/deep_code_research.git
cd deep_code_research
npm install
npm run dev https://github.com/user/repo

Usage

npx deep-code-research https://github.com/user/repo

# With options
npx deep-code-research https://github.com/user/repo --lens security --budget 50000
Option Description Default
--lens <focus> Free-text analysis focus (e.g., "security", "performance", "error handling") general
--budget <tokens> Token budget 100,000
--max-repos <n> Max related repos to analyze 20
--output <file> Save JSON report -

How It Works

Phase 1: Understand target repo
Phase 1.5: Map target file structure (so sub-agents know what to compare)
Phase 2: Discover related repositories
Phase 3: Sub-agents analyze BOTH repos in parallel, producing comparative evidence
Phase 4: Synthesize TOP 3 grounded findings

Each sub-agent:

  1. Reads the related repo's code
  2. Checks target's file map for equivalent files
  3. Fetches and compares both implementations
  4. Reports the gap: "Target does X, related does Y"

Built on the Claude Agent SDK.

Model Configuration

The tool uses different Claude models for different tasks:

Role Model Why
Main agent Opus 4.5 Complex orchestration, synthesis
Sub-agents Haiku 4.5 Fast, cost-effective for parallel analysis

To update models (e.g., when newer versions are released), edit src/claude-client.ts:

export const MODEL_ALIASES: Record<ModelAlias, string> = {
  opus: "claude-opus-4-5-20251101",    // ← Update these
  sonnet: "claude-sonnet-4-20250514",
  haiku: "claude-haiku-4-5-20251001",
} as const;

The rest of the codebase uses semantic aliases ("opus", "haiku") so you only need to update this one place.

Cost

A typical research costs $1-3 depending on how many related repos are analyzed. See Anthropic Pricing.

License

MIT