Skip to content

Git Intelligence

basemind precomputes a per-repo git-history index backed by gix, resolving blame and diffs at symbol resolution. History queries return commits, authors, and paths as structured data in tens of microseconds — a pure accelerator that rebuilds automatically when history changes.

Three MCP tools cover git: git_log, git_blame and git_diff. The CLI commands are under basemind git. Every line number is 1-based.

Use it instead of git log / git show. With no arguments it lists recent commits, newest first, with the paths each one touched, the author and the message.

{}

path narrows to commits that modified a file, or a directory when the path ends with /. The lookup is backed by a posting-list index and resolves in ~37 microseconds on a warm repo with thousands of commits.

{
"path": "src/store.rs",
"limit": 5
}

query is a full-text search of commit messages; author searches author names and emails. Both run at full branch depth.

{
"query": "fix race"
}

path with symbol returns the commits where that symbol’s body changed, tracked by structural hash: “when was this function last changed?”

{
"path": "src/store.rs",
"symbol": "open"
}

rev returns that one commit in full, with its whole message and changed files. It takes a full or abbreviated sha, or any revision (HEAD~3, a branch).

{
"rev": "HEAD~1"
}

Squash-merge commits can carry message bodies of hundreds of kilobytes, so a list names each commit by its summary; read the whole message with rev. The list is held to max_tokens (default 6000): overflow is dropped, the response carries budgeted: true and next_cursor resumes at the first dropped commit.

Use it instead of git blame: who last changed each line of a file and in which commit, at HEAD or at rev.

{
"path": "src/store.rs"
}

Pass line and end_line for a 1-based inclusive span, or symbol to blame one function, type or definition, resolved to its line span.

{
"path": "src/store.rs",
"symbol": "open"
}

Use it instead of git status / git diff. With no arguments it returns the working-tree status: staged, modified and untracked files.

{}

path alone diffs that file’s working tree against HEAD.

{
"path": "src/store.rs"
}

from and to diff the file between two revisions (from defaults to HEAD, to to the working tree).

{
"path": "src/store.rs",
"from": "HEAD~1",
"to": "HEAD"
}

structural: true lists the symbols added and removed instead of text hunks.

{
"path": "src/store.rs",
"from": "HEAD~10",
"structural": true
}

basemind git churn [--window --top-k] ranks files by commit count over a recent window, and basemind git by-path <regex> lists commits whose changed paths match a regex. Neither has an MCP tool; git_log with a path ending in / covers the directory case.

On a typical repo with 2,000–4,000 commits:

Query Latency Notes
git_log with path ~37 µs Indexed posting-list lookup
git_log with no arguments ~13 µs Newest-first list scan
Index build 0.5–3.2 s Depends on commit depth
Index size 6–22 % of .git Space–time trade-off

The index is a pure accelerator: it rebuilds automatically when history is rewritten (rebase, force-push, filter-repo) and the tools fall back to live history walks if the index is stale.

  • Prefer git_log, git_blame and git_diff over shelling out to git log, git blame, git diff. Structured results cost fewer tokens to parse.
  • Use git_log instead of parsing git log output. Get commit hashes, paths and timestamps directly.
  • Blame a symbol, not a file, when the question is about one function. Symbol-level blame is more precise than line-level.
  • Use structural: true for structural diffs. Skip implementation details and focus on which symbols changed.
  • Use query / author for commit message mining. Full-text search over messages and authors is cheaper than parsing the log.

Code intelligence · Document search