-
Notifications
You must be signed in to change notification settings - Fork 0
feat: CompositeBackend for memory path routing (durable vs thread-scoped) #850
Copy link
Copy link
Open
Labels
prio:mediumShould do, but not blockingShould do, but not blockingscope:medium1-3 days of work1-3 days of workspec:memoryDESIGN_SPEC Section 7 - Memory & PersistenceDESIGN_SPEC Section 7 - Memory & Persistencetype:featureNew feature implementationNew feature implementationv0.6Minor version v0.6Minor version v0.6v0.6.5Patch release v0.6.5Patch release v0.6.5
Description
Summary
Implement a CompositeBackend that routes specific memory paths to different storage backends, enabling durable persistence for some memory types while keeping others thread-scoped.
Research Source
- Deep Agents Context Engineering (LangChain, 2026-03)
Design
Concept
A wrapper implementing the existing MemoryBackend protocol that dispatches to different concrete backends based on path prefix:
class CompositeBackend:
routes: dict[str, MemoryBackend] # path prefix -> backend
default: MemoryBackend # fallback for unmatched pathsRouting Rules
| Path Prefix | Backend | Persistence |
|---|---|---|
/memories/ |
StoreBackend (durable) | Across sessions |
/preferences/ |
StoreBackend (durable) | Across sessions |
/scratch/ |
StateBackend (thread-scoped) | Current session only |
/working/ |
StateBackend (thread-scoped) | Current session only |
| (default) | StateBackend | Current session only |
Behavior
- Paths start empty; agent creates files on-demand
- Pre-seeding available via Store API
- Follows existing
MemoryBackendprotocol -- no interface changes - Configuration via YAML:
memory:
backend: "composite"
composite:
routes:
memories: "mem0" # durable
preferences: "mem0" # durable
scratch: "session" # thread-scoped
working: "session" # thread-scoped
default: "session"Key Files
src/synthorg/memory/backends/-- existing backend implementationssrc/synthorg/memory/retriever.py-- retrieval pipelinesrc/synthorg/memory/injection.py-- injection strategy enum
Related Issues
- research: multi-agent memory consistency protocols (shared vs distributed) #702 (multi-agent memory consistency protocols)
- feat: memory consolidation upgrades (LLM Merge, Search-and-Ask, diversity penalty) #704 (memory consolidation upgrades)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:mediumShould do, but not blockingShould do, but not blockingscope:medium1-3 days of work1-3 days of workspec:memoryDESIGN_SPEC Section 7 - Memory & PersistenceDESIGN_SPEC Section 7 - Memory & Persistencetype:featureNew feature implementationNew feature implementationv0.6Minor version v0.6Minor version v0.6v0.6.5Patch release v0.6.5Patch release v0.6.5