Skip to content

jeffdhooton/lore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lore

Local git intelligence daemon for AI agents. Pre-indexes blame, commit history, co-change patterns, and authorship data, then serves them as millisecond-latency queries over MCP.

Replaces the 3–5 git log/blame/show commands an AI agent runs every time it needs to understand code history — one query instead of a chain.

Install

go install github.com/jeffdhooton/lore/cmd/lore@latest

Or build from source:

git clone https://github.com/jeffdhooton/lore.git
cd lore
go build ./cmd/lore

Quick start

# Index the current repo (blame every file + last 500 commits)
lore init

# Who wrote lines 40–60 of server.go?
lore blame server.go --start-line 40 --end-line 60

# What changed in this file recently?
lore history server.go

# What files usually change alongside auth.go?
lore cochange auth.go

# What are the most-churned files?
lore hotspots

# Who are the main authors?
lore contributors

# Why does line 45 exist?
lore intent server.go --line 45

# Register with Claude Code
lore setup

How it works

lore init shells out to git blame --porcelain and git log --numstat to build a structured index in BadgerDB. A background daemon (lored) keeps the index resident in memory and serves queries over a Unix socket using JSON-RPC 2.0.

On first query, the daemon auto-spawns — no manual lore start required.

After indexing, the daemon watches .git/refs/heads/ for new commits and re-indexes automatically.

Commands

Command Description
lore init [path] Index a git repository
lore blame <file> Structured blame data per line
lore history [file] Recent commits with context
lore cochange <file> Files that change alongside target
lore hotspots Most-churned files by commit count
lore contributors [file] Main authors ranked by contribution
lore intent <file> --line N Commit message + context for a line
lore status Show indexed repos and daemon state
lore setup Register with Claude Code (MCP + skill)
lore doctor Health checks
lore start/stop Manual daemon lifecycle
lore mcp MCP stdio server (launched by Claude Code)

All commands output JSON by default. Add --pretty for human-readable formatting.

Claude Code integration

lore setup

This registers lore as an MCP server and installs a routing skill so Claude Code automatically uses lore queries instead of raw git commands. After setup, restart Claude Code.

MCP tools

Tool Use case
lore_blame "Who wrote this code?"
lore_history "What changed recently?"
lore_cochange "What else should I update?"
lore_hotspots "Where is the risk?"
lore_contributors "Who should review this?"
lore_intent "Why does this code exist?"
lore_status "Which repos are indexed?"

Architecture

┌────────────┐     Unix socket      ┌──────────┐     BadgerDB
│  lore CLI  │ ──── JSON-RPC 2.0 ──→│  lored   │ ──→ per-repo index
│  lore mcp  │                      │ (daemon) │     ~/.lore/repos/<hash>/
└────────────┘                      └──────────┘
                                         │
                                    fsnotify on
                                    .git/refs/
  • One binary, two modes: CLI client + daemon (same binary, auto-spawned)
  • BadgerDB with Snappy compression for the per-repo index
  • fsnotify watches .git/refs/heads/ and .git/HEAD for automatic re-indexing
  • No CGO — single static binary, cross-compiles freely

Index strategy

  • git blame --porcelain on every tracked file at HEAD (parallel, capped at NumCPU workers)
  • git log --numstat for the last 500 commits (configurable via --depth)
  • Co-change pairs derived from commits (skipping bulk commits touching 50+ files)
  • Churn stats and per-file contributor aggregation

A typical repo indexes in under a second. Queries return in under 10ms.

Flags

--repo <path>    Override the repo root (defaults to cwd)
--pretty         Pretty-print JSON output
--depth <n>      Commits to index (default 500, 0 = all)
--start-line <n> Filter blame from this line
--end-line <n>   Filter blame to this line
--limit <n>      Max results for history/hotspots/cochange
--line <n>       Line number for intent queries

Part of the agent tool suite

A collection of local-first, single-binary dev tools built for AI coding agents. All share the same architecture: Go, no CGO, BadgerDB, daemon over Unix socket, MCP stdio, millisecond-latency queries. Free, local-only, no cloud.

Tool What it does Status
scry Code intelligence — symbols, refs, call graphs, impls, test coverage Shipped
flume Runtime visibility — HTTP requests, SQL queries, exceptions from dev servers P0 shipped
tome Schema awareness — DB schemas, API shapes, ORM models, enums P0 shipped
lore Git intelligence — blame, history, co-change patterns, hotspots P0 shipped

Requirements

  • Go 1.23+
  • git on PATH

License

MIT

About

Local git intelligence daemon for AI agents

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages