Persistent Memory for AI Agents
An elephant never forgets. Neither should your AI.
Documentation Β· npm Package Β· Obsidian Plugin Β· GitHub
ClawVault is a structured memory system for AI agents that uses markdown as the storage primitive. It solves the fundamental problem of AI agents losing context between sessions β what we call "context death."
Unlike vector databases or cloud-based memory solutions, ClawVault is:
- Local-first β Your data stays on your machine. No cloud sync, no vendor lock-in.
- Markdown-native β Human-readable, git-friendly, works with Obsidian out of the box.
- Graph-aware β Wiki-links build a knowledge graph that enriches context retrieval.
- Session-resilient β Checkpoint/recover primitives survive crashes and context resets.
- Fact-aware β Write-time extraction builds structured facts with conflict resolution.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ClawVault Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Agent βββββΆβ Session βββββΆβ Observer βββββΆβ Router β β
β β (Claude, β β Watcher β βCompressorβ β β β
β β GPT..) β ββββββββββββ ββββββββββββ ββββββ¬ββββββ β
β ββββββββββββ β β
β β βΌ β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β Markdown Vault β β
β β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββ β β
β β β βdecisions/β β lessons/ β β people/ β βprojectsβ β β
β β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββ β β
β β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββ β β
β β β β tasks/ β β backlog/ β βhandoffs/ β β inbox/ β β β
β β β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββ β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β ββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββ β
β β β .clawvault/ (Internal State) β β
β β β graph-index.json β last-checkpoint.json β config β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β βΌ βΌ β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β wake βββββΆβ context βββββΆβ Graph βββββΆβ Search β β
β β sleep β β profiles β β Traversalβ β(hybrid) β β
β βcheckpointβ ββββββββββββ ββββββββββββ ββββββββββββ β
β ββββββββββββ β
β β
β Data Flow: Session β Observe β Score β Route β Store β Reflect β Promote β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ClawVault is built around 8 core primitives that model how agents should interact with persistent memory:
| Primitive | Description | ClawVault Implementation |
|---|---|---|
| Goals | What the agent is trying to achieve | tasks/, projects/, --working-on flags |
| Agents | Identity and ownership tracking | --owner metadata, agent handoffs |
| State Space | Current context and environment | checkpoint, recover, session state |
| Feedback | Learning from outcomes | lessons/, observations/, reflection engine |
| Capital | Resources and constraints | Token budgets, context profiles, priority scoring |
| Institution | Rules and patterns | decisions/, preferences/, injection rules |
| Synthesis | Combining information | Graph traversal, context blending, semantic search |
| Recursion | Self-improvement loops | reflect, weekly promotion, archival |
These primitives map directly to CLI commands and vault structure, creating a coherent system for agent memory.
# Install ClawVault CLI
npm install -g clawvault
# Optional: install qmd for backward-compatible fallback paths
npm install -g github:tobi/qmd
# Quick verification
clawvault doctor# Create a new vault
clawvault init ~/memory --name my-brain
# Optional: Set up Obsidian integration
clawvault setup --theme neural --canvas# Start your session
clawvault wake
# Store memories as you work
clawvault remember decision "Use PostgreSQL" --content "Chosen for JSONB support"
clawvault capture "TODO: Review PR tomorrow"
# Checkpoint during heavy work
clawvault checkpoint --working-on "auth rollout" --focus "token refresh"
# End your session
clawvault sleep "finished auth rollout" --next "implement migration"# In-process hybrid search (BM25 + semantic reranking)
clawvault search "postgresql"
# Semantic/vector search commands (requires hosted embeddings configured)
clawvault vsearch "what did we decide about storage"
# Configure hosted embeddings (OpenAI/Gemini/Ollama)
clawvault config set search.embeddings.provider openai
clawvault config set search.embeddings.model text-embedding-3-small
clawvault config set search.embeddings.apiKey "$OPENAI_API_KEY"
clawvault rebuild-embeddings
# Get context for a task
clawvault context "database migration"
clawvault context --profile planning "Q1 roadmap"ClawVault v3 adds write-time fact extraction and entity graphs to the core memory pipeline:
- Fact Store β Extracts structured facts (preferences, attributes, relationships) at write time with conflict resolution and deduplication
- Entity Graph β Builds a relational graph enabling multi-hop queries ("Alice works at Google + Google is in CA β Alice is in CA")
- Hybrid Search β BM25 + semantic embeddings + Reciprocal Rank Fusion (RRF)
- 466 tests passing across 71 test files
- 20+ PRs merged from 6 external contributors
- Published on npm as
clawvault - Active development since February 2026
- In-process hybrid search engine β BM25 + hosted semantic embeddings + cross-encoder reranking, with
qmdnow optional. - Python SDK (
clawvault-py) β PyPI package with aVaultclass, BM25 search, and checkpoint/wake lifecycle helpers. - Inbox + background workers β
clawvault inbox addandclawvault maintainwith Curator, Janitor, Distiller, and Surveyor workers.
ClawVault builds a typed knowledge graph from wiki-links, tags, and frontmatter:
# View graph summary
clawvault graph
# Refresh graph index
clawvault graph --refreshDifferent tasks need different context. Use profiles to tune retrieval:
| Profile | Purpose |
|---|---|
default |
Balanced retrieval |
planning |
Broader strategic context |
incident |
Recent events, blockers, urgent items |
handoff |
Session transition context |
auto |
Hook-selected based on session intent |
clawvault context --profile incident "production outage"Full task lifecycle with Kanban support:
# Create tasks
clawvault task add "Ship v2 onboarding" --owner agent --project core --priority high
# View blocked items
clawvault blocked
# Sync with Obsidian Kanban
clawvault kanban syncPull relevant decisions and preferences into agent context automatically:
clawvault inject "How should we handle the deployment?"
clawvault inject --enable-llm "What's our pricing strategy?"pip install clawvault-pyfrom clawvault import Vault
vault = Vault("~/memory")
results = vault.search_bm25("postgresql decision")
vault.checkpoint("working on auth rollout")ClawVault is designed to work seamlessly with Obsidian:
- Graph themes β Neural/minimal themes with colored nodes by category
- Bases views β Auto-generated task views (
all-tasks.base,blocked.base,by-project.base) - Canvas dashboards β
clawvault canvasgenerates visual dashboards - Kanban round-trip β Export/import between ClawVault and Obsidian Kanban
# Generate canvas dashboard
clawvault canvas --template brain
# Set up Obsidian integration
clawvault setup --theme neural --canvas --basesFor hook-based lifecycle integration with OpenClaw:
# Install and enable hook pack
openclaw hooks install clawvault
openclaw hooks enable clawvault
# Verify
openclaw hooks list --verbose
openclaw hooks check
clawvault compatThe hook automatically:
- Detects context death and injects recovery alerts
- Auto-checkpoints before session resets
- Provides
--profile autofor context queries
If you use both a MEMORY.md workspace file and a ClawVault vault, understand their roles:
- MEMORY.md = Boot context (executive summary the agent sees instantly)
- Vault = Full knowledge store (searchable, structured, versioned)
MEMORY.md should contain high-level identity, key decisions, and current focus. The vault stores everything else. Update MEMORY.md periodically to reflect vault state, but it doesn't need to mirror it.
See docs/openclaw-plugin-usage.md for detailed guidance on this pattern.
- Node.js 18+ (22+ recommended)
- npm 9+
- Linux, macOS, Windows, or WSL
qmdis optional (used only for backward-compatible fallback paths; in-process search is built in)
For Linux-specific install and PATH guidance, see docs/getting-started/installation.md.
ClawVault supports multiple LLM providers for features like context generation, observation compression, and semantic search. Set the appropriate environment variable to enable a provider:
| Provider | Environment Variable | Default Model | Notes |
|---|---|---|---|
| Anthropic | ANTHROPIC_API_KEY |
claude-3-5-haiku-latest |
Claude models |
| OpenAI | OPENAI_API_KEY |
gpt-4o-mini |
GPT models |
| Google Gemini | GEMINI_API_KEY |
gemini-2.0-flash |
Gemini models |
| xAI (Grok) | XAI_API_KEY |
grok-2-latest |
Grok models via OpenAI-compatible API |
| Ollama | (local) | llama3.2 |
Local models, no API key needed |
| OpenAI-compatible | OPENAI_API_KEY |
gpt-4o-mini |
Any OpenAI-compatible endpoint |
Provider priority (when multiple keys are set): OpenClaw > Anthropic > OpenAI > Gemini > xAI
# Example: Use xAI (Grok) as your LLM provider
export XAI_API_KEY="your-xai-api-key"
# Example: Use Anthropic
export ANTHROPIC_API_KEY="your-anthropic-api-key"npm install -g clawvault# 1) Create or initialize a vault
clawvault init ~/memory --name my-brain
# 2) Optional vault bootstrap for Obsidian
clawvault setup --theme neural --canvas
# 3) Verify OpenClaw compatibility in this environment
clawvault compatIf you want hook-based lifecycle integration, use this sequence:
# Install CLI
npm install -g clawvault
# Install and enable hook pack
openclaw hooks install clawvault
openclaw hooks enable clawvault
# Verify
openclaw hooks list --verbose
openclaw hooks info clawvault
openclaw hooks check
clawvault compatImportant:
clawhub install clawvaultinstalls skill guidance, but does not replace hook-pack installation.- After enabling hooks, restart the OpenClaw gateway process so hook registration reloads.
Append these to your existing memory workflow. Do not replace your full prompt setup:
## ClawVault
- Run `clawvault wake` at session start.
- Run `clawvault checkpoint` during heavy work.
- Run `clawvault sleep "summary" --next "next steps"` before ending.
- Use `clawvault context "<task>"` or `clawvault inject "<message>"` before complex decisions.init,setup,store,captureremember,list,get,stats,reindex,sync
search,vsearch,context,injectobserve,reflect,session-recapgraph,entities,link,embed
wake,sleep,handoff,recapcheckpoint,recover,status,clean-exit,repair-sessioncompat,doctor
task ...,backlog ...,blocked,project ...,kanban ...canvas(generates defaultdashboard.canvas)
tailscale-status,tailscale-sync,tailscale-serve,tailscale-discover
# Store and retrieve memory
clawvault remember decision "Use PostgreSQL" --content "Chosen for JSONB and reliability"
clawvault search "postgresql"
clawvault vsearch "what did we decide about storage"
# Session lifecycle
clawvault wake
clawvault checkpoint --working-on "auth rollout" --focus "token refresh edge cases"
clawvault sleep "finished auth rollout plan" --next "implement migration"
# Work management
clawvault task add "Ship v2 onboarding" --owner agent --project core --priority high
clawvault blocked
clawvault project list --status active
clawvault kanban sync
# Obsidian projection
clawvault canvasClawVault can serve vault content for sync over Tailscale and exposes WebDAV under /webdav for mobile-oriented workflows.
clawvault tailscale-status
clawvault tailscale-serve --vault ~/memory
clawvault tailscale-discovervault/
βββ .clawvault/ # Internal state
β βββ graph-index.json # Knowledge graph
β βββ last-checkpoint.json
β βββ config.json
βββ decisions/ # Key choices with reasoning
βββ lessons/ # Insights and patterns
βββ people/ # One file per person
βββ projects/ # Active work tracking
βββ tasks/ # Task files with frontmatter
βββ backlog/ # Quick captures and ideas
βββ handoffs/ # Session continuity
βββ inbox/ # Quick captures
βββ templates/ # Document templates
- First-line diagnostic:
- run
clawvault doctorafter install or environment changes
- run
- Global install fails with
EACCES/ permission denied:- run
npm config set prefix ~/.npm-global - add
export PATH="$HOME/.npm-global/bin:$PATH"to your shell rc and reload shell
- run
clawvault: command not foundafter install:- check
npm config get prefix - ensure
<prefix>/binis present in yourPATH
- check
qmdfallback errors:qmdis optional; in-process BM25 search is available without it- if you want fallback compatibility, ensure
qmd --versionworks in the same shell
- Hook/plugin not active in OpenClaw:
- run
openclaw hooks install clawvault - run
openclaw hooks enable clawvault - verify with
openclaw hooks list --verbose
- run
- OpenClaw integration drift:
- run
clawvault compat
- run
- Session transcript corruption:
- run
clawvault repair-session --dry-runthenclawvault repair-session
- run
| Resource | URL |
|---|---|
| Documentation | clawvault.dev |
| npm Package | npmjs.com/package/clawvault |
| GitHub | github.com/Versatly/clawvault |
| Issues | github.com/Versatly/clawvault/issues |
| Obsidian Plugin | clawvault.dev/obsidian |
We welcome contributions! ClawVault has had 20+ PRs merged from 6 external contributors.
- Fork the repository
- Create a feature branch
- Run tests:
npm test - Submit a PR
See our contribution guidelines for details.
$CLAW: 5Fjr82MTB8mvxkzi9FYtvrUsPiDGE2M29w3dYcZpump
MIT