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
MemorySystemfacade 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
- Pre-1.0: the API is versioned and tested, and details may still evolve. The current version is in
pyproject.toml. - The authoritative export list is
src/abstractmemory/__init__.py;docs/api.mddocuments it. - Requires Python 3.10+.
What's new in 0.5.2
- Diary replay carries recorded resolution metadata, including target identifiers, with private titles omitted. Existing projections are not backfilled.
What's new in 0.5.1
community_keys_of/community_memberships_of: the membership-only topic read for every recalled record, tens of microseconds per call from the in-memory community index (the runtime's recall stamps use it).- A standing topic still pending its title or summary is authored in place by
communities_passwith the budget the changed topics leave, and its queued tasks move up to the topics' priority.
What's new in 0.5.0
- Every memory's title and summary is authored: memory's passes take a host
authorcallable, and a record whose authoring failed forms pending, with its task, until a reader completes it (retitle,rewrite_digest,declare_pending,rearm_pending). - A persistent task queue per home (
MemorySystem(task_queue=True)), ripple v1, and understanding rewritten in place with every earlier reading kept as a version. - Topics:
communityrecords formed during sleep, with provisional placement of each new record at formation. - The sleep cadence read
records_since_maintenance, and the Stop fence hookscommit_guardandwrite_barrier.
Upgrading from 0.4.x: see the "Upgrading" notes in CHANGELOG.md.
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]"
Fast vector search on the SQLite store (numpy; without it the store serves the same results from a labelled Python scan):
python -m pip install -e ".[fast]"
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; [fast] installs numpy for the SQLite store's vector matrix cache; [all], [all-apple], and [all-gpu] install the LanceDB backend and numpy.
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]])
The memory graph: revisions and provenance
abstractmemory.graph is the write path of a mind (0.4.0): every change to the graph is one Revision (a cause such as ingest, reinterpret or maintenance, plus assert / close / narrow operations applied together and atomically, once per revision id), and every memory must name where it came from in AbstractRuntime's ledger (a SourceRef to a run, a step (run_id, seq), an artifact, a message, an event or a diary entry) or the memories it was derived from; a write with neither is refused with ProvenanceRequired. MemoryGraph(store, journal) then answers history(memory_id) (asserted, closed, narrowed: by which revision and why), sources_of(memory_id), derived_from_source(ref), a lossless change feed revisions(after=cursor), and replay_into(...). The database is a connector behind the graph (abstractmemory.graph.backend): SQLite by default, LanceDB and in-memory held to the same conformance suite. See docs/api.md and the "Time axes" and "Provenance" sections of docs/memory-system.md.
Documentation
- Getting started:
docs/getting-started.md - Architecture:
docs/architecture.md - The memory system (cognitive model):
docs/memory-system.md - API reference:
docs/api.md - Stores/backends:
docs/stores.md - Operator guide (entity homes):
docs/operator.md - FAQ:
docs/faq.md - Troubleshooting:
docs/troubleshooting.md - Development:
docs/development.md
Project
- Changelog:
CHANGELOG.md - Contributing:
CONTRIBUTING.md - Code of conduct:
CODE_OF_CONDUCT.md - Security:
SECURITY.md - License:
LICENSE - Acknowledgments:
ACKNOWLEDGMENTS.md
Design principles
- Append-only, no deletion: updates are new assertions; belief revision is closure records (retract/supersede/reinterpreted/merged); forgetting is decay of retrieval strength plus closures and silencing — the substrate is lossless. The one mutable cell is a record's understanding:
rewrite_digestandretitlerewrite a digest or a title in place and keep every earlier reading as a version. - Reads are pure: reconstruction, inspection, replay, and the entity card deposit nothing.
commit_selectionis the only strengthening path. - One seq axis: the journal assigns a monotonic
seqto every record; any past state is reproducible by anchoring reads atas_of. - Works-or-loud: degraded paths are labeled
#FALLBACKin 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.
For AI agents
Register and use the AbstractMemory skill for scoped reads, provenance-aware writes and replay.
Metadata
Release files for AbstractMemory 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| abstractmemory-0.5.2.tar.gz | 1.5 MB | With provenance | Details for abstractmemory-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| abstractmemory-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for abstractmemory-0.5.2-py3-none-any.whl |
Total release size: 2.1 MB
Release files / abstractmemory-0.5.2.tar.gz
| Download URL | abstractmemory-0.5.2.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c907347d8146d8d4a40e32e9999f98278ee2834d500ec986ad2aabc82a244089
|
|
BLAKE2b-256 checksum How to use checksums |
d3dc1f13b0cfe0ec912569e53cbfdfaa8b2ec7498fe3ca6a171ee6f4e8050df0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 14, 2026.
Transparency logRelease files / abstractmemory-0.5.2-py3-none-any.whl
| Download URL | abstractmemory-0.5.2-py3-none-any.whl |
|---|---|
| Size | 627.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8df2a18a4226713d1955074ca3f57059f17e46fc5fc69be59cce0bfecb26fc6
|
|
BLAKE2b-256 checksum How to use checksums |
993c2ed61455b2cf83a7b8e08b044702257cb25eb08f0b6a3d1e9cbb60a15bd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 14, 2026.
Transparency logSecurity for AbstractMemory 0.5.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
Both files in this release have been uploaded with provenance metadata.
Attestation for abstractmemory-0.5.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 Nov 14, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.