Querying Memories¶
Lerim provides several ways to search and retrieve memories. All queries are read-only and project-scoped.
lerim ask -- LLM-powered Q&A¶
The primary query interface. Sends your question to the lead agent with memory context.
Requires running server
lerim ask is a service command that requires lerim up or lerim serve
to be running.
Basic query¶
The lead agent retrieves relevant memories, uses them as context, and returns a natural language answer with evidence of which memories were consulted.
Limit context¶
Control how many memory items are included as context:
| Flag | Default | Description |
|---|---|---|
question |
required | Your question (quote if it contains spaces) |
--project |
-- | Scope to a specific project (not yet implemented) |
--limit |
12 |
Max memory items provided as context |
JSON output¶
Get structured output for scripting or agent integration:
Returns JSON with the answer, sources, and metadata.
lerim memory search -- keyword search¶
Full-text keyword search across memory titles, bodies, and tags. Runs locally on the host -- no server required.
| Flag | Default | Description |
|---|---|---|
query |
required | Search string to match (case-insensitive) |
--project |
-- | Filter to project (not yet implemented) |
--limit |
20 |
Max results |
When to use search vs ask
Use memory search for quick keyword lookups when you know what you're
looking for. Use ask when you need the LLM to reason about your question
and synthesize an answer from multiple memories.
lerim memory list -- browse all memories¶
List stored memories (decisions and learnings), ordered by recency:
| Flag | Default | Description |
|---|---|---|
--project |
-- | Filter to project (not yet implemented) |
--limit |
50 |
Max items |
Tips for effective queries¶
Be specific¶
# Good -- specific topic
lerim ask "What authentication pattern does the API use?"
# Less effective -- too broad
lerim ask "How does auth work?"
Reference past decisions¶
lerim ask "Why did we switch from REST to gRPC for the internal API?"
lerim ask "What problems did we have with the original caching approach?"
Check before implementing¶
At the start of a coding session, ask your agent:
Check lerim for any relevant memories about [topic you're working on].
Your agent will run lerim ask or lerim memory search to pull in past
decisions and learnings before it starts working.