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/admission-and-trust.md
Admission and trust
Why admission exists
Retrieval quality cannot repair a polluted memory store. V4 therefore treats automatic writing as a policy decision rather than a side effect of extraction.
Default source classes
user_messageassistant_messagesystem_instructiontool_resulttool_callassistant_actionexternal_documentretrieved_memorygenerated_summaryimported_recordexplicit_application_write
Applications should label sources accurately. Unknown source data receives conservative treatment.
Default trust levels
From strongest to weakest:
authoritativeuser_statedobservedderiveduntrusted_externalquarantined
A lower-authority source cannot silently replace a conflicting higher-authority current memory.
Default decisions
The default policy can return:
ADDDEFERREJECTQUARANTINE
Reconciliation can later convert an accepted candidate into MERGE or SUPERSEDE based on the canonical slot.
Important reason codes
RETRIEVED_MEMORY_REINGESTIONASSISTANT_SELF_REPORTSYSTEM_PROMPT_ECHOTRANSIENT_STATEINSUFFICIENT_EVIDENCELOW_CONFIDENCESENSITIVE_DATAUNTRUSTED_INSTRUCTIONCONTRADICTS_HIGHER_AUTHORITYSUBJECT_AMBIGUOUS
Custom policy
from memoripy import AdmissionDecision, MemoryAction, MemoryState
class MyPolicy:
def evaluate(self, *, candidate, evidence, state):
if candidate.kind == "policy" and evidence.source_type != "explicit_application_write":
return AdmissionDecision(
action=MemoryAction.QUARANTINE.value,
state=MemoryState.QUARANTINED.value,
reason_codes=["POLICY_REQUIRES_APPROVAL"],
trust_level="quarantined",
durability=candidate.durability,
)
# Delegate to another policy or return an explicit decision.Pass it through MemoryPipelineConfig(admission_policy=MyPolicy()).
Explicit writes
MemoryClient.write(...) is the preferred path for application-owned policies, constraints, and normalized facts. It still creates evidence and immutable versions, but the source is marked authoritative and explicit.
Sensitive evidence
The default policy can quarantine common secret patterns. This is a guardrail, not a complete data-loss-prevention system. Applications handling regulated or highly sensitive information should sanitize input before capture and implement retention rules outside the default library.
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