Generated banner for Memoripy v4
Generated logo for Memoripy v4

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.
— the description by Khazar Ayaz

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.

Folders
FolderRoleFiles
.githubagent-config4
docsdocs20
examplesexamples4
teststests11
benchmarksfolder3
memoripyfolder32

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

  1. 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
  2. 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
  3. Not scanned by AutoGineerAutoGineer could not scan everything it runs. https://pypi.org/project/memoripy/
  4. 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/api-reference.md

Memoripy v4 API reference

Memory

A small facade for the common workflow.

Memory(path=None, **client_kwargs)

Methods:

  • capture(text=None, **kwargs)

  • recall(query, **kwargs)

  • search(query, **kwargs)

  • write(key=..., value=..., **kwargs)

  • explain(memory_id)

  • correct(memory_id, value, **kwargs)

  • forget(memory_id, **kwargs)

  • audit()

MemoryClient

Construction
MemoryClient(
    repository=None,
    chat_model=None,
    embedding_model=None,
    extractor=None,
    pipeline=None,
)

MemoryClient.from_path(path, **kwargs)
Capture and writing
client.capture(
    messages=None,
    events=None,
    items=None,
    user_id=None,
    agent_id=None,
    run_id=None,
    project_id=None,
    organization_id=None,
    namespace=None,
    idempotency_key=None,
)

Returns evidence IDs, created and updated records, pending records, quarantined candidates, rejected candidates, admission decisions, and projection status.

client.write(
    kind,
    key,
    value,
    summary=None,
    subject=None,
    metadata=None,
    tags=None,
    entity_names=None,
    layer="semantic",
    observed_at=None,
    durability="durable",
    trust_level="authoritative",
    valid_from=None,
    valid_to=None,
    **scope,
)
client.search(
    query,
    limit=5,
    filters=None,
    include_trace=False,
    include_historical=False,
    as_of=None,
    expand_scope=True,
    track_usage=True,
    **scope,
)

Search results contain:

  • memory

  • score

  • rank_breakdown

  • retrieval_receipt

  • evidence

  • projection_status

Context
client.context.build(
    query=None,
    messages=None,
    limit=8,
    max_tokens=480,
    include_debug=False,
    include_trace=False,
    include_historical=False,
    as_of=None,
    context_policy="compact",
    **scope,
)

Returns a ContextPack.

Record operations
  • get(memory_id=...)

  • get_all(filters=None, **scope)

  • update(memory_id=..., data=..., idempotency_key=None)

  • correct(memory_id=..., value=..., reason=None, valid_from=None, idempotency_key=None)

  • delete(memory_id=..., idempotency_key=None)

  • forget(memory_id=..., idempotency_key=None)

  • delete_all(filters=None, idempotency_key=None, **scope)

  • history(memory_id=...)

  • explain(memory_id=...)

Quality and lifecycle
  • audit()

  • feedback(memory_id=..., outcome=...)

  • maintenance.consolidate(...)

  • recover() for file repositories

Supported feedback outcomes:

  • included

  • used

  • success

  • confirmed

  • corrected

  • rejected

  • failure

Import and export
  • export()

  • import_(payload, mode="merge" | "replace", idempotency_key=None)

AsyncMemoryClient

The asynchronous client mirrors MemoryClient and runs synchronous repository operations through asyncio.to_thread.

Configuration

AdmissionConfig

Controls confidence thresholds, assistant semantic writes, generated-summary writes, sensitive-data quarantine, external-instruction quarantine, evidence-span requirements, and admission-log retention.

RetrievalConfig

Controls reciprocal-rank fusion and lane weights for lexical, semantic, exact, entity, temporal, authority, activation, and policy retrieval.

BrainConfig

Controls attention mode, working-memory size, decay, dormancy, consolidation, and utility weighting.

MemoryPipelineConfig

Combines extractor, admission policy, reconciler, reranker, asset processor, brain, retrieval, and trace defaults.

Service

  • MemoryService

  • serve_http(...)

  • create_fastapi_app(...)

The service is a local-development surface unless the caller supplies deployment authentication, authorization, tenancy, and operational controls.

88 files · 62 not served here

Advantages

Limitations

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