Repository navigation
Conversation
…val CLI
Add a full retrieval evaluation framework so search quality can be
measured, compared, and tracked instead of evaluated by vibes.
- src/core/search/eval.ts: pure IR metrics (precisionAtK, recallAtK,
mrr, ndcgAtK), EvalQrel/EvalConfig/EvalReport types, and runEval()
orchestrator that executes any strategy against user-provided qrels
- src/commands/eval.ts: gbrain eval CLI with single-run table and
A/B comparison mode (--config-a / --config-b) showing Δ nDCG
- src/core/operations.ts: eval_search operation available via MCP;
agents can pass inline qrels JSON and get metrics back
- src/core/search/hybrid.ts: add rrfK and dedupOpts to HybridSearchOpts
so A/B tests can override RRF_K=60, cosine threshold, type ratio cap
without touching constants
- test/eval.test.ts: 30+ unit tests for all metric functions
- test/e2e/mechanical.test.ts: replace non-asserting console.log
precision@5 block with real expect() assertions using precisionAtK
Usage: gbrain eval --qrels ./my-queries.json
gbrain eval --qrels ./qrels.json --config-a '{"rrf_k":60}' --config-b '{"rrf_k":30}'
Made-with: Cursor
|
@4shut0sh — this is exactly what GBrain needed. A proper retrieval eval framework with real IR metrics instead of vibing on search quality. The API design is clean: pure metric functions with zero deps for unit testing, runEval() orchestrator for E2E, A/B comparison mode for parameter tuning. Making rrfK and dedupOpts configurable on HybridSearchOpts was the right call — it integrates perfectly with our compiled truth boost work. We've pulled this into garrytan/search-quality-boost (PR #64) with full attribution via Massive thank you for this. The eval harness is the kind of infrastructure that makes every future search improvement measurable instead of guesswork. Closing in favor of #64 which includes this work. |
Full audit document for Node 1-4: Operations layer and trust boundary migration. Includes: - Complete scope definition (3 child nodes, 16 implementation slices) - Grill decisions recorded (A A A A A) - Current state audit (4,243 lines TS to migrate) - Security critical path identification - TDD implementation slicing plan (#40-#55) - Gap analysis summary - Acceptance gates - Risk mitigation plan Implementation slices: 16 total, ~3,750 - 5,300 estimated lines of Rust
Complete 1:1 TypeScript → Rust port of the operations layer type system: - ErrorCode enum with full v0.31 error codes - OperationError struct with exact TS serialization (error/message/suggestion/docs) - Dual error system bridge: OperationError → StructuredError conversion - AuthInfo struct (v0.8+ OAuth with federated read support) - CliOpts struct with quiet/progress_json/progress_interval - Logger trait with Debug + Send + Sync bounds, NoopLogger implementation - OperationContext struct with COMPLETE trust boundary fields: - remote (MCP trust flag — security critical) - via_subagent + subagent_id (agent policy enforcement) - source_id (v0.34 tenancy filter) - allowed_slug_prefixes (v0.23 dream cycle workspace whitelist) - takes_holders_allow_list (v0.28 visibility model filter) - brain_id (v0.19 mount support) - source_scope_opts() helper with v0.34.1 precedence logic - Operation object-safe trait with name/description/local_only() Tests: 14/14 passing - Error serialization parity verified byte-for-byte with TS - Trust boundary context constructors verified - Source scope precedence logic verified
…val CLI
Add a full retrieval evaluation framework so search quality can be measured, compared, and tracked instead of evaluated by vibes.
Usage: gbrain eval --qrels ./my-queries.json
gbrain eval --qrels ./qrels.json --config-a '{"rrf_k":60}' --config-b '{"rrf_k":30}' Made-with: Cursor