| name | clawvault |
| description | Agent memory system with memory graph, context profiles, checkpoint/recover, structured storage, semantic search, and observational memory. Use when: storing/searching memories, preventing context death, graph-aware context retrieval, repairing broken sessions. Don't use when: general file I/O. |
ClawVault 🐘
An elephant never forgets. Structured memory for OpenClaw agents.
Built for OpenClaw. Canonical install: npm CLI + hook install + hook enable.
Security & Transparency
What this skill does:
- Reads/writes markdown files in your vault directory (
CLAWVAULT_PATH or auto-discovered)
repair-session reads and modifies OpenClaw session transcripts (~/.openclaw/agents/) — creates backups before writing
- Provides an OpenClaw hook pack (
hooks/clawvault/handler.js) with lifecycle events (gateway:startup, gateway:heartbeat, command:new, session:start, compaction:memoryFlush, cron.weekly). Hook is opt-in and must be installed/enabled.
observe --compress makes LLM API calls (Gemini Flash by default) to compress session transcripts into observations
Environment variables used:
CLAWVAULT_PATH — vault location (optional, auto-discovered if not set)
OPENCLAW_HOME / OPENCLAW_STATE_DIR — used by repair-session to find session transcripts
GEMINI_API_KEY — used by observe for LLM compression (optional, only if using observe features)
No cloud sync — all data stays local. No network calls except LLM API for observe compression.
This is a full CLI tool, not instruction-only. It writes files, registers hooks, and runs code.
Auditability: the published ClawHub skill bundle includes SKILL.md, HOOK.md, and hooks/clawvault/handler.js so users can inspect hook behavior before enabling it.
Install (Canonical)
npm install -g clawvault
openclaw hooks install clawvault
openclaw hooks enable clawvault
openclaw hooks list --verbose
openclaw hooks info clawvault
openclaw hooks check
clawhub install clawvault can install skill guidance, but does not replace explicit hook pack installation.
Recommended Safe Install Flow
npm view clawvault version dist.integrity dist.tarball repository.url
npm install -g clawvault@latest
npm install -g github:tobi/qmd
openclaw hooks install clawvault
node -e "const fs=require('fs');const p='hooks/clawvault/handler.js';console.log(fs.existsSync(p)?p:'hook file not found in current directory')"
openclaw hooks info clawvault
openclaw hooks enable clawvault
openclaw hooks check
Setup
clawvault init ~/my-vault
export CLAWVAULT_PATH=/path/to/memory
clawvault shell-init >> ~/.bashrc
Quick Start for New Agents
clawvault wake
clawvault capture "TODO: Review PR tomorrow"
clawvault checkpoint --working-on "PR review" --focus "type guards"
clawvault sleep "PR review + type guards" --next "respond to CI" --blocked "waiting for CI"
clawvault doctor
Reality Checks Before Use
clawvault compat
qmd --version
openclaw --version
ClawVault currently depends on qmd for core vault/query flows.
Current Feature Set
Memory Graph
ClawVault builds a typed knowledge graph from wiki-links, tags, and frontmatter:
clawvault graph
clawvault graph --refresh
Graph is stored at .clawvault/graph-index.json — schema versioned, incremental rebuild.
Graph-Aware Context Retrieval
clawvault context "database decision"
clawvault context --profile planning "Q1 roadmap"
clawvault context --profile incident "production outage"
clawvault context --profile handoff "session end"
clawvault context --profile auto "current task"
Context Profiles
| Profile | Purpose |
|---|
default | Balanced retrieval |
planning | Broader strategic context |
incident | Recent events, blockers, urgent items |
handoff | Session transition context |
auto | Hook-selected profile based on session intent |
OpenClaw Compatibility Diagnostics
clawvault compat
clawvault compat --strict
Core Commands
Wake + Sleep (primary)
clawvault wake
clawvault sleep "what I was working on" --next "ship v1" --blocked "waiting for API key"
Store memories by type
clawvault remember decision "Use Postgres over SQLite" --content "Need concurrent writes for multi-agent setup"
clawvault remember lesson "Context death is survivable" --content "Checkpoint before heavy work"
clawvault remember relationship "Justin Dukes" --content "Client contact at Hale Pet Door"
Quick capture to inbox
clawvault capture "TODO: Review PR tomorrow"
Search (requires qmd installed)
clawvault search "client contacts"
clawvault vsearch "what did we decide about the database"
Context Death Resilience
Wake (start of session)
clawvault wake
Sleep (end of session)
clawvault sleep "what I was working on" --next "finish docs" --blocked "waiting for review"
Checkpoint (save state frequently)
clawvault checkpoint --working-on "PR review" --focus "type guards" --blocked "waiting for CI"
Recover (manual check)
clawvault recover --clear
Handoff (manual session end)
clawvault handoff \
--working-on "ClawVault improvements" \
--blocked "npm token" \
--next "publish to npm, create skill" \
--feeling "productive"
Recap (bootstrap new session)
clawvault recap
Auto-linking
Wiki-link entity mentions in markdown files:
clawvault link --all
clawvault link memory/2024-01-15.md
Folder Structure
vault/
├── .clawvault/ # Internal state
│ ├── last-checkpoint.json
│ └── dirty-death.flag
├── decisions/ # Key choices with reasoning
├── lessons/ # Insights and patterns
├── people/ # One file per person
├── projects/ # Active work tracking
├── handoffs/ # Session continuity
├── inbox/ # Quick captures
└── templates/ # Document templates
Best Practices
- Wake at session start —
clawvault wake restores context
- Checkpoint every 10-15 min during heavy work
- Sleep before session end —
clawvault sleep captures next steps
- Use types — knowing WHAT you're storing helps WHERE to put it
- Wiki-link liberally —
[[person-name]] builds your knowledge graph
Checklist for AGENTS.md
## Memory Checklist
- [ ] Run `clawvault wake` at session start
- [ ] Checkpoint during heavy work
- [ ] Capture key decisions/lessons with `clawvault remember`
- [ ] Use wiki-links like `[[person-name]]`
- [ ] End with `clawvault sleep "..." --next "..." --blocked "..."`
- [ ] Run `clawvault doctor` when something feels off
Append this checklist to existing memory instructions. Do not replace your full AGENTS.md behavior unless you intend to.
Session Transcript Repair (v1.5.0+)
When the Anthropic API rejects with "unexpected tool_use_id found in tool_result blocks", use:
clawvault repair-session --dry-run
clawvault repair-session
clawvault repair-session --session <id> --agent <agent-id>
clawvault repair-session --list
What it fixes:
- Orphaned
tool_result blocks referencing non-existent tool_use IDs
- Aborted tool calls with partial JSON
- Broken parent chain references
Backups are created automatically (use --no-backup to skip).
Troubleshooting
- qmd not installed — install qmd, then confirm with
qmd --version
- No ClawVault found — run
clawvault init or set CLAWVAULT_PATH
- CLAWVAULT_PATH missing — run
clawvault shell-init and add to shell rc
- Too many orphan links — run
clawvault link --orphans
- Inbox backlog warning — process or archive inbox items
- "unexpected tool_use_id" error — run
clawvault repair-session
- OpenClaw integration drift — run
clawvault compat
- Hook enable fails / hook not found — run
openclaw hooks install clawvault, then openclaw hooks enable clawvault, restart gateway, and verify via openclaw hooks list --verbose
- Graph out of date — run
clawvault graph --refresh
- Wrong context for task — try
clawvault context --profile incident or --profile planning
Stability Snapshot
- Typecheck passes (
npm run typecheck)
- Test suite passes (
449/449)
- Cross-platform path handling hardened for Windows in:
- qmd URI/document path normalization
- WebDAV path safety and filesystem resolution
- shell-init output expectations
- OpenClaw runtime wiring validated by
clawvault compat --strict (requires local openclaw binary for full runtime validation)
Integration with qmd
ClawVault uses qmd for search:
bun install -g github:tobi/qmd
npm install -g github:tobi/qmd
qmd collection add /path/to/vault --name my-memory --mask "**/*.md"
qmd update && qmd embed
Environment Variables
CLAWVAULT_PATH — Default vault path (skips auto-discovery)
OPENCLAW_HOME — OpenClaw home directory (used by repair-session)
OPENCLAW_STATE_DIR — OpenClaw state directory (used by repair-session)
GEMINI_API_KEY — Used by observe for LLM-powered compression (optional)
Links