LlamaIndex storage integration for Sulcus thermodynamic memory
Project description
sulcus-llamaindex
LlamaIndex storage integration for Sulcus — a thermodynamic memory system for AI agents.
What is Sulcus?
Sulcus stores AI memories as nodes with a heat value (0–1) that represents accessibility. Memories naturally cool over time; pinned memories retain their heat indefinitely. This creates a biologically-inspired attention gradient across your agent's knowledge graph.
Installation
pip install sulcus-llamaindex
Note: Only
llama-index-coreis required — not the fullllama-indexpackage.
Components
| Class | Purpose |
|---|---|
SulcusVectorStore |
Drop-in BasePydanticVectorStore for RAG pipelines |
SulcusDocumentStore |
KV-style document persistence |
SulcusReader |
Load existing Sulcus memories as LlamaIndex Document objects |
Usage
SulcusVectorStore — RAG Pipeline
from llama_index.core import VectorStoreIndex, StorageContext
from llama_index.core.schema import Document
from sulcus_llamaindex import SulcusVectorStore
# Set up the store
vector_store = SulcusVectorStore(
api_key="sk-...",
namespace="my-project", # logical namespace in Sulcus
)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
# Index documents — they're persisted to Sulcus automatically
docs = [
Document(
text="Pinned memories resist heat decay.",
metadata={
"memory_type": "semantic", # episodic | semantic | preference | procedural
"heat": 0.9, # 0.0–1.0, higher = more accessible
"namespace": "my-project",
},
),
]
index = VectorStoreIndex.from_documents(docs, storage_context=storage_context)
# Query
response = index.as_query_engine(similarity_top_k=5).query("What are pinned memories?")
print(response)
Metadata Mapping
LlamaIndex node metadata fields are mapped to Sulcus fields on add():
| LlamaIndex metadata key | Sulcus field | Default |
|---|---|---|
memory_type |
memory_type |
"semantic" |
heat |
heat |
0.8 |
namespace |
namespace |
store default |
Returned nodes (from query()) include all Sulcus fields in metadata:
sulcus_id, memory_type, heat, base_utility, is_pinned, modality, namespace.
SulcusReader — Load Existing Memories
from sulcus_llamaindex import SulcusReader
reader = SulcusReader(api_key="sk-...", namespace="research")
# Load all memories of a specific type
docs = reader.load_by_type("semantic")
# Load only pinned (high-importance) memories
pinned = reader.load_pinned()
# Filter by namespace, type, and pinned status simultaneously
docs = reader.load_data(
memory_type="episodic",
namespace="project-x",
pinned=False,
search="deployment", # optional server-side substring filter
)
# Quick search returning Documents
results = reader.search("thermodynamic heat", limit=10)
SulcusDocumentStore — Document Persistence
from llama_index.core import StorageContext
from sulcus_llamaindex import SulcusDocumentStore
doc_store = SulcusDocumentStore(api_key="sk-...", namespace="my-project")
storage_context = StorageContext.from_defaults(docstore=doc_store)
Document nodes are stored under a docstore:<namespace> Sulcus namespace as procedural memories, keeping them separate from your semantic memory graph.
Full Example
See examples/rag_pipeline.py for a complete workflow:
- Load existing Sulcus memories as LlamaIndex Documents
- Store new documents into the vector store
- Build a
VectorStoreIndex - Run natural-language queries
SULCUS_API_KEY=sk-... python examples/rag_pipeline.py
Thermodynamic Tips
- Use
heat=0.9for core knowledge you want to remain accessible long-term. - Pin critical memories via the Sulcus API (
client.pin(memory_id)) to prevent any heat decay. - Use namespaces to partition memory by project, agent, or session — they're free and unlimited.
memory_typematters: Sulcus's UI and search can filter by type, so labelling memories correctly improves discoverability.
Requirements
- Python ≥ 3.9
sulcus >= 0.1.0llama-index-core >= 0.12.0
License
MIT
Project details
Release history Release notifications | RSS feed
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 sulcus_llamaindex-0.1.0.tar.gz.
File metadata
- Download URL: sulcus_llamaindex-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
370e16049b9f26d734349a47110da593e3885b96831ae001c8d71cee05be2a88
|
|
| MD5 |
79752e05216b828b385fd3b434726a10
|
|
| BLAKE2b-256 |
eca4d3092f6a667ca48f418ca0eed75d893e4c628b017ba91a908875439900b9
|
File details
Details for the file sulcus_llamaindex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sulcus_llamaindex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbc210bc1d7552241ae2548b589efa27618c27d6caff22eb23fb570f546731e4
|
|
| MD5 |
f92ac48ad6c03b679b0fdc3988872e08
|
|
| BLAKE2b-256 |
61ef0f3cda796178f1d771385d5f61cce106bede5752b75014df6812e7c30291
|