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+.
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
- 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); 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_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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file abstractmemory-0.3.0.tar.gz.
File metadata
- Download URL: abstractmemory-0.3.0.tar.gz
- Upload date:
- Size: 916.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48e9d859c4a194a14fc329a3875058bab2d90f88014401b781a7126b436fa2a9
|
|
| MD5 |
db212849f9d9b7fce1e1de7693571d02
|
|
| BLAKE2b-256 |
9db4b8d0dc9a1253dcf1a40497d8fe84f16a5db13a34ae4cf3e64fd640e2b209
|
Provenance
The following attestation bundles were made for abstractmemory-0.3.0.tar.gz:
Publisher:
release.yml on lpalbou/AbstractMemory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abstractmemory-0.3.0.tar.gz -
Subject digest:
48e9d859c4a194a14fc329a3875058bab2d90f88014401b781a7126b436fa2a9 - Sigstore transparency entry: 2354333525
- Sigstore integration time:
-
Permalink:
lpalbou/AbstractMemory@861e0730e9ee92751a62a0119521732246f5a094 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/lpalbou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@861e0730e9ee92751a62a0119521732246f5a094 -
Trigger Event:
push
-
Statement type:
File details
Details for the file abstractmemory-0.3.0-py3-none-any.whl.
File metadata
- Download URL: abstractmemory-0.3.0-py3-none-any.whl
- Upload date:
- Size: 408.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1984dcd4b8623ef2c918e8bcd3ced43f1a67ddaaca7a2ba92f3d11ad17e458b
|
|
| MD5 |
cba14be8c1dfc21c83324c7e859aec85
|
|
| BLAKE2b-256 |
864630d1c05af7fe01fa8255659765aa2ca37a59e6701e66465658bafbc7591c
|
Provenance
The following attestation bundles were made for abstractmemory-0.3.0-py3-none-any.whl:
Publisher:
release.yml on lpalbou/AbstractMemory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abstractmemory-0.3.0-py3-none-any.whl -
Subject digest:
f1984dcd4b8623ef2c918e8bcd3ced43f1a67ddaaca7a2ba92f3d11ad17e458b - Sigstore transparency entry: 2354333599
- Sigstore integration time:
-
Permalink:
lpalbou/AbstractMemory@861e0730e9ee92751a62a0119521732246f5a094 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/lpalbou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@861e0730e9ee92751a62a0119521732246f5a094 -
Trigger Event:
push
-
Statement type: