loreline
Imports Discord chat exports and links relevant messages to commits, pull requests, or files in the repository.
Indexes a Git repository's history, including commits, blame data, and line history, to trace why specific lines, functions, or files exist and keep the local knowledge base current via hooks or watching.
Enriches repository history with GitHub pull request descriptions, review comments, and linked issues using a token or gh auth login, while also resolving PR numbers from commit history.
Connects to local Ollama models to generate explanations and answer history questions using the collected evidence with citations.
Uses the OpenAI API or OpenAI-compatible endpoints as an optional LLM to generate code-history explanations and cited answers.
Imports Slack workspace exports and links messages that mention commits, pull requests, or files to the relevant code history.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Español · Français · Deutsch · Português · Русский
loreline
git blame tells you who. loreline tells you why.
A local-first agent that turns any git repository into a living knowledge base. Point it at any line, and it tells you the decision, the pull request, the discussion and the people behind it.
The web UI (loreline serve) on a real open-source repo. The "Why it exists" text is written by whichever LLM you connect.
Why?
Every codebase is full of lines that look wrong but are there for a reason: a sleep(0.3), a retry count of 3, a weird special case for one customer. The reason lives in a PR description from 2021, a review comment, a Slack thread, or someone's head. When nobody can find it, people either leave the code alone forever or "clean it up" and reintroduce the bug.
loreline connects every line of code to the story behind it:
$ loreline why app/upload.py:42
⟡ app/upload.py:42
│ for attempt in range(3): # S3 drops ~1% of PUTs
Why it exists
Uploads are retried three times because S3 intermittently returned 503s under load
[C1]. The fix came from issue #7 ("Uploads fail randomly") and was merged in [PR#42],
where a reviewer noted 3 matches the AWS SDK default.
Decision: retry failed uploads up to 3 times instead of failing the request.
[C1] introduced by 9f2c1e7a Retry uploads three times
Ada Lovelace · 2024-03-02
PR #42 Retry flaky uploads https://github.com/acme/app/pull/42
issue #7 Uploads fail randomly
💬 cy: 3 matches the SDK default, approvingRelated MCP server: provenance-mcp
Features
whyfor any line, function or file. Follows the line through history withgit blame -w -M -Candgit log -L, skipping moves and whitespace noise (and honouring.git-blame-ignore-revs).Finds the pull request, even offline. It reads PR numbers from merge and squash commits and walks back to the merge that brought a commit in. With a GitHub token it also pulls the PR description, review comments and linked issues.
Chat is part of the record. Import Slack exports, Discord exports, JSONL or plain notes. Messages that mention a commit, a PR or a file get linked to that code automatically.
Ask the history.
loreline ask "why did we drop Redis?"searches commits, PRs, issues and chat (SQLite FTS5) and answers with citations.Always current.
loreline initinstalls git hooks so the index updates on every commit, merge and rebase.loreline watchis there too if you prefer polling.Knowledge map.
loreline map -o LORE.mdwrites one line per file on why it exists. It's cached per file and only regenerated when that file changes.Works with any LLM, or none. Ollama, LM Studio, llama.cpp, vLLM, any OpenAI-compatible API, Anthropic Claude. With no LLM you still get the full evidence trail.
Plugs into your coding agent.
loreline mcpis an MCP server, so Claude Code, Cursor, Windsurf, Zed and others can ask "why is this here?" before they delete something.Local-first and private by default. Everything lives in
.git/loreline/. Nothing leaves your machine unless you point it at a hosted LLM, and author emails are redacted from LLM prompts.Zero dependencies. Pure Python standard library plus
git. Installs in seconds.
Install
One command, using whichever tool you already have:
pipx install git+https://github.com/bollenlee89-blip/loreline
# or
uv tool install git+https://github.com/bollenlee89-blip/loreline
# or
curl -fsSL https://raw.githubusercontent.com/bollenlee89-blip/loreline/main/install.sh | shYou need Python 3.9+ and git. This also installs a git-why command, so git why file.py:42 works.
Quick start
cd your-repo
loreline init # index history + install auto-update hooks
loreline why src/server.py:120 # why does this line exist?
loreline why src/server.py:connect # ...or this function?
loreline ask "why do we pin protobuf to 3.20?"
loreline serve # web UI at http://localhost:7777Connect an LLM (optional)
loreline picks one automatically: a running Ollama first, then ANTHROPIC_API_KEY, then OPENAI_API_KEY. To choose explicitly:
# Local, fully private
ollama pull qwen2.5-coder && loreline config set llm.provider ollama && loreline config set llm.model qwen2.5-coder
# Any OpenAI-compatible server (LM Studio, llama.cpp, vLLM, OpenRouter, Groq...)
loreline config set llm.provider openai
loreline config set llm.base_url http://localhost:1234/v1
loreline config set llm.model your-model
# Anthropic
export ANTHROPIC_API_KEY=...Add --global to save a setting for all repositories. Run loreline doctor to check your setup.
Pull request context (optional)
For GitHub repos, loreline uses GITHUB_TOKEN, GH_TOKEN or your gh auth login to fetch PR descriptions, reviews and linked issues. Results are cached locally. Without a token it still finds PR numbers from history.
Team chat (optional)
loreline import ./slack-export/ # Slack workspace export folder
loreline import discord-channel.json # DiscordChatExporter JSON
loreline import decisions.md notes.txt # meeting notes, ADRs, "date name: message" logs
loreline import messages.jsonl # {"author","date","text","channel"} per lineUse it from Claude Code, Cursor and other agents
claude mcp add loreline -- loreline mcpFor Cursor, Windsurf or another MCP client, add a server with command loreline and args ["mcp"]. Agents get two tools: loreline_why and loreline_ask.
Commands
Command | What it does |
| Index the repo and install auto-update git hooks |
| Explain why a line, function or file exists ( |
| Answer a question from the project's history, with citations |
| Write a knowledge map of why every file exists |
| Local web UI: browse files and click any line |
| Import Slack, Discord, JSONL or text notes |
| Run as an MCP server for coding agents |
| Manual indexing, polling watcher, hook management |
| Configuration and health check |
How it works
git history ──┐
PRs/reviews ──┼──► index (.git/loreline/lore.db, SQLite + FTS5) ──► evidence pack ──► LLM (optional) ──► answer with citations
issues ───────┤ ▲ updated by git hooks / watch ▲
chat/notes ───┘ └──────────────────────────────────── blame + git log -L for the line you asked aboutIndex: commits, touched files, PR numbers, PR discussions, linked issues and chat messages are stored in a local SQLite database with full-text search.
Trace: for the line you ask about,
git blamefinds the commit that introduced it andgit log -Lfinds every later commit that changed it.Link: each commit is tied to its PR (from the message, the merge commit, or the GitHub API), and the PR to its issues, review comments and chat.
Explain: that evidence is shown directly, or handed to your LLM with strict instructions to cite every claim and never invent facts.
Privacy
The database lives inside
.git/, so it's never committed and never shows up in your working tree.The web UI binds to
127.0.0.1and rejects requests for other hostnames, which blocks DNS-rebinding attacks.With a local model (Ollama, llama.cpp…) nothing leaves your machine.
Author emails are redacted from anything sent to an LLM (
privacy.redact_emails, on by default).
Roadmap
GitLab / Gitea / Bitbucket merge-request enrichment
VS Code and JetBrains extensions (hover a line → why)
Embedding search alongside FTS5
"Stale reason" alerts: when the reason for a line no longer applies
Shareable
LORE.mdmaps committed by CI
Ideas and PRs are very welcome. See CONTRIBUTING.md.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
A cited wiki of your GitHub repo: search, read pages, find symbols and ask, with line citations.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables Git repository interaction and automation via LLMs, providing tools to read, search, and manipulate Git repositories.1572 npmMIT
- AlicenseNot gradedqualityDmaintenanceAnswers why code exists by tracing file:line or natural-language questions through git blame, commits, PRs, and linked issues, providing cited evidence from history.MIT
- FlicenseNot gradedqualityDmaintenanceEnables tracing any line in a local git repository back to the commit that actually introduced it and the PR/review discussion behind it, overcoming git blame's misleading last-touch attribution.-
- AlicenseAqualityBmaintenanceEnables coding agents to query local notes, decisions, docs, and code with hybrid retrieval (BM25 + embeddings + reranking) and get path:line citations. It provides tools like rag_query for full-corpus search and search_knowledge for project-scoped knowledge recall.21MIT