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.
Language-agnostic fact extraction - remove hardcoded human-language trigger phrases
Status: draft Author: claude-dev-agent (via feature-release-playbook; external consultant step waived by operator) Audience: implementation
Problem statement
src/core/brain/fact-extract.ts and src/core/brain/truth/ingest.ts detect facts in user
turns using regexes anchored on English trigger phrases ("my name is", "I prefer", a
"yes/correct/right/exactly ... is/are" confirmation frame, English quantity action verbs
"spent|paid|earned|...", English stop-words, an English possession-key blocklist, and
English STRUCTURERS like "based in"). PR #84 made search and classification
language-agnostic; this extraction path was the one deferred slice. We cannot enumerate the
world's languages, so any phrase list is a defect, not a feature.
Scope
- Delete every hardcoded human-language phrase from the fact-extraction path: the prose
family patterns in
fact-extract.tsand the EnglishSTRUCTURERS/POSSESSION_REintruth/ingest.ts. - Keep only structurally detectable, language-neutral facts: URLs, e-mail addresses, and quantities expressed through language-neutral symbols (currency symbols / ISO codes, percent).
- Update
truth/ingest.tsso no dead branch survives the family removals.
Out of scope
- Re-introducing prose-fact capture through any other mechanism (explicit author labels or an LLM provider). Tracked as a follow-up if recall loss proves material.
- The
decision:/rule:explicit-label markers inpre-compact-extract.ts. Those are an author-written structured-label convention (likeTODO:), not natural-language detection; left as-is. - Changing the persisted claim-ledger schema. The nullable
actioncolumn stays for back-compat; we simply stop deriving it from English verbs.
Chosen approach
Variant 1 (structural-only). extractFacts keeps three language-neutral families:
url- barehttps?://...match, no trigger phrase.email- bare RFC-ish address match, no trigger phrase.quantity- a number bound to a language-neutral measurement symbol (currency symbol, ISO-4217-style code, or percent). The English actor/action frame and stop-word list are removed;parseQuantityFactno longer emits a prose-derivedaction.
Everything that needed a human-language frame (identity, preference, location, possession, confirmation) is removed. Prose facts in any language are not auto-captured by this real-time, LLM-free path; that is an accepted, explicit recall reduction, consistent with precision-over-recall and with PR #84's structural philosophy.
Design decisions
- Structural, not lexical. A signal qualifies only if it is detectable without knowing
any natural language (a URL, an
@-address, a currency symbol). This is the same test PR #84 applied to search and classification. - No fake fallback. We do not add a "no provider -> pretend" path. Removed families are removed, not stubbed.
actionis no longer invented. The quantityactionwas an English verb. It is set tonullfrom this path;truth/aggregate.tsalready bucketsaction: string | null, so quantities now aggregate byunit. The column stays nullable for back-compat and for a future explicit-label source.- Stable public API.
extractFacts,parseQuantityFact,factDedupHash,routeExtractedFactskeep their signatures; only behavior narrows.FactFamilyloses the removed members.
File changes
src/core/brain/fact-extract.ts- replaceFAMILY_PATTERNSwith the three structural families; deleteQUANTITY_UNIT_STOPWORDS,POSSESSION_KEY_BLOCKLIST, the English action verbs; narrowFactFamily; reworkparseQuantityFactto structural quantity (no action).src/core/brain/truth/ingest.ts- deletePOSSESSION_RE, the EnglishSTRUCTURERS(name/called/based-in); keep the structural email/website structurers; drop thepossessionbranch; keep thequantitybranch (actionnow null).- Tests across
tests/core/brain/**andtests/**that assert removed families.
Risks and open questions
- Recall regression (accepted). English prose facts (name, preference, location) stop auto-extracting. Mitigation: explicit labels and the dream pass still feed memory; the loss is precision-safe.
- Quantity precision. Without an actor frame, quantity must stay tight (bound to a currency/percent symbol) to avoid matching arbitrary numbers. Covered by tests.
- Downstream
actionconsumers. Confirmtruth/aggregate.tsandtruth/store.tstolerate a nullactionend-to-end (they type itstring | null).