Memoripy v4
Memory server
Created by Khazar Ayaz
Published in caspianmoon/memoripy. Publisher page
691 GitHub stars
What it is
Evidence-first local memory for AI agents with temporal versions, admission policies, citations, explainable recall, MCP, and audit tooling.
AutoGineer overview, from the brain’s own files
Memoripy is an evidence-first memory runtime designed to provide AI agents with structured, verifiable, and persistent memory. It operates by capturing evidence and managing it through a lifecycle that includes admission, deferral, rejection, or quarantine of candidate memories. The system maintains both current and historical versions of data, allowing for temporal tracking. Retrieval is handled through independent lanes and rank fusion, ensuring that agents receive a scoped and cited context pack. Additionally, Memoripy includes audit tooling to provide transparency into what the system has remembered and the reasoning behind those memory decisions.
How it works
Memory model: Hybrid
AutoGineer overview, from the brain’s own files
The system functions as a memory runtime that processes information through six core operations: capturing evidence, applying admission policies to filter candidates, preserving temporal versions, retrieving data via rank fusion, building cited context packs, and auditing memory state. It utilizes a hybrid memory model and supports integration via an official MCP server, a CLI, and a REST API, with storage capabilities provided by PostgreSQL.
| Folder | Role | Files |
|---|---|---|
| .github | agent-config | 4 |
| docs | docs | 20 |
| examples | examples | 4 |
| tests | tests | 11 |
| benchmarks | folder | 3 |
| memoripy | folder | 32 |
Requirements
Runtimes: Python >=3.10
Databases: PostgreSQL
API keys (by name): MEMORIPY_API_KEY
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Google Antigravity, Kiro, OpenCode, Amp, Roo Code, Cline, JetBrains Junie, Devin (ex-Windsurf)
Set it up
This brain runs code automatically: 1 script. Review setup.py before opening the folder in Claude Code. No step below turns a hook on for you.
setup.py:python setup.py
- Not scanned by AutoGineerThe author’s README also describes installing it from a clone of its repository. Read its install section: AutoGineer did not scan that path. https://github.com/caspianmoon/memoripy/blob/42316ca5d49f7df3d91afbf93e65871b33c588ad/README.md#install-v4-from-source
- Not scanned by AutoGineerAutoGineer could not scan everything it runs. https://pypi.org/project/memoripy/
Created by Khazar Ayaz. Published in caspianmoon/memoripy. Licence: Apache License 2.0.
Usage
AutoGineer overview, from the brain’s own files
- Integrating memory into AI agents via the MCP server
- Managing memory lifecycles with admission and quarantine policies
- Auditing agent memory state for transparency
- Retrieving cited context for agent tasks
- Tracking historical memory versions
- “Retrieve all evidence regarding project X from the last month.”
- The system returns a cited context pack containing the relevant temporal versions of memories associated with project X.
- “Audit the memory admission for the recent user interaction.”
- The system provides an explanation of why the interaction was admitted or rejected based on the configured admission policies.
Documentation by Khazar Ayaz
Read the documentation at the source
docs/migration-v3-v4.md
Migrating from v3 to v4
Snapshot migration
V2 and v3 snapshots can be imported through the normal API:
snapshot = old_client.export()
new_client.import_(snapshot, mode="replace")Missing v4 fields receive conservative defaults. The resulting schema version is 4.
Run an audit immediately after migration:
memoripy audit ./.memoripy --html migration-audit.htmlBehavioral changes
Automatic writes are more conservative
Content that v3 stored may now be deferred, rejected, or quarantined. This is intentional. Inspect admission_decisions in capture results.
Assistant messages do not normally create user facts
V4 preserves assistant messages as evidence and episodes where appropriate, but does not treat assistant self-reports as trusted semantic user memory by default.
Retrieved memory cannot become new evidence
Any integration that feeds recalled context back into capture must label it as retrieved_memory. The default policy rejects it as a durable write.
Temporal history is explicit
Current search excludes expired versions. Use include_historical=True or a historical query when prior truth is required.
Scope supports more fields
Project, organization, and namespace are now first-class scope fields. Existing user, agent, and run behavior remains supported.
Retrieval uses rank fusion
V4 unions independent retrieval lanes. Score values are therefore not directly comparable to v3 weighted scores.
Corruption no longer becomes an empty store
A malformed file store raises MemoryCorruptionError. Restore with memoripy recover after inspecting the corrupt file.
API compatibility
The main v3 assistant flow remains:
client.capture(...)
client.context.build(...)
client.chat.completions.create(..., memory_strategy="v4")
client.maintenance.consolidate(...)memory_strategy="v3" is also accepted as a compatibility alias in the chat surface.
The legacy MemoryManager wrapper remains best-effort compatibility. New applications should use Memory or MemoryClient directly.
88 files · 62 not served here
- .dockerignore (not served here)
- .github/workflows/ci.yml (not served here)
- .github/workflows/compare-memory.yml (not served here)
- .github/workflows/mcp-smoke.yml (not served here)
- .github/workflows/publish-pypi.yml (not served here)
- .gitignore (not served here)
- ATTRIBUTION.md
- AUTOGINEER-RUNS.md
- CHANGELOG.md
- CONTRIBUTING.md
- Dockerfile (not served here)
- LICENSE
- README.md (not served here)
- SECURITY.md
- benchmarks/README.md (not served here)
- benchmarks/__init__.py (not served here)
- benchmarks/v4_contracts.json (not served here)
- docker-compose.gateway.yml (not served here)
- docs/admission-and-trust.md
- docs/api-reference.md
- docs/architecture.md
- docs/assistant-memory.md
- docs/assisted-extraction.md
- docs/audit-and-evals.md
- docs/brain-mode-and-maintenance.md
- docs/concepts.md
- docs/faq.md
- docs/getting-started.md
- docs/hosted-gateway.md
- docs/index.md
- docs/low-level-and-compatibility.md
- docs/mcp-server.md
- docs/migration-v3-v4.md
- docs/release-v0.4.0.md
- docs/releasing.md
- docs/service-and-storage.md
- docs/tuning-and-comparisons.md
- docs/v4-architecture.md
- examples/README.md (not served here)
- examples/assisted_extraction.py (not served here)
- examples/mcp_tokens.example.json (not served here)
- examples/v4_receipts.py (not served here)
- memoripy/__init__.py (not served here)
- memoripy/__main__.py (not served here)
- memoripy/admission.py (not served here)
- memoripy/assisted.py (not served here)
- memoripy/audit.py (not served here)
- memoripy/cli.py (not served here)
- memoripy/client.py (not served here)
- memoripy/comparisons.py (not served here)
- memoripy/engine.py (not served here)
- memoripy/evals.py (not served here)
- memoripy/extractors.py (not served here)
- memoripy/gateway.py (not served here)
- memoripy/implemented_models.py (not served here)
- memoripy/in_memory_storage.py (not served here)
- memoripy/inspector.py (not served here)
- memoripy/json_storage.py (not served here)
- memoripy/main.py (not served here)
- memoripy/mcp_server.py (not served here)
- memoripy/memory_manager.py (not served here)
- memoripy/memory_store.py (not served here)
- memoripy/model.py (not served here)
- memoripy/pipeline.py (not served here)
- memoripy/postgres_repository.py (not served here)
- memoripy/repository.py (not served here)
- memoripy/retrieval.py (not served here)
- memoripy/service.py (not served here)
- memoripy/storage.py (not served here)
- memoripy/temporal.py (not served here)
- memoripy/tenant.py (not served here)
- memoripy/tuning.py (not served here)
- memoripy/types.py (not served here)
- memoripy/utils.py (not served here)
- pyproject.toml (not served here)
- requirements.txt (not served here)
- setup.py (not served here)
- tests/test_assisted_temporal.py (not served here)
- tests/test_benchmarks.py (not served here)
- tests/test_mcp_integration.py (not served here)
- tests/test_mcp_tools.py (not served here)
- tests/test_memoripy_v2.py (not served here)
- tests/test_memoripy_v3.py (not served here)
- tests/test_memoripy_v4.py (not served here)
- tests/test_pipeline_features.py (not served here)
- tests/test_publish_workflow.py (not served here)
- tests/test_tenant_gateway.py (not served here)
- tests/test_tuning_comparisons.py (not served here)
Advantages
- Provides explainable recall and audit tooling to understand why specific information was remembered. evidence: docs/index.md
- Supports temporal versioning to track changes in memory over time. evidence: docs/index.md
Limitations
- Requires external configuration and setup for storage backends like PostgreSQL. evidence: pyproject.toml
Security
Risk level: Low risk
This brain runs
Install scripts (1)
setup.py:python setup.py
- Low risk: scripts-present (setup.py)
Attribution and licence
- Created by
- Khazar Ayaz
- Declared authors
- Khazar Ayaz (declared in pyproject.toml)
- Publisher
- Khazar Ayaz (Community)
- Source
- caspianmoon/memoripy · commit 42316ca
- Licence
- Apache License 2.0 (files served here)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Khazar Ayaz.
Install from source
62 of its files are not served here, so there is no ZIP. caspianmoon/memoripy at 42316ca