Skip to main content
The Lerim CLI is the primary interface for managing Lerim’s continual learning layer. Commands fall into two categories:
  • Host-only commands run locally and never require a server (init, project, up, down, logs, connect, memory)
  • Service commands are HTTP clients that require a running Lerim server started via lerim up or lerim serve (ask, sync, maintain, status)

Installation

pip install lerim
Prerequisites: Python 3.10+, Docker (optional)

Quick start

lerim init                     # interactive setup — detects your coding agents
lerim project add .            # add current project
lerim up                       # start Lerim Docker service
lerim ask "your question"      # query memories

Global flags

These flags work with most commands:
--json
boolean
Emit structured JSON instead of human-readable text. Works with status, memory list, project list, and more.
lerim status --json
lerim memory list --json
--version
boolean
Show Lerim version and exit.
lerim --version
The --json flag can appear before or after the subcommand. Both lerim --json status and lerim status --json work.

Exit codes

Lerim commands return standard exit codes:
CodeMeaningExample
0SuccessCommand completed without errors
1Runtime failureServer not reachable, file not found, API error
2Usage errorInvalid arguments, missing required parameters
3Partial successSome operations succeeded, others failed
4Lock busyAnother process holds the sync/maintain lock

Command categories

Setup and project management

Service lifecycle

  • lerim up - Start Docker container
  • lerim down - Stop Docker container
  • lerim logs - View container logs
  • lerim serve - Run HTTP server + daemon (Docker entrypoint)

Memory operations

  • lerim sync - Index sessions and extract memories (hot path)
  • lerim maintain - Refine existing memories (cold path)
  • lerim daemon - Run continuous sync + maintain loop
  • lerim ask - Query memories with natural language

Platform connections

Direct memory access

  • lerim memory search - Full-text search across memories
  • lerim memory list - List recent memory items
  • lerim memory add - Manually create a memory
  • lerim memory reset - Destructive wipe of memory data

Runtime status

  • lerim status - Show runtime state
  • lerim dashboard - Show dashboard URL

Common patterns

First-time setup

lerim init                     # configure agents
lerim project add ~/codes/app  # register projects
lerim up                       # start service
lerim connect auto             # connect platforms
lerim sync                     # initial sync

Daily workflow

# Query before starting work
lerim ask "What auth pattern are we using?"

# After coding sessions, sync manually if needed
lerim sync --window 24h

# Check status
lerim status

Troubleshooting

# Check if server is running
lerim status

# View logs
lerim logs --follow

# Restart service
lerim down && lerim up

# Preview sync without writing
lerim sync --dry-run

Fresh start

# Destructive reset (requires --yes flag)
lerim memory reset --yes

# Re-sync recent sessions
lerim sync --max-sessions 10
lerim memory reset --yes permanently deletes all memories, workspace data, and session indexes. This cannot be undone.

Running without Docker

If you prefer not to use Docker, run Lerim directly:
lerim connect auto    # detect platforms
lerim serve &         # start server in background
lerim sync            # manual sync
lerim maintain        # manual maintain

# Or run daemon loop
lerim daemon          # continuous sync + maintain

Configuration

Lerim uses TOML-layered configuration (lowest to highest priority):
  1. src/lerim/config/default.toml - Shipped defaults
  2. ~/.lerim/config.toml - User global config
  3. <repo>/.lerim/config.toml - Project overrides
  4. LERIM_CONFIG env var - Explicit override path
API keys come from environment variables:
  • OPENROUTER_API_KEY (required for default models)
  • OPENAI_API_KEY (optional)
  • ANTHROPIC_API_KEY (optional)
  • ZAI_API_KEY (optional)

Next steps

Initialize Lerim

Run the interactive setup wizard

Manage projects

Register and track your repositories

Connect platforms

Link your coding agents

Sync sessions

Extract memories from agent sessions

Build docs developers (and LLMs) love