#artificial-intelligence #version-control #development-tools #git

bin+lib lore-cli

Capture AI coding sessions and link them to git commits

1 unstable release

new 0.1.0 Dec 31, 2025

#2774 in Command line utilities

Apache-2.0

640KB
14K SLoC

Lore

License CI Release Platform Windows

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.

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:

Tool Format
Claude Code JSONL
Codex CLI JSONL
Gemini CLI JSON
Amp JSON
Aider Markdown
Continue.dev JSON
Cline JSON
Roo Code JSON
Kilo Code JSON
OpenCode JSON

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 install adds a post-commit hook that prompts for linking

Links are bidirectional: given a session, find its commits; given a commit, find its sessions.

Installation

From crates.io

cargo install lore-cli

From Releases

Download the latest binary from GitHub Releases and add it to your PATH.

From Source

git clone https://github.com/varalys/lore.git
cd lore
cargo install --path .

Quick Start

# First time? Run init for guided setup
lore init

# Or just start using lore - it will prompt for setup automatically
lore sessions

# View a session
lore show abc123

# Link a session to the current commit
lore link abc123

# Later, view what sessions informed a commit
lore show --commit HEAD

Example Workflow

# You're reviewing a PR and want to understand a change
$ git log --oneline -1
a1b2c3d feat: add rate limiting to API

$ lore show --commit a1b2c3d
Sessions linked to commit a1b2c3d:

  Session: 7f3a2b1
  Tool: claude-code
  Duration: 45 minutes
  Messages: 23

# View the full conversation
$ lore show 7f3a2b1

Find any conversation across all your AI coding sessions:

# Basic search
lore search "authentication"

# Filter by tool
lore search "bug fix" --tool claude-code

# Filter by date range
lore search "refactor" --since 2025-12-01 --until 2025-12-15

# Filter by project or branch
lore search "api" --project myapp
lore search "feature" --branch main

# Combine filters
lore search "database" --tool aider --project backend --since 2025-12-01

# Show more context around matches
lore search "error handling" --context 3

Search matches message content, project names, branches, and tool names. Results show surrounding context so you can understand the conversation flow.

Commands

Command Description
lore init Guided first-run setup (auto-detects AI tools)
lore status Show daemon status, watchers, and recent sessions
lore sessions List sessions (supports --repo, --limit, --format)
lore show <id> View session details
lore show --commit <ref> View sessions linked to a commit
lore import Import sessions from all enabled watchers
lore link <id> Link session to HEAD
lore unlink <id> Remove a session-commit link
lore search <query> Full-text search with filters and context
lore hooks install Install git hooks for automatic linking
lore hooks status Check installed git hooks
lore hooks uninstall Remove installed git hooks
lore daemon start Start background watcher for real-time capture
lore daemon stop Stop background watcher
lore daemon logs View daemon logs
lore daemon install Install daemon as a system service
lore daemon uninstall Remove daemon service
lore config View configuration
lore config get <key> Get a config value
lore config set <key> <val> Set a config value

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 Status Storage Location
Claude Code Supported ~/.claude/projects/
Codex CLI Supported ~/.codex/sessions/
Gemini CLI Supported ~/.gemini/tmp/*/chats/
Amp Supported ~/.local/share/amp/threads/
Aider Supported .aider.chat.history.md
Continue.dev Supported ~/.continue/sessions/
Cline Supported VS Code extension storage
Roo Code Supported VS Code extension storage
Kilo Code Supported VS Code extension storage
OpenCode Supported ~/.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

lore daemon start    # Start watching
lore daemon status   # Check what's being watched
lore daemon logs     # View daemon logs
lore daemon stop     # Stop watching

Run as a Service

Install the daemon as a system service to start automatically on login:

lore daemon install    # Install and enable service
lore daemon uninstall  # Remove service

This uses launchd on macOS and systemd on Linux. The service restarts automatically on failure.

Manual systemd Setup (Linux)

If you prefer to configure systemd yourself:

mkdir -p ~/.config/systemd/user

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:

systemctl --user daemon-reload
systemctl --user enable --now lore.service
systemctl --user status lore.service

macOS with Homebrew

Once a Homebrew formula is available:

brew services start lore
brew services stop lore

Until then, use lore daemon install or manage launchd manually.

Git Hooks

Install hooks to automatically record session links on commit:

lore hooks install   # Install post-commit hook
lore hooks status    # Check hook status
lore hooks uninstall # Remove hooks

Output Formats

Commands support --format for scripting and integration:

lore sessions --format json
lore show abc123 --format json
lore show abc123 --format markdown
lore status --format json

Configuration

On first run, Lore prompts for setup automatically. You can also run lore init manually.

The init wizard:

  1. Detects installed AI coding tools
  2. Shows which tools have existing sessions
  3. Lets you choose which watchers to enable
  4. Offers to import existing sessions

Configure which tools to track:

lore config set watchers claude-code,aider,gemini
lore config get watchers

For scripting, use --no-init to skip the first-run prompt:

lore --no-init sessions --format json

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.

Dependencies

~47–66MB
~1M SLoC