toji
Codebase graph memory: index structure once, answer with evidence forever.
toji parses your codebase (Python, TypeScript, TSX, JavaScript) into a queryable
graph — symbols, signatures, docstrings, call/import/inherit edges — stored in
SQLite. No source is stored; read always fetches live lines from disk. Awesome no?
Built for AI reviewers and anyone tired of skimming ten files to answer
"who calls this?": every answer carries exact path:line evidence, ambiguous
names are surfaced instead of guessed, and unresolved calls are reported as
unknown rather than invented.
Install
pip install toji # or: uv tool install toji
Or install as an agent skill (instructions for AI coding agents):
npx skills add mr-jones123/toji
Quickstart
toji index . # index current directory -> .toji/graph.db
toji map src/ # skeleton of a module: symbols, signatures, docstrings
toji find "classify" # regex search over symbol names
toji callers classify_change # who calls it, with file:line evidence
toji blast classify_change # BFS blast radius: what a change affects, hop-ranked
toji read classify_change # the symbol's actual source lines
Reindexing is incremental and content-hashed: only changed files re-parse. A full 12k-file monorepo indexes in ~40s; unchanged reindex scans are sub-second.
Commands
| Command | Evidence returned |
|---|---|
index [PATH] [--force] |
build/rebuild the graph (incremental by content hash) |
map [FILE|SYM] |
file skeleton or symbol detail |
find <regex> |
matching symbols |
calls <sym> |
forward call edges + unresolved callees |
callers <sym> |
reverse call edges (1 hop) |
blast <sym> [--depth N] [--forward] |
affected symbols across calls/contains/inherits |
deps <file> |
import edges both directions, resolved to files |
read <sym> |
the symbol's live source lines from disk |
stats |
index size, resolution quality metrics |
benchmark graphcode <JSONL> <REPOS> |
GraphCode-Bench F1 and exact match |
benchmark traceeval <CORPUS> |
TraceEval edge precision, recall, and F1 |
Every command accepts --json for stable machine-readable output.
Benchmarks
The adapters run Toji directly against local benchmark data; they never clone repositories or choose revisions for you.
# GraphCode-Bench: REPOS contains owner__repo, owner/repo, or repo directories.
toji benchmark graphcode bench500_balanced.jsonl repos/ --output graphcode-results.json
# TraceEval: use the held-out IDs and emit files accepted by its official scorer.
toji benchmark traceeval data/benchmark \
--ids data/traceeval_split/test_ids.json \
--output-dir traceeval-results/
python scripts/compute_metrics.py \
--results-dir traceeval-results/ --gt-dir data/benchmark \
--models toji --languages python javascript
TraceEval Java programs are skipped because Toji indexes Python, TypeScript,
TSX, and JavaScript only. The adapter's direct TraceEval summary is raw edge
F1; use the benchmark's compute_metrics.py command above for its canonical
normalization.
How resolution works
Call edges normally store the callee as written (obj.method, helper). For
JavaScript and TypeScript, simple constructor assignments (const obj = new Service()), constructed class fields, and this.method() calls are qualified
to their class before resolution. Remaining calls resolve through file-local
scopes, the importing file's own imports, then global unique suffix/bare-name
matches:
- Confident matches resolve with the exact call-site line attached.
- Ambiguous names list every candidate instead of guessing.
- Unresolved calls (stdlib, dynamic dispatch) are counted and shown —
never fabricated.
toji statsreports the ratio so you know what the graph is confident about.
blast and callers merge same-named definitions (e.g. a method implemented
by several cloud adapters) and traverse from all of them, reporting the count;
read, calls, and map require a single symbol and will ask you to
disambiguate instead.
Releasing
Conventional Commits drive versions automatically on push to main
(fix: → patch, feat: → minor, BREAKING CHANGE: → major). The release
workflow tests, bumps the version, generates the changelog, tags, builds, and
publishes to PyPI. Configure either PyPI trusted publishing or a PYPI_TOKEN
secret to enable publishing.
License
TBD.
Metadata
Release files for toji 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| toji-0.2.0.tar.gz | 90.8 kB | Without provenance | Details for toji-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| toji-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for toji-0.2.0-py3-none-any.whl |
Total release size: 120.6 kB
Release files / toji-0.2.0.tar.gz
| Download URL | toji-0.2.0.tar.gz |
|---|---|
| Size | 90.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3fdd95f7779501a04ee10bc46bf9dc9ec56cad6d79c08f9f82b36d65b3ecfb5
|
|
BLAKE2b-256 checksum How to use checksums |
bd254957163359c0da7d4743f3101453d2f2d6f080b83fafed3da643c09bba5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / toji-0.2.0-py3-none-any.whl
| Download URL | toji-0.2.0-py3-none-any.whl |
|---|---|
| Size | 29.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77cfe1aed9f7b02dabb3c34df1c6e10695d7d7c1374310781321a7f4643f1915
|
|
BLAKE2b-256 checksum How to use checksums |
1992c0fb29af51e92fe15a1c8b978d0422de6482dca1e425e7a82dd39aaac686
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for toji 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.