返回资讯中心
外部精选
软件工程
#开发者实时流

A code knowledge graph grounded in formal methods

A god's-eye view of your codebase for AI agents. Stop grepping. Ensure correctness and completeness for any task your AI agent performs.

Hacker News 最新HaoleiZ2026/10/14 · 2026/10/1430 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

A god's-eye view of your codebase for AI agents. Stop grepping. Ensure correctness and completeness for any task your AI agent performs.

What it does · Why · Get started · Maturity · Benchmarks · CLI · Graph output · Cross-file coverage · Run locally

Be first to see what we build.  Stay in touch ↗

Give it a repository. It builds a knowledge graph of your code using formal methods: for every function, exactly who calls it and what it calls, derived by logical rules rather than guessed. Your AI agents, and you, then understand, explore, search and edit the code from that map instead of grepping. Grep cannot see calls through an interface, a subclass or a callback, and its output gets truncated, so agents silently miss what was cut. The map prunes 99.9% of the codebase, so agents keep their context for the task, not the search.

On real bugs. On 748 held-out Defects4J bugs, scored once after the rules were frozen, the tests AxiomCode picks from source include every bug-revealing test for 94.9% of bugs (best tree-sitter builder: 61.5%), at an F1 of 72.4 against what Defects4J observes by running the suite.

Why: types make a better graph. Choosing tests means following calls several hops back from a change, and one wrong link loses every test beyond it. A tree-sitter based CST builder matches a call to a declaration by name; AxiomCode resolves it the way the compiler does, from the receiver's type. Scored against the compiler's own answer, compiled bytecode for Java and the type checker for TypeScript, over five open-source projects per language:

Across files, it recovers which files call into which with an F1 of 0.976 in Java and 0.896 in TypeScript (best CST-based: 0.876 and 0.708), and finds the call path from one method to another 97.4% and 87.7% of the time (80.6% and 65.8%).

AxiomCode supports Java, TypeScript and Python, with JavaScript and C# in beta (Language and skill maturity). These benchmarks are Java and TypeScript, the languages where a compiler gives an independent ground truth to score against. Details in Benchmark results and Measured cross-file coverage.

A typed graph is a more accurate graph. Compared with a tree-sitter-based graph builder, which guesses a call's target from syntax (the name, the imports, a variable's declared type), AxiomCode resolves each call from the receiver's declared and inferred type, as the compiler does. Through an interface, an override, a generic, or a callback, syntax alone cannot decide the target, and every wrong guess is a missing or invented edge; a resolved edge is a call the program actually makes. That matters because an agent follows edges several hops deep, and one missed link loses everything beyond it.

The call graph of an open-source TypeScript web framework, drawn as a page and asked which tests a change to basicAuth can affect. Source files form the inner ring and test files the outer one. The solid blue paths are chains of resolved calls from basicAuth to the 7 test files that must run; the dashed red ones mark the other 130, which have no chain to it and can be skipped. Green is the shared compare that basicAuth calls, and gold the 11 other files that also reach it.

AI agents work from an incomplete picture of a codebase, and the reason is structural: what a call reaches is usually decided somewhere else. The type comes from another file, the implementation from another module, the binding from a dependency or a configuration key. Reading the file in front of you cannot show any of that, so a missed dependency becomes an incomplete change and a second fix.

AxiomCode Graph makes the structure behind the code queryable. Agents can understand a task's scope, from the implementation to downstream effects and affected tests, before acting. This supports more reliable changes, more complete task execution, and up to 50% fewer tool calls to explore a new codebase in our benchmarks.

The graph is grounded in formal methods, using deterministic, language-aware rules. Source locations and confidence tiers make its results inspectable, while unresolved calls remain explicit rather than being presented as established relationships that could lead to false positives.

AxiomCode Graph is two parts. The engine (@axiomcode/code-graph on npm) parses a repository and builds its graph; it also provides the axiomcode command and an MCP server. The plugin (plugins/axiomcode/) is the agent-facing frontend: a skill, four MCP tools, and hooks. Install the engine first.

Requirements: Node ≥ 22.13 and Python 3 (python3, or python / py on Windows). On Windows, also Git for Windows: the CLI runs under its bash. The engine ships as a prebuilt binary for macOS (Apple Silicon and Intel), Linux (x64 and arm64) and Windows x64, and npm install takes the one for your platform. No Soufflé and no compiler are needed, with one exception:

Linux arm64 (Graviton or Ampere servers, Raspberry Pi, node:-slim or Alpine containers on an Apple Silicon Mac): the parser's native modules compile during npm install, so install build tools first, e.g. sudo apt install build-essential python3. The full node: Docker images already include them.

Before every release, the exact packages that ship are installed without Soufflé and run end to end (every CLI verb, five languages) on macOS arm64 and x64, Linux x64 and arm64, and Windows x64. Check an install with axiomcode --version.

1. the engine and the axiomcode command

npm i -g @axiomcode/code-graph

2. the plugin, in your agent

Claude Code

claude plugin marketplace add AxiomCodeAI/axiomcodegraph && claude plugin install axiomcode@axiomcode

Codex CLI and desktop app

codex plugin marketplace add AxiomCodeAI/axiomcodegraph && codex plugin add axiomcode@axiomcode

Copilot CLI (VS Code agent mode loads Copilot CLI's plugins too)

copilot plugin marketplace add AxiomCodeAI/axiomcodegraph && copilot plugin install axiomcode@axiomcode

Gemini CLI

gemini extensions install https://github.com/AxiomCodeAI/axiomcodegraph

Cursor

cursor-agent plugin marketplace add https://github.com/AxiomCodeAI/axiomcodegraph

Windsurf, Devin CLI

devin plugins install AxiomCodeAI/axiomcodegraph#plugins/axiomcode

Any other agent that speaks MCP takes one entry in its MCP config; see Support for agents. Start a new agent session afterward: plugins are loaded at startup. Add .axiomcode/ to your .gitignore; the graph is built there on first use.

1. the plugin, in your agent

Claude Code

claude plugin uninstall axiomcode@axiomcode && claude plugin marketplace remove axiomcode

Codex CLI

codex plugin remove axiomcode@axiomcode && codex plugin marketplace remove axiomcode

Copilot CLI

copilot plugin uninstall axiomcode@axiomcode && copilot plugin marketplace remove axiomcode

Gemini CLI

gemini extensions uninstall axiomcode

2. the engine, and the graphs it built

npm uninstall -g @axiomcode/code-graph rm -rf <your-project>/.axiomcode ~/.cache/axiomcode

In Cursor, remove the plugin from the Plugins panel; in Devin CLI, from its plugin manager; in VS Code, take the repository out of chat.plugins.marketplaces; in any other MCP client, delete the axiomcode entry.

From the shell, in any Java, TypeScript, Python, JavaScript, or C# project. There is no setup step: the first command builds the graph, and later ones read it.

In this TypeScript project, main builds an OrderService and calls place, which writes to two things in two other folders: a Ledger, a concrete class, and a Store, an interface that SqlStore and MemoryStore implement. Both chains cross files; the second goes through the interface, where nothing in orderService.ts names SqlStore, so searching for it never reaches the caller.

cd <your-project> axiomcode path main Ledger.put axiomcode path main SqlStore.put

Every answer is a numbered list of places, each with the code of the function it sits in and the line that matters marked →:

  1. src/main.ts:9 [resolved · hop 1/2 main → OrderService.place]
6 export function main(useSql: boolean): void {
7 const store = useSql ? new SqlStore("orders") : new MemoryStore();
8 const service = new OrderService(new Ledger(), store);
→ 9 service.place("A-1", 42);
10 }
  1. src/orders/orderService.ts:8 [resolved · hop 2/2 OrderService.place → Ledger.put]
7 place(id: string, amount: number): void {
→ 8 this.ledger.put(`order ${id}: ${amount}`);
9 this.store.put(id, amount);
10 }

verified: ✓ (2 edge(s) looked up again)

The second chain ends the same way, at src/orders/orderService.ts:9, tagged one of a set: store.put can run SqlStore.put or MemoryStore.put, depending on which store main built, and the graph keeps both as candidates instead of picking one.

From an agent, ask in plain words. The skill tells the agent to query the graph instead of grepping:

Every agent below gets the four MCP tools and the skill; the hooks, which keep the graph current and report what an edit breaks, run where the last column says so. No hook annotates the agent's own reads and searches.

{ "mcpServers": { "axiomcode": { "command": "npx", "args": ["-y", "@axiomcode/code-graph", "mcp"] } } }

Language and skill maturity

A language is usable end to end when both the parser (source → relational IR) and the engine (IR → graph) support it. The skill, the MCP tools and the CLI answer from the same graph for every language.

XML, YAML, .properties and META-INF/services are part of the Java graph, so a change to a property key or a wiring declaration has a blast radius into methods. A repository with several languages gets one graph per language.

Call resolution. 96.5% of Java calls and 88.8% of TypeScript calls linked to the compiler's exact target; the chart above and Measured cross-file coverage break this down.

Test selection. On 748 held-out bugs from Defects4J, scored once after the evaluation rules were frozen, the tests AxiomCode selects include every bug-revealing test for 94.9% of bugs, against 61.5% for the best CST-based graph builder, at an F1 of 72.4 against Defects4J's own selection, which it gets by running the suite.

Change impact. On five real commits of a large JVM project (181,355 methods), the direct callers AxiomCode reports have precision 0.980 against 0.397 for CST-based name matching, at the same recall. An agent asked about one change had to read 95 of 43,793 methods, and every true direct caller was among them.

Three questions, each answered as numbered places with the code of the function each one sits in. The MCP server offers the same three as tools: impact(name), path(start, end) and tests(). Finding where code lives is left to your own search: bring the name you found to these commands.

A name is written the way it appears in the code: Owner.method, method, Type, Owner.field, or file.py:123. It is resolved exactly; a miss lists the nearest names. axiomcode help <command> prints one command's usage.

impact with no name and tests compare the working tree with a baseline: the last commit (right after an explicit axiomcode index, the tree it indexed). The background refresh (below) resets it whenever HEAD moves (a commit, a merge, a pull, a checkout), so committed edits drop out and nothing accumulates. While edits are uncommitted, they read the baseline's own graph, kept in .axiomcode/base, so a removed method still shows all its callers.

The graph stays current on its own. Every file the parser reads is recorded with its hash at build time; after an edit, a shell command, a finished turn, at session start, and before a query, anything that differs starts one background rebuild per repository, with the language, --src and --library of the graph it replaces. Every command keeps reading the previous graph until the new one is indexed and swapped in. A query answers from the previous graph at once, with a graph refresh: line naming the files it predates and the rows in them marked; --fresh waits for the rebuild instead, and AXIOMCODE_FRESH_WAIT (seconds, defa

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →