Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs(eval): entity-anchored query retrieval gates 1 and 2 pass (key stays off pending harness gate 3)
garrytan687f32569758
diff --git a/docs/eval/decisions/entity-anchoring-query/README.md b/docs/eval/decisions/entity-anchoring-query/README.mdindex 70b44747f6..7b17ccabf0 100644--- a/docs/eval/decisions/entity-anchoring-query/README.md+++ b/docs/eval/decisions/entity-anchoring-query/README.md@@ -1,8 +1,14 @@# Entity-anchored retrieval in query and search: verdict-Not yet measured. The gates below were written and pushed before any gated run. The change sits behind-`search.entity_anchoring`, which is off by default; with the key off, `query` and `search` return what they-returned before.+Entity anchoring passes gates 1 and 2 here. `search.entity_anchoring` stays off until the harness lane's gate 3+(dev slices, then validation) passes, and that run has not happened. On the seeded appended-corrections+workload (3 seeds, embeddings on), turning the key on lifted `query` + reader at equal tokens from 88.4% to+100% accuracy, from 11.6% to 0% stale-wrong answers, and from 0.139 to 0 batches of freshness lag. Turning it on+lowered no question's recall in the existing evals that cover `query`, but on their as-written questions it+never fired, so that pass shows only that nothing else moves.++Measured build: gbrain 2fa44f149 (the `capy/mpw-integration` branch). c4add4176 moves the op seam into+`entity-anchor.ts` with no change in behavior. Stage: dev.## The change@@ -30,6 +36,67 @@ callers now share it (`entityAnchoredPages`).- `src/core/types.ts`: the optional `SearchResult.entity_anchored` field.- `src/core/config.ts`: the key registration.+## Results++### Gate 1: seeded workload (pass)++Every state of every seed triggered anchoring (216 of 216). Each cell is the mean across seeds 42, 7 and 1234,+with the min and max in brackets.++| Arm | Accuracy | Stale-wrong | Freshness lag (batches) | Correct at change | $ per correct |+|---|---|---|---|---|---|+| **key on, equal tokens** | 1.000 [1.000, 1.000] | 0.000 | 0.000 | 1.000 | 0.00127 |+| key off, equal tokens | 0.884 [0.875, 0.903] | 0.116 [0.097, 0.125] | 0.139 [0.117, 0.150] | 0.861 [0.850, 0.883] | 0.00133 |+| key on, full evidence | 1.000 | 0.000 | 0.000 | 1.000 | 0.00230 |+| key off, full evidence | 0.981 [0.972, 0.986] | 0.009 [0.000, 0.028] | 0.022 [0.017, 0.033] | 0.978 [0.967, 0.983] | 0.00235 |++| Seed | Accuracy on / off | Lag on / off | Wins | Accuracy lower |+|---|---|---|---|---|+| 42 | 1.000 / 0.875 | 0.000 / 0.150 | yes | no |+| 7 | 1.000 / 0.903 | 0.000 / 0.117 | yes | no |+| 1234 | 1.000 / 0.875 | 0.000 / 0.150 | yes | no |++- The key-off arm reproduces run 3's query + reader arm (0.884), so the comparison sits on a known baseline.+- At equal tokens, anchoring puts the newest note about the entity inside the budget. Off, keyword and vector+ ranking often surface an older note first, and the reader repeats the superseded city.+- Cost per correct answer falls slightly (0.00127 against 0.00133), because the reader reads the same tokens+ and is right more often.+- **Caveat.** This workload was built around exactly this failure mode, so every question is an entity-scoped+ current-state question. It shows the mechanism works; it cannot say how often real questions take this shape.+ Gate 3 measures that.++Metered spend: $1.52 of the $10 cap. Voyage embedding and rerank calls are not metered.++### Gate 2: existing retrieval evals (pass)++All corpora were run through the `query` op, keyword-only and hermetic. Recall@10 and MRR are shown key on /+key off.++| Corpus | Questions | Anchoring fired | Recall@10 lower | Recall@10 higher | Recall@10 on / off | MRR on / off |+|---|---|---|---|---|---|---|+| namedthing | 12 | 0 | 0 | 0 | 0.917 / 0.917 | 1.000 / 1.000 |+| namedthing+now | 12 | 0 | 0 | 0 | 0.833 / 0.833 | 0.917 / 0.917 |+| relational | 38 | 0 | 0 | 0 | 1.000 / 1.000 | 0.289 / 0.289 |+| relational+now | 38 | 24 | 0 | 8 | 0.136 / 0.000 | 0.096 / 0.000 |+| longmemeval-nightly | 10 | 0 | 0 | 0 | 1.000 / 1.000 | 1.000 / 1.000 |+| longmemeval-nightly+now | 10 | 0 | 0 | 0 | 1.000 / 1.000 | 1.000 / 1.000 |++- The `+now` rows are a diagnostic, not the gate: each question has " now" appended so anchoring can fire.+ On the relational fixture it fired on 24 of 38 questions. 8 gained recall and none lost.+ NamedThingBench titles are not entity pages, and the LongMemEval nightly fixture has none either, so+ anchoring never fires there.+- No hard-negative question lost its clean top 3.+- **Key off matches the build without the change.** Every key-off response in this script, 120 rows across the+ corpora, matches the same script run on the pre-change code. The only differences are fields that vary+ between any two runs: scores carry a recency term computed from the clock, and page revisions are random+ UUIDs.+- Reproduce: `bun evals/entity-anchoring/regression.ts --json`.++## Where else this applies++The pinned-questions run 3 also recommended think's gather for current-state questions about one entity, and+context_pack's entity cards. Neither is built. Each needs its own gate.+## Gates (preregistered)1. **Seeded workload.** This is the appended-corrections workload from@@ -60,6 +127,17 @@ callers now share it (`entityAnchoredPages`).**Decision.** The key becomes default-on only if gates 1 and 2 pass here and gate 3 passes in the harnesslane. Until then it stays off. The cap for gates 1 and 2 is $10.+## Reproduce++```bash+bun evals/entity-anchoring/query-gate.ts --plan --seeds 42,7,1234 --embeddings voyage:voyage-4+bun evals/entity-anchoring/query-gate.ts --run --yes --max-usd 4 --seeds 42,7,1234 --entities 6 \+ --reader-model anthropic:claude-sonnet-5-5 --embeddings voyage:voyage-4 --json+bun evals/entity-anchoring/regression.ts --json+```+## Changelog+- 2026-10-05: gates 1 and 2 pass on 2fa44f149. The key stays off pending gate 3.+- 2026-10-05: gates preregistered before any gated run.diff --git a/docs/eval/decisions/entity-anchoring-query/decision.json b/docs/eval/decisions/entity-anchoring-query/decision.jsonnew file mode 100644index 0000000000..3bdc98f025--- /dev/null+++ b/docs/eval/decisions/entity-anchoring-query/decision.json@@ -0,0 +1,40 @@+{+ "schema_version": 1,+ "decision_id": "entity-anchoring-query",+ "plan": "MEMORY_PROOF_WAVE fix lane (from C4 run 3)",+ "title": "Entity-anchored retrieval for entity-scoped current-state query/search",+ "verdict_type": "quality",+ "stage": "dev",+ "candidate": {+ "gbrain": "garrytan/gbrain@2fa44f149",+ "config": {+ "search.entity_anchoring": "true"+ }+ },+ "baselines": [+ {+ "gbrain": "garrytan/gbrain@2fa44f149",+ "config": {+ "search.entity_anchoring": "false"+ },+ "note": "same brain, same query op call, key off"+ }+ ],+ "preregistration": "README.md in garrytan/gbrain@9a8cfb9f7, before any gated run",+ "models": {+ "reader": "anthropic:claude-sonnet-5-5",+ "embedding": "voyage:voyage-4 (1024d)",+ "selection": "B-suite fixed reader; gbrain default embedding"+ },+ "gates": {+ "1": "seeded appended-corrections workload, seeds 42/7/1234, query op expansion off, reader at 200 tokens (sensitivity: 16 rows); pass if in every seed key-on accuracy is higher or freshness lag lower, and accuracy lower in no seed",+ "2": "NamedThingBench, relational retrieval-quality, LongMemEval nightly through the query op key on vs off (keyword-only); pass if no question top-10 recall is lower with the key on",+ "3": "harness lane: LongMemEval knowledge-update, PersonaMem, BEAM dev slices, then validation (not run here)"+ },+ "decision_rule": "default-on only if gates 1 and 2 pass here and gate 3 passes in the harness lane; off until then",+ "budget": {+ "max_usd": 10,+ "metered_spend_usd": 1.5243+ },+ "reproduce": "bun evals/entity-anchoring/query-gate.ts --run --yes --max-usd 4 --seeds 42,7,1234 --entities 6 --reader-model anthropic:claude-sonnet-5-5 --embeddings voyage:voyage-4 --json"+}diff --git a/docs/eval/decisions/entity-anchoring-query/verdict.json b/docs/eval/decisions/entity-anchoring-query/verdict.jsonnew file mode 100644index 0000000000..f7676cc158--- /dev/null+++ b/docs/eval/decisions/entity-anchoring-query/verdict.json@@ -0,0 +1,305 @@+{+ "decision_id": "entity-anchoring-query",+ "stage": "dev",+ "decided_at": "2026-10-05T22:00:00Z",+ "measured_build": "garrytan/gbrain@2fa44f149",+ "gate_1": {+ "status": "pass",+ "metered_spend_usd": 1.5243,+ "seeds": [+ {+ "seed": 42,+ "on_accuracy": 1,+ "off_accuracy": 0.875,+ "on_lag": 0,+ "off_lag": 0.15,+ "on_stale": 0,+ "off_stale": 0.125,+ "wins": true,+ "accuracy_lower": false+ },+ {+ "seed": 7,+ "on_accuracy": 1,+ "off_accuracy": 0.9027777777777778,+ "on_lag": 0,+ "off_lag": 0.11666666666666667,+ "on_stale": 0,+ "off_stale": 0.09722222222222222,+ "wins": true,+ "accuracy_lower": false+ },+ {+ "seed": 1234,+ "on_accuracy": 1,+ "off_accuracy": 0.875,+ "on_lag": 0,+ "off_lag": 0.15,+ "on_stale": 0,+ "off_stale": 0.125,+ "wins": true,+ "accuracy_lower": false+ }+ ],+ "triggered": {+ "42": "72/72",+ "7": "72/72",+ "1234": "72/72"+ },+ "aggregate": [+ {+ "reads_per_write": 1,+ "arm": "anchoring_on",+ "seeds": 3,+ "accuracy": {+ "mean": 1,+ "min": 1,+ "max": 1+ },+ "stale_wrong_rate": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "mean_lag_batches": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "correct_at_change": {+ "mean": 1,+ "min": 1,+ "max": 1+ },+ "lifecycle_usd": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "usd_per_correct": {+ "mean": 0.001270787037037037,+ "min": 0.0012603888888888888,+ "max": 0.0012843055555555555+ }+ },+ {+ "reads_per_write": 1,+ "arm": "anchoring_off",+ "seeds": 3,+ "accuracy": {+ "mean": 0.8842592592592592,+ "min": 0.875,+ "max": 0.9027777777777778+ },+ "stale_wrong_rate": {+ "mean": 0.11574074074074074,+ "min": 0.09722222222222222,+ "max": 0.125+ },+ "mean_lag_batches": {+ "mean": 0.13888888888888887,+ "min": 0.11666666666666667,+ "max": 0.15+ },+ "correct_at_change": {+ "mean": 0.8611111111111112,+ "min": 0.85,+ "max": 0.8833333333333333+ },+ "lifecycle_usd": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "usd_per_correct": {+ "mean": 0.001333720309320309,+ "min": 0.001280430769230769,+ "max": 0.0013843174603174605+ }+ },+ {+ "reads_per_write": 1,+ "arm": "anchoring_on_full",+ "seeds": 3,+ "accuracy": {+ "mean": 1,+ "min": 1,+ "max": 1+ },+ "stale_wrong_rate": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "mean_lag_batches": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "correct_at_change": {+ "mean": 1,+ "min": 1,+ "max": 1+ },+ "lifecycle_usd": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "usd_per_correct": {+ "mean": 0.0022993333333333334,+ "min": 0.002282222222222222,+ "max": 0.002310111111111111+ }+ },+ {+ "reads_per_write": 1,+ "arm": "anchoring_off_full",+ "seeds": 3,+ "accuracy": {+ "mean": 0.9814814814814815,+ "min": 0.9722222222222222,+ "max": 0.9861111111111112+ },+ "stale_wrong_rate": {+ "mean": 0.009259259259259259,+ "min": 0,+ "max": 0.027777777777777776+ },+ "mean_lag_batches": {+ "mean": 0.022222222222222223,+ "min": 0.016666666666666666,+ "max": 0.03333333333333333+ },+ "correct_at_change": {+ "mean": 0.9777777777777777,+ "min": 0.9666666666666667,+ "max": 0.9833333333333333+ },+ "lifecycle_usd": {+ "mean": 0,+ "min": 0,+ "max": 0+ },+ "usd_per_correct": {+ "mean": 0.0023514169014084503,+ "min": 0.0023353802816901397,+ "max": 0.0023617999999999994+ }+ }+ ]+ },+ "gate_2": {+ "status": "pass",+ "reports": [+ {+ "corpus": "namedthing",+ "questions": 12,+ "triggered": 0,+ "recall10_lower": [],+ "recall10_higher": 0,+ "mean_recall10": {+ "on": 0.9166666666666667,+ "off": 0.9166666666666667+ },+ "mean_rr": {+ "on": 1,+ "off": 1+ },+ "negative_clean_lost": []+ },+ {+ "corpus": "namedthing+now",+ "questions": 12,+ "triggered": 0,+ "recall10_lower": [],+ "recall10_higher": 0,+ "mean_recall10": {+ "on": 0.8333333333333334,+ "off": 0.8333333333333334+ },+ "mean_rr": {+ "on": 0.9166666666666667,+ "off": 0.9166666666666667+ },+ "negative_clean_lost": []+ },+ {+ "corpus": "relational",+ "questions": 38,+ "triggered": 0,+ "recall10_lower": [],+ "recall10_higher": 0,+ "mean_recall10": {+ "on": 0.9999999999999992,+ "off": 0.9999999999999992+ },+ "mean_rr": {+ "on": 0.28890977443609034,+ "off": 0.28890977443609034+ },+ "negative_clean_lost": []+ },+ {+ "corpus": "relational+now",+ "questions": 38,+ "triggered": 24,+ "recall10_lower": [],+ "recall10_higher": 8,+ "mean_recall10": {+ "on": 0.13596491228070173,+ "off": 0+ },+ "mean_rr": {+ "on": 0.09649122807017543,+ "off": 0+ },+ "negative_clean_lost": []+ },+ {+ "corpus": "longmemeval-nightly",+ "questions": 10,+ "triggered": 0,+ "recall10_lower": [],+ "recall10_higher": 0,+ "mean_recall10": {+ "on": 0.9999999999999999,+ "off": 0.9999999999999999+ },+ "mean_rr": {+ "on": 0.9999999999999999,+ "off": 0.9999999999999999+ },+ "negative_clean_lost": []+ },+ {+ "corpus": "longmemeval-nightly+now",+ "questions": 10,+ "triggered": 0,+ "recall10_lower": [],+ "recall10_higher": 0,+ "mean_recall10": {+ "on": 0.9999999999999999,+ "off": 0.9999999999999999+ },+ "mean_rr": {+ "on": 0.9999999999999999,+ "off": 0.9999999999999999+ },+ "negative_clean_lost": []+ }+ ],+ "off_path": "key-off responses equal the pre-change build modulo clock-dependent recency scores and random revision UUIDs (120 responses)"+ },+ "gate_3": {+ "status": "pending",+ "owner": "harness lane",+ "requires": "retrieve through the query op (or gbrain query) with search.entity_anchoring=true"+ },+ "overall": "off_pending_gate_3",+ "caveats": [+ "The seeded workload was built around the failure mode: every question is entity-scoped current-state (216/216 triggered).",+ "Gate 2 never triggered on as-written questions; the cue-added relational diagnostic triggered 24/38 with 8 recall gains and 0 losses.",+ "Voyage embedding and rerank calls are not metered."+ ]+}