pgmem
Concepts

Trust & memory formation

Authority, evidence, and claim lifecycle.

Claims are not all equal. pgmem records who asserted a claim, what evidence supports it, and its lifecycle; ClaimPolicy then decides whether the candidate is accepted, held, corroborates an existing claim, supersedes one, is discarded, or must be fetched as live state.

Authority

The default policy ranks sources from strongest to weakest:

application → resolver → user → agent → summary

Application, resolver, and user observations may become active claims when they do not conflict with a stronger assertion. Agent and summary inference is held by default until corroborated. Evidence is immutable provenance, not a confidence substitute.

claim, decision = await session.observe(
    subject=SubjectRef(kind="customer", identifier="customer-123"),
    predicate="billing.plan",
    value="annual",
    authority=Authority.application,
    evidence=[Evidence(kind="billing_event", reference="evt_123", authority=Authority.application)],
)
assert decision.action == "accept"

Corrections and retention

Use lifecycle methods to corroborate, supersede, retract, expire, or revoke a claim's source. retention_until is an optional expiry deadline, not a choice of memory tier. It hides an elapsed claim from active reads immediately; run ClaimRetentionWorker off the response path to record expired, remove derived projections, and rebuild affected narratives. Derived projections never become the source of truth.

On this page