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

Metadata

Release files for fabricatio-memory 0.3.8

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

Built distributions (wheels)

Table of built distributions (wheels) for fabricatio-memory 0.3.8
File Actions
fabricatio_memory-0.3.8-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for fabricatio_memory-0.3.8-cp314-cp314-win_amd64.whl
fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ x86-64 Details for fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_x86_64.whl
fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ ARM64 Details for fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_aarch64.whl
fabricatio_memory-0.3.8-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for fabricatio_memory-0.3.8-cp314-cp314-macosx_11_0_arm64.whl
fabricatio_memory-0.3.8-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for fabricatio_memory-0.3.8-cp313-cp313-win_amd64.whl
fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details for fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_x86_64.whl
fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ ARM64 Details for fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_aarch64.whl
fabricatio_memory-0.3.8-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for fabricatio_memory-0.3.8-cp313-cp313-macosx_11_0_arm64.whl
fabricatio_memory-0.3.8-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for fabricatio_memory-0.3.8-cp312-cp312-win_amd64.whl
fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_x86_64.whl
fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ ARM64 Details for fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_aarch64.whl
fabricatio_memory-0.3.8-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for fabricatio_memory-0.3.8-cp312-cp312-macosx_11_0_arm64.whl

Total release size: 76.2 MB

Release files / fabricatio_memory-0.3.8-cp314-cp314-win_amd64.whl

Download URL fabricatio_memory-0.3.8-cp314-cp314-win_amd64.whl
Size 6.1 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
f7893a6c16dc7a857563f6b9d79bcef7217ea3c2a47c219625329ca641df5bbd
BLAKE2b-256 checksum
How to use checksums
840884760621b28f9503364f5210885f6de82efec6c217c8e3637a7cdc6df27a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_x86_64.whl
Size 6.9 MB
Tags CPython 3.14 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
4dd76284e4f317778c394ba2fdca8bb8ee6a057944ae17da5979ee97d254f2be
BLAKE2b-256 checksum
How to use checksums
e43d7516e04076f291acf631e9d695e83ae8d03c9a990d489f68d4b9df1f4d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_aarch64.whl

Download URL fabricatio_memory-0.3.8-cp314-cp314-manylinux_2_34_aarch64.whl
Size 6.2 MB
Tags CPython 3.14 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
ea46dd0e119a2c22f823beb09fa18b9ceebd7ee9c300443a78041890276e0460
BLAKE2b-256 checksum
How to use checksums
c458363503c480d2592223ca57573ff424799d9f8319e923cbf9c8ef6aebf1c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp314-cp314-macosx_11_0_arm64.whl

Download URL fabricatio_memory-0.3.8-cp314-cp314-macosx_11_0_arm64.whl
Size 6.2 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6a0e19901f3c3e4f44898aefb0bd548906281795ac5908a533b9cab229167acb
BLAKE2b-256 checksum
How to use checksums
eb0940dc9b001c55a672843ea88d908c40761581e540324698b82d89006f2355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp313-cp313-win_amd64.whl

Download URL fabricatio_memory-0.3.8-cp313-cp313-win_amd64.whl
Size 6.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
1bfdc62e369a6a6f1b39e507d3cd63da4d928bff3e4f0f80f21f6ed6cf4b6197
BLAKE2b-256 checksum
How to use checksums
8a33fadce5d9f79fc420fdab56fbaf9157fbc1fcd3a83a1bc68d172a9c53feee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_x86_64.whl
Size 6.9 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
815d81e2ee81d17d6d0cd97366c9f6094de08024f2d1e38bfdf448d278ecdb83
BLAKE2b-256 checksum
How to use checksums
d50f21af5ef2111ef63b539a37f16d979bb30c6ac9db78e8725d10d4a752a7da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_aarch64.whl

Download URL fabricatio_memory-0.3.8-cp313-cp313-manylinux_2_34_aarch64.whl
Size 6.2 MB
Tags CPython 3.13 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
9fd64f425f5c1adad65ed22297fd6379af6ef5518e0c5b2071e01df84861446b
BLAKE2b-256 checksum
How to use checksums
a52e02267483219f9d5e70c1ba007954ef91d1f84481ef7039006a8915432456
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp313-cp313-macosx_11_0_arm64.whl

Download URL fabricatio_memory-0.3.8-cp313-cp313-macosx_11_0_arm64.whl
Size 6.2 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ea7e8bef23ac4648d25958c07dc73326fbd628ba80b532b1ba64fb7435b2e458
BLAKE2b-256 checksum
How to use checksums
e1cbae5280614d955ed34ef304552bccd34021705bf1cc7e1c9f969f41efa27a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp312-cp312-win_amd64.whl

Download URL fabricatio_memory-0.3.8-cp312-cp312-win_amd64.whl
Size 6.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
7308cca0303cdc0c36f7680da4a6242f9539e862dfb6ace99c132d3441382b78
BLAKE2b-256 checksum
How to use checksums
74e174404d1644bc9c3673846af131fa239f11cd57eb148ee4151e9a97b036e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_x86_64.whl
Size 6.9 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
3c6a7b99e3a01be849d516b18c062b60f6f10ae191e781c877134c1bf35e0d5a
BLAKE2b-256 checksum
How to use checksums
163c5af1d1fbd06c30ad8bcb33da2df38336abbaa620861650a124ce0804d97a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_aarch64.whl

Download URL fabricatio_memory-0.3.8-cp312-cp312-manylinux_2_34_aarch64.whl
Size 6.2 MB
Tags CPython 3.12 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
8c692e5cb564639d6c58480606cc43530bb7f0094f68dee899d123a744dad42b
BLAKE2b-256 checksum
How to use checksums
5007acafbdbfbbe32760a671b3a423cf70dbf8195bdcbfe3e5bcc28322a1c47d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Release files / fabricatio_memory-0.3.8-cp312-cp312-macosx_11_0_arm64.whl

Download URL fabricatio_memory-0.3.8-cp312-cp312-macosx_11_0_arm64.whl
Size 6.2 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ef8fadceaa1a4d7e39f3ef27e063ed221e9eba38cbad2e29c5177e1b870c9c3e
BLAKE2b-256 checksum
How to use checksums
83d17ee4eced13cf2ba6710cf1c61a8050ec52f310cb9c9fa4ba837f09eb5d94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Security for fabricatio-memory 0.3.8

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.8 This release

12 release files No provenance

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