SuperAPI AI Directory

lachesis

Code property graph for C, Python and TypeScript: callers/callees, data and taint flow with source-to-sink witnesses, points-to and guard/sink structure.

Open website

About this tool

Lachesis is a code property graph tool that supports C, Python, and TypeScript/JavaScript. It reads code and builds a map, and then you can ask this map questions, such as: who called this function, where did this value go, and can external input reach a dangerous location.

Unlike text search tools such as grep, Lachesis tracks the actual flow of data and can determine where a value comes from, where it goes next, and whether an external request can reach sensitive operations (for example, a database call without a login check). It reads code like a compiler rather than guessing with text patterns, so it will not miss calls because of renaming or unusual import styles.

The main capabilities include:

  • A unified cross-language map: C, Python, and TypeScript/JavaScript are in the same map, and a mixed project is one graph rather than three.
  • Data flow and taint flow: supports source-to-sink path evidence, answers "can this input reach this location," and returns a path or a clear negative.
  • Points-to analysis and guard/sink structures for security reasoning.
  • C lifetime analysis: tracks the allocation, freeing, and use of C objects, reports double-free and use-after-free, and gives the paths where they occur.
  • Every answer comes with a certainty explanation: some links are exact, and some are safe guesses, and Lachesis clearly tells you when it is guessing.

There are three ways to use it:

  1. Terminal command: after installation, point it at a folder, for example lachesis ./repo, and it will build the map, save it, and print leads. A lead is a point where external input may reach a sensitive location without checks, and each lead is a question to investigate rather than a final conclusion. You can also give it a git URL directly, for example lachesis https://github.com/owner/repo,它会下载到临时文件夹、扫描并清理。首次扫描较慢,之后地图缓存在 ~/.lachesis/cache, and subsequent runs are fast.
  2. Python library: open the map once, and then you can ask questions freely. Example scripts are in the examples/ directory.
  3. MCP server: for use by AI agents. After starting the server, the agent can build and query maps on its own. It supports clients such as Cursor, VS Code, Claude, and Docker; see the documentation for specific setup.

The workflow has three steps, one command per step:

  • build: read code with a real compiler and generate a basic map of symbols and calls. This is the fast part and satisfies most navigation needs.
  • enrich: compute how data flows through the map. This is not done at build time; when a question is asked, only the needed part is computed and cached.
  • analyze: traverse the map and print leads. These are sensitive points, scored and matched against known defect patterns, with a time limit, so large projects will not hang.

The map is saved as a folder (graph.kuzu), containing an embedded database and a small index file, and all tools read it directly.

Environment requirements: Python 3.10-3.12. Python analysis requires no additional dependencies; scanning TypeScript/JavaScript requires node in PATH; C requires clang. When missing, it gives a clear prompt rather than crashing.

Limitations: Python has no type checker, so attribute calls are matched by name; C reads one file at a time and does not track calls in function pointer tables it has never seen. C lifetime analysis is currently limited to C and works within a single function, and there is one known false positive being tracked. The tool may change before 1.0.

License: AGPL-3.0. It can be used commercially, but if you run a modified version as a network service, you need to share the modified source code with users. If that does not apply, consider a separate commercial license.