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
Release files for sulcus-llamaindex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sulcus_llamaindex-0.1.0.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sulcus_llamaindex-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / sulcus_llamaindex-0.1.0.tar.gz
| Download URL | sulcus_llamaindex-0.1.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
370e16049b9f26d734349a47110da593e3885b96831ae001c8d71cee05be2a88
|
|
BLAKE2b-256 checksum How to use checksums |
eca4d3092f6a667ca48f418ca0eed75d893e4c628b017ba91a908875439900b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / sulcus_llamaindex-0.1.0-py3-none-any.whl
| Download URL | sulcus_llamaindex-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbc210bc1d7552241ae2548b589efa27618c27d6caff22eb23fb570f546731e4
|
|
BLAKE2b-256 checksum How to use checksums |
61ef0f3cda796178f1d771385d5f61cce106bede5752b75014df6812e7c30291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|