-
Notifications
You must be signed in to change notification settings - Fork 174
Cross Project Learning
github-actions[bot] edited this page Feb 12, 2026
·
3 revisions
Loki Mode's memory system that learns from every session and applies insights to future projects.
Cross-project learning captures three types of knowledge:
| Type | Description | Example |
|---|---|---|
| Patterns | Reusable approaches | "Use JWT with refresh tokens for auth" |
| Mistakes | Errors to avoid | "Don't store secrets in localStorage" |
| Successes | What worked well | "TDD reduced bugs by 60%" |
At the end of each session, Loki Mode:
- Analyzes
CONTINUITY.mdfor patterns - Extracts learnings from session logs
- Deduplicates using MD5 hashing (reduces 71% duplicates)
- Stores in JSONL format for efficient append
At the start of each session, Loki Mode:
- Loads relevant learnings from global memory
- Applies patterns to current context
- Avoids known mistakes
- Reuses successful approaches
~/.loki/learnings/
patterns.jsonl # Reusable patterns
mistakes.jsonl # Errors to avoid
successes.jsonl # Successful approaches
Each file uses JSONL (JSON Lines) format:
{"version":"1.0","created":"2026-02-02T12:00:00Z"}
{"description":"Always validate user input at API boundaries","project":"auth-service","category":"security","timestamp":"2026-02-02T12:30:00Z"}
{"description":"Use connection pooling for database connections","project":"data-api","category":"performance","timestamp":"2026-02-02T14:00:00Z"}# List all learnings
loki memory list
# List specific type
loki memory show patterns
loki memory show mistakes
loki memory show successes
# With limit
loki memory show patterns --limit 10# Search across all types
loki memory search "authentication"
# Output as JSON
loki memory search "database" --format json# View statistics
loki memory statsOutput:
Cross-Project Learnings Statistics
By Category:
patterns: 25
mistakes: 10
successes: 15
Total: 50
By Project:
auth-service: 20
data-api: 15
frontend: 10
unknown: 5
# Export all learnings
loki memory export ./learnings-backup.json
# Import learnings
loki memory import ./learnings-backup.json# Clear specific type
loki memory clear patterns
loki memory clear mistakes
# Clear all
loki memory clear all# Remove duplicate entries
loki memory dedupecurl http://localhost:57374/memoryResponse:
{
"patterns": 25,
"mistakes": 10,
"successes": 15,
"location": "/Users/you/.loki/learnings"
}curl "http://localhost:57374/memory/patterns?limit=10"Response:
{
"type": "patterns",
"entries": [
{
"description": "Use JWT with refresh tokens",
"project": "auth-service",
"timestamp": "2026-02-02T12:00:00Z"
}
],
"total": 25,
"limit": 10,
"offset": 0
}curl "http://localhost:57374/memory/search?q=authentication"curl -X DELETE http://localhost:57374/memory/patterns| Variable | Default | Description |
|---|---|---|
LOKI_MEMORY_DIR |
~/.loki/learnings |
Storage location |
LOKI_MEMORY_ENABLED |
true |
Enable/disable learning |
LOKI_MEMORY_DEDUPE |
true |
Auto-deduplicate |
# ~/.config/loki-mode/config.yaml
memory:
enabled: true
directory: ~/.loki/learnings
dedupe: true
max_entries_per_type: 1000Loki Mode extracts learnings from CONTINUITY.md:
# Session Continuity
## Patterns Discovered
- Always validate user input at API boundaries
- Use connection pooling for database connections
## Mistakes Made
- Forgot to handle null case in user lookup
- Didn't set up proper error boundaries
## What Worked Well
- TDD approach caught 3 bugs early
- Component-first design simplified testing- Be specific - "Use bcrypt with cost factor 12" vs "Hash passwords"
- Include context - "For REST APIs, use..." vs "Use..."
- Keep it actionable - Focus on what to do/avoid
- Review periodically - Remove outdated learnings
-
Deduplicate regularly - Run
loki memory dedupe - Export backups - Keep backups of valuable learnings
- Share selectively - Review before sharing with team
In addition to raw JSONL learnings, Loki Mode can extract structured solutions -- curated, categorized knowledge with YAML frontmatter that feeds back into future planning.
| Aspect | Raw Learnings (JSONL) | Structured Solutions (MD) |
|---|---|---|
| Format | JSON lines, append-only | Markdown with YAML frontmatter |
| Structure | Flat description field | title, tags, symptoms, root_cause, prevention |
| Storage | ~/.loki/learnings/*.jsonl |
~/.loki/solutions/{category}/*.md |
| Retrieval | Keyword grep | Tag + symptom matching, relevance scoring |
| Categories | patterns/mistakes/successes | security/performance/architecture/testing/debugging/deployment/general |
---
title: "Connection pool exhaustion under load"
category: performance
tags: [database, pool, timeout, postgres]
symptoms:
- "ECONNREFUSED on database queries under load"
root_cause: "Default pool size of 10 insufficient"
prevention: "Set pool size to 2x concurrent connections"
confidence: 0.85
source_project: "auth-service"
created: "2026-02-09T12:00:00Z"
applied_count: 0
---
## Solution
[Detailed explanation of fix]
## Context
[How this was discovered]- After VERIFY passes with novel insight (automatic via COMPOUND phase)
- When fixing a non-obvious bug (root cause analysis)
- When discovering a reusable pattern
- When hitting a pitfall worth documenting
- Manually via
loki compound run
# List solutions by category
loki compound list
# Show solutions in a category
loki compound show security
# Search across all solutions
loki compound search "authentication"
# Manually trigger compounding from session learnings
loki compound run
# View statistics
loki compound statsAt the start of each session, Loki Mode:
- Scans
~/.loki/solutions/subdirectories - Reads YAML frontmatter from each solution file
- Matches tags and symptoms against current task context
- Injects top 3 relevant solutions into the REASON phase context
- API Reference - Memory API endpoints
- CLI Reference - Memory CLI commands
- Architecture - Memory system architecture