Sulcus thermodynamic memory middleware for LangChain Deep Agents — replace flat AGENTS.md with a real memory engine
Project description
Sulcus × Deep Agents
Thermodynamic memory middleware for LangChain Deep Agents. Replace flat AGENTS.md files with a real memory engine.
The Problem
Deep Agents' built-in memory is a Markdown file (AGENTS.md) that the LLM manually edits with edit_file. This means:
- No search — the entire file is loaded every time, regardless of relevance
- No decay — everything stays forever until the LLM decides to delete it
- No cross-agent sharing — sub-agents get isolated filesystems; their memories die when they terminate
- No cross-session persistence — sandbox restarts lose everything
- No prioritization — a three-month-old preference and a five-minute-old finding have equal weight
The Fix
sulcus-deepagents replaces this with the Sulcus thermodynamic engine:
- Semantic search — only relevant memories are injected, ranked by similarity + heat
- Automatic decay — episodic memories fade in hours; semantic knowledge persists for months
- Cross-agent sharing — sub-agents write to the same Sulcus graph; findings survive termination
- Persistent across sessions — memories live in the database, not the sandbox
- Heat propagation — recently recalled, frequently accessed memories rank higher
Install
pip install sulcus-deepagents
Quick Start
Middleware (automatic context injection)
from sulcus import Sulcus
from sulcus_deepagents import SulcusMemoryMiddleware
from deepagents import create_deep_agent
client = Sulcus(api_key="sk-...")
agent = create_deep_agent(
middleware=[
SulcusMemoryMiddleware(client=client)
]
)
Every model call now gets relevant memories injected into the system prompt automatically.
Tools (explicit memory operations)
from sulcus_deepagents import SulcusMemoryTools
memory_tools = SulcusMemoryTools(client=client)
agent = create_deep_agent(
tools=memory_tools.tools()
)
The agent gets five memory tools:
| Tool | Description |
|---|---|
sulcus_store |
Store a memory with type + importance classification |
sulcus_search |
Search by natural language, ranked by relevance + heat |
sulcus_recall |
Recall a memory by ID, boosting its heat |
sulcus_pin |
Pin/unpin to prevent/allow decay |
sulcus_forget |
Permanently delete a memory |
Combined (recommended)
agent = create_deep_agent(
middleware=[SulcusMemoryMiddleware(client=client)],
tools=memory_tools.tools(),
)
The middleware handles passive context injection. The tools handle active memory management. Together, the agent gets automatic recall AND explicit control.
Backend (AGENTS.md interception)
from sulcus_deepagents import SulcusBackend
agent = create_deep_agent(
backend=SulcusBackend(client=client)
)
Intercepts AGENTS.md reads/writes — read_file("AGENTS.md") returns a Sulcus-generated summary; write_file("AGENTS.md", content) parses and stores entries as individual memory nodes.
Memory Types
| Type | Use For | Default Decay |
|---|---|---|
episodic |
Events, conversations, task findings | Fast (24h half-life) |
semantic |
Facts, knowledge, data | Slow (30d half-life) |
preference |
Settings, opinions, style | Slower (90d half-life) |
procedural |
Workflows, how-tos, patterns | Slowest (180d half-life) |
moment |
Significant interactions | Slow (custom) |
Sub-Agent Memory Sharing
This is where Sulcus changes the game. In standard Deep Agents:
Main Agent → spawns Sub-Agent → sub-agent edits its AGENTS.md → sub-agent terminates → AGENTS.md is GONE
With Sulcus:
Main Agent → spawns Sub-Agent → sub-agent calls sulcus_store → sub-agent terminates → memory PERSISTS
Both agents share one Sulcus tenant. The sub-agent's findings are immediately searchable by the main agent and any future agents.
Configuration
SulcusMemoryMiddleware(
client=client,
search_limit=15, # Max memories per turn
token_budget=2000, # Approximate tokens for memory context
memory_types=None, # Filter types (None = all)
min_heat=0.0, # Minimum heat threshold
)
Self-Hosted
client = Sulcus(
api_key="your-key",
server_url="http://localhost:4200",
)
Examples
examples/basic_agent.py— Single agent with persistent memoryexamples/multi_agent.py— Main agent + research sub-agent with shared memory
Links
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_deepagents-0.1.0.tar.gz.
File metadata
- Download URL: sulcus_deepagents-0.1.0.tar.gz
- Upload date:
- Size: 11.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 |
4d87bbea58a0335d3a355db1e12d79ac9af5ec479e2d540f7246a49c4cb784c7
|
|
| MD5 |
a9277fbe50703c25ded4622cf2f9edd7
|
|
| BLAKE2b-256 |
12f3fac28e7248d965e849fa7992b9a27e95f6b0f20be6c81bba680cf9f23f19
|
File details
Details for the file sulcus_deepagents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sulcus_deepagents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 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 |
c455d1e4c6eb8277c50c6aeb2cc759b2a6d218f349ea6a4518e3e9d3b3eb44b0
|
|
| MD5 |
bc182bed4b80e990d9c4652df7eb2711
|
|
| BLAKE2b-256 |
fdab56b08963e8718122034c628e3f3d3fe2cf946eb5888763657f62b09b870f
|