Retrieval gate for coding agents

Agent memory
should not outlive
its source.

SourceTether ties every remembered claim to one exact TypeScript declaration, and re-reads that declaration before the memory is allowed back into the agent's context.

the failure

01 — The failure

The source moved. The memory didn't.

An agent remembered a value once. Nothing told it when the declaration underneath that value changed.

Remembered claim static gravity = 9.81; Captured while the lander was calibrated for Earth.
Current source static gravity = 1.62; demo/mission/src/descent-model.ts → DescentModel.gravity

Hand the agent the remembered 9.81 and its controller thrusts for a planet it is no longer on: fuel depleted at 491.4 m, still climbing at +67.64 m/s. Make it re-read the declaration first and the same controller touches down at −1.50 m/s with 4.33 fuel remaining.

02 — How it works

Capture, anchor, verify.

Three steps a developer wires in once. Everything after that happens at retrieval time, before the agent sees a word.

  1. 01

    Capture a narrow claim

    One atomic, checkable fact — not a summary, not a paragraph of context.

    DescentModel.gravity is a static property of class DescentModel initialized to the numeric literal 9.81.
  2. 02

    Anchor it to a symbol

    The claim is bound to a resolved declaration: project-relative path, qualified name, declaration kind, and a structural fingerprint of its AST.

    src/descent-model.ts → DescentModel.gravity class_static_property · sha256 fingerprint · no line or byte offsets
  3. 03

    Verify before release

    On retrieval the declaration is resolved again and re-fingerprinted. The gate has three answers, and only one of them releases text.

    • match release the claim
    • changed withhold, and name the symbol to re-read
    • unresolved withhold

Changed does not mean false.

A changed fingerprint says the ground under the claim moved — not that the claim was ever a lie. SourceTether does not overwrite the memory, contradict it, or guess a new value. It withholds it and hands back the exact symbol the agent has to read again before it may speak.

Provenance, never blind trust.

In local mode Claude-Mem supplies the observation a claim came from, and SourceTether records that provenance. It never exposes raw Claude-Mem content on trust: the only text that reaches the agent is a claim whose anchor just verified against the file on disk.

Mission console initialising
Technical proof
anchor
—
declaration kind
—
captured fingerprint
—
current fingerprint
—
gate
—
observation
—
Source —
— —

Retrieval gate

—

—

04 — Scope

TypeScript declaration anchors today. Source-grounded agent memory as the broader idea.

Working today

  • Binds one narrow claim to a resolved TypeScript declaration by project path and qualified name.
  • Compares a structural AST fingerprint, so reformatting and edits around the declaration leave the gate open.
  • Releases on a match, or withholds and hands back the exact symbol to re-read. Three answers, never a guess.
  • Carries Claude-Mem provenance through local mode, without ever releasing text the anchor has not vouched for.

The next phase

  • Anchors past a single declaration: one claim spanning several symbols, and source that is not TypeScript.
  • A retrieval hook an agent calls directly, so the gate runs inside an ordinary memory lookup rather than a demo.
  • Telling an edit that invalidates a claim from one that only moved it — so changed asks for a re-read less often, and means more when it does.