CLI Commands

CLI Commands

The mem CLI is built on the Typer framework and serves as a thin command-line wrapper around MemovManager.

Core Commands

Initialize Repository

mem init

Initialize .mem/ repository in the current directory.

Track Files

mem track <files>

Start tracking specified files. Files must be tracked before they can be included in snapshots.

Example:

mem track src/main.py src/utils.py

Create Snapshot

mem snap [--files <files>] [--prompt <prompt>] [--response <response>]

Create a snapshot of tracked files with optional prompt/response metadata.

Options:

OptionDescription
--filesComma-separated list of files to snapshot
--promptUser prompt to record
--responseAI response to record
--by-userMark as user-made changes (default: false)

Example:

mem snap --files "src/api.py,src/models.py" --prompt "Add user authentication"

View History

mem history [--limit <n>]

Show commit history with prompts, responses, and file changes.

Example:

mem history --limit 10

Show Commit Details

mem show <hash>

Display detailed information about a specific commit.

Jump to Snapshot

mem jump <hash>

Restore files from a historical snapshot, creating a new branch.

Example:

mem jump abc1234

Check Status

mem status

Show working directory status: untracked, modified, and clean files.

Branch Commands

List Branches

mem branch

List all branches with their current commit hashes.

Create Branch

mem branch <name>

Create a new branch at the current HEAD.

Switch Branch

mem switch <name>

Switch to an existing branch.

File Management

Rename File

mem rename <old> <new>

Rename a tracked file, updating the tracking metadata.

Remove File

mem remove <file>

Remove a file from tracking.

Amend Commit

mem amend <hash> [--prompt <prompt>] [--response <response>]

Update the notes (prompt/response) of an existing commit without changing the commit itself.

RAG Mode Commands

These commands require installation with [rag] extras.

Sync to VectorDB

mem sync

Write pending operations to VectorDB for semantic search capabilities.

Semantic Search

mem search <query> [--type <type>]

Search through code history by prompt text, file paths, or content.

Options:

OptionValuesDescription
--typeprompt, response, codeFilter by content type
--limitnumberMaximum results to return

Web UI Commands

Start Web UI

mem ui start [--port <port>]

Launch the Web UI server (default port: 38888).

Options:

OptionDefaultDescription
--port38888Port to run the server on
--foregroundfalseRun in foreground (blocking)

Example:

mem ui start --port 8080

Command Reference Table

CommandPurposeKey Options
mem initInitialize repository
mem trackStart tracking files<files>
mem snapCreate snapshot--files, --prompt, --response
mem historyShow history--limit
mem showShow commit<hash>
mem jumpTime-travel<hash>
mem statusCheck status
mem branchManage branches[name]
mem switchSwitch branch<name>
mem renameRename file<old>, <new>
mem removeRemove file<file>
mem amendUpdate notes<hash>, --prompt, --response
mem syncSync VectorDB
mem searchSemantic search<query>, --type
mem uiStart Web UI--port, --foreground

Exit Codes

CodeMeaning
0Success
1Error (validation failed, operation failed, RAG unavailable)

Common Options

These options are available for most commands:

OptionTypeDefaultDescription
--locstring.Project directory path
--promptstringNoneDescriptive prompt
--responsestringNoneAI/user response
--by-userboolfalseMark as user operation

Output Formatting

The CLI uses Rich library for formatted output:

  • Tables - Results display in structured table format
  • Colors - Status indicators with color coding
  • JSON - Use --format json for machine-readable output