Codeglance
Repository maps, file outlines, definitions and semantic search for AI coding agents; session recall
An MCP server that lets an AI coding agent
look at the shape of a repository before it reads any of it: a map of a
project (one line per file), the outline of a file with line ranges,
where a symbol is defined, and the source of one by its name. Beside it, codeglance recall searches Claude Code
session transcripts, so nothing is lost when the context is compacted, and a
new session finds what an earlier one did.
Why
An agent that wants one method of a 600-line file usually reads all 600 lines, and pays for every one of them in tokens and context. With an outline it reads the 40 lines it needs:
map_file libs/orders/src/orders.service.ts
export @Injectable class OrdersService L8-212
constructor L12-16
method load L18-55
method save L57-98
...
212 lines
Then it reads L57-98 and nothing else.
Install
On a Mac, with Homebrew, a ready binary for Apple Silicon and Intel:
brew install rubilax84/tap/codeglance
Anywhere else, or to build it yourself:
cargo install codeglance
or cargo install --git https://gitlab.com/dryaglin.andrei/codeglance for
the latest, cargo install --path . in a clone. It needs Rust 1.89 or newer and
git on the PATH. The maps, outlines, find, read, review, stats
and recall work on macOS and Linux; semantic search and similar run
the embedding model on Core ML, so they are macOS only (see
Semantic search); recall ranks by words and needs no
model.
Add it to Claude Code
From inside the repository:
claude mcp add codeglance -- codeglance serve
The server works on the repository that holds the directory it starts in.
Started in a folder that is no repository itself but holds some side by
side (a product split over a few repositories, checked out next to each
other), it answers about all of them as one, every path starting with the
directory of its repository: api/src/main.ts. Each repository is read
through its own git, and the list is read again on every call, so one
cloned since is seen. A git worktree checked out beside its repository, the
way a pull request is often reviewed (api and api-pr-12), holds the
same files: a search over the folder lists each file the worktree has
unchanged once, under the main checkout's path, and only the files the two
differ in twice, the old and the new. Named as a target, the worktree shows
all of its files. similar and review still need one repository: they
compare that repository's changes. Started anywhere else, such as the home
folder, the server still starts, and each tool answers that it is in no
repository and that the agent should be started in one or in a folder of
them; it searches nothing and keeps nothing there. To have it in every
project, add it with user scope:
claude mcp add --scope user codeglance -- codeglance serve.
Any other MCP client starts it the same way: the command codeglance serve
over stdio.
Then the hook, one command for every event it answers, in
~/.claude/settings.json (or a project's .claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Read|Bash|mcp__.*codeglance.*",
"hooks": [{ "type": "command", "command": "codeglance hook" }]
}
],
"SessionStart": [
{ "hooks": [{ "type": "command", "command": "codeglance hook", "timeout": 60 }] }
],
"PostCompact": [
{ "hooks": [{ "type": "command", "command": "codeglance hook", "timeout": 10 }] }
],
"UserPromptSubmit": [
{ "hooks": [{ "type": "command", "command": "codeglance hook", "timeout": 30 }] }
],
"PostToolUse": [
{ "hooks": [{ "type": "command", "command": "codeglance hook", "timeout": 30 }] }
]
}
}
From the project's README.