| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Quantifies how much codegraph reduces token usage when AI agents navigate large codebases, compared to raw file exploration (Glob/Grep/Read/Bash).
Claude Agent SDK
npm install @anthropic-ai/claude-agent-sdkAPI key
export ANTHROPIC_API_KEY=sk-ant-...Git (for cloning Next.js)
codegraph installed in this repo (npm install)
# Smoke test — 1 issue, 1 run (~$2-4)
node scripts/token-benchmark.js --issues csrf-case-insensitive --runs 1 > result.json
# View the JSON
cat result.json | jq .aggregate
# Generate the markdown report
node scripts/update-token-report.js result.json
cat docs/benchmarks/TOKEN-SAVINGS.md# All 5 issues × 3 runs (~$10-20)
node scripts/token-benchmark.js > result.json
node scripts/update-token-report.js result.json| Flag | Default | Description |
|---|---|---|
| --runs <N> | 3 | Number of runs per issue (medians used) |
| --model <model> | sonnet | Claude model to use |
| --issues <id,...> | all | Comma-separated subset of issue IDs |
| --nextjs-dir <path> | $TMPDIR/... | Reuse existing Next.js clone |
| --skip-graph | false | Skip codegraph rebuild (use existing DB) |
| --max-turns <N> | 50 | Max agent turns per session |
| --max-budget <$> | 2.00 | Max USD per session |
| --perf | false | Also run build/query perf benchmarks on the Next.js graph |
| ID | Difficulty | PR | Description |
|---|---|---|---|
| csrf-case-insensitive | Easy | #89127 | Case-insensitive CSRF origin matching |
| ready-in-time | Medium | #88589 | Incorrect "Ready in" time display |
| aggregate-error-inspect | Medium | #88999 | AggregateError.errors missing in output |
| otel-propagation | Hard | #90181 | OTEL trace context propagation broken |
| static-rsc-payloads | Hard | #89202 | Static RSC payloads not emitted/served |
Baseline: Agent has Glob, Grep, Read, Bash tools. No codegraph.
Codegraph: Agent has the same tools plus a codegraph MCP server providing structural navigation (symbol search, dependency tracking, impact analysis, call chains).
| Scenario | Approximate cost |
|---|---|
| 1 issue × 1 run | $2-4 |
| 1 issue × 3 runs | $6-12 |
| 5 issues × 3 runs | $30-60 |
Costs depend on model choice and issue difficulty. The --max-budget flag caps individual sessions.
Edit scripts/token-benchmark-issues.js and add an entry to the ISSUES array:
{
id: 'short-slug',
difficulty: 'easy|medium|hard',
pr: 12345,
title: 'PR title',
description: 'Bug description for the agent (no solution hints)',
commitBefore: 'abc123def...', // SHA before the fix
expectedFiles: ['packages/next/src/path/to/file.ts'],
}Requirements:
The runner outputs JSON to stdout. See TOKEN-SAVINGS.md for the generated report.
| Back | FazBrowse Home | New Git URL |