Lore
Lore captures AI coding sessions and links them to git commits.
When you use AI coding tools like Claude Code or Aider, the conversation history contains valuable context. This includes everything from the prompts you wrote, the approaches you tried, and the decisions you made. Git captures the final code, but does not contain reasoning history for your commits. Lore preserves both.
MCP Integration: Lore includes an MCP server that lets AI tools query your session history directly. Claude Code can search past sessions, retrieve context, and pick up where you left off.
Table of Contents
- Use Cases
- How It Works
- Installation
- Quick Start
- Example Workflow
- MCP Server
- Search
- Blame
- Export
- Session Awareness
- Command Reference
- Supported Tools
- Background Daemon
- Git Hooks
- Output Formats
- Configuration
- Database Management
- Session Deletion
- Shell Completions
- Data Location
- License
- Contributing
Use Cases
- Code review: See the AI conversation that produced a PR, not just the diff
- Debugging: Understand why code was written a certain way by reading the original discussion
- Knowledge transfer: When someone leaves a project, their AI conversations stay with the code
- Learning: Study how problems were solved by browsing linked sessions
- Search: Find that conversation where you solved a similar problem - search by keyword, project, tool, or date
How It Works
Lore reads session data from AI coding tools, stores it in a local SQLite database, and creates links between sessions and git commits.
Capture
Lore includes parsers for each supported tool. Import existing sessions with lore import, or run lore daemon start to watch for new sessions in real-time.
Storage
Sessions and messages are stored in a SQLite database at ~/.lore/lore.db. The schema includes:
- sessions: ID, tool, timestamps, working directory, message count
- messages: ID, session ID, role (user/assistant), content, timestamp
- session_links: Maps session IDs to git commit SHAs
Full-text search uses SQLite FTS5 to index message content.
Linking
Links connect sessions to commits. You can create them:
- Manually:
lore link <session-id> --commit <sha> - Via hooks:
lore hooks installadds a post-commit hook that prompts for linking
Links are bidirectional: given a session, find its commits; given a commit, find its sessions.
Installation
Homebrew (macOS)
From crates.io
From Releases
Download the latest binary from GitHub Releases and add it to your PATH.
From Source
Quick Start
# First time? Run init for guided setup
# Or just start using lore - it will prompt for setup automatically
# Example output - shows branch transitions during each session
# ID STARTED MESSAGES BRANCH DIRECTORY
# c9731a91 2025-12-25 17:52 566 main -> feat/auth -> main myapp
# 24af9690 2025-12-22 19:13 1910 feat/phase-0-foundati... lore
# View a session
# Link a session to the current commit
# Later, view what sessions informed a commit
Example Workflow
# You're reviewing a PR and want to understand a change
# View the full conversation
MCP Server
Lore includes an MCP (Model Context Protocol) server that allows AI coding tools to query your session history directly. This enables tools like Claude Code to access your past sessions and reasoning history.
Claude Code
Add Lore as an MCP server:
Or manually edit ~/.claude/settings.json:
Restart Claude Code after adding the server.
Claude Desktop
Edit ~/.claude/claude_desktop_config.json:
Restart Claude Desktop after editing the configuration.
Available Tools
The MCP server exposes these tools to AI assistants:
| Tool | Description |
|---|---|
lore_search |
Search session messages for text content |
lore_get_session |
Get full details of a session by ID |
lore_list_sessions |
List recent sessions with optional filters |
lore_get_context |
Get recent session context for a repository |
lore_get_linked_sessions |
Get sessions linked to a git commit |
Example Usage
Once configured, Claude Code can use Lore tools naturally:
- "Search my sessions for authentication code"
- "Show me the last session in this project"
- "What sessions are linked to the previous commit?"
The AI assistant will automatically call the appropriate Lore tools and incorporate the results into its responses.
Search
Find any conversation across all your AI coding sessions:
# Basic search
# Filter by tool
# Filter by date range
# Filter by project or branch
# Combine filters
# Show more context around matches
Search matches message content, project names, branches, and tool names. Results show surrounding context so you can understand the conversation flow.
Blame
See which AI session led to a specific line of code:
# Find the session that produced line 42 of main.rs
# Example output:
# Line 42 of src/main.rs
# Content: pub fn initialize_database() -> Result<Database> {
# Commit: a1b2c3d (2025-01-05)
# Author: Jane Developer
# Message: feat: add database initialization
#
# Linked Sessions:
# Session 7f3a2b1 (claude-code, 23 messages)
#
# Relevant Excerpts:
# [User] Can you help me write a function to initialize the database?
# [Assistant] I'll create an initialize_database function that...
This connects git blame to your AI reasoning history. For any line of code, you can trace back to the conversation that produced it.
# Output as JSON for scripting
# Output as markdown
Export
Export sessions for sharing, archiving, or backup:
# Export as markdown (default)
# Export as JSON
# Write to a file
Redaction
Remove sensitive content before sharing:
# Automatic redaction of common secrets
# Add custom patterns
Built-in redaction patterns:
- API keys and tokens (
sk-,Bearer,api_key=) - AWS credentials (
AKIA...,aws_secret_access_key) - GitHub tokens (
ghp_,gho_,ghu_,ghs_,ghr_) - Email addresses
- IPv4 addresses
- Private keys (RSA, DSA, EC headers)
- Connection strings (mysql://, postgres://, mongodb://, redis://)
Redacted content is replaced with [REDACTED].
Session Awareness
Lore helps you pick up where you left off and organize your sessions:
# See what session is active in the current directory
# Get quick context on recent sessions in this repo
# Get detailed summary of the last session (for "continue where we left off")
# Add a bookmark or note to the current session
# Tag sessions for organization
# Add a summary to a session for future reference
Tags, annotations, and summaries appear in lore show output and help you quickly understand past sessions.
Command Reference
Essential commands to get started:
Run lore --help for the full command list, or lore <command> --help for details on any command.
Supported Tools
Lore targets Linux, macOS, and WSL2. Windows native support is planned for a
future release. For WSL2, CLI-based tools work as long as the sessions live in
the Linux filesystem. VS Code extension sessions are only discovered when the
extensions run in WSL (Remote - WSL); if you run VS Code natively on Windows,
those sessions live under %APPDATA% and are not detected today.
| Tool | Format | Storage Location |
|---|---|---|
| Claude Code | JSONL | ~/.claude/projects/ |
| Codex CLI | JSONL | ~/.codex/sessions/ |
| Gemini CLI | JSON | ~/.gemini/tmp/*/chats/ |
| Amp | JSON | ~/.local/share/amp/threads/ |
| Aider | Markdown | .aider.chat.history.md |
| Continue.dev | JSON | ~/.continue/sessions/ |
| Cline | JSON | VS Code extension storage |
| Roo Code | JSON | VS Code extension storage |
| Kilo Code | JSON | VS Code extension storage |
| OpenCode | JSON | ~/.local/share/opencode/storage/ |
Building an AI coding tool? We welcome contributions to support additional tools. Open an issue with your tool's session storage location and format, or submit a PR adding a watcher. See CONTRIBUTING.md for details.
Background Daemon
The daemon watches for new sessions in real-time and imports them automatically.
Manual Start
Run as a Service
Install the daemon as a system service to start automatically on login.
macOS with Homebrew (Recommended)
If you installed via Homebrew, use brew services:
Linux with systemd
Use the built-in service installer:
The service restarts automatically on failure.
Manual systemd Setup (Linux)
If you prefer to configure systemd yourself:
Create ~/.config/systemd/user/lore.service:
[Unit]
Description=Lore AI session capture daemon
After=default.target
[Service]
Type=simple
ExecStart=%h/.cargo/bin/lore daemon start --foreground
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
Then enable and start:
Git Hooks
Install hooks to automatically record session links on commit:
Output Formats
Commands support --format for scripting and integration:
Configuration
On first run, Lore prompts for setup automatically. You can also run lore init manually.
The init wizard:
- Detects installed AI coding tools
- Shows which tools have existing sessions
- Lets you choose which watchers to enable
- Offers to import existing sessions
- Offers to install shell completions
- Offers to start the background service (for real-time capture)
Configure which tools to track:
For scripting, use --no-init to skip the first-run prompt:
Database Management
Lore provides commands for managing the database:
# View database statistics
# Example output:
# Database Statistics
#
# Sessions: 142
# Messages: 8934
# Links: 67
# File size: 12.45 MB
#
# Date Range
# Oldest: 2024-06-15 09:23
# Newest: 2025-01-02 14:56
#
# Sessions by Tool
# claude-code: 98
# aider: 31
# gemini: 13
# Reclaim unused disk space
# Delete old sessions (preview first with --dry-run)
Duration formats for --older-than:
Nd- days (e.g.,90d)Nw- weeks (e.g.,12w)Nm- months (e.g.,6m)Ny- years (e.g.,1y)
Session Deletion
Delete a single session and all its data:
This permanently removes the session, its messages, and any commit links.
Shell Completions
The easiest way to install completions is to let Lore auto-detect your shell:
Or specify a shell explicitly:
You can also output completions to stdout for manual installation:
After installing, restart your shell or source the completion file.
PowerShell and Elvish completions are also available (lore completions powershell, lore completions elvish) and will be documented when Windows support is added.
Data Location
~/.lore/
├── lore.db # SQLite database
├── config.yaml # Configuration
└── logs/ # Daemon logs
All data stays on your machine. There is no cloud sync or external service.
License
Apache 2.0
Contributing
See CONTRIBUTING.md.