Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

chore(todos): close the v240 ANALYZE entry with item 6's receipt; file the identity-sibling read behind entity names latency

garrytan0cc82544c361
diff --git a/TODOS.md b/TODOS.md
index 8ab87a447e..e468fa0f52 100644
--- a/TODOS.md
+++ b/TODOS.md
@@ -18,6 +18,7 @@ Context: gbrain-evals `docs/plans/2026-10-15-lhf-wave-2/PLAN.md` ("NOT in scope"
- [ ] **P2 — Size budget for the `full` tool surface.** **What:** every registration pins `full` (about 27.5k tokens per turn against 5.1k for `starter`), and the 25k-character ceiling in `test/mcp-schema-budget.test.ts` covers only `starter`. Narrowing the listing is out (hidden-tool tasks fail on `starter`, 0/20 vs 17/20), so the lever is description size on `full`. **Fix:** extend the per-tool budget to full-only tools, largest first, toward about 80k characters, moving long guidance to `docs/mcp/TOOL_REFERENCE.md`. **Gate:** the keyless ceiling test plus a Cat 40 dev smoke on `full` including family H (about $40). **Source:** `audit/cost.md` C5; `eng-native.r1.md` (deferred to its own DX plan). **Effort:** M. **Priority:** P2.
- [ ] **P2 — Chat-key-only `tokenmax` without a reranker.** **What:** with only a chat key the reranker is skipped silently and fused hybrid lost to bare vectors on concept questions (Cat 13: 99 vs 118 of 181 first-place, an old pin). **Fix:** re-measure on the current tree first, then pick the default for reranker-less installs. **Source:** `audit/evals-findings.md` §9. **Effort:** M. **Priority:** P2.
- [ ] **P3 — Retrieval findings carried from gbrain-evals, each needing a fresh measurement before a fix.** Family E (long meeting transcripts ranked below short mail: renewal briefs 4-5/30 hybrid vs 14/30 keyword-only, stale numbers); mention links only on the next stale sweep, not on write; H1 aggregation at the floor on sealed and S worlds (4-11 of 60-120 cells, oracle about 100%); proactive brief gaps (task-start requests without a lexicon word fired 0/8; a cold first `turn_context` of 169-339 ms against the 300 ms cutoff dropped the brief in 3/9 smoke cells); scoped HNSW recall (10% source scope on 1M chunks: recall@50 0.777). **Source:** `audit/evals-findings.md` §11-15. **Effort:** S to L each. **Priority:** P3.
+- [ ] **P2 — `entity names` batch time goes to the identity-sibling read.** **What:** on a synthetic 55k-page PGLite brain a 50-name batch takes about 2.4 s, and most of the statement time is `readIdentitySiblings` (`src/core/mentions/siblings.ts`), whose `lower(title) LIKE '%: <subject>'` arm cannot use an index and scans every page of the linkable types once per name, then the per-name `page_aliases` reads. ANALYZE does not change it (LHF wave 2 item 6 receipt). **Fix:** an index-served form of the suffix match (for example a trigram index on `lower(title)` or a stored title-subject column), checked with EXPLAIN at 55k pages. **Effort:** S. **Priority:** P2.
- [ ] **P3 — #6771 (@lubosxyz): repair code metadata without re-embedding.** **What:** a contributor PR in a different subsystem (about $1 avoided per 15M-token repository on repair); out of this wave's scope, to revise in its own fix wave. **Source:** `audit/cost.md` C9. **Effort:** S. **Priority:** P3.
## Cat 40 Hard fix wave follow-ups (filed 2026-10-07, GBRA-39)
@@ -41,7 +42,7 @@ Context: gbrain-evals `docs/plans/2026-10-07-cat40-hard-fix/PLAN.md`; this wave
- [ ] **P3 — Show the keyword count and `next` in CLI `gbrain search` output.** **Effort:** S. **Priority:** P3.
- [ ] **P2 — Measure the keyword count at scale.** **What:** on PGLite the count runs serially with the search (one connection). **Gate:** `keyword_count_unavailable` under 1% of searches and added p50 under 100 ms on a 55k calibration slot; otherwise skip the count on large PGLite brains. **Effort:** S. **Priority:** P2.
- [ ] **P2 — Quarantined referrers still appear in card `edges[]` (`context_pack` and `entity`).** **What:** the inbound edge read in `src/core/verbs/entity-card.ts` applies the private-page and private-origin filters but not the quarantine filter or the caller's trust floor, so an untrusted caller's `context_pack` card (and full `entity` card) lists a quarantined referrer's slug, link type and `links.context` sentence in `edges[]`, and a below-floor referrer on `context_pack`, while `records[]`, `referenced_by`, `newer_mentions` and F3 `page_status` leave them out (seen on the entity-records test world: `contracts/acme-quarantined` in `edges[]`, absent from `records`). Left as is in Cat 40 next wave Part 1. **Fix:** apply `quarantineFilterFragment` (unless an authorized `include_quarantined` read) and the pack's eligibility to the inbound edge query and `backlink_count`, with a hidden-referrer test on both engines. **Effort:** S. **Priority:** P2.
-- [ ] **P2 — Analyze `pages` after the v240 name-lookup indexes on an upgraded PGLite brain.** **What:** v240 builds `idx_pages_source_title_lower` and `idx_pages_slug_trgm` without refreshing planner statistics, and PGLite runs no autovacuum. On the 55,838-page World M PGLite brain with the indexes freshly built, a 50-name `entity names` batch took p50 5,378 ms on master `09d21554d`, and 1,200 ms after `ANALYZE pages` (1 name: 89 → 42 ms; 10 names: 1,128 → 276 ms). The pre-index path took 17,728 ms. **Fix:** `ANALYZE pages` after the v240 handler on PGLite, or a planner-stats refresh like `plannerStatsForLinkDrain`, with a plan test on an upgraded brain. **Effort:** S. **Priority:** P2.
+- [x] **P2 — Analyze `pages` after the v240 name-lookup indexes on an upgraded PGLite brain.** **Done (LHF wave 2 item 6):** `buildIndexOnline` analyzes the table after every index build on both engines, and an already-present expression index without statistics gets them at the next PGLite maintenance pass (doctor names it; `gbrain repair planner-stats --apply` on Postgres); `test/planner-stats-expression-index.test.ts` covers the upgraded brain. The latency gain did not reproduce on a synthetic 55k-page PGLite brain: the title arm's estimate went from 275 rows to 1 with the same BitmapOr plan, and the 50-name batch stayed at 2,469 vs 2,396 ms p50 (2 interleaved rounds of 3), because most of its time goes to the sibling read below. Not re-measured on the World M slot. **What (as filed):** v240 builds `idx_pages_source_title_lower` and `idx_pages_slug_trgm` without refreshing planner statistics, and PGLite runs no autovacuum. On the 55,838-page World M PGLite brain with the indexes freshly built, a 50-name `entity names` batch took p50 5,378 ms on master `09d21554d`, and 1,200 ms after `ANALYZE pages` (1 name: 89 → 42 ms; 10 names: 1,128 → 276 ms). The pre-index path took 17,728 ms. **Fix:** `ANALYZE pages` after the v240 handler on PGLite, or a planner-stats refresh like `plannerStatsForLinkDrain`, with a plan test on an upgraded brain. **Effort:** S. **Priority:** P2.
## CI runtime follow-ups (filed 2026-10-09, GBRA-64)