
Lachesis
io.github.UnboundCompute由 GitHub 帳號 UnboundCompute 發布v0.5.3更新於 Oct 24, 2026
Compiler-precise code property graph for C, Python, and TypeScript, navigable over MCP.
概覽
Lachesis 為 C、Python 與 TypeScript/JavaScript 建立編譯器級精確的程式碼屬性圖,讓助理查詢呼叫關係、資料流與汙點路徑。
- 可以做什麼
- 從本機資料夾或 git 位址建立並快取程式碼屬性圖,把 C、Python 與 TypeScript/JavaScript 放進同一張圖,列出程式碼庫中連結最多的樞紐並搜尋名稱,開啟檔案與資料夾並讀取真實函式內容,追蹤呼叫者與被呼叫者,追蹤值的流向和某個位置的來源,判斷某個輸入是否能到達某個位置,解析指標與別名,找出外部輸入到達敏感操作的位置,並一次取得某個位置的全部證據與信心程度。
- 適用情境
- 適合讓助理根據真實程式碼庫而非文字搜尋來推理:追蹤呼叫鏈、追蹤資料流,或檢查不可信輸入能否到達資料庫呼叫等敏感操作,也適合初次梳理陌生儲存庫。
- 執行需求
- 以 PyPI 套件 lachesis-cpg 透過 stdio 在本機執行,可用 uvx 或已安裝的 lachesis 指令啟動,也可用 Docker。需要 Python 3.10-3.12;掃描 TypeScript/JavaScript 需要 PATH 中有 node,C 需要 clang。未宣告帳號、金鑰或環境變數。首次掃描較慢,圖會快取在使用者主目錄下。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Lachesis,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Lachesis
Lachesis reads your code and builds a map of it. Then you can ask the map questions, like who calls this function, where does this value go, and can bad input reach a dangerous spot.
It works on C, Python, and TypeScript/JavaScript, all in one map.
[PyPI] [Python] [CI] [License: AGPL-3.0] [MCP] [Docker] [Glama] [Security Scan]
What is this?
Search tools like grep tell you where a word shows up in your code. Lachesis is different. It follows the actual data. It can tell you where a value came from, where it goes next, and whether a request from the outside can reach something dangerous, like a database call with no login check in front of it.
To do this it reads your code the same way a compiler does, not by guessing with text patterns. So it doesn't miss a call just because a name was renamed or imported in a weird way.
You can use it three ways: as a command in your terminal, as a Python library, or as an MCP server that an AI agent can talk to.
Quick start
Install it, then point it at a folder:
It builds the map, saves it, and prints the leads. A lead is a spot where outside input can reach something sensitive with no check in the way. Each lead is a question to look into, not a final answer.
You can also give it a git URL instead of a folder:
lachesis https://github.com/owner/repo. It downloads the code to a temp folder,
scans it, and cleans up after.
The first scan of a project is slow. After that the map is cached under
~/.lachesis/cache, so every run after is fast.
The three ways to use it
Terminal. One lachesis command. lachesis ./repo is the easy front door.
If you want more control, the steps map to three passes:
Python library. Open the map once, then ask it as many questions as you want.
Runnable example scripts are in examples/.
MCP (for AI agents). Start the server and an agent can build and query the map on its own:
See MCP below for setup in Cursor, VS Code, Claude, and Docker.
What you can ask
Once the map is built, these are the moves. They work from the terminal, the Python library, or as MCP tools an agent uses:
Every answer comes with how sure it is. Some links are exact. Some are a safe guess, and Lachesis tells you when it's guessing instead of hiding it. Read the answers as evidence, not as a verdict.
MCP
Run lachesis mcp from the same place you built the map. You can hand it a
graph.kuzu path, but you don't have to. Start it with no argument and the agent
builds its own map when you point it at a repo.
One click (uses uvx, no install step):
[Add lachesis to Cursor] [Install in VS Code]
Or set it up by hand. If the package is already installed:
Or let uvx fetch it on first run, no install:
Or run it in Docker, with all three languages already in the image:
More client notes are in docs/queries.md.
Languages
Each language is read by a real compiler or its own parser, never a text guess.
A mixed project is one map, not three. A Python function and a TypeScript function it calls sit in the same map, and the same tools work across both.
Two limits worth knowing. Python has no type checker, so it matches attribute calls by name. C reads one file at a time, so it won't follow a call through a function-pointer table it never sees. Each language says what it can and can't do.
How it works
Lachesis works in three steps, and each one is a command.
- build: read the code with real compilers into a plain map of symbols and calls. This is the fast part, and it's all most navigation needs.
- enrich: work out how data flows through the map. This isn't done at build time. A question only computes the part of the flow it needs, then caches it.
- analyze: run over the map and print the leads. These are sensitive spots, scored and matched to known bug shapes. It has a time limit, so a big project can't hang.
There's also a C lifetime pass. Some bugs, like freeing the same object twice or using it after it's freed, aren't about one spot. They're about the whole life of an object. A separate pass tracks each C object being allocated, freed, and used, and reports double-free and use-after-free with a path showing how it happens.
The map is saved as a folder (graph.kuzu). It holds an embedded database plus a
small index file. That folder is the map. Every tool reads it directly.
More detail is in docs/graph-model.md (what's in the
map) and docs/scaling.md (big repos, memory, and speed).
Install
Works on Python 3.10–3.12. Python analysis needs nothing extra. Scanning
TypeScript/JavaScript needs node on your PATH, and C needs clang. If one is
missing you get a clear message, not a crash.
To work from a clone (for contributors):
Where to go next
examples/: a five-minute walkthrough plus a runnable script per feature.docs/graph-model.md: what's in the map.docs/queries.md: every way to ask a question.docs/scaling.md: big repos, memory, and CI.
Roadmap
Done recently:
- C lifetime bugs. Finds double-free and use-after-free on C objects, with a path showing how, and no false alarms on the clean paths.
- Big repos. Large multi-language trees build in parallel pieces and link into one map, staying inside a set memory budget.
- Scan a git URL directly. Point it at
https://…, it downloads, scans, and cleans up. - One tool, three front doors. The same code powers the terminal command, the Python library, and the MCP tools.
Coming next:
- C lifetime bugs across functions: free in one function, use in another.
- A single "can this input reach this spot?" question that returns a path or a clear no, across files and languages.
Status
Lachesis is early and moving fast. The map, the storage, the navigation and MCP
tools, and the C lifetime pass all work today and are checked by a test suite. The
lifetime pass is C-only for now and works within one function. One known false
alarm is tracked. The tools may still change before 1.0; the
CHANGELOG lists changes.
License
AGPL-3.0. See LICENSE. You can use, study, change, and share it,
including for commercial use. If you run a changed version as a network service,
you have to share your changed source with its users. If that doesn't fit your
case, a separate commercial license may be an option. See
CONTRIBUTING.md or open an issue.
Security
Found a security bug? Please don't open a public issue. See
SECURITY.md for how to report it privately.
來源:README.md,提交 e464ccf
工具
0版本歷史
1- v0.5.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分