provena-agent-memory 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. provena_agent_memory-0.1.0/LICENSE +21 -0
  2. provena_agent_memory-0.1.0/PKG-INFO +447 -0
  3. provena_agent_memory-0.1.0/README.md +399 -0
  4. provena_agent_memory-0.1.0/provena_agent_memory.egg-info/PKG-INFO +447 -0
  5. provena_agent_memory-0.1.0/provena_agent_memory.egg-info/SOURCES.txt +37 -0
  6. provena_agent_memory-0.1.0/provena_agent_memory.egg-info/dependency_links.txt +1 -0
  7. provena_agent_memory-0.1.0/provena_agent_memory.egg-info/entry_points.txt +7 -0
  8. provena_agent_memory-0.1.0/provena_agent_memory.egg-info/requires.txt +29 -0
  9. provena_agent_memory-0.1.0/provena_agent_memory.egg-info/top_level.txt +1 -0
  10. provena_agent_memory-0.1.0/pyproject.toml +80 -0
  11. provena_agent_memory-0.1.0/setup.cfg +4 -0
  12. provena_agent_memory-0.1.0/src/__init__.py +2 -0
  13. provena_agent_memory-0.1.0/src/api.py +5 -0
  14. provena_agent_memory-0.1.0/src/cli.py +232 -0
  15. provena_agent_memory-0.1.0/src/config.py +12 -0
  16. provena_agent_memory-0.1.0/src/core/__init__.py +1 -0
  17. provena_agent_memory-0.1.0/src/core/domain.py +99 -0
  18. provena_agent_memory-0.1.0/src/integrations/__init__.py +1 -0
  19. provena_agent_memory-0.1.0/src/integrations/capture.py +57 -0
  20. provena_agent_memory-0.1.0/src/integrations/capture_hook.py +14 -0
  21. provena_agent_memory-0.1.0/src/integrations/context_hook.py +14 -0
  22. provena_agent_memory-0.1.0/src/integrations/hooks.py +90 -0
  23. provena_agent_memory-0.1.0/src/integrations/mcp_server.py +132 -0
  24. provena_agent_memory-0.1.0/src/memory/__init__.py +5 -0
  25. provena_agent_memory-0.1.0/src/memory/intelligence.py +164 -0
  26. provena_agent_memory-0.1.0/src/persistence/__init__.py +5 -0
  27. provena_agent_memory-0.1.0/src/persistence/models.py +238 -0
  28. provena_agent_memory-0.1.0/src/py.typed +1 -0
  29. provena_agent_memory-0.1.0/src/web/__init__.py +1 -0
  30. provena_agent_memory-0.1.0/src/web/app.py +655 -0
  31. provena_agent_memory-0.1.0/src/web/operator_views.py +148 -0
  32. provena_agent_memory-0.1.0/src/web/policies.py +40 -0
  33. provena_agent_memory-0.1.0/src/web/schemas.py +121 -0
  34. provena_agent_memory-0.1.0/tests/test_agent_capture_hook.py +77 -0
  35. provena_agent_memory-0.1.0/tests/test_agent_context_hook.py +48 -0
  36. provena_agent_memory-0.1.0/tests/test_cli.py +29 -0
  37. provena_agent_memory-0.1.0/tests/test_domain.py +14 -0
  38. provena_agent_memory-0.1.0/tests/test_integration.py +481 -0
  39. provena_agent_memory-0.1.0/tests/test_intelligence.py +55 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aniket Kolte
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,447 @@
1
+ Metadata-Version: 2.4
2
+ Name: provena-agent-memory
3
+ Version: 0.1.0
4
+ Summary: Evidence-backed memory for AI agents
5
+ Author: Aniket Kolte
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/admiralpunk/Provena
8
+ Project-URL: Documentation, https://github.com/admiralpunk/Provena#readme
9
+ Project-URL: Repository, https://github.com/admiralpunk/Provena.git
10
+ Project-URL: Issues, https://github.com/admiralpunk/Provena/issues
11
+ Keywords: ai-agents,memory,mcp,provenance,audit
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: httpx<1,>=0.27
22
+ Requires-Dist: mcp<3,>=2
23
+ Provides-Extra: server
24
+ Requires-Dist: fastapi<1,>=0.115; extra == "server"
25
+ Requires-Dist: uvicorn<1,>=0.30; extra == "server"
26
+ Requires-Dist: pydantic-settings<3,>=2.5; extra == "server"
27
+ Requires-Dist: sqlalchemy<3,>=2.0; extra == "server"
28
+ Requires-Dist: psycopg[binary]<4,>=3.2; extra == "server"
29
+ Requires-Dist: alembic<2,>=1.13; extra == "server"
30
+ Requires-Dist: openai<3,>=2; extra == "server"
31
+ Requires-Dist: pgvector<1,>=0.3; extra == "server"
32
+ Provides-Extra: release
33
+ Requires-Dist: build<2,>=1.2; extra == "release"
34
+ Requires-Dist: setuptools>=75; extra == "release"
35
+ Requires-Dist: twine<7,>=6; extra == "release"
36
+ Requires-Dist: wheel>=0.45; extra == "release"
37
+ Provides-Extra: test
38
+ Requires-Dist: pytest<10,>=8; extra == "test"
39
+ Requires-Dist: fastapi<1,>=0.115; extra == "test"
40
+ Requires-Dist: uvicorn<1,>=0.30; extra == "test"
41
+ Requires-Dist: pydantic-settings<3,>=2.5; extra == "test"
42
+ Requires-Dist: sqlalchemy<3,>=2.0; extra == "test"
43
+ Requires-Dist: psycopg[binary]<4,>=3.2; extra == "test"
44
+ Requires-Dist: alembic<2,>=1.13; extra == "test"
45
+ Requires-Dist: openai<3,>=2; extra == "test"
46
+ Requires-Dist: pgvector<1,>=0.3; extra == "test"
47
+ Dynamic: license-file
48
+
49
+ <p align="center">
50
+ <img src="frontend/public/logo.svg" width="96" height="96" alt="Provena logo">
51
+ </p>
52
+
53
+ <!-- mcp-name: io.github.admiralpunk/provena-memory -->
54
+
55
+ <h1 align="center">Provena</h1>
56
+
57
+ <p align="center">
58
+ <strong>Evidence-backed persistent memory for AI agents.</strong><br>
59
+ Know what an agent remembers, where it came from, and why it was retrieved.
60
+ </p>
61
+
62
+ Provena gives Codex, Claude Code, Gemini CLI, custom agents, and other MCP clients a shared long-term memory layer with explicit provenance. It stores source events separately from structured claims, links every claim to immutable evidence, records review and retrieval history, and keeps source authority separate from semantic relevance.
63
+
64
+ The result is agent context that can be inspected, challenged, scoped, and explained instead of an opaque collection of vector matches.
65
+
66
+ ## Product Demo
67
+
68
+ > **Loom walkthrough coming soon.**
69
+ >
70
+ > Replace this block with a linked Loom thumbnail or embedded preview. The surrounding section is intentionally ready for the final demo asset.
71
+
72
+ ## What is Provena?
73
+
74
+ Provena is a memory service and integration harness for AI-assisted development workflows. It sits between an agent host and durable storage through REST, MCP, or lifecycle hooks.
75
+
76
+ The harness is responsible for:
77
+
78
+ - capturing selected user and assistant turns as immutable source events;
79
+ - accepting explicit, structured memories from an agent or application;
80
+ - extracting candidate facts with a configured local or hosted model;
81
+ - retrieving relevant claims from one exact organization and scope;
82
+ - returning source attribution, status, and authority with retrieved context; and
83
+ - recording which claims were delivered during each retrieval.
84
+
85
+ Provena does **not** execute an agent's code or tasks. Its role in the execution context is to make memory capture and context assembly traceable. Retrieval records improve reproducibility by showing which stored claims were supplied to an agent, but Provena does not currently replay a model run or prove that a retrieved claim influenced a later action.
86
+
87
+ ### Core model
88
+
89
+ | Record | Meaning |
90
+ | --- | --- |
91
+ | **Event** | Immutable source material, such as a user statement, assistant inference, hypothesis, or tool observation. |
92
+ | **Claim** | A structured proposition: subject, predicate, JSON value, validity interval, and review state. |
93
+ | **Evidence** | An immutable link from a claim to the event that supports it. |
94
+ | **Memory action** | An append-only status transition or review decision with actor, reason, and version. |
95
+ | **Claim relationship** | A typed link such as `supports`, `contradicts`, `supersedes`, `derived_from`, or `related_to`. |
96
+ | **Retrieval event** | An audit record of a query and the exact claims returned to an agent. |
97
+ | **Scope** | An exact organization, project, or branch boundary for stored and retrieved memory. |
98
+
99
+ Claims can be candidates, active, verified, conflicted, superseded, quarantined, expired, ephemeral, or deleted. Changing state never erases the claim's source evidence.
100
+
101
+ ## Why Provenance Matters
102
+
103
+ Agent memory can be relevant and still be wrong, stale, speculative, or malicious. A vector result alone cannot answer who asserted a fact, what the original source said, whether a human reviewed it, or which execution context received it.
104
+
105
+ Provena preserves those distinctions:
106
+
107
+ - **Traceability:** `memory_explain` follows a claim back to its source event, credential, extraction run, relationships, status history, and recorded retrievals.
108
+ - **Verification:** human credentials review state transitions; agent-generated summaries cannot promote themselves into high-authority facts.
109
+ - **Auditability:** events, evidence links, relationships, and memory actions are append-only.
110
+ - **Temporal clarity:** recorded time and fact-validity time are stored separately.
111
+ - **Conflict awareness:** overlapping claims with different values remain visible until a reviewer records a contradiction, temporal change, or dismissal.
112
+ - **Isolation:** tenant-owned records include organization IDs, and retrieval requires an exact scope.
113
+ - **Security:** remembered content is treated as untrusted data and never grants permission to perform an action.
114
+
115
+ PostgreSQL is the authoritative system of record. pgvector embeddings are derived indexes; they do not replace evidence or determine authority.
116
+
117
+ ## How Provena Works
118
+
119
+ ```mermaid
120
+ flowchart LR
121
+ A[Agent, CLI, or host application] --> B[REST, MCP, or lifecycle hook]
122
+ B --> C[Provena capture and retrieval harness]
123
+ C --> D[FastAPI policy and transaction boundary]
124
+ D --> E[(PostgreSQL + pgvector)]
125
+ C --> F[Ollama or OpenAI\noptional extraction and embeddings]
126
+ E --> G[Attributed context or explain response]
127
+ G --> A
128
+ E --> H[Next.js operator console]
129
+ ```
130
+
131
+ A typical write and retrieval flow is:
132
+
133
+ ```text
134
+ source turn or explicit memory
135
+ → immutable event
136
+ → candidate claim linked through evidence
137
+ → duplicate and conflict checks
138
+ → optional human review
139
+ → exact-scope semantic retrieval
140
+ → attributed context plus retrieval audit record
141
+ ```
142
+
143
+ Model output never raises source authority or activates a claim. Candidate claims may be returned as clearly marked provisional context until a human promotes, quarantines, or deletes them.
144
+
145
+ ## Use Cases
146
+
147
+ - **Cross-session agent memory:** share reviewed project facts or user constraints across Codex, Claude Code, Gemini CLI, and custom clients using the same organization and scope.
148
+ - **Explainable preferences:** preserve a statement such as a dietary restriction and show the exact event behind the structured preference.
149
+ - **Architecture memory:** record decisions such as a production database, runtime, or deployment policy with validity time and source evidence.
150
+ - **Conflict review:** distinguish a contradiction from a temporal migration or a fact that belongs to another environment.
151
+ - **Branch experiments:** isolate feature-branch facts in a branch scope so they do not silently enter project-scope retrieval.
152
+ - **Context auditing:** inspect the exact claims delivered in an agent retrieval without treating operator browsing as another agent retrieval.
153
+
154
+ ## Getting Started
155
+
156
+ ### Fastest self-hosted release setup
157
+
158
+ Published releases provide prebuilt API and console images. Download the three deployment files from the matching GitHub release, then create local configuration:
159
+
160
+ ```bash
161
+ mkdir provena && cd provena
162
+ curl -LO https://github.com/admiralpunk/Provena/releases/download/v0.1.0/compose.yaml
163
+ curl -LO https://github.com/admiralpunk/Provena/releases/download/v0.1.0/compose.ollama.yaml
164
+ curl -Lo .env.example https://github.com/admiralpunk/Provena/releases/download/v0.1.0/.env.example
165
+ cp .env.example .env
166
+ ```
167
+
168
+ Generate separate values for `POSTGRES_PASSWORD` and `BOOTSTRAP_TOKEN`, place them in `.env`, and start core mode:
169
+
170
+ ```bash
171
+ python -c 'import secrets; print(secrets.token_urlsafe(32))'
172
+ docker compose up -d postgres api
173
+ docker compose exec api provena status --api-url http://127.0.0.1:8000
174
+ docker compose exec api provena init --format shell
175
+ ```
176
+
177
+ Core mode supports explicit memories and review without downloading a model. To enable local automatic extraction and semantic retrieval, add the Ollama override:
178
+
179
+ ```bash
180
+ docker compose -f compose.yaml -f compose.ollama.yaml up -d
181
+ ```
182
+
183
+ Save the one-time credentials printed by `provena init`. Add the human key and scope ID to `.env` before starting the optional console profile. See [`deploy/README.md`](deploy/README.md) for upgrades and backups.
184
+
185
+ ### Prerequisites
186
+
187
+ For local development:
188
+
189
+ - Python 3.12 or newer
190
+ - Node.js 20 or newer and npm
191
+ - Docker Engine with Docker Compose, used for PostgreSQL and local Ollama
192
+ - `curl`
193
+
194
+ For the containerized setup, only Docker Engine, Docker Compose, and `curl` are required.
195
+
196
+ ```bash
197
+ git clone https://github.com/admiralpunk/Provena.git
198
+ cd Provena
199
+ ```
200
+
201
+ ### Option 1: Run Locally
202
+
203
+ Install the Python service and its MCP and test dependencies:
204
+
205
+ ```bash
206
+ python3 -m venv .venv
207
+ .venv/bin/pip install -e '.[server,test]'
208
+ cp .env.example .env
209
+ ```
210
+
211
+ Set a private `BOOTSTRAP_TOKEN` in `.env`, then start PostgreSQL and Ollama and install the default local models:
212
+
213
+ ```bash
214
+ docker compose up -d postgres ollama
215
+ docker compose exec ollama ollama pull qwen2.5:1.5b
216
+ docker compose exec ollama ollama pull nomic-embed-text
217
+ ```
218
+
219
+ Migrate the database and start the API:
220
+
221
+ ```bash
222
+ set -a
223
+ source .env
224
+ set +a
225
+ .venv/bin/alembic upgrade head
226
+ .venv/bin/uvicorn provena.api:app --reload --host 127.0.0.1 --port 8000
227
+ ```
228
+
229
+ The API is now available at `http://127.0.0.1:8000`; interactive OpenAPI documentation is at `http://127.0.0.1:8000/docs`. Verify API and database readiness with:
230
+
231
+ ```bash
232
+ .venv/bin/provena status
233
+ ```
234
+
235
+ In a second Bash terminal, load the same configuration and create a local organization, project scope, agent credential, and human review credential:
236
+
237
+ ```bash
238
+ set -a
239
+ source .env
240
+ set +a
241
+ eval "$(.venv/bin/provena init --format shell)"
242
+ ```
243
+
244
+ The bootstrap credentials are returned once and exported only in the current shell. Start the operator console with the human credential:
245
+
246
+ ```bash
247
+ cat > frontend/.env.local <<EOF
248
+ PROVENA_API_URL=http://127.0.0.1:8000
249
+ PROVENA_API_KEY=$PROVENA_HUMAN_KEY
250
+ PROVENA_SCOPE_ID=$PROVENA_SCOPE_ID
251
+ EOF
252
+
253
+ cd frontend
254
+ npm ci
255
+ npm run dev
256
+ ```
257
+
258
+ Open `http://127.0.0.1:3000/overview?scope=$PROVENA_SCOPE_ID`.
259
+
260
+ ### Option 2: Run with Docker
261
+
262
+ <details>
263
+ <summary>Upgrading from the earlier Compose file without a named PostgreSQL volume?</summary>
264
+
265
+ Back up the existing database before the first restart with this Compose file, then restore it into the new named volume:
266
+
267
+ ```bash
268
+ docker compose exec -T postgres pg_dump -U provena -Fc provena > provena-before-volume.dump
269
+ docker compose down
270
+ docker compose up -d postgres
271
+ until docker compose exec -T postgres pg_isready -U provena -d provena; do sleep 1; done
272
+ docker compose exec -T postgres pg_restore -U provena --clean --if-exists --no-owner -d provena < provena-before-volume.dump
273
+ ```
274
+
275
+ </details>
276
+
277
+ Copy the environment template and replace `BOOTSTRAP_TOKEN` with a private value:
278
+
279
+ ```bash
280
+ cp .env.example .env
281
+ docker compose up --build -d
282
+ ```
283
+
284
+ The first start downloads the configured Ollama extraction and embedding models. Follow progress and verify the API:
285
+
286
+ ```bash
287
+ docker compose logs -f ollama-models api
288
+ curl -fsS http://127.0.0.1:8000/openapi.json > /dev/null && echo "Provena API is ready"
289
+ ```
290
+
291
+ Press `Ctrl+C` after the services are ready; the containers continue running in the background.
292
+
293
+ Create the initial workspace from inside the API container:
294
+
295
+ ```bash
296
+ eval "$(docker compose exec -T api python scripts/bootstrap_workspace.py --format shell)"
297
+ ```
298
+
299
+ Then start the console profile with the issued human credential and project scope:
300
+
301
+ ```bash
302
+ PROVENA_API_KEY="$PROVENA_HUMAN_KEY" \
303
+ PROVENA_SCOPE_ID="$PROVENA_SCOPE_ID" \
304
+ docker compose --profile console up --build -d console
305
+ ```
306
+
307
+ Open:
308
+
309
+ - API documentation: `http://127.0.0.1:8000/docs`
310
+ - Operator console: `http://127.0.0.1:3000/overview?scope=$PROVENA_SCOPE_ID`
311
+
312
+ Stop the stack without deleting memory:
313
+
314
+ ```bash
315
+ docker compose --profile console stop
316
+ ```
317
+
318
+ PostgreSQL and Ollama use named volumes. Add `docker compose --profile console down --volumes` only when you intentionally want to destroy the local database and downloaded models.
319
+
320
+ ## Connect an AI Agent
321
+
322
+ The published connector can run in an isolated environment through `uvx`; users do not need to clone Provena or install the server package. Generate a configuration using the **agent** credential and one exact scope:
323
+
324
+ ```bash
325
+ export PROVENA_API_URL=http://127.0.0.1:8000
326
+ export PROVENA_API_KEY=paste-agent-key
327
+ export PROVENA_SCOPE_ID=paste-project-or-branch-scope-id
328
+ uvx --from provena-agent-memory provena connect codex
329
+ ```
330
+
331
+ Use `claude`, `gemini`, or `generic` instead of `codex` to print the corresponding JSON configuration. The resulting MCP command uses:
332
+
333
+ ```json
334
+ {
335
+ "command": "uvx",
336
+ "args": ["--from", "provena-agent-memory", "provena-mcp"],
337
+ "env": {
338
+ "PROVENA_API_URL": "http://127.0.0.1:8000",
339
+ "PROVENA_API_KEY": "paste-agent-key",
340
+ "PROVENA_SCOPE_ID": "paste-project-or-branch-scope-id"
341
+ }
342
+ }
343
+ ```
344
+
345
+ After adding the configuration, verify the same credential and scope independently:
346
+
347
+ ```bash
348
+ uvx --from provena-agent-memory provena doctor
349
+ ```
350
+
351
+ The MCP adapter exposes:
352
+
353
+ - `memory_context` and `memory_search` for attributed retrieval;
354
+ - `memory_record_event` and `memory_capture_turn` for source capture;
355
+ - `memory_remember` and `memory_propose_claim` for evidence-backed candidate claims; and
356
+ - `memory_explain` for provenance, review, conflict, and retrieval history.
357
+
358
+ Agent keys can create events and candidate claims. Only human credentials can review claim status or resolve conflicts. Host sessions provide provenance labels; they do not create separate memory stores. See [ADR 0014](docs/adr/0014-model-agnostic-agent-integration.md) for the model-agnostic integration boundary.
359
+
360
+ ## Configuration
361
+
362
+ ### Service and model settings
363
+
364
+ | Variable | Default | Purpose |
365
+ | --- | --- | --- |
366
+ | `DATABASE_URL` | `postgresql+psycopg://provena:provena_dev@localhost:5437/provena` | SQLAlchemy connection for the authoritative PostgreSQL store. |
367
+ | `BOOTSTRAP_TOKEN` | empty | Local trust anchor for creating organizations and issuing, rotating, or revoking credentials. Required for bootstrap operations. |
368
+ | `MEMORY_PROVIDER` | `ollama` | Memory intelligence provider: `ollama`, `openai`, or `none`. |
369
+ | `OLLAMA_BASE_URL` | `http://127.0.0.1:11434` | Ollama HTTP endpoint. Compose overrides this with the internal service address. |
370
+ | `EXTRACTION_MODEL` | `qwen2.5:1.5b` | Fact extraction model. Provider-prefixed model names are stored as provenance. |
371
+ | `EMBEDDING_MODEL` | `nomic-embed-text` | Embedding model used for semantic retrieval. |
372
+ | `OPENAI_API_KEY` | empty | Required only when `MEMORY_PROVIDER=openai`. |
373
+
374
+ ### Console, MCP, and hook settings
375
+
376
+ | Variable | Purpose |
377
+ | --- | --- |
378
+ | `PROVENA_API_URL` | Base URL of the Provena REST API. |
379
+ | `PROVENA_API_KEY` | Server-side console or agent credential. Never expose it as a `NEXT_PUBLIC_` variable. |
380
+ | `PROVENA_SCOPE_ID` | Exact project or branch scope used for capture and retrieval. |
381
+ | `PROVENA_AGENT_HOST` | Optional host label used by portable lifecycle hooks for session provenance. |
382
+
383
+ Use a human credential for the local console if you need review and conflict actions. Use an agent credential for MCP and automatic capture. Do not give a conversational agent the human review key.
384
+
385
+ ## Development
386
+
387
+ Start only the development dependencies:
388
+
389
+ ```bash
390
+ docker compose up -d postgres ollama
391
+ ```
392
+
393
+ Create and migrate the disposable integration-test database, then run the deterministic suite:
394
+
395
+ ```bash
396
+ docker compose exec -T postgres sh -c 'createdb -U provena provena_test 2>/dev/null || true'
397
+ DATABASE_URL=postgresql+psycopg://provena:provena_dev@127.0.0.1:5437/provena_test \
398
+ .venv/bin/alembic upgrade head
399
+ TEST_DATABASE_URL=postgresql+psycopg://provena:provena_dev@127.0.0.1:5437/provena_test \
400
+ .venv/bin/pytest -q
401
+ ```
402
+
403
+ Validate migrations and the frontend production build:
404
+
405
+ ```bash
406
+ DATABASE_URL=postgresql+psycopg://provena:provena_dev@127.0.0.1:5437/provena_test \
407
+ .venv/bin/alembic check
408
+ cd frontend
409
+ npm run typecheck
410
+ npm run build
411
+ ```
412
+
413
+ Model-dependent behavior is isolated behind the memory intelligence interface. Deterministic tests use fake transports and do not require model calls.
414
+
415
+ ## Project Structure
416
+
417
+ ```text
418
+ src/
419
+ core/ domain enums and state-transition rules
420
+ persistence/ SQLAlchemy mappings and database invariants
421
+ memory/ extraction and embedding providers
422
+ integrations/ MCP, conversation capture, and host lifecycle hooks
423
+ web/ FastAPI routes, policies, schemas, and operator projections
424
+ alembic/ versioned PostgreSQL migrations
425
+ frontend/ Next.js operator console
426
+ scripts/ local setup helpers
427
+ deploy/ versioned self-hosted release Compose files
428
+ docs/adr/ durable architecture decisions
429
+ examples/ deterministic MCP client flow
430
+ tests/ domain and real-PostgreSQL integration tests
431
+ compose.yaml local PostgreSQL, Ollama, API, and optional console stack
432
+ server.json official MCP Registry package metadata
433
+ ```
434
+
435
+ Read [the architecture guide](docs/architecture.md) for current guarantees and limits. Accepted decisions live in [`docs/adr/`](docs/adr/).
436
+
437
+ ## Current Limits
438
+
439
+ Provena currently uses exact-scope retrieval; branch inheritance and cross-scope promotion are not implemented. It records claim delivery but not whether an agent action was caused by that claim. Binary artifact storage, production identity federation, semantic duplicate resolution, automatic temporal resolution, and a general task execution sandbox are outside the current implementation.
440
+
441
+ Raw event payloads, claims, evidence, actions, extraction metadata, embeddings, and retrieval membership are stored in PostgreSQL. This keeps the provenance transaction atomic while broader artifact storage remains deferred.
442
+
443
+ ## Contributing
444
+
445
+ Keep changes small and preserve the evidence and tenant-boundary invariants. Use Alembic for schema changes, add real PostgreSQL coverage for database guarantees, and record durable architecture decisions in `docs/adr/`. Run the backend tests, frontend type check, and production build before opening a change.
446
+
447
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the contributor workflow, [SECURITY.md](SECURITY.md) for private vulnerability reporting, and [CHANGELOG.md](CHANGELOG.md) for release history.