awgraph — the code graph your agent reads instead of grepping
Docs · Source · pip install awgraph · The Aither World
The Aither World is an operating system for agents — a Linux you can hand to one, the runtimes it works in, and the tools it works with. awnix is the Linux underneath it; awgraph is one of its 33 bricks — each installs on its own, runs offline, and needs no account.
Start here: Index one repo and ask it who calls one function.
An agent asked to fix a bug does not know which files matter, so it greps, opens whatever matched, and spends most of its context window on code it will not change. awgraph indexes the repository into a graph of symbols — functions, methods, classes, their calls and callers — and answers a natural-language task with the handful of chunks that task actually needs.
pip install awgraph
Python 3.10+. Nothing else is required to index and query.
What it costs, measured
The interesting question is not "is a graph better than grep" — it is what does
each cost to reach the same answer. The task is a real commit message with the
answer filenames stripped out; the truth is the set of files that commit
actually modified. k is the result budget, and it is swept for both
retrievers, because k bounds grep's output too — sweeping it for only one arm
manufactures a win.
Measured on two corpora, because the answer depends on how big your repo is. That is the first question anyone asks about a graph retriever, and it deserves a number instead of an intuition:
| corpus | Python files | lines | chunks indexed | tasks |
|---|---|---|---|---|
| small | 88 | 76,527 | ~2,400 | 33 commits |
| large | 2,434 | 1,233,731 | 44,735 | 40 commits |
Both are subtrees of one Python monorepo, and both retrievers are confined to the same subtree, so they search the same universe. Neither ever sees the truth set while retrieving.
Small corpus — 76,527 lines
| k | awgraph recall | awgraph tokens | grep recall | grep tokens | awgraph cheaper by |
|---|---|---|---|---|---|
| 10 | 0.803 | 1,311 | 0.924 | 351,427 | 268x |
| 25 | 0.939 | 3,132 | 0.985 | 504,640 | 161x |
| 50 | 0.939 | 6,158 | 1.000 | 668,299 | 109x |
| 100 | 0.939 | 12,059 | 1.000 | 735,727 | 61x |
| 200 | 0.939 | 23,386 | 1.000 | 735,727 | 31x |
| 400 | 1.000 | 45,269 | 1.000 | 735,727 | 16x |
awgraph reaches the same ceiling as exhaustive grep — recall 1.000 — for 16x less context. But grep is the better finder at this size: it hits 1.000 at k=50 while awgraph is still at 0.939.
Large corpus — 1,233,731 lines
| k | awgraph recall | awgraph tokens | grep recall | grep tokens | awgraph cheaper by |
|---|---|---|---|---|---|
| 10 | 0.633 | 1,790 | 0.463 | 529,030 | 296x |
| 25 | 0.667 | 4,038 | 0.650 | 988,154 | 245x |
| 50 | 0.692 | 7,849 | 0.733 | 1,585,684 | 202x |
| 100 | 0.742 | 14,813 | 0.817 | 2,362,274 | 159x |
| 200 | 0.825 | 28,210 | 0.917 | 3,336,833 | 118x |
| 400 | 0.887 | 54,560 | 0.950 | 4,835,491 | 89x |
The ranking flips with scale. At 76k lines grep wins recall at every matched budget. At 1.2M lines awgraph wins it outright at k=10 and k=25 — the budgets that fit in a context window — while costing 245-296x less. So the honest answer to "does this only pay off on a big codebase?" is: it pays off on both, but for different reasons. On a small repo it buys you the same answer for far less. On a large one it buys you a better answer at any budget you can actually spend.
Read the rest honestly, because the shape matters more than the headline:
- grep still wins at large
k, and cannot be used there. Its 0.950 at k=400 costs 4,835,491 tokens per task. Nothing accepts that in one window, so it is a recall you cannot spend. awgraph's 0.887 costs 54,560. - awgraph did NOT reach grep's ceiling on the large corpus. On the small one it closed to 1.000 at k=400; here it tops out at 0.887 against grep's 0.950. A sweep that fails to close the gap is a result, not a run to discard.
- The two costs diverge, and that is why scale flips it. Going from the small corpus to the large one, grep's k=400 bill grows 6.6x (735,727 → 4,835,491) while awgraph's grows 1.2x (45,269 → 54,560). grep pays for the repository; awgraph pays for the budget you set.
- awgraph's token count is for previews, not whole function bodies — signature + docstring + a body preview per chunk. An agent that then reads the full body of its top hits pays more than the number above. grep's figure is whole files, which is what an agent actually has to read. The comparison is fair at the retrieval step and generous to awgraph after it.
Do you actually need the embeddings? Ablated on the small corpus — same 33 tasks, same index, semantic half off:
| k | keyword only | with embeddings | gain |
|---|---|---|---|
| 10 | 0.682 | 0.803 | +0.121 |
| 25 | 0.818 | 0.939 | +0.121 |
| 50 | 0.909 | 0.939 | +0.030 |
So yes at small k, and less so as the budget grows — which is the regime that
matters, since the whole point is a small k. Embedding on CPU is the slow part of
setup, and this is what it buys.
Caveats, because a benchmark without them is marketing: n=33 and n=40, one
repository, Python only, and k is a knob a caller chooses rather than something
the tool tunes for itself. Two more worth stating plainly:
- This measures retrieval, not resolution. No patch was written and no test was run. Files-retrieved and tasks-fixed are different axes.
- The graph arm is not perfectly deterministic, and the spread is ±0.025. In a single run on the large corpus, the same k=10 query set scored 0.608 in the headline pass and 0.633 in the sweep — same code, same tasks, same process, because the semantic arm times out on some queries under load. Anything smaller than 0.025 here is noise, including differences we would rather were real.
Two things measured and not confirmed, recorded because a benchmark that only reports its wins is an advertisement:
-
Embedding coverage was not the gap. Going from 33.3% of chunks carrying vectors to 100% moved recall@10 from 0.800 to 0.803. The earlier claim that partial coverage understated the result is refuted.
-
A naive fusion did not work. Run the graph, fall back to grep when it returns few files: 0.894 recall at 348,389 tokens — worse recall than grep AND nearly grep's full cost, because the fallback fires on almost every task and pays both bills. A trigger keyed on result count cannot help; it fires when the graph is confidently wrong and stays quiet when the graph is confidently right. It behaves the same way at 1.2M lines: +0.050 recall over the graph alone for 216x the tokens.
The cost model was the flaw, and fixing it is measured. Treating grep's output as a RESULT SET commits the agent to reading whole files. Used instead as SEEDS —
git grep -ilreturns paths, and the previews for those files come from the index — the same fallback costs 16,444 tokens instead of 387,865, a 23.6x cut, at 0.633 recall against the naive version's 0.658. So seeding is the right way to pay for a fallback and it did not buy recall over the graph alone (0.633 either way). Score-keyed triggering remains untested.
Setup: index once, embed lazily
Two costs, and only one of them scales with repo size.
| step | 2,400 chunks | 43,730 chunks | 44,735 chunks |
|---|---|---|---|
| parse + index | 49.8s | 75.5s | 27.2s |
| embed | — | ~97 min (CPU, ~450 vectors/min) | 3m23s (GPU server, ~13,200/min) |
Indexing is close to size-insensitive — 27x the files for 1.5x the time in the first two columns, because parsing runs across workers. The third column is a different, faster machine embedding against a GPU inference server rather than CPU sentence-transformers, which is the whole difference between 97 minutes and three: the embedding step is the one worth throwing hardware at. It is also optional, cached and incremental — re-indexing reuses stored vectors and only embeds what changed.
Without any embedding backend, queries fall back to keyword scoring and still work. That fallback is silent by design and dangerous by nature — a graph with no vectors looks like a working graph that is merely worse. Check coverage rather than assuming it:
embedded = sum(1 for c in graph.chunks.values() if c.embedding is not None)
print(f"{embedded}/{len(graph.chunks)} chunks carry vectors")
Use it from the terminal
pip install awgraph
awgraph index . # parse + persist an index for this repo
awgraph query "retry with exponential backoff"
awgraph callers send_request # who calls this
awgraph calls send_request # what does this call
awgraph stats # what is in the index
awgraph selftest # prove the install works
query prints path:line [type] name and the signature, so results paste
straight into an editor. --json on any read command gives machine-readable
output for wiring into a tool loop.
Exit codes are meaningful: 0 success, 1 a real negative answer (no match), 2 the command could not run at all — so a script can tell "nothing matched" from "there is no index yet", which are different problems with different fixes.
The index is cached outside your repository — under AWGRAPH_CACHE_DIR if
set, otherwise the platform user-cache directory, keyed by a digest of the
absolute repo path. Nothing is written into the tree you point it at.
awgraph stats always prints embedding coverage, including 0.0%. Without an
embedding backend hybrid_query silently falls back to keyword scoring and
still returns ten confident-looking results, so "is the semantic half actually
on?" is a question you should never have to answer by reading the source.
Use it from a coding agent (MCP)
pip install "awgraph[mcp]"
then one line in your client's MCP config — Claude Code, Cursor, Windsurf, Zed:
{"mcpServers": {"awgraph": {"command": "awgraph", "args": ["mcp"]}}}
Your agent gains code_index, code_search, code_callers, code_calls and
code_stats. It searches by meaning and gets back symbols with file, line,
signature, calls and callers — rather than pasting file text into its own
context, which is the cost this package exists to remove.
Index once per repository (code_index); it is cached on disk outside the
repo. Indexing is never implicit: a search against an unindexed repo tells the
agent to index rather than pausing for minutes, because a long silent call reads
as a hang and usually gets killed.
Use it from Python
import asyncio
from awgraph import CodeGraph
async def main():
graph = CodeGraph(root_path="/abs/path/to/repo", auto_index=False)
await graph.index_codebase("/abs/path/to/repo") # absolute path required
for chunk in await graph.hybrid_query("retry with exponential backoff", max_results=5):
print(chunk.name, chunk.source_path, chunk.start_line)
asyncio.run(main())
index_codebase needs an absolute path. Given a relative one it walks
nothing, indexes zero chunks, and returns successfully — so assert on
len(graph.chunks) rather than on the absence of an exception.
The query does not need to contain the symbol name. Asking for "backoff policy for flaky calls" against a class documented as "Backoff policy for flaky calls" returns it by meaning, not by string match.
Where it sits
Three packages, three different questions about the same repository:
- awgit — semantic version control. Stable node ids, semantic edit-ops, leases so concurrent agents do not overwrite each other, stacked commits with one PR each. It knows what changed and who is editing it.
- awgraph — code intelligence. Symbols, call paths, dependencies, blast radius. It knows what the code is and what depends on what.
- awdk — the agent runtime that consumes both.
The seam is the useful part: awgit tells you a commit touched
RetryPolicy.next_delay; awgraph tells you what calls it and which tests cover
it; the agent reads that instead of the repository.
Related work
GitNexus is the closest analogue and worth reading. Its recommended mode augments grep with graph context rather than replacing grep — a conclusion these measurements independently reach. Note its licence is PolyForm Noncommercial (source-available, commercial use forbidden), where awgraph is Apache 2.0. Its published figures measure SWE-bench task resolution; the numbers above measure retrieval recall. Those are different axes and should not be compared directly.
Licence
Apache 2.0.
The aw family
Standalone tools that share one idea: replace something you would otherwise have to trust with something you can check.
Each installs on its own, works offline, and needs no account.
| instead of trusting | you check | |
|---|---|---|
| awdk | a framework's idea of how your agents should run | one loop you can read, pointed at a backend you already pay for |
| awskills | that an agent knows your procedure | the procedure written down, versioned, and loadable by any agent |
| awm | that memory stayed in its lane | tenant:user:project scopes, so a write cannot cross a boundary |
| awnode | a vendor's cloud with every prompt | a local gateway routing to backends you chose |
| awgraph (you are here) | that grep found everything | an AST + tree-sitter call graph an agent can traverse |
| awgit | that no one else is editing this file | a lease, refused at commit time if you do not hold it |
| awseal | that the artifact came from who you think | an Ed25519 seal — the key that verifies is not the key that forges |
| awshare | that the download is intact | content-addressed bundles, verified on fetch |
| awnest | that there is a person on the other end | a verdict with evidence, where "we could not tell" is not "yes" |
| awnboard | a share link anyone who sees it can use | an invitation addressed to one person, for one gate, revocable |
| awnix | that the box is what you left it as | an immutable image you built, with atomic rollback |
| awrecover | that the restore worked | a restore that fully lands or does not land at all |
| awkno | that the docs site is up, or that you remember the family | the whole ecosystem in your terminal, with no network at all |
| awrelay | a SaaS in the middle of your agents | findings, alerts and coordination over your own transport |
| awmail | a mailbox somebody else can read | mail your agents send and receive over your own server |
| awfind | one vendor's idea of the web | results from whichever providers you configured |
| awbrowse | that the page said what you were told | the render, the DOM and the requests it made |
| aitherkvcache | a vendor's quantisation defaults | sub-byte KV cache kernels you can benchmark yourself |
| AitherZero | a pile of scripts nobody has numbered | numbered, discoverable automation with declarative playbooks |
| AitherConnect | what a page tells your browser to do | a federated search and desktop bridge you host |
| awreason | a confident paragraph | the phases it went through, and every tool call it made to get there |
| awrecurse | that everything you pasted in was actually read | which slices it opened, and what it concluded from each |
| awprism | the first explanation that fits | the ranked alternatives, and the observation that separates them |
| awrepl | what the agent believes the value is | the value, printed from the live session |
| awresearch | a summary of pages nobody opened | every claim against the source it came from |
| awpredict | a model because it trained without erroring | its prediction against a self-updating lookup, on the rows that are actually novel |
| awkno | that the docs site is up, or that you remember the family | the whole ecosystem in your terminal, with no network at all |
awnix is the ground floor — A Linux you can hand to an agent — immutable base, capabilities included.
The Aitherium ecosystem
Every repository here is public. Each publishes an aither-manifest.json beside its page, so any surface can read every sibling's — the network is browsable from any node in it.
| repo | what it is | pages |
|---|---|---|
| awdk | Build AI agent fleets — 3 lines, any backend, local or cloud | docs |
| awskills | Portable agent skills — self-contained procedures an agent loads on demand | docs |
| awm | A portable, scoped agent memory | docs |
| awnode | A lightweight local gateway — bridges your apps to the AI backends you chose | docs |
| awrun | A priority-aware queue and dispatcher for agentic runs and ad-hoc CI builds | docs |
| awgraph (you are here) | A semantic code graph for agents — AST + tree-sitter, call graphs | docs |
| awgit | Semantic version control on top of git — edit-ops and leases | docs |
| awseal | Sign an artifact so a stranger can verify it | docs |
| awshare | Publish an artifact and fetch it back verified | docs |
| awdit | An append-only audit trail whose gaps are DETECTABLE | docs |
| awbac | Role-based access control that fails closed and explains itself | docs |
| awiam | Who is this caller? A directory and session store that fails honestly | docs |
| awtunnel | Reach a service that has no public address | docs |
| awnest | Prove there is a human before you let them into the nest | docs |
| awnboard | A front gate you can put in front of anything, and hand someone the key to | docs |
| awnix | A Linux you can hand to an agent — immutable base, capabilities included | docs |
| awrecover | Labelled snapshots with an all-or-nothing restore | docs |
| awkno | The man page for the Aither World — every brick, stack and law, offline | docs |
| awrelay | Portable agent messaging — findings, alerts, coordination | docs |
| awmail | Give an agent an email address — send, and actually receive | docs |
| awnet | The agentic web — agents host a mesh, and agents join one | docs |
| awfind | A portable search client — query, results, ranking | docs |
| awbrowse | A portable browser client — navigate, console, network, DOM, screenshot | docs |
| awknowledge | How to run a coding agent so the result survives — the laws, with evidence | docs |
| aitherkvcache | Near-optimal KV cache quantization for LLM inference — sub-byte compression | docs |
| AitherZero | PowerShell 7+ automation framework — numbered, self-describing scripts | docs |
| AitherConnect | Browser extension — federated AI search, page context, and the Living OS overlay | docs |
| awreason | A portable reasoning client — sessions, phases, thoughts, and the chain that produced the answer | docs |
| awrecurse | Answer a question over a context far larger than the window — recursively, with the trace kept | docs |
| awprism | Turn a failure into ranked hypotheses — and say what would confirm each one | docs |
| awrepl | A REPL an agent can actually use — state that survives between turns | docs |
| awresearch | Ask a research question, get a cited report you can check | docs |
| awpredict | Predict what your environment does next, and how surprised you were | docs |
| awkno | The man page for the Aither World — every brick, stack and law, offline | docs |
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file awgraph-1.4.2.tar.gz.
File metadata
- Download URL: awgraph-1.4.2.tar.gz
- Upload date:
- Size: 125.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3469859e77bbcd9b3b0db90c7b0dd7e51288dd33c18fef48d11e695efa02a95
|
|
| MD5 |
bcde9385c89e3165d1a4d1a7cbb4bd68
|
|
| BLAKE2b-256 |
7bb38fd2c3f816b0d5b2949cde7345a80432076f9b61ac80faec9d7862014643
|
Provenance
The following attestation bundles were made for awgraph-1.4.2.tar.gz:
Publisher:
pypi-publish.yml on Aitherium/awgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
awgraph-1.4.2.tar.gz -
Subject digest:
f3469859e77bbcd9b3b0db90c7b0dd7e51288dd33c18fef48d11e695efa02a95 - Sigstore transparency entry: 2583424079
- Sigstore integration time:
-
Permalink:
Aitherium/awgraph@f0d7fba8cb84a3550e11d2cf81d1674e41d2cf5a -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/Aitherium
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f0d7fba8cb84a3550e11d2cf81d1674e41d2cf5a -
Trigger Event:
release
-
Statement type:
File details
Details for the file awgraph-1.4.2-py3-none-any.whl.
File metadata
- Download URL: awgraph-1.4.2-py3-none-any.whl
- Upload date:
- Size: 114.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
240d21cfb27e4ee0aed1cbd8afcb7ce75c45d72bce880b5ed18dc5ea11fb5011
|
|
| MD5 |
b48cd9f02582a79e6b6eaf6edd283147
|
|
| BLAKE2b-256 |
3568cc4ac2536eca947a8d19fed116967133f05c934b1fb3a5d0df72ea53bb54
|
Provenance
The following attestation bundles were made for awgraph-1.4.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on Aitherium/awgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
awgraph-1.4.2-py3-none-any.whl -
Subject digest:
240d21cfb27e4ee0aed1cbd8afcb7ce75c45d72bce880b5ed18dc5ea11fb5011 - Sigstore transparency entry: 2583424083
- Sigstore integration time:
-
Permalink:
Aitherium/awgraph@f0d7fba8cb84a3550e11d2cf81d1674e41d2cf5a -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/Aitherium
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f0d7fba8cb84a3550e11d2cf81d1674e41d2cf5a -
Trigger Event:
release
-
Statement type: