Prerequisites
Python version
Lerim requires Python 3.10 or higher. Check your Python version:Lerim supports Python 3.10, 3.11, 3.12, and 3.13+. For Python versions below 3.13, Lerim automatically installs
eval_type_backport>=0.2.0 for compatibility.Docker (recommended)
Docker is the recommended way to run Lerim as an always-on service. Install Docker Desktop for your platform:- macOS: Docker Desktop for Mac
- Windows: Docker Desktop for Windows
- Linux: Docker Engine
LLM API key
Lerim uses LLM providers for extraction and querying. You need at least one API key:- OpenRouter (recommended): Get your API key at openrouter.ai
- OpenAI: Get your API key at platform.openai.com
- ZAI: Contact ZAI for access
- Anthropic (optional): Get your API key at console.anthropic.com
Installation
Install via pip
Install Lerim using pip:lerim command-line tool and all required dependencies:
pydantic>=2.0python-dotenv>=1.2.1PyYAML>=6.0loguru>=0.7.3dspy>=3.1.3python-frontmatter>=1.1.0openrouter>=0.6.0pydantic-ai>=1.61.0logfire[dspy]>=4.25.0
For Python 3.10, Lerim also installs
tomli>=2.0 for TOML config file support (built-in for Python 3.11+).Verify installation
Check that Lerim is installed:Optional dependencies
Lerim supports optional features via extras:embeddings extra includes:
lancedb>=0.27.1pyarrow>=15.0.0torch>=2.2transformers>=4.44.2,<5
Configuration
Set API keys
Lerim reads API keys from environment variables. Set at least one:~/.bashrc, ~/.zshrc, etc.):
Lerim uses OpenRouter by default with the following models:
- Lead agent:
x-ai/grok-4.1-fast - Explorer agent:
x-ai/grok-4.1-fast - Extraction:
openai/gpt-5-nano(300K token window) - Summarization:
openai/gpt-5-nano(300K token window)
~/.lerim/config.toml. See the configuration guide for details.Run the setup wizard
Run the interactive setup wizard:- Detect your installed coding agents (Claude Code, Codex, Cursor, OpenCode)
- Ask which agents you want to connect
- Write the config to
~/.lerim/config.toml - Check for Docker availability
Configuration layers
Lerim uses a layered TOML config system (low to high priority):src/lerim/config/default.toml(shipped with package — all defaults)~/.lerim/config.toml(user global config)<repo>/.lerim/config.toml(project overrides)LERIM_CONFIGenv var path (explicit override, for CI/tests)
Starting Lerim
With Docker (recommended)
Start Lerim as a Docker service:- Runs the sync + maintain daemon loop
- Serves the dashboard at
http://localhost:8765 - Exposes the HTTP API for CLI commands
The first time you run
lerim up, Docker will pull the Lerim image from the registry. This may take 1-2 minutes depending on your internet connection.Running without Docker
If you prefer not to use Docker, run Lerim directly:lerim memory search but not service commands like lerim ask.
Verification
Verify that Lerim is running:lerim up or lerim serve.
Adding projects
Register the projects you want Lerim to track:.lerim/ directory for its memories.
List registered projects:
When you add or remove projects while Lerim is running, the container automatically restarts to mount the new volumes.
Connecting coding agents
Lerim ingests session transcripts from your coding agents. Connect them using:Platform session stores
| Platform | Default Session Store | Format |
|---|---|---|
| Claude Code | ~/.claude/projects/ | JSONL files |
| Codex CLI | ~/.codex/sessions/ | JSONL files |
| Cursor | ~/Library/Application Support/Cursor/User/globalStorage/ (macOS) | SQLite state.vscdb, exported to JSONL |
| OpenCode | ~/.local/share/opencode/ | SQLite opencode.db, exported to JSONL |
Troubleshooting
Python version issues
Problem:ERROR: Package 'lerim' requires a different Python: 3.9.0 not in '>=3.10'
Solution: Upgrade to Python 3.10 or higher. Use pyenv to manage multiple Python versions:
Docker not found
Problem:Docker: not found during lerim init
Solution: Install Docker Desktop or run Lerim without Docker using lerim serve.
API key errors
Problem:Missing API key: OPENROUTER_API_KEY
Solution: Set the environment variable:
~/.bashrc, ~/.zshrc) for persistence.
Port already in use
Problem:Error starting userland proxy: listen tcp4 0.0.0.0:8765: bind: address already in use
Solution: Change the server port in ~/.lerim/config.toml:
No sessions detected
Problem:lerim status shows sessions_indexed_count: 0
Solution: Make sure you’ve:
- Connected at least one agent platform:
lerim connect auto - Used your coding agents to create some sessions
- Waited for the sync loop to run (or trigger manually with
lerim sync)
missing, the path doesn’t exist. Reconnect with the correct path:
Memory not persisting
Problem: Memories disappear after restarting Lerim Solution: Make sure you’ve registered projects withlerim project add. Without registered projects, memories only go to ~/.lerim/memory/ (global scope).
Project-scoped memories are stored in <repo>/.lerim/memory/ and are more durable.
Build from source (development)
If you want to run Lerim from source:Lerim uses uv for fast Python environment management, but you can also use
pip or poetry.Next steps
Quickstart
Get up and running in 5 minutes
Configuration
Customize model providers, tracing, and more
CLI reference
Master all Lerim commands
Architecture
Understand how Lerim works