CLI guide
The CLI is the default way to use Memory. The day-to-day surface is small:
memory query "<question>" # pull product context mid-taskmemory save --stdin # save product-meaningful changesmemory sync # reconcile at session endmemory status # where things standEverything else is setup, inspection, or maintenance. All commands accept a
global --json flag for structured envelopes.
The loop
Section titled “The loop”memory init
Section titled “memory init”Initialize Memory storage in this project and print the indexing brief.
memory initmemory init --dry-runmemory init --no-viewmemory init --no-agent-guidancememory init --forcememory init --brief- Creates
.memory/storage with a starterprojectnode. - Installs the guidance block and generated product map sections into
AGENTS.mdandCLAUDE.md(skipped with--no-agent-guidance). - Starts the local viewer (skipped with
--no-view). - Prints the indexing brief the coding agent follows to build the initial
graph.
--briefprints only the brief and touches nothing. --dry-runpreviews what init would create or change without writing.--forcediscards existing Memory storage and initializes from scratch.
memory query <question>
Section titled “memory query <question>”Query local Memory and print a token-budgeted Markdown subgraph of matching memory.
memory query "why do webhook retries run in the worker?"memory query "state of batch exports" --budget 1200- Seeds on full-text matches, expands one hop along active relations, and attaches connected open questions.
--budget <number>overrides the token budget (default comes from.memory/config.json, initially 2000).
memory save --stdin
Section titled “memory save --stdin”Save product memory from intent-first input: create or update feature/decision/gotcha/question nodes, mark stale, supersede, or delete.
memory save --stdinmemory save --stdin --dry-run--stdinis required; the input is JSON with the shape{task, nodes, stale, supersede, delete}. See the Reference for the exact node fields.--dry-runvalidates and plans the write without changing anything.- Every successful save refreshes the product map in
AGENTS.md/CLAUDE.md.
memory sync
Section titled “memory sync”Run the diff-driven staleness pass: report nodes whose anchors changed or died since the last sync, list coverage gaps, refresh the product map, and advance the sync marker.
memory syncmemory sync --dry-run- Diffs the tree since the commit recorded in
.memory/sync-state.json. - Reports changed, orphaned, and unanchored nodes plus directories with code but no feature coverage, and prints an agent prompt with a pre-filled save skeleton when reconciliation is needed.
- Never writes graph nodes itself.
--dry-runreports without advancing the marker or refreshing the map.
memory status
Section titled “memory status”Summarize the product graph: features by stage, open questions, stale anchors, last activity, and last sync.
memory statusmemory status --all--allprints one row per registered project from the user-level registry (~/.memory/projects.json) — the cross-project dashboard.
Inspection
Section titled “Inspection”memory check
Section titled “memory check”Validate canonical storage and generated index health. Also warns when anchors
match no files or the product map sections in AGENTS.md/CLAUDE.md are
missing or out of date.
memory checkmemory check --jsonmemory diff
Section titled “memory diff”Show Memory changes, including untracked memory files in Git projects. Plain
git diff -- .memory/ can miss untracked files before staging.
memory diffmemory inspect <id>
Section titled “memory inspect <id>”Show one Memory object and its direct relations.
memory inspect feature.webhook-retry-queuememory view
Section titled “memory view”Start the local viewer: projects dashboard, memory list, node detail, and the
relation graph. Binds to 127.0.0.1 only.
memory viewmemory view --openmemory view --port 4888memory view --detach--openopens the URL in the default browser.--port <number>picks the port (random available port by default).--detachstarts the viewer in a background process and prints its URL.
Maintenance
Section titled “Maintenance”memory rebuild
Section titled “memory rebuild”Rebuild generated indexes from canonical storage. Does not change canonical memory.
memory rebuildmemory projects
Section titled “memory projects”Manage the user-level project registry behind memory status --all and the
viewer’s projects dashboard.
memory projects listmemory projects add # registers the current directorymemory projects add /path/to/projectmemory projects remove <registry-id|project-id|path>memory projects prune # drop entries whose storage is gonememory reset
Section titled “memory reset”Back up and clear local Memory storage. The backup archive lands under
.memory/.backup/.
memory resetmemory reset --all # every project in the registrymemory reset --destroy # delete .memory/ entirely, no backupmemory upgrade
Section titled “memory upgrade”Removed as a migration path. Storage created by older schema versions is not
migrated; run memory reset then memory init and rebuild the graph from the
indexing brief.
memory docs
Section titled “memory docs”Read bundled public docs or open the hosted docs site.
memory docsmemory docs getting-startedmemory docs cli --openmemory docs --jsonMCP covers query, save, status, and inspect when the client has launched
memory-mcp. Everything else — init, sync, viewer, registry, maintenance —
stays in the CLI. See the MCP guide.