Loading...
Loading...
Manage LLMem — structured memory system with SQLite-backed factual memory, semantic search, and background dreaming (decay, boost, promote, merge). Use when the user wants to: (1) add, search, update, or delete memories, (2) generate context for injection, (3) check memory stats, (4) run background consolidation/dream. Triggers on: "memory", "remember", "recall", "llmem", "memories", "forget", "consolidate memories", "dream".
npx skill4agent add michieldean/llmem llmemrelated_tosupersedescontradictsdepends_onderived_from~/.local/bin/llmem~/.config/llmem/config.yaml~/.config/llmem/memory.dbhttp://localhost:11434session.adapteropencode~/.local/share/opencode/opencode.dbcopilot~/.copilot/session-state/--sharenoneno_transcript# For Copilot CLI:
session:
adapter: copilot
copilot:
state_dir: ~/.copilot/session-state
share_dir: .llmem init| Type | Use for |
|---|---|
| fact | Objective truths, definitions, state of the world |
| decision | Choices made and their rationale |
| preference | User preferences, style choices |
| event | Things that happened at a point in time |
| project_state | Current status of a project or system |
| procedure | How-to knowledge, step sequences |
| conversation | Notable conversation outcomes or commitments |
| self_assessment | Structured introspective records — error patterns, behavioral corrections, recurring mistakes, proposed procedural updates |
| Category | Description |
|---|---|
| NULL_SAFETY | Missing null/None/undefined checks before property access or method calls |
| ERROR_HANDLING | Missing try/except, bare except, swallowed errors, unhandled promise rejections |
| OFF_BY_ONE | Boundary errors, wrong loop bounds, fencepost errors |
| RACE_CONDITION | Concurrency issues, async/await problems, missing locks |
| AUTH_BYPASS | Missing auth checks, SSRF, injection vulnerabilities, security oversights |
| DATA_INTEGRITY | Stale derived fields, out-of-sync caches/embeddings/indexes, source-of-truth divergence |
| MISSING_VERIFICATION | Skipped test steps, unverified outputs, assumed-it-works |
| EDGE_CASE | Unhandled empty input, unexpected types, boundary values |
| PERFORMANCE | N+1 queries, unnecessary recomputation, memory leaks |
| DESIGN | Architectural issues, wrong abstraction level, coupling problems |
| REVIEW_PASSED | Clean review with no findings — positive outcome for tracking purposes |
| Field | Required | Description |
|---|---|---|
| Category | Yes | Taxonomy category from the Error Taxonomy above (e.g. |
| Context | No | Where and when — file, task, session date |
| What_happened | Yes | Behavioral description, not narrative |
| Outcomes | No | What were the results? Did things work on first try or require iterations? |
| What_caught_it | No | How the error was discovered ( |
| Estimates_vs_actual | No | Was the complexity assessment accurate? Did tasks take more or less effort? |
| Recurring | No | |
| Proposed_update | No | Specific procedural directive to prevent recurrence |
| Iteration_count | No | How many attempts before success (integer). 1 = first try, 2 = one retry, etc. |
# Add a memory
llmem add --content "content" --type fact
llmem add --content "prefer dark theme" --type preference --confidence 0.9
# Search memories (hybrid RRF fusion by default)
llmem search "query"
llmem search "query" --type decision --limit 5
llmem search "query" --fts-only # FTS5 keyword search only (no embedder needed)
llmem search "query" --semantic-only # Semantic (embedding) search only (requires embedder)
llmem search "query" --valid-only # Only show valid (non-expired) memories
# List all
llmem list
llmem list --type fact --limit 20
llmem list --all # Include expired memories
# Get specific memory (read-only, does not update access stats)
llmem get <id>
# Update a memory
llmem update <id> --content "new content"
llmem update <id> --confidence 0.95
llmem update <id> --summary "short summary"
llmem update <id> --metadata '{"key": "value"}'
# Invalidate (soft-delete — marks as expired)
llmem invalidate <id> --reason "no longer relevant"
# Delete permanently
llmem delete <id>
# Stats
llmem stats
# Context injection for sessions
llmem context --session-id <session_id> # Inject context for a new session
llmem context --compacting --session-id <session_id> # Inject key memories during compaction
# Session lifecycle hooks
llmem hook --type idle --session-id <session_id> # Memory extraction + introspection
llmem hook --type created --session-id <session_id> # Context injection on session start
llmem hook --type ending --session-id <session_id> # Automatic introspection on session end
llmem hook --type ending --session-id <session_id> --model glm-5.1:cloud --base-url http://localhost:11434
llmem hook --type compacting --session-id <session_id># Context during compaction
# Dream — background consolidation (decay, boost, promote, merge)
llmem dream # Preview all phases (dry-run)
llmem dream --apply # Execute all phases
llmem dream --phase light # Run only the light phase
llmem dream --phase deep # Run only the deep phase
llmem dream --phase rem # Run only the REM phase
llmem dream --apply --phase deep # Apply only the deep phase
llmem dream --apply --report /path/to/report.html # Generate HTML dream report
# Learn a lesson from a wrong→right correction
llmem learn --wrong "called wrong function" --right "call correctFunction() instead" --context "handler.py:42"
# Introspect — analyze a failure and store self_assessment memory
# Manual mode: specify fields directly
llmem introspect --category NULL_SAFETY --what-happened "missing null check" --context "handler.py:42" --caught-by self-review --proposed-fix "always check for None before .field"
llmem introspect --category NULL_SAFETY --what-happened "missing null check" --model glm-5.1:cloud --base-url http://localhost:11434
# Automatic mode: introspect a session transcript or arbitrary text
llmem introspect --auto --session <session-id> # Read transcript from OpenCode adapter
llmem introspect --auto --text "Encountered a null pointer error" # Introspect arbitrary text
llmem introspect --auto --session <session-id> --model glm-5.1:cloud --base-url http://localhost:11434
# Track review findings as self_assessment memories (automatic post-review hook)
llmem track-review --single --category NULL_SAFETY --context "handler.py:42" # Single finding (uses --single flag)
llmem track-review --findings /tmp/review-findings.json --context "handler.py" # Batch mode: persist findings from JSON file
llmem track-review --clean # Invalidate all existing track-review memories
llmem track-review # Clean review (no findings) → creates REVIEW_PASSED memory
# Export/import
llmem export --output memories.json
llmem import memories.json
# Embedding quality metrics
llmem metrics
# Initialize config and database
llmem init
llmem init --ollama-url http://localhost:11434supersedescontradictsdepends_onrelated_toderived_fromRetriever--traverse-relationsfinal_score = rrf_score * (1 - blend) + weighted_signal * blend| Signal | Weight | Formula |
|---|---|---|
| Confidence | 0.4 | Direct use of |
| Recency | 0.3 | |
| Access frequency | 0.2 | |
| Type priority | 0.1 | Lookup in |
| Type | Priority |
|---|---|
| decision | 1.2 |
| preference | 1.1 |
| procedure | 1.1 |
| fact | 1.0 |
| project_state | 1.0 |
| self_assessment | 1.0 |
| event | 0.9 |
| conversation | 0.7 |
llmem~/.local/bin/llmem/usr/local/bin/llmemnomic-embed-textvec0llmem context --session-id <id>llmem hook --type <idle|created|ending|compacting> --session-id <id>self_assessment--model--base-urlllmem getaccess_countaccessed_ataccess_countaccessed_atcalibration_statusdecreasingstableincreasingcalibrated_atstale_procedure: truestale_atllmem get <id>llmem track-reviewself_assessment--single--findings <file>REVIEW_PASSED--clean~/.config/llmem/dream-diary.mdskill_patch_thresholdproposed-changes.mdproposed-changes.md[SKILL PATCH]stale_procedure_days### Calibration--applyllmem dream--report /path/to/report.htmlllmem-dream.timerllmem dream --applyharness/llmem-dream.serviceharness/llmem-dream.timerdream:~/.config/llmem/config.yaml| Key | Default | Description |
|---|---|---|
| 0.92 | Cosine similarity for near-duplicate detection |
| 0.05 | Confidence reduction per decay interval |
| 30 | Days per decay interval |
| 0.3 | Minimum confidence after decay |
| 0.3 | Memories at or below this are invalidated |
| 5 | Access count that triggers confidence boost |
| 0.05 | Confidence boost amount |
| ~/.config/llmem/dream-diary.md | Path to dream diary file |
| (none) | Path for HTML dream report output |
| 3 | Minimum self_assessment occurrences to trigger behavioral insight |
| 30 | Days of self_assessment memories for behavioral insights |
| (none) | Cosine similarity threshold for auto-linking related memories |