Skip to content

Commit e6a07d7

Browse files
committed
新增多项目无限制对比基准
1 parent 5ed6d06 commit e6a07d7

36 files changed

Lines changed: 6517 additions & 0 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.work/
2+
results/raw/
3+
results/runs/
4+
__pycache__/
5+
.DS_Store
6+
fair-e2e-context-bundle.tar.gz
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Benchmark Protocol
2+
3+
## Isolation
4+
5+
Each tool receives a separate detached worktree at the same repository SHA.
6+
This prevents `.repobrain/` from entering CodeGraph's corpus and `.codegraph/`
7+
from entering RepoBrain's corpus. Third-party repositories are shallow clones.
8+
9+
## Tracks
10+
11+
### Unrestricted native track (latest-v2 default)
12+
13+
- Both products receive independent worktrees at the same pinned source SHA.
14+
- RepoBrain uses its public full refresh and `rb-ask` workflow.
15+
- CodeGraph uses its installed CLI/integration as the primary discovery tool.
16+
- Both answer agents may inspect source files for verification, with no command
17+
count or context-budget limit beyond the native tools' own limits.
18+
- A product must actually be invoked; a plain model-only answer is invalid.
19+
- Compare final evidence correctness, total end-to-end wall time, and Trae
20+
token usage. Report monetary cost only when the runtime emits an amount.
21+
- Use a shared requested model and record any observed server-side reroute.
22+
23+
This track models normal IDE use. It does not isolate pure retrieval quality.
24+
25+
### Deterministic index track
26+
27+
- RepoBrain: `RB_REFRESH_SCAN_ONLY=1 rb-refresh`
28+
- CodeGraph: `codegraph init`
29+
- No model is involved.
30+
- Run tools sequentially on an otherwise idle machine.
31+
32+
### Source-free native retrieval track
33+
34+
- RepoBrain: full host-runner refresh followed by `rb-ask --json`
35+
- CodeGraph: `codegraph explore`
36+
- A subagent may invoke only the assigned product command. It may not read,
37+
grep, search, or inspect the target repository directly.
38+
- Results are scored against the answer atoms in `config/questions.json`.
39+
- RepoBrain results are eligible only when the public refresh command promotes
40+
an active generation. A scan-only index, deleted staging generation, direct
41+
source answer, or manually promoted generation is not a valid substitute.
42+
43+
This track measures each product's native workflow, not pure retrieval parity.
44+
RepoBrain produces a final answer; CodeGraph returns source context and graph
45+
paths. Report these differences explicitly.
46+
47+
### Ceiling retrieval track
48+
49+
- Use the same focused corpus and answer atoms for both products.
50+
- RepoBrain may waive only the deterministic generic host-runner
51+
`git_insights=partial` state.
52+
- Reject promotion if any other stage or module is degraded, or if the failure
53+
list is non-empty.
54+
- Copy the promoted RepoBrain knowledge into a source-free workspace before
55+
`rb-ask`, preventing direct source reads.
56+
- Label these results as ceiling behavior rather than unmodified current-main
57+
behavior.
58+
59+
### Controlled answer track
60+
61+
For a stricter future run, feed both retrieval outputs into the same frozen
62+
model with source-reading tools disabled and an equal context-token budget.
63+
This pilot does not claim that controlled-model result.
64+
65+
## Metrics
66+
67+
### Build
68+
69+
- Wall, user, and system time from `/usr/bin/time -lp`
70+
- Maximum resident set size
71+
- Final index directory size
72+
- Completion state and parser errors
73+
- Indexed files divided by Git tracked files
74+
75+
### Retrieval
76+
77+
- Expected-file recall
78+
- Expected-symbol recall
79+
- Citation validity: cited file and line exist at the pinned SHA
80+
- Unsupported-claim rate
81+
- Wall time
82+
- Output bytes
83+
- Input, cached-input, output, and reasoning tokens when emitted by the runtime
84+
- Monetary cost only when explicitly emitted; otherwise mark it unavailable
85+
86+
### Incremental
87+
88+
- Explicit update time: `rb-refresh --quick` versus `codegraph sync`
89+
- Time until changed facts are queryable
90+
- Stale-fact rate
91+
- Incremental result versus clean rebuild
92+
- Update amplification in each tool's native unit
93+
94+
## Repetition
95+
96+
The checked-in result is a pilot with one cold-build run and one retrieval run
97+
per question. A publishable benchmark should use:
98+
99+
- three cold builds per tool and repository
100+
- ten retrieval latency runs per deterministic query
101+
- three answer runs per question
102+
- paired bootstrap confidence intervals for answer metrics
103+
104+
## Failure Policy
105+
106+
Timeouts, crashes, incomplete indexes, and missing answers remain in the
107+
dataset. Environment-specific blocks are reported separately and are not
108+
attributed to the product.
109+
110+
If a tool cannot create the prerequisite queryable index through its public
111+
workflow, record the retrieval result as unavailable with the build failure.
112+
Do not assign zero answer-atom recall because no answer was produced.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# RepoBrain vs CodeGraph Benchmark
2+
3+
## Latest v2 multi-repository suite
4+
5+
The v2 suite preserves the original VERL/Excalidraw pilot below and adds a
6+
manifest-driven comparison over pinned releases of Flask, Vite, ripgrep,
7+
Prometheus, and Grafana. Grafana is a stress track and must be reported
8+
separately from the four-repository main track.
9+
10+
The suite pins RepoBrain and CodeGraph as well as every corpus revision. It
11+
builds each product from an independent worktree. The default
12+
`unrestricted_native` track models normal IDE use: both agents can read the
13+
same pinned source tree and use their product's native integration without a
14+
command budget. The optional `source_free` track isolates retrieval indexes.
15+
Every run is stored below
16+
`results/runs/<run-id>/<track>/<repository>/repeat-<n>/<product>/`.
17+
18+
Start with the Flask smoke test:
19+
20+
```bash
21+
bash benchmarks/codegraph-comparison/scripts/bootstrap.sh --repository flask
22+
23+
benchmarks/codegraph-comparison/.work/v2/tools/repobrain-venv/bin/python \
24+
benchmarks/codegraph-comparison/scripts/prepare_corpora.py \
25+
--repository flask
26+
27+
benchmarks/codegraph-comparison/.work/v2/tools/repobrain-venv/bin/python \
28+
benchmarks/codegraph-comparison/scripts/run_benchmark_v2.py \
29+
--run-id flask-unrestricted-smoke \
30+
--track unrestricted_native \
31+
--repository flask \
32+
--limit 1 \
33+
--workers 1 \
34+
--restart
35+
36+
benchmarks/codegraph-comparison/.work/v2/tools/repobrain-venv/bin/python \
37+
benchmarks/codegraph-comparison/scripts/render_benchmark_v2_report.py \
38+
benchmarks/codegraph-comparison/results/runs/flask-unrestricted-smoke/unrestricted_native/results.json \
39+
benchmarks/codegraph-comparison/results/runs/flask-unrestricted-smoke/unrestricted_native/report.md
40+
```
41+
42+
For a formal main-track run, prepare the four non-stress repositories and use
43+
`--repeat 3 --workers 1`. Run Grafana under a different run id. Compare final
44+
evidence correctness, total wall time, and Trae token usage. Monetary cost is
45+
reported only when Trae emits it; otherwise it remains explicitly unavailable.
46+
For `source_free`, a generated corpus manifest records that source files are
47+
absent from the query directory; this is auditable isolation, not an
48+
OS/container security boundary.
49+
50+
The v2 entrypoints are:
51+
52+
- `config/manifest-latest-v2.json`: tool and corpus pins
53+
- `config/questions-v2.json`: 23 repository-specific questions
54+
- `scripts/bootstrap.sh`: pinned tool/worktree setup
55+
- `scripts/prepare_corpora.py`: public index builds and source-free publication
56+
- `scripts/run_benchmark_v2.py`: repeated fair-E2E runner
57+
- `scripts/render_benchmark_v2_report.py`: multi-repository report
58+
59+
## Legacy pilot
60+
61+
The legacy files contain the original historical comparison of:
62+
63+
- RepoBrain `main` at `b0ebc36b611305dcbdda7343fc8e0136fa7f2686`
64+
- CodeGraph `1.5.0`
65+
66+
The primary corpora are:
67+
68+
- `verl-project/verl` at `8f8b122195ecf43475679fb6ee0204ee33f387c5`
69+
- `excalidraw/excalidraw` at `4a6f4e7a32ce3d3360d4d209d14105acc144d8c7`
70+
71+
OpenClaw was also attempted at
72+
`1e6844b71aa2299c082d23cf66dce38ff00b2211`. Its CodeGraph run is excluded
73+
because a corporate endpoint policy terminated Node processes operating on an
74+
OpenClaw checkout. The RepoBrain result is retained only as a scalability
75+
observation, not as a paired comparison.
76+
77+
## Layout
78+
79+
- `config/manifest.json`: pinned tool, repository, and machine versions
80+
- `config/questions.json`: shared pilot question set and answer atoms
81+
- `PROTOCOL.md`: comparison rules and metric definitions
82+
- `scripts/`: repeatable index and query commands
83+
- `results/`: normalized summaries and reports
84+
- `.work/`: ignored third-party checkouts, virtual environments, and indexes
85+
86+
## Run
87+
88+
From the repository root:
89+
90+
```bash
91+
bash benchmarks/codegraph-comparison/scripts/bootstrap.sh
92+
bash benchmarks/codegraph-comparison/scripts/run_index_benchmark.sh
93+
bash benchmarks/codegraph-comparison/scripts/run_retrieval_benchmark.sh
94+
```
95+
96+
The scripts do not install anything globally. CodeGraph telemetry and update
97+
checks are disabled for benchmark runs.
98+
99+
The historical results separate behavior of their pinned RepoBrain commit from
100+
a ceiling track. That old commit marked deterministic host-runner Git insights
101+
`partial` and removed the unpromoted generation. Current RepoBrain fixed the
102+
public full-refresh path; do not mix the old report with latest-v2 results.
103+
104+
The detailed 15-question accuracy table is in
105+
`results/expanded-question-report.md`.
106+
107+
## Interpretation
108+
109+
RepoBrain scan-only and CodeGraph index different semantic units. Their raw
110+
node and edge counts are therefore descriptive, not directly comparable.
111+
Compare:
112+
113+
- cold build wall time and peak RSS
114+
- index disk size
115+
- indexed-file coverage relative to tracked source files
116+
- retrieval answer-atom recall and citation validity
117+
- output size and query latency
118+
- explicit incremental update time and freshness
119+
120+
Do not collapse these dimensions into one score.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://repobrain.dev/schemas/codegraph-comparison-corpus-manifest-v1.json",
4+
"title": "Source-free benchmark corpus provenance",
5+
"type": "object",
6+
"additionalProperties": false,
7+
"required": ["schema_version", "provenance_schema", "created_at", "benchmark_id", "repository", "product", "source_free"],
8+
"properties": {
9+
"schema_version": {"const": 1},
10+
"provenance_schema": {"const": "config/corpus-manifest-v1.schema.json"},
11+
"created_at": {"type": "string", "format": "date-time"},
12+
"benchmark_id": {"type": "string", "minLength": 1},
13+
"repository": {
14+
"type": "object",
15+
"additionalProperties": false,
16+
"required": ["id", "url", "revision", "release", "primary_language", "corpus", "tracked_tree_sha256"],
17+
"properties": {
18+
"id": {"type": "string", "minLength": 1},
19+
"url": {"type": "string", "format": "uri"},
20+
"revision": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
21+
"release": {"type": "string", "minLength": 1},
22+
"primary_language": {"type": "string", "minLength": 1},
23+
"corpus": {"type": "object"},
24+
"tracked_tree_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
25+
}
26+
},
27+
"product": {
28+
"type": "object",
29+
"additionalProperties": false,
30+
"required": ["name", "pin", "build_status", "build_seconds"],
31+
"properties": {
32+
"name": {"enum": ["repobrain", "codegraph"]},
33+
"pin": {"type": "string", "minLength": 1},
34+
"build_status": {"const": "success"},
35+
"build_seconds": {"type": "number", "minimum": 0}
36+
}
37+
},
38+
"active_generation": {"type": "object"},
39+
"source_free": {
40+
"type": "object",
41+
"additionalProperties": false,
42+
"required": ["verified", "hard_filesystem_isolation", "allowed_top_level_entries", "note"],
43+
"properties": {
44+
"verified": {"const": true},
45+
"hard_filesystem_isolation": {"type": "boolean"},
46+
"allowed_top_level_entries": {
47+
"type": "array",
48+
"uniqueItems": true,
49+
"items": {"type": "string", "minLength": 1}
50+
},
51+
"note": {"type": "string", "minLength": 1}
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)