Local-first π§ memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly π΄ dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.
Recon: the four-failure-mode conformance suite (t_72d6eb23)
Read-only reconnaissance against feat/nothing-runs-unwatched @ 6caf0b83
(v1.47.0). Every anchor below was read; paths are repo-relative.
Headline: none of know_to_ask_failure_rate, false_fire_rate,
source_isolation_violations or avg_injected_tokens appears anywhere in the
tree (grep over *.ts, *.md, *.json returns nothing). Two of the four are
measurable today against seams that already exist. One is measurable only
against a surface that ships default-OFF. One is, as named, unmeasurable
without first deciding which of four meanings of "source" it refers to.
1. The bench substrate: two parallel harnesses, not one
They share no fixture format, no scorer, no report type and no emission path. A new suite must pick a host or become a third.
A. runMemoryBench β the staged phase harness
- Entry
src/core/bench/phases.ts:65. Phasesingest β index β retrieve β evaluate β report(src/core/bench/types.ts:14), each checkpointed to<runsDir>/<run-id>/checkpoint.json(src/core/bench/run-store.ts:84). Resume validates the fixture hash before skipping work and refuses a changed fixture (src/core/bench/run-store.ts:72-79). - A fixture is a repo-local JSON document:
notes[](vault-relative path + body),continuity[](session_turnrecords only),questions[]. Parsed and validated fail-fast atsrc/core/bench/fixture.ts:27; note paths are checked against traversal and absolutes at:112; content-hashed at:81.materializeBenchVault(:86) writes the notes and appends the continuity records into a disposable vault inside the run directory β the operator's configured vault is never resolved. - Six categories (
src/core/bench/types.ts:17-25); four are retrieval (:28-33), plussession_handoffandbudget. Retrieval drivessearch(), handoff drivesloadNormalizedContinuityRecords(), budget drivespackContext()β all three inretrieveQuestion(src/core/bench/phases.ts:124-165). - Scoring is deterministic containment, in
evaluateQuestion(src/core/bench/phases.ts:175): expected paths present in the ranked list and nonot_expected_abovepath ranked higher (:186-207); turn count plus substring for handoff (:210-229); expected pack-item ids present for budget (:232-241). There is no hit@k, no MRR, no rank-sensitive number at all. - Report
BenchReport(src/core/bench/types.ts:88) keeps three families separate on purpose:quality,latency_ms,context_cost(src/core/bench/phases.ts:274-292). - Emission:
report.jsonin the run dir (src/core/bench/phases.ts:117) and stdout viao2b brain bench memory(src/cli/brain/verbs/bench.ts:69-86, exit 1 on any failing question). NoappendMetriccall. No MCP tool. Run dirs are gitignored (.gitignore:29). - LoCoMo is an adapter, not a second harness:
loadLocomoFixture(src/core/bench/locomo.ts:189) converts a LoCoMo dataset into aBenchFixtureand hands it to the unchanged runner (src/cli/brain/verbs/bench.ts:53).
B. runRecallBenchmark β the hit@k / MRR harness
- Entry
src/core/search/benchmark.ts:189. Dataset is{queries:[{id, query, expected[], k?, answer?}]}(:125). - Scores hit@k, MRR, answer-containment@k, source-utilization@k, citation
depth, source warnings (
src/core/search/benchmark.ts:249-263) against a live vault throughsearch()β no disposable vault, no materializer. - Four consumers: the CI gate test
(
tests/core/search/recall-benchmark.test.ts);o2b brain benchmark run(src/cli/brain/verbs/benchmark.ts:24), which appends arecall_benchmarkmetric (:64-80); MCPbrain_benchmark(src/mcp/brain/recall-tools.ts:79, definition:967); and the rerank promotion gaterunRerankEvalGate(src/core/search/rerank-eval-gate.ts:66), which runs the benchmark twice and compares.
Baselines and CI gating
- No baseline is committed as a file anywhere. Both "baselines" are
constants inside test files:
tests/core/search/recall-benchmark.test.ts:45-51(MIN_HIT_AT_5 = 0.9,MIN_MRR = 0.85,MIN_ANSWER_CONTAINMENT_AT_5 = 0.99, with a re-measurement protocol in the header comment at:1-20), andtests/cli/brain-bench.test.ts:44-45(quality.total === 6 && quality.passed === 6). - CI (
.github/workflows/ci.yml) has no bench step. Its only relevant line isbun test(.github/workflows/ci.yml:78). Both harnesses therefore gate CI, but only as ordinary test files β there is no workflow invocation ofo2b brain bench memory, no artifact upload, no threshold file, no trend.
What this means for the shape of the work
runMemoryBench is the only harness with a disposable-vault materializer,
checkpointing, and a report that already separates metric families β all four
new metrics need a controlled vault, so it is the natural host. But its types
are closed unions keyed on BenchCategory. Adding a category touches
src/core/bench/types.ts (category list, question fields, result fields,
report fields), src/core/bench/fixture.ts:138 (parseQuestion) and :187
(validateQuestionShape), and src/core/bench/phases.ts in three places
(retrieveQuestion, evaluateQuestion, buildReport) β plus a schema bump
past o2b.bench.v1 (src/core/bench/types.ts:12) if any existing field
changes meaning.
2. Proactive injection: it exists, and its decision core is pure
The hook manifest is hooks/hooks.json (Claude Code auto-discovers it;
.claude-plugin/plugin.json declares no hooks). Registered injection surfaces:
| Surface | Event | Default | Decision core | Pure? |
|---|---|---|---|---|
active-inject |
SessionStart, PostCompact | ON | assembleActiveContext hooks/active-inject.ts:437 |
yes |
recall-inject |
UserPromptSubmit | OFF (src/core/config.ts:976) |
decideRecallInject src/core/brain/recall-inject.ts:155 |
yes, retriever injected |
nav-inject |
UserPromptSubmit | OFF (src/core/config.ts:992) |
decideNavInject src/core/brain/nav-inject.ts:33 |
yes |
gap-agenda |
SessionStart | OFF (src/core/config.ts:1034) |
renderGapAgenda src/core/brain/gaps/gap-loop.ts:368 |
yes |
pretool-orient |
PreToolUse | OFF (src/core/config.ts:1019) |
decideOrient src/core/brain/pretool-orient.ts:125 |
yes (denies, does not inject) |
active-inject emits hookSpecificOutput.additionalContext
(hooks/active-inject.ts:197-203): standing rules first, read outside the
fail-open boundary (:415), then runtime notices + Brain/active.md +
Brain/lessons.md inside it (:437, :463, :507). Which preferences are
live is decided by readActivePreferences(vault, agentScope)
(src/core/brain/active.ts:258) β renderActive (:138). Only
SessionStart and UserPromptSubmit may carry additionalContext
(hooks/lib/context-events.ts:23).
The decisive point for failure mode 1. active.md is injected wholesale,
bounded only by a character budget (budgetActiveBody,
src/core/brain/active-budget.ts:161). There is no per-turn relevance
selection on the always-on path β it fires every session with everything.
Scoring know_to_ask_failure_rate or false_fire_rate against active-inject
is degenerate by construction.
The surface that can be silent is recall-inject:
decideRecallInject(prompt, retriever, options) -> "inject" | "abstain" | "error"
src/core/brain/recall-inject.ts:155, declared I/O-free and
retriever-agnostic in its own docblock (:12-16). Outcomes are exactly
inject (:196), abstain{empty_prompt|no_matches|below_floor}
(:162, :187, :191) and error{timeout|retriever_failed} (:174,
:176). Bounds: RECALL_INJECT_CONFIDENCE_FLOOR = 0.35 (:43),
RECALL_INJECT_MAX_NOTES = 4 (:30), RECALL_INJECT_MAX_CHARS = 900
(:33). This is the seam that makes failure mode 1 measurable at all β
the retriever is a parameter, so a fixture retriever runs the shipped decision
logic offline.
A second, earlier decision exists: evaluateSurfacingGate(input)
(src/core/search/surfacing-gate.ts:70) β a pure string function of
(prompt, previousPrompt, explicit) behind MCP brain_recall_gate
(src/mcp/search-tools.ts:1130). It suppresses only empty prompts
(:74), verbatim repeats (:77-79), slash commands (:80), and single
shell commands against a hardcoded name set (:30-42, :82) β and
otherwise fails open (:85). Scored alone, it produces retrieve: true
for essentially every natural-language prompt.
Also proactive: the anticipatory cache. refreshAnticipatoryCache
(src/core/brain/anticipatory-cache.ts:298) and readAnticipatoryContext
(:371) are synchronous and pure, composing packContext and
searchSessionRecall (plain lowercase substring matching,
src/core/brain/session-recall.ts:194); it is warmed unprompted off
UserPromptSubmit/PostToolUse lifecycle events
(src/core/brain/session-lifecycle.ts:355-363).
The most aggressive proactive consumer is not a Claude hook β it is Hermes:
plugins/hermes/provider.py:481 calls brain_recall_gate (:489) and, when
it says retrieve, pulls brain_context_pack (:491) before every API call,
capped by _PREFETCH_MAX_TOKENS = 1024 (:105).
The only live-model dependency on any injection path is the embedding call
at src/core/search/semantic-phase.ts:162, reached through
defaultRecallRetriever (src/core/brain/recall-inject.ts:361). Because the
retriever is a parameter, an offline bench never touches it.
3. Token accounting: nothing in this repo counts tokens exactly
There is no BPE tokenizer and no tokenizer dependency. There are five estimators, and they disagree on the same input:
| Site | Formula | Unit |
|---|---|---|
src/core/brain/text/tokenizer.ts:34-38 |
ceil(utf8_bytes / 4) |
UTF-8 bytes |
src/core/search/embeddings/signature.ts:84-91 |
ceil(str.length / 4) |
UTF-16 code units |
src/core/search/chunker.ts:57 |
whitespace-run count | words |
src/core/bench/phases.ts:291 |
Math.ceil(avgChars / 4), inline |
code points |
src/core/brain/token-impact.ts:206 |
baseline - packed over caller-supplied ints |
whatever the caller meant |
estimateTokens (src/core/brain/text/tokenizer.ts:34) is the closest thing
to canonical, and documents itself as a non-BPE heuristic at :1-30. Its
callers are the whole of Brain-side token accounting:
src/core/brain/context-pack.ts:378, :509, :552;
src/core/brain/context-transforms.ts:65;
src/core/brain/token-footprint.ts:64, :130;
src/core/brain/generation-reports.ts:102; hooks/active-inject.ts:320,
:341. The bench's own context_cost.est_tokens
(src/core/bench/phases.ts:291) does not import it β it re-implements a
different formula inline.
brain_token_impact (handler src/mcp/brain/recall-tools.ts:417, core
src/core/brain/token-impact.ts:195) performs zero counting: it is a
ledger over integers the harness posts. Its method: "exact" | "fallback"
field (src/core/brain/token-impact.ts:61, defaulted to "fallback" at
src/mcp/brain/recall-tools.ts:435) is an unverified caller claim; no adapter
in this repo posts "exact". Default off
(token_impact_ledger_enabled, src/core/config.ts:940).
The only token-denominated enforcement is packContext's maxTokens
(admission test src/core/brain/context-pack.ts:510, final sum :627).
Everything else that actually enforces is characters or code points:
applyCharBudget (src/core/brain/recall-budget.ts:127), budgetActiveBody
(src/core/brain/active-budget.ts:161),
INJECT_BUDGET_CHARS_DEFAULT = 8000
(src/core/brain/policy/blocks/active.ts:58),
RECALL_INJECT_MAX_CHARS = 900, clipPayloadToBudget
(src/core/brain/continuity/store.ts:210, budget measured as
JSON.stringify(payload).length at :216), applySectionBudget
(src/core/brain/text/text-budget.ts:142).
What "per-harness" means here
| Harness | Injection code | Budget |
|---|---|---|
| Claude Code | hooks/hooks.json:27-33 β hooks/active-inject.ts:493, :514 |
chars (resolveInjectionLimits hooks/active-inject.ts:391-401) |
| Codex | .codex-plugin/plugin.json:6 β plugins/codex/hooks/active-inject.ts (byte-identical copy) |
same |
| OpenCode | plugins/opencode/open-second-brain.ts:193, injected at :265 |
none β pass-through |
| OpenClaw | src/openclaw/index.ts:48-60 (before_prompt_build) |
none; injects only an identity reminder |
| Hermes | plugins/hermes/provider.py:476, :480 |
tokens, hard-coded 1024 at :105 |
| MCP | src/mcp/brain/recall-tools.ts (brain_context_pack) |
caller-supplied, no server default |
| CLI | src/cli/brain/verbs/context-pack.ts:31-39 |
--max-tokens required, no default |
So a per-harness avg_injected_tokens is computable β but only by applying
estimateTokens to the string each adapter emits. No adapter reports a token
count, and four of seven do not enforce a token budget at all.
4. Source isolation: "source" is four unrelated concepts
Before the metric can be named, the noun has to be disambiguated:
- Ingested source β a document imported into the vault; record is a
Markdown summary page under
Brain/sources/withkind: brain-source. Typesrc/core/brain/ingest/sources-registry.ts:27; frontmatter built atsrc/core/brain/ingest/ingest.ts:154-167(source_path,source_hash,provenance). Notesource_hashis an identity hash of the path string (ingest.ts:142-148), not of content. - Source trace β every page derived from one source file.
searchBySourceFilesrc/core/brain/source-cleanup.ts:455, match kinds at:71. Behindbrain_search_by_source/brain_delete_by_source(src/mcp/brain/ingest-tools.ts:133,:158). - Signal
source_typeβ the closed enumlive | inline | session(src/core/brain/signal.ts:271-273), which is whatbrain_sourcesreports, grouped by(agent, source_type)(src/core/brain/portability/sources.ts:71). - Cross-vault origin β
local,profile/<name>,source/<alias>(src/core/brain/portability/origins.ts:42-73).
The isolation notion that actually exists is OWNER scope
One rule: isOwnerVisible(owner, scope)
(src/core/graph/agent-scope.ts:104) β no requested scope means no filtering
(:16-19); an ownerless page is shared; an unparseable owner: fails closed
as somebody else's (:52). Gated by config integrity.owner_scope_delivery
(off | warn | fail), default off
(src/core/brain/policy/blocks/integrity.ts:67). Consumers include
src/core/search/result-filters.ts:317,
src/core/brain/preferences-collect.ts:280,
src/core/brain/owner-scoped-facts.ts:42.
Agent identity is recorded but does not partition: resolveAgentName
(src/core/config.ts:369) stamps agent on signals/log lines
(src/core/brain/log.ts:57) and source_agent on entities
(src/core/brain/entities/types.ts:57, stamped
src/core/brain/entities/registry.ts:504), but nothing copies it into
owner, and ingested source pages carry no owner at all
(src/core/brain/ingest/ingest.ts:154-167).
A ready-made violation counter β with a naming trap
packContext already counts cross-owner items:
collectCandidates returns hiddenByOwnerScope
(src/core/brain/context-pack.ts:311, accumulated :329, returned :387).
Under warn, formatOwnerScopeWarning
(src/core/brain/preferences-collect.ts:307-318) renders it as
"N memory item(s) owned by another agent **were delivered**" β i.e. under
warn the counter is a delivered-leak count, exactly a
source_isolation_violations numerator. Under fail the function returns
null at :311 and nothing is reported. The variable name says "hidden"; the
message says "delivered"; they are the same number in different modes.
Cross-vault
The union happens in exactly one place: searchAcrossVaults
(src/core/search/cross-vault.ts:94, merge :150-215). Origin labels are
attached to every result twice β as origin and as an origin:<label> entry
in reasons[] (:44-50), mirrored onto cards at :53-59. Non-active origins
are read-only (selfHeal: false, cache off, :157-167). There is no
vault-level ACL: any registered profile or source vault is fully readable.
Existing leakage invariants
tests/core/brain/source-cleanup.test.ts:152-155β the only genuine "content derived from source A must not appear in a result scoped to source B" assertion, with a deliberately-planted second source (:79-88). Delete side at:213,:236.tests/mcp/agent-scope-matrix.test.ts:362-379β for five gated surfaces:expect(out).not.toContain("owned-by-a")under gatefail, plus own-memory retention. Per-surface leakage assertions at:460-473(brain_search_expandrejects a foreign chunk),:475-487(second_brain_querypaths andtotal_pages),:510-530(brain_search_by_sourceentries and total),:596-615.:391-404asserts the converse invariant: scoping must not narrow the sharedBrain/active.md(byte equality at:403).
Verification of t_b18551b1
Partly refuted. The exactly-once partition test is real β
tests/mcp/agent-scope-matrix.test.ts:299-311
(expect(new Set(classified).size).toBe(classified.length) then a
bidirectional toEqual(actual)), with a count pin at :313-315
(expect(TOOLS.length).toBe(110)). But it is not the only assertion: the
SCOPED_SURFACES bucket carries the behavioural leakage assertions listed
above, plus a schema check that every argument-scoped surface declares
agent_scope (:317-329).
Where the claim holds: UNSCOPED_CONTENT (:88-114) and NON_CONTENT
(:117-206) are prose-justified lists with no test that a NON_CONTENT tool
actually returns nothing owner-taggable; and within SCOPED_SURFACES
(:66-81), brain_query (:73) and brain_search (:74) get only the
schema-declares-agent_scope check, while brain_retrieval_plan gets only a
coarse item_count comparison (:447-456). Net: classification correctness is
asserted for roughly 12 of 14 scoped tools and for zero of the other 96.
One further gap: tests/core/search/cross-vault.test.ts:64-74 asserts the
set of origin labels and that each result carries some origin: reason β it
never asserts that a result labelled local came from the active vault. The
origin-mislabelling failure is untested.
5. Write-back: the extractor seam is already the only mode
Extraction is agent-side. The server never calls a model.
grep -riE 'api\.anthropic|api\.openai|/v1/chat/completions|/v1/messages|generativelanguage' src/
returns zero hits; the only fetch calls under src/core/brain/ are
research/external-fetch.ts:231, explorer.ts:324 and
capture/telegram-capture.ts:418,433 β none on the write path.
The contract is stated repeatedly in the code:
src/core/brain/fact-extract.ts:5-7 ("without an LLM call"),
src/core/brain/session-checkpoint.ts:31,
src/core/brain/distill/distill-source.ts:10-12 ("the calling agent supplies
the atomic claims⦠this core runs NO model"),
src/core/brain/diarization.ts:16, and
src/mcp/brain/context-tools.ts:579 ("The calling agent generates; the Brain
never does"). Where prose is required, core returns a needs-llm-step
envelope for the caller to fulfil
(src/core/brain/write-session/types.ts:23-35,
src/core/brain/write-session/engine.ts:98).
Consequence for the task framing: "an injectable-extractor seam that runs
the shipped segmentation/insertion/dedup code with ZERO LLM calls in CI" is not
a seam to build β it is the default and only mode. What a fidelity bench must
supply is the caller's structured intake, which is exactly the shape
brain_feedback and brain_session_checkpoint already accept.
Entry points and their input shape
| Entry | Anchor | Input |
|---|---|---|
brain_feedback |
src/mcp/brain/feedback-tools.ts:700 (schema), write :157 |
structured (topic/signal/principle/scope/source[]/raw) |
brain_session_checkpoint |
src/mcp/brain/synthesis-tools.ts:150, core input src/core/brain/session-checkpoint.ts:59-88 |
structured array of signals + decisions/learnings |
brain_write_batch |
src/mcp/brain/write-batch-tools.ts:190, mapper :64-138 |
structured note ops |
brain_pre_compact_extract |
src/mcp/brain/pack-tools.ts:600 (handler), :986 (schema) |
raw bounded text |
o2b brain import-session |
src/cli/brain/verbs/import-session.ts:40 |
raw transcript JSONL |
| aider wrapper | src/cli/aider.ts:107-112 |
raw transcript tail β extractPreCompactRecords |
Raw prose enters at exactly two doors: import-session and
brain_pre_compact_extract.
Server-side recognizers (all regex, all deterministic)
- Structural facts β url / email / quantity only:
src/core/brain/fact-extract.ts:90-94, applied at:144. Deliberately language-agnostic; the docblock at:8-13explains that English trigger phrases were removed as a defect. - Labeled lines β
src/core/brain/pre-compact-extract.ts:60-66(decision:,commitment:,outcome:,rule:,open question:), applied:142-158. Input truncated atDEFAULT_MAX_CHARS = 40_000(:68,:77), recorded astruncated_input(:120). - Inline
@osbmarkers βsrc/core/brain/inline.ts:850, consumed atsrc/core/brain/sessions/import.ts:387.
Validation of caller-supplied structure: validateBrainFeedbackInput
(src/core/brain/sessions/validate-feedback.ts:57, shared by live MCP and
session replay), then src/core/brain/signal.ts:257-275.
Segmentation, insertion, dedup
- Segmentation operates on already-normalized turn records, never free
text:
DEFAULT_GROUP_SIZE = 8(src/core/brain/session-recall.ts:148), two-level grouping at:366-412, and the "summary" is concatenated truncated lines (summarizeGroup:560-572). - Insertion:
writeSignal(src/core/brain/signal.ts:235, atomic name allocation:311-335, frontmatter render:360-426) βBrain/inbox/sig-*.md, orBrain/pending/under write-approval (src/core/brain/fact-extract.ts:341-349). Continuity rows viaappendContinuityRecord(src/core/brain/continuity/store.ts:100, append under lock:284-301). - Dedup, four independent layers: content hash over
(topic, sign, principle, scope)
src/core/brain/dedup-hash.ts:86with a read-side index at:55-84; fact hashsrc/core/brain/fact-extract.ts:185(chain order documented at:353); idempotency ledgersrc/core/brain/signal.ts:282-298(same key + different payload throws); continuitydedupe_keysrc/core/brain/pre-compact-extract.ts:91-102.
Provenance fields available to grade
Authoritative list is renderSignalDocument
(src/core/brain/signal.ts:360-426): id :367, created_at :368,
agent :372, scope :378, source[] wikilinks :381, source_type
:387-393, schema_type :395, dedup_hash :398, session_ref :401,
origin_vault :404, valid_from :410, recorded_at :413,
authored_at :418, expiration_date :424. Event-time policy:
resolveEventInstant (src/core/brain/sessions/import.ts:124-135) β outside
the epoch < ts <= now window it falls back to wall clock and emits no
bi-temporal keys, which is itself a gradeable fidelity outcome.
No confidence score is written onto a signal.
Continuity provenance: schema, content-hash id, kind, canonical-UTC
createdAt, sourceRefs[], payload, private, redacted
(src/core/brain/continuity/store.ts:256-282), with
session_id/turn_start/turn_end/content_hash/dedupe_key on the
pre-compact payload (src/core/brain/pre-compact-extract.ts:108-121).
Existing "fixed conversation in, assert the files out" tests
Four, all pass/fail rather than scored:
tests/core/brain.sessions.import.test.ts:113-136 (asserts session_ref and
the [[basename#turn]] wikilink, and that the absolute path is absent);
tests/e2e/brain-capture-and-fields.test.ts:37;
tests/core/brain/pre-compact-extract.test.ts:20-51 (exact ordered
extract_type list plus source refs); and
tests/core/brain/fact-extract.anchoring.test.ts:75-92. Host fixtures exist
for five runtimes at tests/fixtures/sessions/{claude,codex,grok,hermes,opencode}-minimal.jsonl.
6. Determinism and CI cost
- CI is one job. The only test step is
bun test(.github/workflows/ci.yml:78); the local wrapper isscripts/testβexec bun test. - A deterministic offline embedder ships:
LocalProvider(src/core/search/embeddings/local-provider.ts:67-78) β FNV-1a feature hashing over token unigrams and character trigrams, unit-normalised, dependency-free, no key, no download. The recall-benchmark CI gate already runs on it:tests/core/search/recall-benchmark.test.ts:60-64(semantic: { enabled: true, provider: "local", dimension: 256 }), and pins determinism explicitly at:155-160(two runs must betoEqual). - Measured wall clock on this machine:
bun test tests/core/search/recall-benchmark.test.tsβ 1.57 s for 10 tests including a fullindexVaultwith embeddings;bun test tests/core/bench/ tests/cli/brain-bench.test.tsβ 2.03 s for 20 tests across 5 files. A fourth-metric suite of comparable size is low single-digit seconds β CI cost is not a constraint. - Determinism is environmental, not enforced.
runMemoryBenchcallsresolveSearchConfig({ vault })with no config path (src/core/bench/phases.ts:82,:89), and that function still readsprocess.env(src/core/search/index.ts:401).search_semantic_enableddefaults tofalse(src/core/search/index.ts:455-459) β butOPEN_SECOND_BRAIN_SEARCH_SEMANTIC,OPEN_SECOND_BRAIN_EMBEDDING_PROVIDERand the API-key variables are not in the test-helper scrub list (tests/helpers/run-cli.ts:36-46, which scrubs nine unrelated names). The "deterministic and network-free" claim atsrc/core/bench/phases.ts:12-13is therefore a property of the default shell, not an invariant the harness holds. A developer with semantic search configured runs a different bench than CI does.
Divergences
Where the task framing does not survive contact with the source.
"The existing bench" is two benches.
runMemoryBenchandrunRecallBenchmarkshare nothing. The task's own hint list names both without distinguishing them. Any plan must say which one it extends; the answer is almost certainlyrunMemoryBench(Β§1), and the cost is a closed union widened in four files plus a report-schema decision.The extractor seam is not new β it is the only mode. The server never calls a model on any write path (Β§5). "Injectable extractor seam with zero LLM calls" describes the shipped architecture. The real design question is the inverse of the one asked: not how to inject a fake extractor, but what structured intake a fixture supplies to stand in for a real agent's distillation, and whether grading that is measuring memory or measuring the fixture author.
know_to_askis only scoreable on a default-OFF surface. The always-on injection path (active-inject) has no know-to-ask decision β it injectsactive.mdwholesale every session. The only code that can choose silence on a real prompt isdecideRecallInject(src/core/brain/recall-inject.ts:155), behindrecall_inject_enabled, default off (src/core/config.ts:976). A metric that gates CI would be gating a feature most installs do not run.false_fire_rateagainstbrain_recall_gateis degenerate.evaluateSurfacingGatefails open by design (src/core/search/surfacing-gate.ts:66-68,:85): every prompt that is not empty, a verbatim repeat, a slash command or a bare shell command retrieves. Its false-fire rate is ~1 by construction. The anti-gaming pressure the task wants must be applied to the confidence floor and ranking insidedecideRecallInject, not to the gate.avg_injected_tokenshas no token count to average. Five estimators disagree (Β§3); the bench already uses a sixth formula inline (src/core/bench/phases.ts:291);brain_token_impactcounts nothing (src/core/brain/token-impact.ts:206). Four of seven harnesses enforce no token budget at all. The metric is buildable, but only as "estimateTokensapplied to the emitted string" β and stating that explicitly is the difference between an honest number and one that implies a precision the repo does not have.source_isolation_violationsnames four different things (Β§4), and the isolation notion that actually exists is owner scope, not source scope, and it is defaultoff(src/core/brain/policy/blocks/integrity.ts:67). Gating at zero under the shipped default is vacuous: with no requested scope there is no filtering (src/core/graph/agent-scope.ts:16-19), so nothing can be violated. The metric only has content if the fixture forcesintegrity.owner_scope_delivery: fail.The counter that exists reports in the wrong mode.
hiddenByOwnerScopeis surfaced only underwarn, where it counts items that were delivered (src/core/brain/preferences-collect.ts:313-316); underfailit is deliberately unreported (:311). A zero-gated invariant must therefore assert on pack contents β astests/mcp/agent-scope-matrix.test.ts:368-372already does β not read a counter.t_b18551b1's claim is partly wrong and should be re-scoped before it is acted on (Β§4). The matrix does assert behavioural non-leakage for its gated surfaces; what it does not assert is anything about the 96 tools in
UNSCOPED_CONTENTandNON_CONTENT.The only prose recognizer in the write path is English-only.
src/core/brain/pre-compact-extract.ts:60-66hardcodesdecision,commitment,outcome,rule,open question. This contradicts the rule the sibling extractor states in its own docblock (src/core/brain/fact-extract.ts:8-13: a per-language phrase list is a defect). A write-back fidelity fixture written in any other language scores 0 through that door for a reason that is not a memory failure.The bench emits no metric, so a new family has no dashboard path.
runMemoryBenchwrites onlyreport.json;docs/metrics.md:56-70lists noo2b.bench.*surface. Anything meant to be trended must go throughappendMetric(src/core/brain/metrics.ts).The metrics contract has already drifted.
docs/metrics.md:62documentsrecall_benchmarkwith six payload fields; the CLI writes eleven (src/cli/brain/verbs/benchmark.ts:66-79) and the MCP tool writes six (src/mcp/brain/recall-tools.ts:107-118) β two writers on one surface with different fields, neither matching the doc.Determinism is a property of the environment, not the harness (Β§6).
What a design must not assume
- That there is one bench to extend. There are two, and neither generalises to the other's fixture format.
- That a new extractor seam is needed. It is not; the seam that matters is the
retriever parameter in
decideRecallInject, which already exists. - That the default-on injection path makes a relevance decision. It does not.
- That
brain_recall_gateis the know-to-ask decision. It is a cheap suppressor that fails open. - That any token number in this repo is exact, or that two token numbers from different modules are comparable.
- That "source" is one concept, or that source isolation is enforced by
default. Owner scope is the only isolation primitive, and it ships
off. - That a violation counter can be read out of a
fail-mode pack. It cannot. - That the harness's network-freedom is enforced. It is inherited from an unset environment and not scrubbed by the CLI test helper.
- That a fixture written in one natural language exercises the same code paths
as one written in another β
pre-compact-extractrecognises English labels only. - That CI cost is a constraint. It is not: the comparable existing suites run
in 1.6β2.0 s with the offline
LocalProvider.