Memory belongs to the user, not to the model.
soul-memory is a model-independent, local-first Memory Operating System for AI Agents.
It is designed to help AI agents understand users across sessions while keeping memory owned, exportable and controllable by the user.
Models should not own user memory.
Instead, GPT, Claude, Codex, Gemini, Cursor, OpenClaw and future agents should all be able to consume the same user-owned memory layer through adapters.
AI Agent
|
Adapter
|
Memory API
|
Retrieval Engine
|
Memory Engine
|
User-Owned Memory Store
v0.7.3 is the current Session Assembler release for the local MVP.
It contains:
- Vision documents
- Architecture documents
- Concept definitions
- RFCs
- MVP implementation specification
- Pydantic API schemas
- Memory detail and statistics endpoints
- Consistent runtime error handling
- Codex CLI adapter
- Portable JSON memory import
- Memory schema v0.2 with subtype and migration support
- Import normalization for legacy and external memory types
- Controlled
soul syncmemory write path - Soul Event Protocol v1 domain model
- Durable SQLite event store
- Event ingest/list/show API
- Event CLI inspection tools
- Codex lifecycle hook connector
- Codex event delivery spool
- Safe
soul connect codexhook installation - Deterministic Session Assembler for reconstructing conversation sessions and turns
Build a local memory service that proves cross-session memory:
- Store durable user information.
- Start a new session.
- Recall relevant user memory.
- Inject concise context into an AI agent.
Install dependencies:
pip install -e .[dev]Start the local service:
python -m uvicorn src.main:app --host 127.0.0.1 --port 8765The default SQLite database is soul_memory.db in the current working directory. Override it with SOUL_MEMORY_DB.
Example PowerShell flow:
Invoke-RestMethod http://localhost:8765/memories `
-Method Post `
-ContentType "application/json" `
-Body '{"type":"project","content":"User is building soul-memory.","importance":5}'
Invoke-RestMethod http://localhost:8765/recall `
-Method Post `
-ContentType "application/json" `
-Body '{"query":"Help me continue this project."}'
Invoke-RestMethod http://localhost:8765/exportv0.4.1 also includes:
Invoke-RestMethod http://localhost:8765/memories/{memory_id}
Invoke-RestMethod http://localhost:8765/statsInvalid memory types return HTTP 400 with a clear error message. Malformed request payloads return HTTP 422.
v0.7.1 adds a source-independent event ingestion layer. Events are observations, not memories, and do not automatically write active memories.
API endpoints:
POST /events
GET /events
GET /events/{event_id}
CLI examples:
node bin/soul.mjs event ingest event.json
node bin/soul.mjs events --session session-demo
node bin/soul.mjs events --type user.prompt --source demo-agent
node bin/soul.mjs event show demo-001Re-ingesting the same event_id is idempotent and reports duplicate=true.
v0.7.2 connects selected Codex lifecycle hooks to the Soul Event Protocol:
SessionStart -> session.started
UserPromptSubmit -> user.prompt
Stop -> agent.response
Install the user-level hooks:
node bin/soul.mjs connect codexThen open Codex, run /hooks, and review/trust the Soul Memory hook definitions.
Inspect connector state and replay offline events:
node bin/soul.mjs connector codex status
node bin/soul.mjs connector codex flush
node bin/soul.mjs disconnect codexThe connector stores failed deliveries as normalized SoulEvent JSON under ~/.soul/spool/codex/. It captures user prompts, latest assistant responses at Stop, session/workspace context, and selected model/permission metadata. It does not parse Codex transcripts and does not implement secret redaction.
v0.7.3 reconstructs inspectable conversation sessions from stored SoulEvents:
Event Store -> Session Assembler -> ConversationSession -> ConversationTurn
It groups events by source and native session.id, orders them by occurred_at with insertion order as the tie breaker, and pairs user.prompt with agent.response. Missing responses are preserved as incomplete turns. It does not create memory candidates, run LLM extraction, or write memories automatically.
API endpoints:
GET /sessions
GET /sessions/{session_id}
CLI examples:
node bin/soul.mjs sessions
node bin/soul.mjs session show session-demoThe v0.6.0 CLI adapter connects Codex to soul-memory without modifying Codex.
Initialize local CLI config:
node bin/soul.mjs initCheck status:
node bin/soul.mjs statusRecall memory:
node bin/soul.mjs recall "continue this project"Run Codex with generated context:
node bin/soul.mjs codex "implement the next task"This generates:
.soul/context.md
AGENTS.md
Use --dry-run to generate files without launching Codex:
node bin/soul.mjs codex "implement the next task" --dry-runSync candidate memories from a coding session:
node bin/soul.mjs sync --summary "Implemented the Codex CLI adapter"The sync command shows candidates and asks for confirmation before storing anything.
Import portable memory JSON:
node bin/soul.mjs import soul-memory-guolin-profile-v0.1.jsonUse --preview to inspect normalization and duplicate handling without storing memories:
node bin/soul.mjs import soul-memory-guolin-profile-v0.1.json --previewUse --yes to skip the confirmation prompt after preview:
node bin/soul.mjs import soul-memory-guolin-profile-v0.1.json --yesClear memories for the configured user:
node bin/soul.mjs clearFor scripted reset:
node bin/soul.mjs clear --yesClear another user or all users:
node bin/soul.mjs clear --user guolin
node bin/soul.mjs clear --allclear permanently deletes memories and memory events. Use it when you want a clean import environment.
docs/
vision/
architecture/
concepts/
rfc/
implementation/
src/
api/
memory/
extraction/
retrieval/
injection/
adapter/
examples/
tests/
scripts/