CLI Reference
CLI Reference
Complete reference for all memories.sh CLI commands.
The memories CLI is the primary interface for managing your AI agent memory store. All commands operate on a local SQLite database at ~/.config/memories/local.db.
Command references on this page map to a segmented lifecycle model: session working memory + long-term semantic/episodic/procedural stores. See Memory Segmentation.
Quick Reference
# First-time setup (auto-configures MCP for detected tools)
memories setup
# Add memories
memories add --rule "Always use TypeScript strict mode"
memories add --decision "Chose Tailwind for utility-first CSS"
memories add --fact "API rate limit is 100/min"
# Search
memories search "authentication"
memories search "how to handle login" --semantic
# Reminders
memories reminders add "0 9 * * 1-5" "Review open TODOs"
memories reminders run
# Generate instruction files
memories generate all
# Sync config files
memories files ingest
memories files apply --globalCommand Overview
Setup Commands
| Command | Description |
|---|---|
init | Initialize memories and auto-configure MCP for detected tools (setup alias) |
login | Authenticate for cloud sync features |
Core Commands
| Command | Description |
|---|---|
add | Add a new memory (rule, decision, fact, or note) |
recall | Get rules and relevant memories for AI agents |
prompt | Output memories formatted for AI system prompts |
Search Commands
| Command | Description |
|---|---|
search | Keyword or semantic search across memories |
list | List memories with optional filters |
embed | Generate embeddings for semantic search |
Management Commands
| Command | Description |
|---|---|
edit | Edit an existing memory |
forget | Soft-delete memories by ID or bulk filter |
tag | Bulk tag and untag operations |
reminders | Manage cron-based reminders (add, list, run, enable, disable, delete) |
stale | Find stale memories with superseded/conflict filters |
review | Interactively keep/delete stale memories |
Lifecycle Commands
| Command | Description |
|---|---|
session | Manage explicit memory session lifecycle (start, checkpoint, status, end, snapshot) |
compact | Run inactivity compaction worker for active sessions |
consolidate | Merge duplicates and supersede outdated memories |
openclaw memory | Read/write OpenClaw semantic, daily, and snapshot files |
Generation Commands
| Command | Description |
|---|---|
generate | Generate IDE rule files from memories |
diff | Show what changed since last generate |
Data Commands
| Command | Description |
|---|---|
export | Export memories to JSON or YAML |
import | Import memories from JSON or YAML |
ingest | Import from existing IDE rule files |
Sync Commands
System Commands
| Command | Description |
|---|---|
config | Manage agent configuration |
org | List and switch active organization workspace |
serve | Start the MCP server |
stats | Show memory statistics |
doctor | Check health and diagnose issues |
hook | Manage git hooks |
Global Behavior
Project Detection
- When inside a git repository, commands automatically scope to the current project (detected from the
originremote URL) - When outside a git repo, or when
--globalis passed, memories are stored with global scope - Global memories are included in all project queries
Database
- All memories are stored in a single SQLite database at
~/.config/memories/local.db - FTS5 full-text search with BM25 ranking
- Vector embeddings for semantic search (dimension depends on selected model; default is 384)
- Soft-deleted memories are retained but excluded from queries
MCP Integration
When you run memories setup (or memories init), it automatically:
- Detects installed AI tools (Cursor, Claude Code, Windsurf, VS Code)
- Configures MCP for each detected tool
- Generates instruction files with your existing memories
- Imports existing project skill configs (such as
.claude/skillsand.codex/skills) into memories
This means your memories are immediately available to your AI tools via MCP.