You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Serving: retrieval lane measured on real moments #14
What: Word-matchable facts from the Libraries are served by local retrieval, measured alone and combined with the other lanes on real past moments. Why: Many stored facts match the moment's words directly and need no GPU, but raw-moment search found the needed knowledge in the top five for only 29% of moments, so its shape must be measured, not assumed. So what: An agent builds the retrieval lane and its measurement; the lane stays only if it adds served needs the exact keys do not cover.
A local retrieval lane serves facts from the Libraries at the serving moments within the per-turn budget, and a measurement on the real past moments compares distilled facts indexed by situation with raw search, alone and combined with exact keys.
Elon record
Requirements and who asked: retrieval kept and measured alone (roasts and gap reviews); the measurement of distilled situation-indexed facts against raw search (this Spec's earlier acceptance criteria, user).
Deleted: retrieval as a prefilter for the router; the lane itself if exact keys cover the factual needs without growing the router.
Bottleneck: the serving server and log.
Checked myself: step 0 retrieval figures (top 5 for 29%, top 20 for 48% of moments); plain hybrid search found the right page top 5 for 21 of 22 fact-against-fact questions.
Acceptance criteria
The measurement reports needs found per lane alone and combined, on the real past moments, with false serves on random no-need turns.
If kept, the lane serves live within the budget and its moments are logged like the other lanes.
User decision (standing rule, restated 2026-10-12): the retrieval lane must use the user's existing local BGE-M3 embedder, served by oMLX on the user's main machine, not a separately installed embedder. Build and measure the lane against that endpoint; if it is unreachable, report that as a blocker instead of installing another embedding model.
Capture depends on this (2026-10-14, see #8): capture will stop writing Cue lines for knowledge whose moment names its subject, and rely on this retrieval lane instead. So #14's measurement now decides how capture splits entries between retrieval and intent (Cue). Capture-written entries become part of the measured corpus.
Plan (user, 2026-10-14): measure first, then design. Capture's extract prompt must explain exactly how search works, so search is designed before that prompt is finalised, and the design rests on experiments rather than guesses. Order:
Experiments (Sol dispatcher; Sol and Grok agents only). Corpus: the capture test items from 2026-10-14 (about 100 items, local only), the Great Library and the AgentsMD rule lines. Gold pairs: each captured item's "Needed at" moment and its knowledge. Variants: what is indexed (entry body, body plus subject words, body plus the situation line); keywords (BM25), vectors (small embedding models) or hybrid; which words of the moment are used (user message, tool call text, recent window); and the cut-off and budget. Metrics: recall@1/5 on gold moments, and false serves on random no-need moments.
Design (Opus), from the measured winner: indexed text, query, ranking, budget and how results are shown.
Extract prompt: rewrite the search paragraph of version C, adding any field search needs.
Update-step test on the real items, including key fixes.
Live measurement on real moments, as this Issue's acceptance asks.
Experiment round 1 (2026-10-15, aggregate numbers only; data stays local):
Corpus: 38 subjects deduplicated from 283 capture variants, plus 10 distractors; 49 gold moments carrying 64 needs.
Best ranking: hybrid BGE-M3 + BM25 with reciprocal rank fusion (k=10), indexing Knowledge + Holds for, querying with the last 1,000 characters: 51/64 needs at top 5. BM25 alone reached 50/64, so the difference is within noise. Longer query windows hurt: at 10k characters, BM25 found 32/64 and vectors 7/64. A user message alone found about 30/64.
Speed: BM25 0.8 ms; short-query vectors about 85 ms; full 10k windows about 1 s just to encode.
False serves: unmeasured. The negative moments were contaminated, and none of 17 human messages was conclusively no-need. Every cut-off that limits noise was calibrated on proxies and loses most of the recall.
Capture implication: write self-contained facts that name the entities and the literal paths, commands and errors. Repeated subject words did not help.
Cue's share: generic drafting or approval moments, unnamed procedural duties, intent without naming, and paraphrases in other languages.
Next: the search design waits for round 2, which builds adjudicated no-need moments and calibrates abstention. The ranking works; the open problem is when to stay silent.
Experiment round 2 (2026-10-15, aggregate numbers only): no-need moments adjudicated by independent judges (Sol and Grok, 273 moments × 48 documents; a third judge settled 83 disputes; agreement before adjudication was 98.6% per document, κ 0.68). Cut-offs were chosen on a calibration half and scored once on a sealed held-out half. Every winning policy was BM25 over Knowledge, using the last 1,000 characters, a score floor, a top-two margin and a 1,000-byte budget.
False-serve cap (calibration)
Held-out needs found /32
Held-out false serves /37
0%
12 (38%)
0
5%
14 (44%)
3 (8%)
10%
19 (59%)
3 (8%)
20%
24 (75%)
5 (14%)
Hybrid with a strict cut-off chose total silence. Limits: all clean negatives come from Chromeria threads, while every sampled round-1 transcript moment had an applicable document; each half has a single family of negative-bearing sources, so the false-serve bounds are weak (95% upper bound 9.5% at the strict cut-off).
Decision for the user: how many wrong serves are acceptable in exchange for found needs; the table is the trade-off. Next experiment: clean negatives from independent transcripts to firm up the false-serve rate.
Experiment round 3 (2026-10-15, aggregate numbers only): 488 clean no-need moments across 12 independent source families (55 from Chromeria threads, 433 from rendered transcripts). Sol and Grok labelled all 1,090 moments against all 48 documents, and a third judge adjudicated. The four sealed round-2 policies were replayed without refitting:
Calibration cap
Needs found (round 2, /32)
False serves on new negatives
Family bootstrap 95%
0%
12
10/488 (2.0%)
0.3–3.5%
5%
14
36/488 (7.4%)
3.5–11.2%
10%
19
36/488 (7.4%)
2.3–11.8%
20%
24
57/488 (11.7%)
4.1–18.2%
Reading: the trade-off holds. The strict policy's zero false serves did not replicate (2%, not 0%). The 10% policy finds more needs than the 5% one at the same false-serve rate. Family independence is unproven, so these are descriptive numbers, not a deployment safety guarantee. Numeric cross-check and methodology review passed.
Decision for the user: the trade-off point. A useful middle option is the 10% policy: about 19 of 32 needs found, with roughly 7% false serves.
User decisions for the stored-item design (2026-10-15):
Everything that is not in an AGENTS.md or injected by a hook must have a way to be served. This includes the runbook (machine facts and tool notes such as rbw), not only the Libraries and AgentsMD procedures.
Fix the store, don't design around it: the current items and capture output are a proof of concept; if their shape is wrong they get rewritten.
Order: inventory every served format, collect everything learned about writing for retrieval, then design one item format (keys for code, a search card for retrieval, situation text for Cue, one body: fact or pointer to a procedure/skill).
Skills become procedures served the same way (exact key, retrieval or Cue), so a large skill set never sits in context.
What: Records the ContextMD architecture split, the one stored-item format (search card) and the test plan scope agreed with the user on 2026-10-15. Why: The design kept getting lost because every layer depends on an item format nobody had decided; experiments also showed the current store mixes incompatible shapes. So what: Next, the agent drafts a test plan (one test per open choice plus a fast review format for labels) and brings it to the user before anything runs.
Architecture (agreed)
Always served, no matching: global AGENTS.md, PREFERENCES.md hook, Promachos persona (Promachos mode), Great Library pointer (first message and after compaction). Never searched.
Capture: Agent Observer (one ledger per machine; text stays in each machine's native logs) → preparation → extract (runs locally on each machine) → one capture queue across all machines with one writer, processed in session-date order (change to Capture: update and write all six owners with receipts and reversible commits #77, which assumed per-machine queues).
Store: update step decides add / update / refresh / remove (skip only for errors such as an unknown owner) and writes the final body and its card; six owners; cards go into one index.
Matched serving per moment: exact key (code), search (BM25 + vectors over cards), Cue (trained model) → decide, budget, serve once per epoch → inject, log, receipt.
Feedback: serve logs (served, missed, ignored; refresh receipts) flow back into capture.
Rule: everything not in an AGENTS.md or injected by a hook must be servable (Libraries, AgentsMD procedures, runbook, future skills).
One item format: the search card (agreed shape, details tested)
Every servable unit has one card file in its owner's own repo (flat folder). Header: optional exact keys (command/path/error, must-know-before), optional Cue fields, optional target. Text: 1-4 self-contained sentences, first sentence names the subject in session words, exact commands/paths kept, says when it applies and its limits.
Short item: the card is the whole body, served as is. Long item (procedure, skill, runbook section): card + target; served = card + "Read in full before ".
One card per servable thing: a single-purpose procedure gets one card; a document covering several situations (e.g. a runbook machine page) gets one card per section.
PREFERENCES and persona get no cards (always loaded). Card stores: Great Library, Satrapy Libraries, AgentsMD, runbook.
Search and Cue both read one uniform format instead of six store shapes. Changing Cue text is acceptable; Cue is retrained.
Search findings that shape the design
Tuning review (Sol max, Grok medium, bare): query construction is the biggest knob; current data (64 needs) only supports differences of 8+ needs; select on needs found at a fixed false-serve limit and byte budget, not recall@5; confirm a winner once on unseen later sessions; pad the index toward about 1,000 real entries.
Growth research (Sol + 3 researchers): raw BM25 floors drift as the store grows (old no-need moments 10/488 → 46-69/488 emissions at 1,000 entries; padding applicability unjudged). Grok's 0-1 normalization failed (1/32 needs). The top1-top2 margin rule is wrong in principle (two good entries cancel). Daily re-fitting rejected by the user. Best-supported hypothesis: frozen BM25 statistics plus a small logistic "applies now" gate over BM25/vector/overlap signals, trained once on labelled pairs, served above a cost-derived line. Not yet measured.
Writing-for-retrieval knowledge (121 lessons, local report): one claim per item, subject named first in session words, exact tokens kept, self-contained text, keys/search/Cue kept separate, short discovery text for long bodies, no mechanical field appending, never test a trigger on the moment it was written from.
Vectors stay in scope (standing BGE-M3 decision); they were tested in round 1 (hybrid 51/64 vs BM25 50/64 at top 5) and lost only on the earlier serve gate.
Tests required (user: every choice is decided by a test)
Card length (600-character cap vs alternatives).
Optional likely-question line on a card.
Vector search over cards only vs cards + target passages vs targets only (passages map back to their card); same three for BM25.
Procedures served by search vs Cue (subject-named vs abstract moments).
Query window and content (sizes below and between 1,000 and 3,000 characters; tool text none/clipped/full; recency; no line labels).
The serve gate (frozen statistics, logistic gate vs raw floor).
Labels
Labels are the bottleneck for every test. The 60-card judge review is paused: even the three-section story format took the user about a minute per card. A faster format is part of the test plan.
Elon record
Requirements and who asked: User: architecture split, one item format, owner-repo cards, one index, one capture queue, everything servable, tests for every choice.
Deleted: Six store-specific search formats, per-store search, daily gate re-fitting, Grok's normalized floor, the margin rule, cards for always-loaded files.
Bottleneck: Labelled moment-item pairs on a realistic store.
Reference for the situation-indexed arm: CocoIndex's entire_session_search example (cocoindex-io/cocoindex) indexes each item as several separately embedded views (prompt, transcript chunks, summary) plus a metadata table, and retrieves by nearest view. For this lane, the matching shape is to embed each entry's situation text (applies, or the moment it serves) as its own row, apart from the body, and compare that against raw-body search in the measurement.
Their incremental engine (re-embedding only changed text, keyed by a hash of input and code) is not needed at our store size; a full rebuild takes seconds. Borrow the indexing shape, not the dependency.
Activity
lukemaj commentedon Oct 12, 2026
User decision (standing rule, restated 2026-10-12): the retrieval lane must use the user's existing local BGE-M3 embedder, served by oMLX on the user's main machine, not a separately installed embedder. Build and measure the lane against that endpoint; if it is unreachable, report that as a blocker instead of installing another embedding model.
lukemaj commentedon Oct 14, 2026
Capture depends on this (2026-10-14, see #8): capture will stop writing Cue lines for knowledge whose moment names its subject, and rely on this retrieval lane instead. So #14's measurement now decides how capture splits entries between retrieval and intent (Cue). Capture-written entries become part of the measured corpus.
lukemaj commentedon Oct 14, 2026
Plan (user, 2026-10-14): measure first, then design. Capture's extract prompt must explain exactly how search works, so search is designed before that prompt is finalised, and the design rests on experiments rather than guesses. Order:
lukemaj commentedon Oct 14, 2026
Experiment round 1 (2026-10-15, aggregate numbers only; data stays local):
Next: the search design waits for round 2, which builds adjudicated no-need moments and calibrates abstention. The ranking works; the open problem is when to stay silent.
lukemaj commentedon Oct 15, 2026
Experiment round 2 (2026-10-15, aggregate numbers only): no-need moments adjudicated by independent judges (Sol and Grok, 273 moments × 48 documents; a third judge settled 83 disputes; agreement before adjudication was 98.6% per document, κ 0.68). Cut-offs were chosen on a calibration half and scored once on a sealed held-out half. Every winning policy was BM25 over Knowledge, using the last 1,000 characters, a score floor, a top-two margin and a 1,000-byte budget.
Hybrid with a strict cut-off chose total silence. Limits: all clean negatives come from Chromeria threads, while every sampled round-1 transcript moment had an applicable document; each half has a single family of negative-bearing sources, so the false-serve bounds are weak (95% upper bound 9.5% at the strict cut-off).
Decision for the user: how many wrong serves are acceptable in exchange for found needs; the table is the trade-off. Next experiment: clean negatives from independent transcripts to firm up the false-serve rate.
lukemaj commentedon Oct 15, 2026
Experiment round 3 (2026-10-15, aggregate numbers only): 488 clean no-need moments across 12 independent source families (55 from Chromeria threads, 433 from rendered transcripts). Sol and Grok labelled all 1,090 moments against all 48 documents, and a third judge adjudicated. The four sealed round-2 policies were replayed without refitting:
Reading: the trade-off holds. The strict policy's zero false serves did not replicate (2%, not 0%). The 10% policy finds more needs than the 5% one at the same false-serve rate. Family independence is unproven, so these are descriptive numbers, not a deployment safety guarantee. Numeric cross-check and methodology review passed.
Decision for the user: the trade-off point. A useful middle option is the 10% policy: about 19 of 32 needs found, with roughly 7% false serves.
lukemaj commentedon Oct 15, 2026
User decisions for the stored-item design (2026-10-15):
rbw), not only the Libraries and AgentsMD procedures.lukemaj commentedon Oct 15, 2026
What: Records the ContextMD architecture split, the one stored-item format (search card) and the test plan scope agreed with the user on 2026-10-15.
Why: The design kept getting lost because every layer depends on an item format nobody had decided; experiments also showed the current store mixes incompatible shapes.
So what: Next, the agent drafts a test plan (one test per open choice plus a fast review format for labels) and brings it to the user before anything runs.
Architecture (agreed)
Rule: everything not in an AGENTS.md or injected by a hook must be servable (Libraries, AgentsMD procedures, runbook, future skills).
One item format: the search card (agreed shape, details tested)
command/path/error,must-know-before), optional Cue fields, optionaltarget. Text: 1-4 self-contained sentences, first sentence names the subject in session words, exact commands/paths kept, says when it applies and its limits.target; served = card + "Read in full before ".Search findings that shape the design
Tests required (user: every choice is decided by a test)
Labels
Labels are the bottleneck for every test. The 60-card judge review is paused: even the three-section story format took the user about a minute per card. A faster format is part of the test plan.
Elon record
lukemaj commentedon Oct 18, 2026
Reference for the situation-indexed arm: CocoIndex's
entire_session_searchexample (cocoindex-io/cocoindex) indexes each item as several separately embedded views (prompt, transcript chunks, summary) plus a metadata table, and retrieves by nearest view. For this lane, the matching shape is to embed each entry's situation text (applies, or the moment it serves) as its own row, apart from the body, and compare that against raw-body search in the measurement.Their incremental engine (re-embedding only changed text, keyed by a hash of input and code) is not needed at our store size; a full rebuild takes seconds. Borrow the indexing shape, not the dependency.