Skip to content
Loom Docs
Esc
↑↓navigate↵open⌘Jpreview
Product
View as Markdown
On this page

History and provenance

Read earlier versions of a memory, see who wrote each version, and trace extracted facts to the turns that support them.

Every write to memory makes a new version; nothing is edited in place. Versions are kept in an append-only mirror, so a fact’s history survives background merges. Each row records who wrote it and how it entered memory, derived rows record their sources, and a person can attest that a row is true. How the version mirror works is in memory architecture.

A memory’s provenance and version history in the dashboard

Operations

Operation Role Answers
memory.history viewer Every version of a key, newest first, including tombstoned and redacted versions.
memory.provenance viewer Where the live row came from: source trace, writer, source class, the conversation it was extracted from.
memory.evidence viewer The source turns a fact was extracted from, with the supporting span and how each link was made.
memory.backlinks viewer What points at a row: versions, digests, typed links in and out, evidence count, entity neighbours.
memory.lineage viewer The promotion trail of a shared memory: who promoted it, from which rows, through which review.
memory.verify writer Attest that a row is true as the signed-in person or service account, or revoke the attestation.
memory.redact admin Scrub the value of one historical version, keeping the row and its audit entry.
namespace.rollback admin Return every memory head in a namespace to its version at a point in time.
namespace.snapshot admin Export a namespace’s curated state as a JSON payload.
namespace.restore viewer Import a snapshot into a fresh namespace, or an existing one the caller administers; never a collection.

namespace.snapshot and namespace.restore are not MCP tools. Field lists are in the operations reference under memory and namespace.

Versions: memory.history

loom.memory holds current state and is read with FINAL, so a merge keeps only the newest version of each row. loom.memory_versions is an append-only mirror filled by a materialized view on every insert; it is the history that memory.history, memory.redact and namespace.rollback read.

A history row carries version (the write’s nanosecond epoch), written_at, value, confidence, pinned, expires_at, tombstoned_at, redacted_at, redaction_reason, content_sha256, agent, actor and source_class. created_at is the row’s first write and repeats on every version. agent="*" spans every writer of the key.

from loom import Agent

async with Agent(org="acme", namespace="support", agent="auditor") as agent:
    for v in await agent.memory.history("customer/4812/plan", agent_id="*"):
        print(v["written_at"], v["actor"], v["source_class"], v["value"])

A tombstone is a version too, so a delete shows in history. memory.restore can reverse an automatic tombstone within 14 days when no permanent refusal exists. For point-in-time reads of current state, use as_of on memory.get, memory.search and memory.ask (validity time).

Bringing an earlier version back

An earlier version comes back as a new version on top of the current one. No version is removed or rewritten: the history then holds the text that was wrong, the versions around it and the restore. It takes two calls: read the versions, then revise the row by its id with the chosen value and the newest version’s content_sha256 as if_match_sha256. A row written with a char_limit takes a third: a version does not carry the cap, so memory.get reads it and the revision passes it back.

from loom import Agent

async with Agent(org="acme", namespace="support", agent="auditor") as agent:
    versions = await agent.memory.history("customer/4812/plan", agent_id="*")
    head, earlier = versions[0], versions[2]
    # Needed only for a row written with a char_limit.
    row = await agent.memory.get("customer/4812/plan", agent_id=head["agent"])
    await agent.memory.update_by_id(
        head["memory_id"],
        earlier["value"],
        if_match_sha256=head["content_sha256"],
        char_limit=row.get("char_limit"),
    )

memory.update_by_id changes the value alone: the row keeps its tags, pin, files and expiry. It writes char_limit as the call gives it, so a revision that leaves it out removes the row’s cap. The write is refused where any revision is:

  • a row that changed since the read answers 409 PRECONDITION_FAILED and writes nothing;
  • a read_only lock answers 423 LOCKED, and an expired row 409 EXPIRED;
  • a row deleted since the read answers updated: false, and so does an id that two namespaces the caller can write both hold (a namespace restored from a snapshot keeps the memory ids): memory.update revises that row by its key.

A redacted version holds no value to bring back. A namespace’s guide is restored the same way: read the earlier revision with namespace.guide_get and its revision, then save its content with namespace.guide_set and the current revision as expected_revision (a namespace’s guide). The dashboard makes both pairs of calls from a memory’s and a guide’s History (the pages).

Who wrote it: actor and source class

The server stamps actor (human:<subject> or process:<subject>) and source_class on every row from the token and the operation. The source_class values are in memory concepts. A request may only downgrade its class to external, imported or derived.

memory.provenance returns both, plus:

  • source_trace and a source_kind derived from it (conversation, extracted, observed, consolidated, app, manual, other);
  • the source_resource_id the writer cited;
  • the conversation thread_id and thread_exists (false when the namespace does not record transcripts, or the transcript is gone);
  • the authored links (memory.link) touching the row.

Search hits carry source_class and verified, which the optional trust term (LOOM_MEMORY_SEARCH_TRUST_WEIGHT) reads.

The knowledge factory walkthrough shows how to revise a saved lesson after its source changes and check the new citation alongside the old wording.

Evidence: which turns a fact came from

Extraction links each fact to its turns in loom.memory_belief_sources. memory.evidence(memory_key) returns those links with the turn’s text (up to 600 characters), role, time, the supporting span, and how the link was made:

scope support_type Meaning
cited extracted_from The extractor named the supporting turn.
lexical lexical_support The server matched the fact to its best turn.
window window Nothing matched; the whole extraction window is linked.
derived derived_from Consolidation lineage: the item is the source memory’s text.

The response counts links by scope, so a check can tell a cited fact from a loosely tied one. For a conversation’s exact wording, memory.recall searches the stored turns (extraction).

Lineage

  • memory.consolidate and period digests write one derived_from link per source into loom.memory_belief_sources; memory.evidence returns them as derived items.
  • A session digest lists the keys it compressed (derived_from on a summary hit).
  • memory.lineage (scope="shared") walks a shared memory’s promotion: the event, who promoted it, the supporting rows, the learnings candidate it came from when one matches (match_confidence exact or inferred), and the audit events. mechanism is review, import, auto or unknown.
  • memory.backlinks is the inverse: what points at a row.

memory.delete retires a consolidated summary whose sources are all gone and downgrades one with surviving sources to conflicted.

Attestation: memory.verify

pinned and confidence do not say who checked a fact. memory.verify records that: the actor from the caller’s token and the content hash they attested. Address the row by memory_id, or by namespace and memory_key with the writer identity. It needs writer on the row’s namespace.

Send if_match_sha256, the content_sha256 that memory.get or memory.get_by_id returned for the content being attested, and the call attests only that content. A row that holds other content answers 409 PRECONDITION_FAILED with current_sha256 and writes nothing: read the row again and attest what it says, never the returned hash unread. The 409 of a high row carries no hash. revoke=true takes the same precondition. Without the field the call attests the row as the server reads it, so an edit that lands after the caller’s read is attested unseen.

loom call memory.verify memory_id=<memory_id> if_match_sha256=<content_sha256>

memory.get and memory.get_by_id return verification, derived from the stored hash and the row’s current one:

verification Meaning
human A person attested and the content has not changed since.
process A service account attested and the content has not changed since.
stale Someone attested, and the content has changed since.
none Never attested, or revoked.

namespace.worklist lists the active and conflicted rows of a namespace whose verification went stale, under its stale_verification kind, the most read key first, with who verified each and when (the worklist).

  • An edit does not clear an attestation; it makes it stale until someone re-verifies.
  • revoke=true clears it. Re-verifying an unchanged row by the same actor is a no-op (changed=false).
  • The human: prefix comes from the token, so an agent cannot mark its own write human. The body’s actor is read only in dev mode without auth.
  • Snapshots and restores carry the attestation columns; a restore never strips verified_by.

Scrubbing history: memory.redact

memory.redact(memory_id, version) scrubs one historical version’s text everywhere it is copied, and every profile version a model built from the memory. It stamps redacted_at and redaction_reason, and keeps the rows and their audit entries. Use it for a secret or personal detail that leaked into an earlier version.

Where What happens
loom.memory, loom.memory_versions value becomes "[REDACTED]"; value_json, evidence, entities and concepts are cleared.
loom.memory_embeddings, loom.memory_chunks Rows whose excerpt or chunk hash is not the live head’s are deleted; the live head’s rows stay.
The user’s profile versions built from the memory Every version whose trace names the memory is scrubbed the same way, the live head included, with its key’s derived rows.
loom.shared, a copy promoted from the key Every version whose value is the redacted text becomes "[REDACTED]", and its search rows are deleted. A live copy stays promoted until an admin demotes it.

Out of scope: tags, files, content_sha256, loom.memory_evidence (owned by erasure), the lineage tables (ids and hashes only) and the entity graph. A shared copy is left as it is while the live head holds the redacted text too (an edit reverted byte for byte).

  • It refuses the memory’s live head (refused_head=true): delete or rewrite the key first. A scrubbed live profile is left out of renders, packs and profile search until the worker rebuilds it.
  • Both lock modes refuse it, on the memory’s own key and on any profile key it reaches.
  • It deletes cached memory.ask and code.ask answers and precedents that quoted the key or a shared copy’s key (cache_rows_deleted, precedent_rows_deleted). For a profile key it reaches, the deletion is org-wide: every user’s profile has the same key, so it clears every cached answer and precedent in the org whose window held that key, in every namespace.
  • The namespace is checked after the fetch; a refusal answers redacted=false, not 403.
  • A version that does not exist answers redacted=false and scrubs nothing, no profile version included.
  • It runs a synchronous ALTER TABLE … UPDATE on the two memory tables (and on loom.shared when a copy still holds the text) and a lightweight DELETE on derived rows: an administrative call.

Writes that race the redaction of a shared copy:

  • a search row the embedding worker writes after the purge, from a stub it read before, stays until the next redact of the key;
  • a promotion of the key loses its search row until it is promoted again;
  • a demote that read the copy before the scrub writes its tombstone with the text, which stays until that version is redacted again.

A copy that a later promotion of its key replaced, and that loom.shared has since merged away, is no longer found: its search row, which FINAL no longer serves, stays until a later purge of the key, and cached answers under a key other than the redacted one stay until they expire.

A copy whose value is "[REDACTED]" counts as one an earlier redact scrubbed, so a memory that holds that text itself and was promoted loses its search rows to the next redact of its key.

The profile reach and its limits are in security. To remove a person’s data everywhere, use erasure.

Rolling a namespace back: namespace.rollback

namespace.rollback(as_of) re-inserts, for each key, the highest version at or before as_of as the new head, and tombstones keys created after it. The rollback is itself new versions, so it can be undone the same way.

  • Dry run by default, reporting reinstate, remove and sample; dry_run=false applies it.
  • memory_keys (up to 500) restricts it; max_keys (default 5,000) bounds one call and truncated says to call again.
  • The embedding_worker re-embeds reinstated heads.
  • An as_of older than the namespace’s history, or in the future, is refused.
curl -sX POST http://localhost:7777/v1/namespace.rollback \
  -H "Authorization: Bearer $LOOM_API_KEY" -H 'Content-Type: application/json' \
  -d '{"org":"dev","namespace":"local","as_of":"<YYYY-MM-DD>T09:00:00Z"}' \
  | jq '{reinstate, remove, truncated, sample}'

Snapshots: namespace.snapshot and namespace.restore

namespace.snapshot exports a namespace’s curated state as JSON: every memory row with version, content_sha256, actor, source_class, validity and attestation columns, the per-type configuration, the grants, and up to include_audit_tail_n recent audit rows (default 1,000). include_embeddings is false by default, so the target re-embeds under its own model.

namespace.restore(target_namespace, payload) writes the payload back as version rows. It is idempotent on snapshot_id (a rerun answers restored=false). It restores into a fresh namespace (the caller becomes admin; refused for a name with no row that already holds data or grants, unless the caller already administers it) or one the caller administers; rebind_agent reassigns every row’s writer. Restored rows are imported.

A snapshot is not a deployment backup; see backup and recovery.

Stewardship

A shared memory can have a steward: the account or group that answers for it, and an interval in days at which it is reviewed. A namespace admin assigns one, a person who can write the namespace records a review of the content they read, and every viewer reads who maintains what. A state says whether a memory’s review is current; it changes nothing about how the memory is served, ranked or expired.

Operation Role Answers
stewardship.assign admin Name the steward and the interval of a shared memory, or the namespace’s fallback.
stewardship.review writer Record a person’s review of the content they read. It changes no value.
stewardship.list viewer The namespace’s items under stewardship, those needing attention first, and counts.
stewardship.get viewer One target’s assignment, state and newest reviews.
loom call stewardship.assign namespace=<ns> target_kind=memory target_key=glossary/sla \
  agent=<agent> steward=ana@example.com review_every_days:=90
loom call stewardship.list namespace=<ns>

A memory target is addressed by the row’s agent and key: agent is the agent that wrote the memory, as memory.list returns it. loom call, the Python SDK and MCP send the caller’s own agent on a call that leaves agent out, which names another row, and an assignment of a key that agent does not hold answers 404. The namespace target is one row whatever agent the call carries.

A steward is a Loom account that holds a direct grant of writer or above on the namespace, or group:<id> of a live group with a member. A role carried only by a token is not a grant: give the account one with grants.create first. target_kind=namespace names the fallback steward, a person who answers for every item whose own steward cannot act. The interval is 30 to 730 days; review_every_days:=0 ends stewardship of the item. A namespace holds at most 500 items under stewardship.

Each item carries a state, the first of these that holds, and a problem when its steward cannot act:

state Meaning
missing The memory has no head a steward can review.
never_reviewed Nobody has reviewed it.
out_of_date The memory changed after its newest review.
correction_requested The newest review asked for a correction.
needs_evidence The newest review asked for evidence.
overdue The interval has passed since the newest confirming review.
due The interval passes within 14 days.
current Reviewed, unchanged and inside the interval.
problem Meaning
unassigned The item has no steward.
steward_revoked The steward can no longer sign in.
steward_no_grant The steward holds no direct grant of writer or above on the namespace.
group_inactive The steward is a group that no longer exists or has no member.

responsible names who should act: the steward, or the fallback steward when the steward is a group or has a problem. stewardship.list takes state, problems_only and mine (the items the caller is responsible for) as filters; its counts cover every item whatever the filters.

An item reads missing when its memory was deleted or renamed, was superseded, rejected or left as a proposal, is a duplicate of another row, is of high sensitivity, or is longer than 16,384 bytes; store a longer text as a document. A rename detaches the steward, because the assignment names the key: assign the steward to the renamed key and end the old item.

Recording a review

A review is three calls: list what is yours, read the content, record what you found.

loom call stewardship.list namespace=<ns> mine:=true
loom call memory.get namespace=<ns> agent=<agent> memory_key=glossary/sla
loom call stewardship.review namespace=<ns> target_kind=memory target_key=glossary/sla \
  agent=<agent> result=confirmed if_match_sha256=<content_sha256>

if_match_sha256 is the content_sha256 that memory.get returned with the text you read. A memory that holds other content answers 409 PRECONDITION_FAILED with current_sha256 and records nothing: read it again and review what it says, never the returned hash unread. result is one of:

result Records Also
confirmed The content is still right. Attests the memory, as memory.verify does.
correction_requested The content needs a correction. It holds no text. Removes a live attestation of that content.
needs_evidence The content needs a source. It holds no text. Removes a live attestation of that content.

A review needs the writer role on the namespace and a signed-in person: sign in with loom login, or mint the token with --user-token. A service account answers 403. Being named the steward grants nothing, and any person who can write the namespace reviews; the review names who did. A confirm sets next_review_at one interval ahead, and the item reads due inside its last 14 days and overdue after. An edit of the memory makes the item read out_of_date until its new content is reviewed. stewardship.get returns the item’s 20 newest reviews, each with of_current_content.

Verification and review

Verifying a memory and reviewing it are two acts with two records.

memory.verify stewardship.review
Who A writer; a service account attests as process A writer who is a signed-in person
Records Who attested which content Who reviewed which content, and the result
Has a date that runs out No Yes: next_review_at, one interval after a confirm
After an edit verification reads stale state reads out_of_date
Repeated, unchanged Writes nothing Appends a review, so the date moves
Affects the other Records no review; a revoke undoes no review A confirm attests; another result removes a live attestation

The four operations are not MCP tools of the default listings; call them by name through loom_op. How the state is derived, what a review writes and what erasure removes is in stewardship.

The audit log

Every write that creates or changes memory leaves one hash-only row in loom.audit_log (key, id, content hash, actor, source class, verdict; never the value). Hourly checkpoints chain the log. See audit.

Limits

  • Redaction of a merged-away version is best effort in loom.memory; the mirror is scrubbed either way.
  • History is only as complete as the mirror. A column added to loom.memory must be added to loom.memory_versions and its view in the same migration.
  • Validity is valid-time only. knowledge_time replays created_at against the retirement (invalid_at) and deletion (tombstoned_at) stamps; there is no separate transaction-time table.
  • thread_exists=false is not an error.
  • A rollback does not restore hard-deleted keys (skipped_no_head).

Last updated on

Was this page helpful?