
LayerMap
io.github.coffeecoprojectv0.1.4更新於 Oct 5, 2026
Call graph for coding agents: callers up to HTTP routes, callees and usages for TS, Go, Python, Java
概覽
LayerMap 為編碼代理提供程式碼庫的唯讀呼叫圖,可沿呼叫鏈向上追溯到 HTTP 路由,並分析 TypeScript、JavaScript、Go、Python 與 Java 的呼叫方與被呼叫方。
- 功能
- LayerMap 會在本機為程式碼庫建立對應,並提供三個唯讀工具:project_explore_map 用來查看目錄、檔案或宣告的呼叫方與被呼叫方(direction 為 INCOMING 或 OUTGOING,depth 最多 8 層),project_search_map 依名稱、路徑或文件中的詞彙尋找宣告,project_find_references 找出某個宣告的所有使用位置。呼叫關係由各語言本身的編譯器或型別檢查器解析,因此介面、基底類別、樣板與裝飾器的呼叫都能依編譯器的解析結果呈現。對應會在每次呼叫時增量更新,並快取在儲存庫之外。
- 適用情境
- 當代理需要在程式碼庫中回答影響範圍問題(例如某處變更會影響哪些 HTTP 路由或處理函式),而不想進行大量分散搜尋時,適合使用。適用於重視編譯器層級呼叫方與被呼叫方準確性的 TypeScript、JavaScript、Go、Python 與 Java 專案。
- 執行需求
- 透過 npx(npm 套件 layermap)以 stdio 在本機執行。需要 Node.js 22.22 或更新版本、macOS 或 Linux(x64 或 arm64),以及一個 Git 儲存庫;Java 專案還需要 JDK 21 或更新版本。未宣告帳號、API 金鑰或環境變數;可選環境變數 LAYERMAP_CACHE 用來指定快取位置。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 LayerMap,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
LayerMap
English · 中文
A real Claude Code session on Miniflux, replayed: one map call finds every endpoint, then the agent confirms them in source.
A layered map of your codebase for coding agents. LayerMap gives Claude Code, Codex, DeepSeek Harness and other MCP clients three read-only tools that answer, in one call, what an agent otherwise works out with dozens of searches:
- What calls this, and what does changing it affect? Callers traced up to 8 levels, to the HTTP routes, handlers, jobs and commands they start from.
- What does it call? Callees down to 8 levels.
- What is here? Modules, each file's declarations, and every usage of a symbol.
It maps TypeScript, JavaScript, Go, Python and Java with each language's own compiler, so calls through interfaces, base classes, templates and decorators resolve as the compiler resolves them, including the ones text search misses.
Example
In Miniflux, one call on Storage.MarkFeedAsRead finds all four
ways a request reaches it, each with its route:
m and f mark methods and functions with their lines; @ is the line of the call, and the quoted
path is the route it is registered under.
Results
Impact questions ("which HTTP endpoints does changing this affect?") on public Go, Python and Java projects, graded blind against truth sets cross-checked with each language's own toolchain:
With a tight budget, the map finds far more of the affected code, at about 24% more tokens. With no limit, both agents get there either way. The map makes the run cheaper, and the agents explore more widely, which takes longer. These are small samples on tasks written by LayerMap's authors. The report has the setup, the published tasks and the limitations.
How LayerMap differs
Other tools give agents part of this. LayerMap combines compiler accuracy with whole-chain traces in one local map:
Another tool fits better if you need:
- more languages, since tree-sitter graphs cover 30 or more;
- Windows;
- renaming and refactoring, from language servers;
- search by meaning, from embedding search;
- search across many repositories, with Sourcegraph.
Install
Claude Code
Codex
DeepSeek Harness
This adds LayerMap to every dsh profile. Each session maps the project dsh was started in, and
npx layermap remove dsh undoes it.
In every agent, start a new session in a Git repository and ask as usual. LayerMap tells the agent
when the map helps. On first launch, npx downloads the pinned layermap package from npm.
Claude Code asks once before each map tool runs in a project. Choose "don't ask again", or run
npx layermap allow claude to allow the plugin's read-only tools everywhere.
Without plugins: run npx layermap setup claude or npx layermap setup codex. Setup does three
things:
- registers the server;
- lets its read-only tools run without a prompt;
- adds one marked sentence to the agent's instructions file.
Use --scope project to set it up for a whole team, and npx layermap remove … to undo it. For any
other MCP client, run npx -y layermap mcp as a stdio server in the repository.
Requirements:
- Node.js 22.22 or later.
- macOS or Linux (x64 or arm64).
- A Git repository.
- For Java projects, a JDK 21 or later.
How it works
The first call in a repository builds its map: seconds for a small project, a few minutes for a large one. Later calls re-analyze only what changed, so the map always matches the working tree.
Maps stay in your user cache (~/Library/Caches/layermap, ~/.cache/layermap or
LAYERMAP_CACHE), never in the repository. LayerMap runs entirely on your machine and sends
nothing anywhere (privacy,
security).
The same from the command line:
FAQ
How long does the first map take? On a recent Mac:
- Miniflux (400 Go files): about 3 s.
- Polar's server (1,900 Python files): about a minute.
- Conductor (1,500 Java and 1,300 TypeScript files): under two minutes.
What can't it see? Calls the compiler cannot resolve statically: dependency injection, unknown framework routing, reflection and computed names. The tools say where a trace stops, and a missing relationship does not prove absence.
Windows? Not yet.
How do I remove it?
- Claude Code:
/plugin uninstall layermap@layermap. - Codex:
codex plugin remove layermap@layermap. - Then delete the cache directory.
Development
You need pnpm, Go 1.24 and a JDK 21+. A missing toolchain leaves its language unanalyzed.
Run pnpm install. On the first install pnpm asks which dependencies may run build scripts; allow
esbuild only, since the SQLite package ships prebuilt binaries:
Then run pnpm test, pnpm typecheck or pnpm lint.
pnpm package builds the npm package.
License
來源:README.md,提交 82b8dcf
工具
0版本歷史
1- v0.1.4最新Oct 5, 2026

