Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gemini-extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axiomcode",
"version": "0.2.3",
"version": "0.2.4",
"description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed.",
"contextFileName": "plugins/axiomcode/AGENTS.md",
"mcpServers": {
Expand Down
3 changes: 2 additions & 1 deletion hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"hooks": [
{ "type": "command", "command": "node \"${extensionPath}${/}plugins${/}axiomcode${/}hooks${/}run.js\" changes.py", "timeout": 25000 },
{ "type": "command", "command": "node \"${extensionPath}${/}plugins${/}axiomcode${/}hooks${/}run.js\" orient.py", "timeout": 20000 },
{ "type": "command", "command": "node \"${extensionPath}${/}plugins${/}axiomcode${/}hooks${/}run.js\" refresh.py", "timeout": 5000 }
{ "type": "command", "command": "node \"${extensionPath}${/}plugins${/}axiomcode${/}hooks${/}run.js\" refresh.py", "timeout": 5000 },
{ "type": "command", "command": "node \"${extensionPath}${/}plugins${/}axiomcode${/}hooks${/}run.js\" fill.py", "timeout": 10000 }
]
}
],
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axiomcode/code-graph",
"version": "0.2.3",
"version": "0.2.4",
"description": "AxiomCode Graph: a resolved call graph of your codebase grounded in formal methods, so you and your coding agents can see who calls what, what a change breaks, and which tests it reaches.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,11 +31,11 @@
],
"license": "FSL-1.1-Apache-2.0",
"optionalDependencies": {
"@axiomcode/engine-darwin-arm64": "0.2.3",
"@axiomcode/engine-darwin-x64": "0.2.3",
"@axiomcode/engine-linux-x64": "0.2.3",
"@axiomcode/engine-linux-arm64": "0.2.3",
"@axiomcode/engine-win32-x64": "0.2.3"
"@axiomcode/engine-darwin-arm64": "0.2.4",
"@axiomcode/engine-darwin-x64": "0.2.4",
"@axiomcode/engine-linux-x64": "0.2.4",
"@axiomcode/engine-linux-arm64": "0.2.4",
"@axiomcode/engine-win32-x64": "0.2.4"
},
"bin": {
"axiomcode": "bin/axiomcode.js"
Expand Down
2 changes: 1 addition & 1 deletion plugins/axiomcode/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "axiomcode",
"description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed.",
"version": "0.2.3",
"version": "0.2.4",
"author": {
"name": "AxiomCode"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/axiomcode/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axiomcode",
"version": "0.2.3",
"version": "0.2.4",
"description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed.",
"author": { "name": "AxiomCode", "url": "https://github.com/AxiomCodeAI/axiomcodegraph" },
"homepage": "https://github.com/AxiomCodeAI/axiomcodegraph",
Expand Down
2 changes: 1 addition & 1 deletion plugins/axiomcode/.cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axiomcode",
"version": "0.2.3",
"version": "0.2.4",
"description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed. Java, TypeScript, Python, JavaScript.",
"author": { "name": "AxiomCode" },
"homepage": "https://github.com/AxiomCodeAI/axiomcodegraph",
Expand Down
2 changes: 2 additions & 0 deletions plugins/axiomcode/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ that never spell the name:
tests() the tests your uncommitted edits reach, and the command that runs them
link(site, target) record where an unresolved call lands, when the code makes it certain;
impact, path and tests then walk it, labelled [asserted]
unresolved() every open call site that may land in the project; after a build, settle them in a
subagent with /axiomcode:fill
context(task) how something works, as a narrative: the call flow step by step;
context(task, source=True) carries each step's code

Expand Down
34 changes: 34 additions & 0 deletions plugins/axiomcode/hooks/fill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""UserPromptSubmit: after a build, tell the agent once that the engine left call sites it could not resolve.

The engine has done what it can by the end of a build; what is left is for someone who reads the code. This says so
ONCE per build (ax_fill.notice keeps the stamp in .axiomcode/.fill-noted-hook) and only when sites that may land in the
project are open, naming the one command that starts the pass: /axiomcode:fill. Silent with no graph, with nothing open,
and on every prompt after the first that heard about this build.
"""
import os, subprocess, sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import _host

try:
ev = _host.read()
except Exception:
sys.exit(0)

def repo_root(start):
cur = os.path.realpath(start)
while True:
if os.path.exists(os.path.join(cur, '.axiomcode', 'out', 'graph.sqlite')): return cur
parent = os.path.dirname(cur)
if parent == cur: return None
cur = parent

root = repo_root(ev.get('cwd') or os.getcwd())
if not root: sys.exit(0)
script = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'skills', 'axiomcode', 'scripts', 'ax_fill.py')
try:
r = subprocess.run([sys.executable, script, root, '--notice', 'hook'], capture_output=True, text=True, timeout=8)
line = r.stdout.strip()
except Exception:
sys.exit(0)
if line: _host.emit('UserPromptSubmit', line)
9 changes: 9 additions & 0 deletions plugins/axiomcode/hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
"timeout": 5
}
]
},
{
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/run.js\" fill.py",
"timeout": 10
}
]
}
],
"Stop": [
Expand Down
52 changes: 50 additions & 2 deletions plugins/axiomcode/mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,41 @@ def plain(text):
if keep and ''.join(keep).strip(): out.append(' '.join(keep).rstrip(' ;,'))
return '\n'.join(out)

def fill_notice(args):
"""once per build, on the first query answer after it: the unresolved sites that may land in the project, and the
tools that settle them (ax_fill.notice). Every host reads a tool answer; not every host runs hooks. '' otherwise"""
if not args or args[0] not in ('impact', 'path', 'context', 'tests'): return ''
repo = repository(args)
if not os.path.isfile(os.path.join(repo, '.axiomcode', 'out', 'graph.sqlite')): return ''
# the common case, a build already told about, is a few stats and a small read here: no process is started for it.
# The stamp is ax_fill.build_stamp's: every live graph, main then each language's, each real file once
try:
ax = os.path.join(repo, '.axiomcode'); lang = os.path.join(ax, 'lang')
dbs = [os.path.join(ax, 'out', 'graph.sqlite')] + [os.path.join(lang, l, 'out', 'graph.sqlite')
for l in (sorted(os.listdir(lang)) if os.path.isdir(lang) else [])]
seen, parts = set(), []
for db in dbs:
rp = os.path.realpath(db)
if os.path.isfile(rp) and rp not in seen:
seen.add(rp); parts.append(f"{rp}@{int(os.stat(db).st_mtime)}")
with open(os.path.join(ax, '.fill-noted-mcp'), encoding='utf-8') as fh:
if fh.read().strip() == '|'.join(parts): return ''
except OSError: pass
try:
r = subprocess.run([sys.executable, os.path.join(scripts_dir(), 'ax_fill.py'), repo, '--notice', 'mcp'],
capture_output=True, text=True, timeout=10)
return r.stdout.strip()
except Exception: return ''


def answer(args):
"""a tool's answer: the CLI's words with the option-naming clauses dropped. A failure run() raises goes the same
way — its words through plain(), then on as the ToolError the client marks isError — so the model reads the
correction (the nearest names, the fix) either way, and a flag it cannot pass is named in neither."""
try: return plain(run(args))
try: out = plain(run(args))
except ToolError as e: raise ToolError(plain(str(e))) from None
note = fill_notice(args)
return f"{out}\n{note}" if note else out


# THE SMALL SURFACE. Search is grep's job; the graph answers what grep cannot. Three questions, each answered as
Expand All @@ -314,14 +343,33 @@ def path(start: str, end: str) -> str:
written on. start / end as written in the code (Owner.method, function, Type)."""
return answer(['path', start, end, os.getcwd()])

@srv.tool()
def unresolved(limit: int = 25, decisions: str = '') -> str:
"""The calls the graph could not resolve, over the whole graph: a summary line, then the next `limit` open sites
(inside the most called callers first), each with its code, the engine's reason and the graph's candidates. Read
each call, then send one decision per line as `decisions`: `<site> <target>` only when the code makes the target
CERTAIN, `<site> not:<target>` for a wrong candidate, `<site> ?` to leave it open. The answer says what was taken
and lists the next page; settled sites drop off. Never link a guess."""
n = str(max(1, min(int(limit or 25), 200)))
if not decisions.strip(): return answer(['unresolved', '--limit', n, os.getcwd()])
import tempfile
with tempfile.NamedTemporaryFile('w', suffix='.tsv', delete=False, encoding='utf-8') as fh: fh.write(decisions)
try:
try: took = answer(['link', '--batch', fh.name, os.getcwd()])
except ToolError as e: took = str(e) # a refused line is reported with the next page, not as a failure
finally:
try: os.unlink(fh.name)
except OSError: pass
return took + '\n\n' + answer(['unresolved', '--limit', n, os.getcwd()])

@srv.tool()
def link(site: str = '', target: str = '') -> str:
"""Record where an unresolved call lands, when you have read the code and the target is CERTAIN: site is the call's
file:line as an answer's `unknown:` block lists it, target the declaration it reaches (Owner.method, function, or
its file:line). impact, path and tests then walk the edge, labelled [asserted]. With no arguments: every link and
whether the graph took it (a link whose line changed is dropped, never trusted). target "-" removes the site's links;
target "not:<declaration>" rejects a lead (a by-name or one-of-a-set guess) at that site, which is then not walked.
Never link a guess, and never link a candidate for its rank alone."""
Never link a guess, and never link a candidate for its rank alone. Many sites at once: unresolved(decisions=...)."""
return answer(['link'] + ([site] if site.strip() else []) + ([target] if site.strip() and target.strip() else []) + [os.getcwd()])

@srv.tool()
Expand Down
2 changes: 2 additions & 0 deletions plugins/axiomcode/rules/axiomcode.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ that never spell the name:
tests() the tests your uncommitted edits reach, and the command that runs them
link(site, target) record where an unresolved call lands, when the code makes it certain;
impact, path and tests then walk it, labelled [asserted]
unresolved() every open call site that may land in the project; after a build, settle them in a
subagent with /axiomcode:fill
context(task) how something works, as a narrative: the call flow step by step;
context(task, source=True) carries each step's code

Expand Down
11 changes: 11 additions & 0 deletions plugins/axiomcode/skills/axiomcode/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Search with grep as usual; the graph answers what grep cannot. Use the MCP tools
| how does A reach B? | `path(start, end)` | `axiomcode path <A> <B>` |
| which tests do my edits need, and how do I run them? | `tests()` | `axiomcode tests` |
| an answer lists an unresolved call I can see the target of | `link(site, target)` | `axiomcode link <file:line> <target>` |
| the graph says sites are left unresolved after a build | `unresolved()`, then `unresolved(decisions)` — or `/axiomcode:fill` | `axiomcode unresolved` |
| how does this work, start to finish? | `context(task, source=True)` | `axiomcode context "<task>" --source` |

Names are written as in the code: `Owner.method`, `function`, `Type`, or `file.py:123` for the declaration at that
Expand Down Expand Up @@ -80,6 +81,16 @@ one. A link is refused when the call written there names a different declaration
the line it was made on is edited, it is dropped and listed as stale, and the site is to resolve again. Never link a
guess: an asserted edge is trusted by every answer after it.

## unresolved

After a build, a note says how many call sites the engine left unresolved that may land in the project's own code
(a library's method on a receiver it could not type is counted, not listed: reading the project does not settle it).
`/axiomcode:fill` works through them in a subagent; without it, `unresolved(limit=25)` lists the next open sites, the
ones inside the most called callers first, each with its code, the engine's reason and the candidates, and
`unresolved(decisions="...")` takes one decision per line and answers with the next page: `<site> <target>` when the code makes it certain, `<site> not:<target>`
for a wrong candidate, `<site> ?` to leave it open (not asked again until its line changes). Settled sites drop off the
list. The same rule as `link`: never link a guess.

## context

How something works, from a task in your own words: the files and callables the task touches and, for a
Expand Down
Loading
Loading