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.
Distilled provenance - variants (audit trail)
Consultant: Claude Code (claude -p, primary), prompt in cli-output/prompt.md, raw output in cli-output/claude.md. It returned three parseable variants and exited 0, so the Codex fallback was not run.
Variants, verbatim
Variant 1: Gate in distillSource, scope derived at classification
- Approach: Extend
classifySourceOriginto keep the bytes it already reads and return{trust, contentHash, bytes, captureScope}in one pass, so the capture scope is a by-product of the existing trust classification (bytes present and complete givesfull-local, bytes truncated by a ceiling givesbounded-local, URL or missing file givesurl-only).distillSourcescans each claim for\p{Quotation_Mark}pairs, normalises both sides for comparison only, and substring-matches against the whole source body; a failed span has its marks stripped and the receipt gains aquote_fidelityfinding, while aurl-onlysource yields a namedunavailable. The health side is one hygiene detector that walks active pages to cited sources and warns when any cited source page carriescapture_scope: url-only. - Trade-offs:
- Pro: smallest surface; one read of the source, no block resolver, no new module layout.
- Pro: the trust classifier is already the chokepoint for "no local bytes", so the shared vocabulary falls out naturally.
- Con: whole-source matching ignores the block id, so a quote that exists elsewhere in the source passes even when the cited block is wrong.
- Con: only guards the
distillSourcepath;brain_write_sessionbytes and already-written pages are never checked. - Con:
classifySourceOriginreturning up to 8 MiB of bytes widens its contract for every other caller.
- Complexity: small
- Risk: medium
Variant 2: Shared provenance module, write-time gate plus lint detector
- Approach: Add a
provenancemodule holding the four-piececapture_scopevocabulary (registered in the census), areadSourceEvidence()that returns bytes, hash and scope and is called by ingest, distill and trust classification, a quote-span scanner over\p{Quotation_Mark}with a word-boundary rule for U+2019, a comparison-only normaliser separate fromQUOTE_VARIANT_RE, and a best-effort block resolver that narrows the match window when the cited^idexists and falls back to the whole source otherwise. The verifier runs twice: at write time insidedistillSource(failed span unquoted, receipt findingquote_fidelitywithverified | unquoted | unavailable), and as a hygiene detector over existing distillations and session pages so caller-authored bytes and old pages surface the same finding.capture_scopeis written to the frontmatter of new source, distillation and report pages; the url-only-backs-active-knowledge check is a second hygiene detector with a doctor code and exit-census row, deriving scope for pre-release pages from the existingmissingsentinel. - Trade-offs:
- Pro: one vocabulary and one evidence reader serve both cards; "no local bytes" is a single enum member everywhere.
- Pro: covers the
brain_write_sessionbypass and the already-written corpus through the existing detector plumbing that already reachesbrain_status. - Pro: block-scoped matching when ids exist, graceful whole-source fallback for the fixtures that cite
^abcwith no ids. - Con: more files and tests; the block resolver is new code with its own edge cases (ids on list items, headings, tables).
- Con: new frontmatter key on new pages means those writers' byte-stability fixtures need regeneration (existing pages untouched).
- Con: the detector re-reads sources on every hygiene pass, which is a cost on large vaults.
- Complexity: medium
- Risk: low
Variant 3: Typed claims and a configurable quote policy
- Approach: Change the claim contract so callers mark
kind: quote | paraphrase;distillSourcerenders a quote only after verification and otherwise applies a configured policy (distill_quote_policy: unquote | drop | reject), whererejectfails the whole write with a new coded error registered in tool-error-codes.capture_scopebecomes an explicit ingest input validated against what was saved (mismatch is an error), and the url-only warning is a doctor check only. Failed spans underunquoteare also recorded in a frontmatter list of unverified block ids on that page. - Trade-offs:
- Pro: strongest guarantee; a strict install can refuse to persist a paraphrase disguised as a quote.
- Pro: typed claims give downstream recall a clean quotable-or-not signal without re-scanning text.
- Con: breaks the current
{text, block?}caller contract and the MCP schema, with the tool description at 280 of 300 characters. - Con: three policies and an explicit scope input multiply the test matrix and the config surface for one release.
- Con:
dropsilently loses knowledge, andrejectturns a model's punctuation choice into a hard write failure. - Con: no detector over existing pages, so the corpus written before this release stays unchecked.
- Complexity: large
- Risk: high
Recommended: Variant 2
Rationale: It is the only variant that satisfies both cards with one vocabulary and one evidence reader while covering the brain_write_session bypass and the already-written corpus through detector plumbing the project already has. Variant 1 leaves two write paths unguarded and silently widens the trust classifier's contract; Variant 3 breaks the claim and MCP contracts and adds policy surface this release does not need. The block resolver with whole-source fallback keeps the match deterministic and fixture-compatible, and the unquote-plus-named-finding fallback follows the existing receipt convention without losing text.
Orchestrator decision
Variant 2, narrowed and with one addition (design.md, "Chosen approach").
- Variant 1 lost because it matches against the whole source and ignores the cited block, so a quote that exists elsewhere passes under a wrong citation; and because it makes
bounded-localmean "truncated by the size ceiling", which would turn today's namedSourceTrustErrorrefusal into a degraded success. Its one-read idea is kept (premise A.5, task A4) through a newreadSourceOriginrather than by wideningclassifySourceOriginfor every caller. - Variant 3 lost because it breaks the
{text, block?}claim contract and the MCP schema of a tool at 280 of 300 description characters, adds a three-way config policy, and itsdroppolicy loses caller-supplied knowledge. Its strict refusal with a registered code survives as an opt-in argument (decision 11), not a config key. - Variant 2, narrowed: the second quote detector over existing and
brain_write_sessionpages is deferred (out of scope by the orchestrator's steer); the doctor code is dropped because the hygiene finding already reachesbrain_status; deriving scope from the freshnessmissingsentinel is replaced by the trust classifier, because distill, ingest, research and entity pages do not carry the freshness contract; the "fall back to the whole source when the block does not resolve" rule is replaced by a namedblock-not-foundoutcome, because the citation is part of what the page asserts. - Addition: an explicit
excerptargument on distillation, sobounded-localhas a real producer without wiring network egress (extractPage). It is also where the two cards meet: an excerpt is the only local text a quote from a URL source can be checked against.