Skip to main content

fabricatio-memory

MIT Python Versions PyPI Version PyPI Downloads PyPI Downloads Build Tool: uv

Memory management for Fabricatio agents — persistent, searchable long-term memory backed by a Tantivy full-text index in Rust.


Installation

pip install fabricatio[memory]
# or
uv pip install fabricatio[memory]

For a full installation including all optional packages:

pip install fabricatio[full]
# or
uv pip install fabricatio[full]

Overview

fabricatio-memory provides a persistent memory system for LLM agents. It combines a Rust-backed Tantivy search engine with Python-level agent capabilities to record, search, and recall information across sessions.

Memories are stored in named stores (independent Tantivy indexes). Each memory carries content, an importance score, tags, and is tracked for access frequency and recency — enabling relevance-boosted retrieval.

The Python layer wraps recording and recall through LLM integration: raw text is structured into a Note by the agent's LLM before storage, and recall queries return LLM-summarized results from the top matching memories.

Architecture

Python (capabilities)          Rust (storage engine)
┌─────────────────────┐       ┌──────────────────────┐
│ Remember            │──▶    │ MemoryStore          │
│  .record(raw)       │       │  .add_memory()       │
│  .recall(query)     │       │  .search_memories()  │
│ SelectiveRemember   │       │  .get_memory()       │
│  .sremember(…)      │       │  .update_memory()    │
└─────────────────────┘       │  .stats()            │
                              └──────────────────────┘
                                        │
                              ┌──────────────────────┐
                              │ MemoryService        │
                              │  .get_store(name)    │
                              │  .list_stores()      │
                              └──────────────────────┘

Key APIs

Rust backend (fabricatio_memory.rust)

Type Description
Memory A single memory entry: uuid, content, timestamp, importance (0–100), tags, access_count, last_accessed.
MemoryService(root, buffer_size, cache_size) Manages named stores. Creates/opens Tantivy indexes under root.
MemoryStore CRUD and search on one index.
MemoryStats Aggregated metrics: total_memories, avg_importance, avg_access_count, avg_age_days.

MemoryStore methods:

Method Description
add_memory(content, importance, tags) Store a new memory; returns its UUID.
get_memory(uuid) Retrieve by ID (updates access count).
update_memory(uuid, content?, importance?, tags?) Update fields; returns True if found.
delete_memory(uuid) Delete by ID.
search_memories(query, top_k, boost_recent) Full-text search, optionally boosting recent entries.
search_by_tags(tags, top_k) Filter by tags (OR semantics).
get_memories_by_importance(min, top_k) Filter by minimum importance.
get_recent_memories(days, top_k) Memories from the last N days.
get_frequently_accessed(top_k) Most-accessed memories first.
count_memories() Total stored documents.
stats() Aggregated MemoryStats.
write() Flush pending writes to disk.

All mutation methods accept an optional write=False parameter; when False, changes are buffered for performance. Call write() to commit.

Python capabilities (fabricatio_memory.capabilities)

Class Description
Remember Mixin providing record() and recall(). Uses the agent's LLM to structure raw text into a Note (content + importance + tags), then stores it. Recall searches the store and summarizes results via LLM.
SelectiveRemember Extends Remember with sremember() — conditionally records only when a judgment (powered by fabricatio-judge) deems the information worth keeping.

Models (fabricatio_memory.models)

Class Fields
Note content: str, importance: int (0–100), tags: List[str]. Pydantic model; LLM output target for record().

Configuration (fabricatio_memory.config)

MemoryConfig controls template paths, store root directory (~/.fabricatio-memory by default), writer buffer size (50 MB default), and index cache size (10 stores).

Service singleton (fabricatio_memory.inited_memory_service)

get_memory_service() returns a lazily-initialized MemoryService using the global MemoryConfig.

Usage

Direct store operations

from fabricatio_memory.rust import MemoryService

service = MemoryService("/path/to/store_root")
store = service.get_store("my_agent")

# Store a memory
mem_id = store.add_memory("User prefers dark mode", importance=70, tags=["preferences", "ui"])

# Search
results = store.search_memories("dark mode", top_k=5, boost_recent=True)
for mem in results:
    print(f"{mem.uuid}: {mem.content} (importance={mem.importance})")

# Stats
stats = store.stats()
print(stats.display())
# total: 42, avg importance: 55.3, avg access: 3.1, avg age: 12.4d

# Commit buffered writes
store.write()

Agent capability (LLM-integrated)

from fabricatio_memory.capabilities.remember import Remember
from fabricatio_memory.inited_memory_service import get_memory_service

class MyAgent(Remember, SomeBaseAgent):
    ...

agent = MyAgent(memory_store_name="agent_memories")
agent.mount_memory_store()

# Record — LLM extracts structured Note from raw text
note = await agent.record("The user said their name is Alice and they work at Acme Corp.")
# note.content = "User name is Alice, works at Acme Corp."
# note.importance = 60
# note.tags = ["user_info", "employment"]

# Recall — semantic search + LLM summarization
summary = await agent.recall("What do we know about Alice?")
# summary = "Alice works at Acme Corp. She prefers dark mode."

Selective memory

from fabricatio_memory.capabilities.selective_remember import SelectiveRemember

class MyAgent(SelectiveRemember, SomeBaseAgent):
    ...

# Only record if the agent judges it's worth remembering
note = await agent.sremember(
    prerequisite="Only remember if this contains personal user information",
    raw="The weather is sunny today."
)
# note is None — weather isn't personal info

Configuration

All options below are read through the fabricatio configuration chain (see the Configuration Guide). Set them under the [ext.memory] table in fabricatio.toml, equivalently under [tool.fabricatio.ext.memory] in pyproject.toml, or via FABRICATIO_EXT__MEMORY__<FIELD_UPPER> environment variables.

[ext.memory]
memory_store_root = "~/.fabricatio-memory"
Option Type Default Description
memory_record_template str "built-in/memory_record" Template for recording memory.
memory_recall_template str "built-in/memory_recall" Template for recalling memory.
sremember_template str "built-in/sremember" Template for selective remembering.
memory_store_root Path ~/.fabricatio-memory Root directory for memory store.
writer_buffer_size int 50000000 Buffer size for memory store writer. In bytes.
cache_size int 10 Cache size for memory store.

Access at runtime: from fabricatio_memory.config import memory_config.

Dependencies

  • fabricatio-core — core interfaces, configuration, template management
  • Optional: fabricatio-judge — required by SelectiveRemember for conditional recording

License

MIT — see LICENSE

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fabricatio_memory-0.3.7-cp314-cp314-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

fabricatio_memory-0.3.7-cp314-cp314-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio_memory-0.3.7-cp313-cp313-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

fabricatio_memory-0.3.7-cp313-cp313-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio_memory-0.3.7-cp312-cp312-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio_memory-0.3.7-cp312-cp312-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file fabricatio_memory-0.3.7-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 c80cf0844adefac793746a22793e87f7034e7cb92123d7731d1a6c3b317b931d
MD5 66f0b596b87e546d6b17f79c4e7ac68e
BLAKE2b-256 40a92fa6f4bc734c285340c19b2a008ab95fd2d3bdb4085c57824df461707b92

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b8b6c9fa8b7a30350680fc2982683e39d1eb446de9dd996637c4c7af9898bec6
MD5 923bfe5206f82dfcdbf6af13a22f91d6
BLAKE2b-256 3da8536bf4ffa9c94b500e8fc58f54a408d748ff123c56c6cc0e5ca2aaee7797

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 e266cc16a3ee8bbfc0e1810b5c9bfd410580c2534833d88a1b32e59f67cfaf42
MD5 cf43b679b02e143639a39f5d26258ccf
BLAKE2b-256 fc9440247e43465e048089feff8b03b15f61bf44548759a9a2b99faa2af2a30f

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e4eb88485c1772c0034193386bcaebe07f99ebeff8f0743fd12a90dd24a3420
MD5 d13d6b565245f78412490ad59b6ca1ed
BLAKE2b-256 a734a3b2f010ed6944cff0c560e03e314f4faa520da86e2aaa0bc0c9b3176159

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2d8a04453485546bf56c66277aaf5f8d5915bf7022888dfe022d1b5435730911
MD5 e37e6f46283338d96848f6a9e314f08e
BLAKE2b-256 25c36cfb7ac96e7595765dbbbe3461fe3eae4471cfb99984a989f4d0d25a839a

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 711dbe9bfd9bf37d5bd1fdb9648139265ae03c577575cd41d826f60dd1f28696
MD5 a3f7c6648914512f126f8ad385e48961
BLAKE2b-256 2e3a6ae9e1c77fed5a1a2fa47525974d1dffb5bdec0d101b3c1952bd2bb04457

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 aa4b8e2ed991f452235b092ed91c64e8ba4494a46a44c121ec1324ab9430e35b
MD5 21f2b1108039e9a4dc2ebbaa186d1369
BLAKE2b-256 30e4a5428ad3b0f8803488e06dae709f214b99790cbd5c6d6ecc5d2844641eb6

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf2ebf10425823586d798c0f4045c7ff4f55d3a75debbe16940b0bb71ccc6f8c
MD5 88201aaa482353f90fa20750c79eb9c7
BLAKE2b-256 2808af1aa85fe37ab77071c7ab2ef77ee155ef4c712c22e293590a6db2840b40

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a5fb5bea93be42148eeff43a10105bc444161ddfa3934e33584ec247db5a9329
MD5 f889a208e49be3ae3724f43167f33a26
BLAKE2b-256 154cf84c5ea26509e6546beed11817d73c8a6ec55246dcda75f05fc6105d73e6

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 358ef214fd72f88a49bdb75dfc3a83077ee4117c17266f9e459dff4cb176b4b3
MD5 013b79295bdcb196d6767e10fb64176f
BLAKE2b-256 9a577ff5eebbd86affe97c13e672778622624bebb85fd91f4893072d6b304d10

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 77d7987f3aad6146ae29a0038e7486a9716272ed592a04236f4fe188c968a57e
MD5 f7bbee17148e1c485c755841546be428
BLAKE2b-256 7d36e348e794cecf5f641615ec8b143ad8e3a66e1a23510a1016a84ddf7c0da8

See more details on using hashes here.

File details

Details for the file fabricatio_memory-0.3.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_memory-0.3.7-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fabricatio_memory-0.3.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d8dec447cdc1f187380c4fff7b471da13c9a16828b826fe5139c6a3c245a8462
MD5 c991196e14e33c0d513b634e520535b7
BLAKE2b-256 481e0c04cd037bffda9090a1762b6fa194c7d09a50e3356f0584d04d55163416

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.7 This release

12 files

0.3.6

12 files

0.3.5

12 files

0.3.3

12 files

0.3.2

12 files

0.3.1

12 files

0.2.10

12 files

0.2.9

12 files

0.2.8

12 files

0.2.7

12 files

0.2.6

12 files

0.2.5

8 files

0.2.4

8 files

0.2.3

8 files

0.2.2

8 files

0.1.1

8 files

0.1.0

4 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page