Graphtory
Agent task graphs you can trust: prep, work, verify, loop.
Write the plan as code. Run it on Temporal. Every agent step is cached, every gate is a human, and nothing passes until its signals say so.
A real run with real Claude on a toy repo: the agent fixes a - b to a + b, three gates are approved, the branch merges to main and verify passes (about a minute of wall clock). The GIF is the captured output. Regenerate with uv run --with pillow python docs/demo/record_real.py; docs/demo/record.py does the same with the scripted fake agent.
Why
Coding agents are good at writing code and bad at knowing when they are done. Graphtory puts the agent inside a graph that decides that for it:
- A plan is a contract. A planner writes the graph in a small Python DSL. It compiles to a JSON plan with per-task PASS signals, is validated, and is approved by a human before anything runs.
- Verification is not the agent's opinion. A verify node runs real code (tests, lint, types) in the run's worktree, reruns to catch flaky tests, and only a clean pass counts.
- Loops are capped, not infinite. Hit a loop cap or a model credit cap and the run pauses and notifies.
resumecontinues it. - Durable by default. Temporal events are the source of truth. LLM steps are cached by run, node and visit, so a worker restart never pays for the same step twice.
- Any agent, per node. Agents are plugins behind one small contract. Claude ships today; others are an entry point away.
- You can stop it.
graphtory killsignals every run and revokes deploy credentials first, even if Temporal is down.
How it works
Task → Proposal → Context → Plan (as code) → Validate → ✋ Approve plan
→ Build → Review → Adversarial review → PR → Team review ─┐
▲ changes? ┘ (capped)
→ ✋ Approve merge → Merge → ✋ Approve deploy → Deploy → Monitor → Verify → PASS
| Piece | What it does |
|---|---|
plan / dsl / validate |
The JSON plan contract, the Python DSL that compiles to it, and the validator (schema, locked judge nodes, signals set) |
templates.bugfix |
The first milestone: a ready-made bug-fix graph |
runner.workflow |
The Temporal workflow: gates, loop caps, pause and resume, runtime add_node, kill |
runner.activities |
All I/O: agent calls with an idempotent cache, a git worktree sandbox per run, verification |
projection |
A rebuildable SQLite projection of workflow events (the UI reads this) |
ui |
A React board (TanStack Query, Router, Table) over the projection: a live dashboard of every run's graph, per-run node states, loop-backs, outputs, a sortable event table, and approve/reject for waiting gates |
mcp_server |
Shared run state and per-agent notes, over MCP |
adapters |
Agent plugins (claude, plus a scripted fake for tests) |
cli |
graphtory worker / mcp / ui / plan / run / show / approve / reject / resume / kill / approver-add / dream |
The board
A scripted-agent run, recorded from the real board in a real browser: the run appears, the graph fills in, and each of the three gates is approved from the page. Regenerate with uv run --with playwright --with pillow python docs/demo/record_ui.py REPO (needs the stack running).
/ is a live overview of every run (live ones as full graphs, finished ones as a list); a run opens to its graph, where ?node=review deep-links a selection. A waiting gate shows Approve and Reject. With gate authentication on, the browser computes the HMAC proof itself and the token never reaches the server. The screenshot is the real forced-review-fail run: the review failed once, the run looped back to build, then merged and verified. The built app is committed under src/graphtory/ui_dist; to change it, cd ui && npm ci && npm run dev (proxies /api to graphtory ui), then npm run build. The interface direction follows unslop by Damir Sokolovsky (CC BY 4.0): quiet graphite chrome, one status dot, color only where something is live or failed.
Quickstart
Requires Python 3.12+, uv and the Temporal CLI.
git clone https://github.com/adityak74/graphtory && cd graphtory
uv sync
uv run pytest -q # the whole suite, no services needed
temporal server start-dev # Temporal on localhost:7233
uv run graphtory worker # workflows + activities
uv run graphtory mcp # MCP server on 127.0.0.1:7801
uv run graphtory ui # live board on http://127.0.0.1:7802
uv run graphtory run --repo PATH --title "fix the failing test" \
--test-cmd "pytest -q" --agent claude --solo
uv run graphtory plan --repo PATH --title "add feature X" --test-cmd "pytest -q" --out plan.json # an agent designs the graph
uv run graphtory run --repo PATH --plan plan.json --solo # run the plan you reviewed
uv run graphtory run --repo PATH --prompt "add feature X; it must ..." --test-cmd "pytest -q" # free-text task: plan it and start (use - to read stdin)
uv run graphtory show RUN_ID # state, plan, PASS signals
uv run graphtory approve RUN_ID plan_gate --user bob
uv run graphtory approver-add bob # optional: require a per-approver token on gates, resume and kill
uv run graphtory dream # morning report from the run history (read-only, proposes only)
- Use
--agent faketo walk the whole graph without calling a model. - The worker and MCP server must share the same
GRAPHTORY_HOME/GRAPHTORY_DB(default~/.graphtory,shared.db), or agents will see an empty projection. - The worker is versioned (deployment
graphtory, build id = package version). On a fresh namespace, set that version as current before workflows run, for exampletemporal worker deployment set-current-version --deployment-name graphtory --build-id <version> --yes. Verified against Temporal CLI 1.10.
Writing a plan
Plans are code, so they diff, review and test like code. The bug-fix template is the reference: it wires the nodes, the gates, the loop caps and the PASS signals, then the validator refuses to start anything malformed (graphtory run exits 2 before touching Temporal).
For feature work, graphtory plan has an agent design the graph in a throwaway clone of your repo, retries with the validator's complaints, and writes plan.json for you to read before graphtory run --plan. The planner chooses the shape and the prompts, never what runs on your machine: verify always runs only your --test-cmd, every node uses the agent you chose, and loop caps are clamped to 5.
Status
v0.1, early. The bug-fix flow runs end to end against real activities, and the workflow, projection, activities, validator and CLI are covered by 126 tests. It has passed with real Claude on toy repos. Proven with a real model: a forced review failure; an unforced adversarial-review failure that looped back to build; an unforced verify failure (strict tests hidden from the agent) that looped back to build and then passed; and a planner-designed two-build plan run end to end. Each run used a live dev server and the versioned worker, with gates approved by hand or from the board. Not yet proven: loop caps and resume against a real model, three or more builds, and a long run. Feature work has started (graphtory plan); a board ships (graphtory ui): a live dashboard, and gates can be approved from it or the CLI. Dream mode has its first slice (graphtory dream, a read-only report); the optimizer, replay and auto-revert, and full apps, are next. See SPEC.md for the design and the open gaps.
Known limits
- Gate authentication is opt-in.
graphtory approver-add NAMEturns it on: approvals then carry an HMAC of the approver's token (per run, node and decision), and forged, borrowed or missing proofs are ignored. With noapprovers.json,--useris honour-system.resumeandkillcarry the same proof (per run and per action), so with authentication on a forged or missing proof is ignored and logged. Akillfrom someone who is not an approver does nothing, so to stop everything without a token, stop the worker. Anyone who can reach Temporal can still terminate a workflow through its own API; put Temporal's auth in front of it. - The Claude adapter runs Bash inside the SDK sandbox (writes only to the worktree, no network, no host reads), denies the file tools outside the worktree, and blanks host secrets (names containing TOKEN, KEY, SECRET, PASSW or CREDENTIAL, except the agent's own login) in the agent's environment.
uv run python scripts/sandbox_drill.pyhas the agent try ten routes out and judges by what lands on disk; it passes on macOS (the first run found the environment leak, now fixed). Not tested on Linux: run the script there. The sandbox's own proxy credential (CLOUDSDK_PROXY_PASSWORD) is still visible inside the agent's shell. Other adapters bring their own isolation. git add -Acommits whatever the agent writes to the worktree branch.killstops workflows at the next node boundary (stop the worker to hard-stop) but revokes creds immediately.- The local MCP server (127.0.0.1:7801) and the board (127.0.0.1:7802) have no login. The board refuses any
HostorOriginother than itself and its only write is approving or rejecting a waiting gate, which the workflow still checks (requester, and the HMAC proof when gate authentication is on). With it off,--useris honour-system on the board just as on the CLI. Anything that outputs say is shown to whoever can reach it. - The projection is auxiliary; Temporal is authoritative.
Contributing
Issues and PRs are welcome. Run uv run pytest -q before you push; every behaviour in the workflow has a test, and new ones should too.
The architecture diagram was drawn from the Graphtory whiteboard; a vector copy is at docs/assets/architecture.svg.
License
Running on more than one machine
What works: Temporal is the shared coordinator, so workers on other hosts can poll the same namespace.
--repo may be a git URL (https, ssh, file://, or user@host:path); each worker keeps its own cached clone under
$GRAPHTORY_HOME/repos/<hash> (cloned on first use, git fetch --prune after). Each worker host sets GRAPHTORY_MCP_URL
to an MCP endpoint reachable from that host (the mcp_url run argument is only a fallback). Skills and SOUL are stored
content-addressed, and graphtory skill-export DIR / skill-import DIR copy them between hosts so a pinned plan finds
the same bytes everywhere.
What is not built: a networked projection store. The SQLite projection (GRAPHTORY_DB, default
$GRAPHTORY_HOME/shared.db) is per host. Pointing GRAPHTORY_DB at a shared path only works with WAL-safe file
semantics, which NFS does not provide, so do not. Recommended: one projection-writer host, with the other workers
sending events there through record_event on the control queue (the --control-queue run argument already exists).
The per-run MCP token secret (mcp_secret) and the approvers file are also per-host; the MCP server and workers that
talk to it must share the same $GRAPHTORY_HOME/mcp_secret. Merging still happens in whatever checkout the merging worker has.
Metadata
Release files for graphtory 0.1.1
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 |
|---|---|---|---|---|
| graphtory-0.1.1.tar.gz | 275.1 kB | Without provenance | Details for graphtory-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| graphtory-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for graphtory-0.1.1-py3-none-any.whl |
Total release size: 517.9 kB
Release files / graphtory-0.1.1.tar.gz
| Download URL | graphtory-0.1.1.tar.gz |
|---|---|
| Size | 275.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4fdfb90325cdeca3b247734ce38e505c4546099bb24b459e762f3eb57211ea9e
|
|
BLAKE2b-256 checksum How to use checksums |
186790fcec3abf4d7f47c06077cae15de1eba5634b8cbbd5621554647e806293
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / graphtory-0.1.1-py3-none-any.whl
| Download URL | graphtory-0.1.1-py3-none-any.whl |
|---|---|
| Size | 242.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f203d1fd8b5edff9fbd19a8ff1caef57959ab7b3b4901155f7459d0710533e2b
|
|
BLAKE2b-256 checksum How to use checksums |
4db8c6e445be22da19ca02d247bf631de0d5886a56105d541aebb3918e1e71f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Security for graphtory 0.1.1
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.