Skip to main content

AbstractMemory

AbstractMemory is a Python library for durable, append-only agent memory. It provides two layers:

  • Layer 1 — triple truth: append-only, temporal, provenance-aware triple assertions with deterministic structured queries and optional vector/semantic retrieval, over in-memory, SQLite, or LanceDB backends.
  • Layer 2 — the memory system: a MemorySystem facade that turns those triples plus an append-only journal into a usage-weighted memory graph: typed record formation, stimulus-driven reconstruction (working memory that emerges from use), attention and decay, identity cores for long-lived entities, valence/gradation (how experience felt), diary conventions, sleep/consolidation, and a replay stream for observability.

Storage never decays and nothing is ever deleted; only retrieval strength changes. Reads are pure — rendering a memory does not strengthen it; only committed use does.

Status

Ecosystem (AbstractFramework)

AbstractMemory is a component of the AbstractFramework ecosystem. It has no dependency on AbstractCore or AbstractRuntime; embeddings for semantic retrieval can come from any OpenAI-compatible /embeddings endpoint (OpenAICompatTextEmbedder), from an AbstractGateway deployment (AbstractGatewayTextEmbedder), or from your own TextEmbedder implementation.

flowchart LR
  APP["Your app or agent"] --> MS["MemorySystem (layer 2)"]
  MS --> ST["Triple store (layer 1)"]
  MS --> J["Journal (append-only)"]
  ST --> IM["InMemoryTripleStore"]
  ST --> SQL["SQLiteTripleStore"]
  ST --> LDB["LanceDBTripleStore"]
  SQL --> F[("one SQLite file")]
  J --> F
  MS -. "optional embeddings" .-> E["TextEmbedder (OpenAI-compatible / Gateway / custom)"]

Related projects:

  • AbstractFramework: https://github.com/lpalbou/abstractframework
  • AbstractCore: https://github.com/lpalbou/abstractcore
  • AbstractRuntime: https://github.com/lpalbou/abstractruntime

Install

From source (recommended inside the AbstractFramework monorepo):

python -m pip install -e .

Optional LanceDB backend:

python -m pip install -e ".[lancedb]"

PyPI (packaged release):

python -m pip install AbstractMemory
python -m pip install "AbstractMemory[lancedb]"

The distribution name is AbstractMemory (pip is case-insensitive); the import name is abstractmemory. The [apple]/[gpu] extras are no-op compatibility aliases; [all], [all-apple], and [all-gpu] install the LanceDB backend.

Quick example — layer 1 (triples)

from abstractmemory import InMemoryTripleStore, TripleAssertion, TripleQuery

store = InMemoryTripleStore()
store.add([
    TripleAssertion(
        subject="Scrooge",
        predicate="related_to",
        object="Christmas",
        scope="session",
        owner_id="sess-1",
        provenance={"span_id": "span_123"},
    )
])

hits = store.query(TripleQuery(subject="scrooge", scope="session", owner_id="sess-1"))
assert hits[0].object == "christmas"      # terms are canonicalized (trim + lowercase)
assert hits[0].assertion_id is not None   # stores stamp read-side identity on results

Quick example — layer 2 (the memory system)

from abstractmemory import (
    MemorySystem, MemoryRecordInput, SQLiteTripleStore, SQLiteJournal, Stimulus,
)

store = SQLiteTripleStore("memory.sqlite3")
journal = SQLiteJournal("memory.sqlite3")   # sidecar tables in the same file
system = MemorySystem(store=store, journal=journal)

# Form a typed record (idempotent by key; forming is not using).
[record_id] = system.remember_many(
    [MemoryRecordInput(kind="episode", title="Pool outage",
                       digest="The connection pool saturated at noon.",
                       keywords=("pool", "outage"))],
    scope="session", owner_id="s1", idempotency_key="turn-1",
)

# Reconstruct working memory for a cue (pure read), then commit what you used.
result = system.reconstruct(Stimulus(cue_text="pool outage"), scopes=[("session", "s1")])
system.commit_selection(result.trace_id, [h.record_id for h in result.handles[:2]])

Documentation

Project

Design principles

  • Append-only, no deletion: updates are new assertions; belief revision is closure records (retract/supersede/reinterpreted); forgetting is decay of retrieval strength plus closures and silencing — the substrate is lossless.
  • Reads are pure: reconstruction, inspection, replay, and the entity card deposit nothing. commit_selection is the only strengthening path.
  • One seq axis: the journal assigns a monotonic seq to every record; any past state is reproducible by anchoring reads at as_of.
  • Works-or-loud: degraded paths are labeled #FALLBACK in result warnings; invalid inputs raise actionable errors instead of silently meaning something else.
  • No heavy dependencies: SQLite persistence and vector scoring use the standard library; LanceDB and embedders are optional.

Metadata

Release files for AbstractMemory 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AbstractMemory 0.3.2
File Size Uploaded Provenance
abstractmemory-0.3.2.tar.gz 917.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for AbstractMemory 0.3.2
File Interpreter ABI Platform
abstractmemory-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / abstractmemory-0.3.2.tar.gz

Download URL abstractmemory-0.3.2.tar.gz
Size 917.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4b664b1e362e64873b3a333d05619de5cbd1569fea85f64978c4e86ea0c4fecc
BLAKE2b-256 checksum
How to use checksums
fd80ce46ad3ab5c3d470b712905b01bd5341a071a98e7df6a7fdd8b6d9c3d213
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / abstractmemory-0.3.2-py3-none-any.whl

Download URL abstractmemory-0.3.2-py3-none-any.whl
Size 409.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70340d95b4209046c814a1e70683d54f6eb84333e15adf41902acea74766c004
BLAKE2b-256 checksum
How to use checksums
b5f4924c319b5306081ffff2506e9eb39efadcf876cafffb572a6ea460449262
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for AbstractMemory 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for abstractmemory-0.3.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page