memories.sh logomemories.sh
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 --global

Command Overview

Setup Commands

CommandDescription
initInitialize memories and auto-configure MCP for detected tools (setup alias)
loginAuthenticate for cloud sync features

Core Commands

CommandDescription
addAdd a new memory (rule, decision, fact, or note)
recallGet rules and relevant memories for AI agents
promptOutput memories formatted for AI system prompts

Search Commands

CommandDescription
searchKeyword or semantic search across memories
listList memories with optional filters
embedGenerate embeddings for semantic search

Management Commands

CommandDescription
editEdit an existing memory
forgetSoft-delete memories by ID or bulk filter
tagBulk tag and untag operations
remindersManage cron-based reminders (add, list, run, enable, disable, delete)
staleFind stale memories with superseded/conflict filters
reviewInteractively keep/delete stale memories

Lifecycle Commands

CommandDescription
sessionManage explicit memory session lifecycle (start, checkpoint, status, end, snapshot)
compactRun inactivity compaction worker for active sessions
consolidateMerge duplicates and supersede outdated memories
openclaw memoryRead/write OpenClaw semantic, daily, and snapshot files

Generation Commands

CommandDescription
generateGenerate IDE rule files from memories
diffShow what changed since last generate

Data Commands

CommandDescription
exportExport memories to JSON or YAML
importImport memories from JSON or YAML
ingestImport from existing IDE rule files

Sync Commands

CommandDescription
syncManage cloud sync
filesSync config files (.agents, .cursor, .claude, etc.)

System Commands

CommandDescription
configManage agent configuration
orgList and switch active organization workspace
serveStart the MCP server
statsShow memory statistics
doctorCheck health and diagnose issues
hookManage git hooks

Global Behavior

Project Detection

  • When inside a git repository, commands automatically scope to the current project (detected from the origin remote URL)
  • When outside a git repo, or when --global is 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:

  1. Detects installed AI tools (Cursor, Claude Code, Windsurf, VS Code)
  2. Configures MCP for each detected tool
  3. Generates instruction files with your existing memories
  4. Imports existing project skill configs (such as .claude/skills and .codex/skills) into memories

This means your memories are immediately available to your AI tools via MCP.

On this page