1. Executive Summary
Provena is a self-hosted memory service for coding agents: one
FastAPI process over PostgreSQL with pgvector, reached through an MCP
server and through hooks for Claude Code, Codex and Gemini CLI. Every
captured turn is an immutable event. A local or hosted model extracts
claims from it, and every claim starts as a candidate linked to the
event's words. A person holding a human credential
promotes, quarantines or deletes it.
Notable: the gate is in the database. PostgreSQL triggers refuse to
change a claim's status unless a matching memory_action row
exists, and refuse that row unless an active human credential signed it.
The same triggers make the event, evidence, action, relationship and
retrieval tables append-only. Authority is derived from the key's role,
not from the caller's say-so.
Weak: candidates are delivered to the agent before anyone reviews them. They are labelled, and the README says plainly that Provena labels a planted fact rather than blocking it. A reviewed temporal change records which claim supersedes which and changes neither status. API keys are organisation-wide, and nothing erases content once captured.
Six marks are present and one is withheld (section 9).
Licence. MIT in LICENSE (copyright 2026
Aniket Kolte) and in pyproject.toml.
SECURITY.md asks for suspected vulnerabilities and
tenant-isolation failures to go through GitHub's private reporting, not
a public issue.
2. Mental Model
An event is what someone said, and a claim is what the system was
asked to believe about it. Events are never edited. A claim's
proposition — subject, predicate, value, validity — is never edited
either; only its status moves, and each move is a row in
memory_action first
(alembic/versions/ccc08f8f4372_initial_evidence_model.py:180-194).
Authority belongs to the source, and the source is the key. An
agent key may record user_statement and
assistant_inference events at low authority and
hypothesis at ephemeral; a human key records
the user's statements at medium and corrections at high; a
tool key records observations and test output at high
(src/core/domain.py:32-46). An insert trigger enforces the
same table, so the API cannot be talked into a higher grade
(alembic/versions/9a7bce89dc4c_credentials_and_conflict_review.py:73-89).
Retrieval is a separate concern from belief. The agent receives
candidates as provisional context, and review decides whether a claim is
reviewed context, removed from context, or left pending
(docs/adr/0012-provisional-retrieval-and-model-derived-indexes.md).
Diagram source
%% caption: everything the agent or model writes is born a candidate; only a human key moves status, and the database refuses a move no human action signed
flowchart TD
HOOK["Host hook or<br/>MCP call"] --> EV["Event<br/>immutable"]
KEY["API key role"] --> AUTH{"authority<br/>trigger"}
AUTH --> EV
EV --> EXT["Extraction model<br/>Ollama or OpenAI"]
EXT --> CL["Claim<br/>status candidate"]
CL --> DUP{"same subject and<br/>predicate, overlap?"}
DUP -- "other value" --> REL["related_to case<br/>awaits review"]
CL --> RET["GET /claims<br/>org + exact scope"]
RET --> F{"status in candidate,<br/>active, verified,<br/>conflicted?"}
F -- "yes" --> CTX["Agent context,<br/>labelled untrusted"]
F -- "no" --> OUT["not delivered"]
HUM["Human key"] --> ACT["memory_action row<br/>trigger checks role"]
ACT --> ST["status change<br/>trigger checks action"]
ST --> CL
HUM --> REL3. Architecture
src/web/app.py is the service: organisations,
credentials, projects, branch scopes, events, claims, extraction,
retrieval, conflict review, explain, and read-only operator views for
the console. src/persistence/models.py is the schema and
the Alembic migrations add the triggers that carry the invariants.
src/memory/intelligence.py wraps extraction and embedding
for Ollama and OpenAI behind one protocol.
src/integrations/ holds the MCP server, the hook entry
points and the host installers; src/cli.py,
src/quickstart.py and src/local_server.py set
up either a Docker Compose stack or a user-owned PostgreSQL cluster
bound to loopback.
The MCP server is a thin HTTP client with an agent key and one fixed
scope (src/integrations/mcp_server.py:31-101). Every
authority decision stays in the REST service, as the module's first line
says.
Deployment and ergonomics
provena quickstart claude (or codex,
gemini) starts PostgreSQL and the API, creates an
organisation, a project, an agent key and a separate reviewer key,
installs the host hooks or plugin with the agent key, and writes the
reviewer key to the console's environment file
(src/cli.py:64-98, :600-623). The console
needs Docker; without it, review goes through the API. Extraction
defaults to a local Ollama model, and without one, recall falls back to
full-text search.
4. Essential Implementation Paths
- Authenticate.
current_credentialhashesX-API-Key, finds an unrevoked credential, andtenantreturns its organisation (src/web/app.py:91-105). - Capture. Hook →
POST /memories→create_eventwith the authority fromSOURCE_AUTHORITY, thenPOST /events/{id}/extract(src/integrations/hooks.py:31-56,src/web/app.py:221-236,:269-287). - Extract.
run_extraction: reuse a completed run for the same models, or call the model, create a candidate claim and an embedding per fact, and record the run; a failure is recorded too (src/web/app.py:289-316). - Create a claim.
create_claim: evidence in the same scope, status candidate, acreatedaction, then duplicate and conflict detection against peers with overlapping validity (src/web/app.py:243-267). - Retrieve.
retrieve_claims: organisation, scope and status filter, vector or full-text ranking, a retrieval event with its items, sources attached (src/web/app.py:475-504). - Review.
change_statusandreview_conflict, both behindrequire_human(src/web/app.py:382-396,:429-448). - Explain.
explain: evidence with credential role, relationships, reviews, actions, extraction runs and every retrieval that delivered the claim (src/web/app.py:506-547). - Inject.
context_runasks for five claims for the prompt and prepends the untrusted-memory notice (src/integrations/hooks.py:59-82).
5. Memory Data Model
event: scope, session, credential,source_kind(six values),authority(high, medium, low, ephemeral), an actor reference, a JSON payload of at most 64 KiB,recorded_at(src/persistence/models.py:100-112).claim: scope, subject, predicate, JSON value,status(nine values),status_version,valid_from,valid_to,recorded_at, with a check that the interval is ordered (:115-128).evidence: claim to event; a deferred trigger refuses a claim with none.claim_relationship: supports, contradicts, supersedes, derived_from, or the system'srelated_tofor a possible conflict, with a reason.conflict_review: one decision per case — contradiction, temporal change or dismissed — with the reviewer's credential and the superseding claim.memory_action: created, status_changed, possible_conflict, duplicate_detected, relationship_created, extracted; version, old and new status, reason, actor, credential (:204-217).extraction_run,claim_embedding: model-derived, append-only, one embedding per claim and model.retrieval_event,retrieval_item: each agent read and the claims it returned.
Times: recorded_at is set by the server. The validity
interval is supplied by the caller and may be open on either side.
Status transitions follow a fixed table; deleted can return
to candidate, and nothing leaves the table
(src/core/domain.py:89-99).
6. Retrieval Mechanics
GET /claims requires a scope in the caller's
organisation and keeps four statuses. With a query, it embeds the text
with the current model and orders by cosine distance among claims
embedded by that model at that dimension. When no model is configured,
or the embedding call fails, it matches stemmed English terms OR-ed
together over subject, predicate and value, ranked by
ts_rank (src/web/app.py:450-493). Without a
query it returns the newest claims. Every call writes a retrieval event
naming the method and the claims returned.
Scope is exact: a project read does not see its branches, and a
branch read does not see its project
(docs/adr/0003-tenant-scope.md). Validity is not a filter,
so a claim whose interval has ended is delivered until a person sets it
expired.
The hook asks for five claims per prompt and passes subject,
predicate, value, status and each source's kind and authority, under a
notice that the claims are untrusted, never permission to act, and that
candidate means pending human review
(src/integrations/hooks.py:77-79).
The poisoning benchmark's committed results ran full-text recall only
and say so (benchmarks/poisoning/RESULTS.md). No
retrieval-quality benchmark was found.
7. Write Mechanics
A hook records the user prompt as user_statement and the
final assistant message as assistant_inference, both with
the agent key, so both are low authority: the agent key attests to the
caller, not to the person quoted (docs/architecture.md:35).
Capture runs asynchronously and fails open.
Extraction is one model call per event, asking for durable facts and
refusing instructions, requests and the assistant's promises
(src/memory/intelligence.py:73-87, :104-110).
A completed run is reused for the same pair of models, so a retry does
not duplicate claims. Each fact becomes a candidate with an
extracted action naming the model and its confidence; the
confidence is recorded and never used to set status.
Duplicates are recorded, not merged. A claim with
the same subject, predicate and value and an overlapping interval gets a
duplicate_detected action; a different value gets a
related_to case for review
(src/web/app.py:258-266). Both claims stay, and both are
delivered.
Operational cost
Capture costs one extraction call and one embedding call per turn on the configured provider. Retrieval costs one embedding call per prompt. There is no consolidation, decay or summarisation pass.
8. Agent Integration
The MCP server registers seven tools: memory_context,
memory_search, memory_record_event,
memory_capture_turn, memory_remember,
memory_propose_claim and memory_explain
(src/integrations/mcp_server.py:104-145). None changes
status or decides a conflict; a test lists the registry and asserts it
(tests/test_integration.py:238-252).
memory_explain refuses a claim outside the configured scope
after fetching it.
The hooks do the routine work: context before each prompt, capture after each side of the turn. The server instructions ask the model to treat memory as untrusted and to confirm the candidate status when it remembers on request.
9. Reliability, Safety, and Trust
The gate is in the database
change_status checks the role in Python. Underneath it,
provena_claim_guard refuses any update to a claim that
changes the proposition, skips a version, or has no
memory_action row with that version and those statuses, and
refuses every delete. provena_status_action_guard refuses a
status_changed action unless its credential is an active
human credential in the same organisation. A committed test
tries the direct SQL route — an update to status, and a
forged action under the agent's credential — and requires both to fail
(tests/test_integration.py:122-147).
Human keys are minted only with the bootstrap token
(src/web/app.py:145-153); a test has the agent key try and
requires a 403 (tests/test_integration.py:189).
What reaches the agent before review
ADR 0012 admits candidates to retrieval, labelled, in place of ADR
0007's reviewed-only rule. The benchmark makes the consequence a
property: a fact planted through assistant output is delivered, as a
candidate with its real source, and stops being delivered only when a
person quarantines it
(benchmarks/poisoning/harness.py:131-155). The review gate
decides what is believed and what is removed; it does not decide what
the agent first sees.
Supersession is an edge
A reviewed temporal change adds supersedes and writes no
status (src/web/app.py:439-446); the architecture document
says neither decision silently changes status
(docs/architecture.md:31). The older claim stays
active and is delivered beside the later one until a person
also sets it superseded.
Keys and reach
Credentials are organisation-wide. Any key, an agent key included,
may read any scope in its organisation by id, and the
/operator/* views — every status, quarantined claims
included, and the audit trail — need no role
(src/web/app.py:549-735). The architecture document states
the first and calls project-level authorisation future work
(docs/architecture.md:35). Quickstart writes the reviewer
key and the bootstrap token to a 0600 file in the user's state directory
(src/quickstart.py:57-71, src/cli.py:600-623),
which the same account's agent shell can read.
Marks
trust_state— present. Nine statuses; agent retrieval drops five.bitemporal— present. Validity apart from record time, both immutable, compared at write time; set only by explicit callers.scope_enforced— present. Organisation from the key and an exact scope on every agent read; keys reach every scope in the organisation.audit_log— present. Seven append-only tables under triggers, and status that cannot move without a signed action.human_review— present. Status and conflict decisions need a human credential the agent's tools and key do not have; candidates are delivered before the decision.negative_eval— present. Populated isolation and quarantine absences.tombstone— withheld. A deleted or quarantined claim is a status, and the peer lookup on write excludesdeleted(src/web/app.py:258); the same value captured again is a new candidate.
10. Tests, Evals, and Benchmarks
The suite is pytest against a live PostgreSQL: 111 test functions
across integration (14 functions covering the full service), host setup,
plugins, hooks, the MCP error surface, quickstart and the local server.
CI runs it on every push against pgvector in a Docker service and,
separately, against system PostgreSQL 16, 17 and 18, after
alembic upgrade head and alembic check
(.github/workflows/ci.yml). The console has its own
typecheck, tests and build.
The poisoning harness runs 23 cases in four groups — planted through
assistant output, instructions smuggled into values, scope and tenant
isolation, and contradiction of a user's statement — and a test fails
the suite if any of its 127 checks fails
(tests/test_poisoning_benchmark.py:14-20). It states what
it does not prove: delivery of a planted fact is an expected result.
Cases to want first: a project read beside a populated neighbour scope in the harness; a supersession review followed by a read, asserting what the agent is given; and a re-captured deleted value.
No paper describes Provena; the benchmark's README cites three papers on memory poisoning as related work.
11. For Your Own Build
Steal
- Put the gate where the data is. A trigger that refuses a status change without a matching action row, and an action row without a human credential, survives every new handler and every script someone writes later.
- Derive authority from the key. A role-to-source table enforced on insert stops the caller choosing its own grade.
- Record every delivery. A retrieval event per read, joined to the claims it returned, answers "did the agent see this" — the question an incident asks first.
- Reuse a completed extraction for the same models. Idempotent capture costs one index.
Avoid
- Do not treat a supersedes edge as a supersession. If retrieval filters on status, a review that only adds an edge leaves both claims live.
- Do not hand the reviewer key to the agent's account by default. A separate OS user or a console-only secret closes what a 0600 file in the home directory leaves open.
- Do not make every row undeletable without an erasure path. Append-only evidence and a privacy request need a designed answer, not a trigger to drop.
Fit
Fits a team or a careful individual who wants every remembered claim traceable to words, a source grade and a reviewer, and who will review. The database design is worth reading whatever the product.
Walk away if the agent must not see unreviewed memory, if several users share an organisation and must not read each other's projects, or if captured conversations must be erasable on request.
12. Open Questions
- Whether a reviewed temporal change is meant to set the older claim superseded, given that retrieval filters on status.
- Whether candidates will become optional in retrieval for deployments that want review before first delivery.
- How erasure is meant to work over tables whose triggers refuse deletion.
- Why the README's example trail shows a validity interval on an extracted claim when extraction sets none at this commit.
Appendix: File Index
- Service:
src/web/app.py,src/web/policies.py,src/web/operator_views.py,src/web/schemas.py - Domain and schema:
src/core/domain.py,src/persistence/models.py - Triggers:
alembic/versions/ccc08f8f4372_initial_evidence_model.py,alembic/versions/9a7bce89dc4c_credentials_and_conflict_review.py,alembic/versions/b7e34c1f6a20_human_status_guard.py,alembic/versions/d4a2f19c8e01_extraction_and_semantic_memory.py - Extraction and embedding:
src/memory/intelligence.py - Agent surface:
src/integrations/mcp_server.py,src/integrations/hooks.py,src/integrations/capture.py,plugins/provena/ - Setup:
src/cli.py,src/quickstart.py,src/local_server.py - Decisions:
docs/adr/,docs/architecture.md - Tests:
tests/test_integration.py,tests/test_poisoning_benchmark.py,benchmarks/poisoning/harness.py
Recorded searches
Run from the repository root at the pinned commit with
/usr/bin/git grep.
- The MCP server holds no status verb.
git grep -n -E 'status|review|quarantin' -- src/integrations/mcp_server.pyreturns the HTTP error handling at:42-55, the server instructions at:107, and four tool descriptions that mention status or review; the seven@server.tool()functions callsearch,record_event,capture_turn,remember,propose_claimandexplain. - Only human-gated handlers write status.
git grep -n -E 'row.status *=' -- srcreturnssrc/web/app.py:393, insidechange_status. - Nothing erases content.
git grep -n -i -E 'erase|erasure|purge' -- src alembicreturns nothing;git grep -n -E 'DELETE FROM|db.delete' -- srcreturns nothing. - The write path ignores deleted claims.
git grep -n -F 'ClaimStatus.DELETED' -- srcreturns the transition table insrc/core/domain.py:90-98and the peer lookup atsrc/web/app.py:258, which excludes them. - Extraction sets no validity.
git grep -n -E 'valid_from' -- src/memory src/web/app.pyreturns thecreate_claimandrecord_memorypaths only;run_extractionatsrc/web/app.py:303passes none. - No paper.
CITATION.cffis absent;git grep -n -i -E 'arxiv|doi\.org|bibtex' -- .returns three related-work citations on memory poisoning inbenchmarks/poisoning/README.md:70-72and nothing else.
History
2026-12-03 — a91e03c3….
First reading, from the 2026-12-03 triage shortlist, at the head of
master. Screened: six auto-run surfaces (the Claude Code
marketplace and plugin manifests, the plugin's MCP and hook files, and
server.json); three dependency surfaces inside the
cooldown; two floating surfaces, one with no lockfile;
AGENTS.md read as data. Nothing was installed, built or
run, and none of the 111 test functions was run. Six marks (section 9).