Skip to content

How recall is checked

Remembrancer is one Node.js service in front of Postgres.

MCP client / HTTP client / dashboard
│ Bearer token (agent grant or person session)
▼
┌─────────────────────────── Hono app (src/http) ───────────────────────────┐
│ /mcp /v1/recall /v1/memories /v1/grants /v1/channels /v1/billing │
└───────┬───────────────────────────────┬──────────────────────────┬────────┘
▼ ▼ ▼
Memories service Accounts service Billing service
(src/services/memory.ts) (accounts.ts) (billing.ts, Stripe)
│ every write appends to the hash-chained ledger (ledger.ts)
▼
Postgres: external (DATABASE_URL) or embedded PGlite (DATA_DIR)

Memories.admitted() is the whole policy, in one SQL query. For each candidate memory it requires:

  1. Audience. Every viewer (member of the channel the agent is answering in) is a member of the memory’s audience, or the audience is public.
  2. Sources. For every source_ref, every viewer has a resource_access row for that resource, checked at query time.
  3. Grant. The memory’s kind is in the grant’s kinds, and its classification is at or below max_classification.
  4. State. The memory is active (not a candidate, archived or tombstoned) and still valid.

Viewers come from channel membership on the server. Nothing in the request body or the memory content can change them. A channel the caller isn’t in, a channel kind the grant doesn’t cover, a memory that doesn’t exist and a memory that’s forbidden all return the same “not found”.

test/leak.test.ts holds the leak tests, including a randomized sweep that checks every admitted memory against an independent oracle and requires zero forbidden items.

See src/db/migrations/. Key tables:

Table Holds
tenant An account: a person, a family or a company. Has a plan.
principal People and agents. Agents are never the person they act for.
channel, channel_member Where agents talk and who is there now.
audience, audience_member Frozen member sets, one per distinct group, shared by memories.
resource_access Built-in relationship store for source permissions.
agent_grant One agent acting for one person, with authorization_details. Token stored as a SHA-256 hash.
memory_record The memory envelope: kind, status, content, time validity, provenance, trust, audience, sources, classification, lineage.
event_log Append-only, hash-chained ledger of every change.
access_decision One row per recall: subject, actor, viewers, admitted IDs, policy version, context hash.

The design follows the schema v1 proposal: OAuth token exchange (sub = person, act = agent) instead of opaque tokens, an AuthZEN/OpenFGA adapter in place of the built-in relationship store, hybrid search with embeddings, a consolidation (“sleep”) job that keeps labels on derived memory, and the remaining memory kinds. Each is a tracked issue.