Ships the contributor-onboarding surface promised in the plan. With this
commit, external researchers have a self-serve path from clone to PR in
under 5 minutes.
Added:
eval/README.md — 5-minute quickstart,
directory map, methodology
one-pager, adapter scorecard
eval/CONTRIBUTING.md — three contributor paths:
1. Write Tier 5.5 queries
2. Submit an external adapter
3. Reproduce a scorecard
eval/RUNBOOK.md — operational troubleshooting:
generation failures, runner
failures, query validation,
world.html rendering, CI
eval/CREDITS.md — contributor attribution
(synthetic-outsider-v1 labeled
as placeholder; real submissions
land here)
.github/PULL_REQUEST_TEMPLATE/tier5-queries.md — structured PR template
for Tier 5.5 submissions
.github/workflows/eval-tests.yml — CI: validates queries,
runs all eval unit tests,
renders world.html on every PR
touching eval/** or
src/core/link-extraction.ts
CI scope (intentionally narrow):
- Triggers on paths: eval/**, src/core/link-extraction.ts, src/core/search/**
- Runs: bun run eval:query:validate (80 queries), test:eval (57 tests),
eval:world:render (smoke-test the HTML renderer)
- Pinned actions by commit SHA (matches existing .github/workflows/test.yml)
- Zero API calls — all Opus/OpenAI paths stubbed or skipped in unit tests
- Fast: ~30s total wall clock
Contributor TTHW (clone → first merged PR):
- Path 1 (Tier 5.5 queries): ~5 min
- Path 2 (external adapter): ~30 min for a simple adapter
- Path 3 (reproduce scorecard): ~15 min wall clock (N=5 run)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5.2 KiB
BrainBench
Public benchmark for personal knowledge brain agent stacks. Ships 4 adapter
configurations scored side-by-side on a 240-page rich-prose fictional corpus
(twin-amara). Measures retrieval, extraction quality, and per-link-type
accuracy.
What this answers: "Does the knowledge graph layer do useful work, or is gbrain just a thin wrapper over vector+keyword hybrid?" Headline: gbrain beats the closest external baseline (hybrid-without-graph, same embedder, same chunking) by +31 points P@5. The graph layer is load-bearing.
5-minute quickstart
# 1. Run the full benchmark (4 adapters × 5 runs, ~15 min wall clock)
bun run eval:run
# 2. Fast iteration (N=1 single run)
bun run eval:run:dev
# 3. Just the type-accuracy report
bun run eval:type-accuracy
# 4. Explore the canonical world (contributor-facing UI)
bun run eval:world:view
What's in the box
eval/
├── data/world-v1/ Canonical world (committed). 240 sharded JSON files.
│ One file per entity + _ledger.json metadata.
├── generators/
│ ├── gen.ts Opus-backed corpus generator (run once; output cached)
│ ├── world.ts World-schema scaffolder
│ └── world-html.ts World explorer HTML renderer (XSS-safe)
├── runner/
│ ├── multi-adapter.ts 4-adapter side-by-side scorer (N=5)
│ ├── type-accuracy.ts Per-link-type accuracy vs gold from _facts
│ ├── before-after.ts Original v1 BEFORE/AFTER retrieval run
│ ├── types.ts Adapter, Page, Query, RankedDoc interfaces
│ ├── adapters/
│ │ ├── ripgrep-bm25.ts EXT-1: classic IR baseline (BM25 over grep hits)
│ │ ├── vector-only.ts EXT-2: pure cosine similarity, same embedder
│ │ └── hybrid-nograph.ts EXT-3: gbrain hybrid with graph disabled
│ └── queries/
│ ├── tier5-fuzzy.ts 30 vague-recall queries (hand-authored)
│ ├── tier5_5-synthetic.ts 50 synthetic outsider queries (AI-authored, labeled)
│ ├── validator.ts Query schema enforcement (temporal as_of_date rule)
│ └── index.ts Aggregator + validateAll()
├── cli/
│ ├── world-view.ts Render + open world.html
│ ├── query-validate.ts Validate a Query[] file
│ └── query-new.ts Scaffold a Query template
└── reports/ Benchmark scorecards (gitignored)
Three contributor paths
Path 1: Reproduce a published scorecard
# 1. Check out the specific gbrain commit referenced in the scorecard
git checkout <commit-sha>
# 2. Run the full benchmark
bun run eval:run
# 3. Compare your numbers to the scorecard. Deterministic adapters should
# match exactly. Embedding-based adapters should land within tolerance bands.
Path 2: Submit a new external adapter
See CONTRIBUTING.md for the adapter submission flow. Short version:
- Implement
eval/runner/adapters/<your-adapter>.tsconforming to theAdapterinterface ineval/runner/types.ts. - Add a unit test file alongside.
- Wire your adapter into
eval/runner/multi-adapter.ts(one line). bun run eval:run:devto verify.- Open a PR.
Path 3: Write Tier 5.5 externally-authored queries
The T5.5 queries currently in the repo are AI-authored (author: "synthetic-outsider-v1") as a placeholder. Real outside researchers should:
bun run eval:world:viewto understand the canonical worldbun run eval:query:new --tier externally-authored --author "@your-handle"- Edit the scaffolded template with a real query + gold slugs
bun run eval:query:validate path/to/your.json- Submit via
eval/external-authors/<your-handle>/queries.jsonin a PR
See CONTRIBUTING.md for the query-submission template.
Methodology one-pager
- Corpus: 240 Opus-generated fictional biographical pages. Fixed, committed, zero private data. Reproducibility baseline for any run.
- Gold: Each page's
_factsmetadata defines canonical relationships. The scorer never shows_factsto the adapters — raw pages only cross the ingestion boundary (structural enforcement inAdapter.init). - Metrics: P@5 and R@5 on relational queries (145 canonical from
_facts, 80 tier-5 + tier-5.5). Type accuracy on extracted edges (eval/runner/type-accuracy.ts). - N=5 runs per adapter with page-order shuffle (seeded LCG; runs are reproducible). Stddev surfaces order-dependent adapter bugs. Deterministic adapters correctly show stddev=0.
- Temporal queries require explicit
as_of_date(validated at query authoring time; rejected at load if a temporal verb is present without it).
Adapter scorecard (most recent, N=5)
See docs/benchmarks/2026-04-18-brainbench-v1.md for the full report.
Quick summary from bun run eval:run:
| Adapter | P@5 | R@5 |
|---|---|---|
| gbrain-after | 49.1% | 97.9% |
| hybrid-nograph | 17.8% | 65.1% |
| ripgrep-bm25 | 17.1% | 62.4% |
| vector-only | 10.8% | 40.7% |
The graph layer beats vector+keyword hybrid on relational queries by ~31 points; hybrid-without-graph barely edges BM25. That's the story.