Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code In Parallel

Point a metered, verified, replayable agent graph at a repository you own, in about fifteen minutes.

One agent versus a graph, three races. The graph lost two of them.

The companion repository for Claude Code In Parallel: The Graph Engineering Playbook. Every graph in the book, one folder per chapter, under the book's own filenames. Book and more at youcanbuildthings.com.

Start here

I want the graph running on a repo I own

./install.sh ~/path/to/your/repo

Copies the three node files and the three gates into that repo's .claude/, wires them into .claude/settings.json (merging rather than overwriting one you already have), and puts the domain-free machinery in graph/. Then, in your repo, bash graph/dry-run.sh graph/rg.sh runs the whole graph with no model and no bill, and bash graph/rg.sh runs it for real.

I want to see it work before it costs me anything

bash verify.sh

Runs every artifact here that doesn't need a model, against the book's own committed measurements, and prints what each one produced. No key, no account, no network. 106 checks on a fresh clone.

I finished the book and just want the files

Everything is under chapters/, at the book's own filenames. The copy table below says where each one goes in your project.

The copy table

The node and hook files live un-nested here and belong under .claude/ in your project. ./install.sh does this for you; this is what it does.

From this repo Goes in your project at
chapters/04-your-first-real-graph/agents/searcher.md .claude/agents/searcher.md
chapters/04-your-first-real-graph/agents/judge.md .claude/agents/judge.md
chapters/06-the-node-that-lies/agents/verifier.md .claude/agents/verifier.md
chapters/05-your-first-bill/hooks/budget.sh .claude/hooks/budget.sh
chapters/06-the-node-that-lies/hooks/require-results.sh .claude/hooks/require-results.sh
chapters/07-routing-you-can-audit/hooks/gate.sh .claude/hooks/gate.sh
settings/settings.merged.json .claude/settings.json
chapters/12-the-next-thirty-days/workflows/dep-check.js .claude/workflows/dep-check.js

The shell scripts go wherever you keep scripts. install.sh puts them in graph/.

Chapter map

Chapter What you build The command Success looks like
01 a three-node graph and a stopwatch bash graph.sh both .start files show the same second
02 the diagnostic that says whether to build one bash decide.sh at least one of your three tasks says one-agent
03 state in a file, killed and resumed bash run.sh the resumed run prints skip for a finished node
04 scope, fan out, dedupe in code, judge bash rg.sh three searchers, one timestamp, and the dedupe was sort -u
05 a per-node meter and a ceiling that fires bash meter.sh .rg/runs you can name the node eating the run
06 a verifier that cannot grade its own work bash regress.sh 2 of 3 cases pass with the bug still in
07 a decision log you can replay, and a gate bash replay.sh you explain a past branch without re-running it
08 entity memory made of files bash sweep.sh two thresholds derived from your own pairs
09 the break-even calculator bash breakeven.sh … a verdict on one real task of yours
10 a scoped, priced, client-ready package the --json-schema entry point somebody else runs it without you speaking
11 three drills and a rollback bash dry-run.sh you recovered three times using only the runbook
12 the scaffold on your own work bash scaffold.sh both gates fired before any real work went in

The shape everything else extends

The rg.sh graph: a scoper, three parallel searchers, a deterministic dedupe, and a judge.

"Fan out, deduplicate in code, then judge. The coordination between nodes is code, not conversation, and the fastest way to check whether you have built a graph or just a crowd is to ask which line of your own source decides what runs next."

The three hook events and their different contracts.

What each chapter hands the next, from chapter 3 to chapter 12.

What it needs to run

bash, jq, git. Nothing else, no package manifest, no framework, no database, no account, nothing to sign up for. Written for bash 3.2, which is what macOS ships.

These run bare. No key, no network, no Claude Code. verify.sh runs all of them on every commit:

verify.sh · meter.sh · regress.sh · replay.sh · decide.sh (ch07) · stalled.sh
sim.sh · sweep.sh · resolve.sh · recall.sh · stale.sh · breakeven.sh
snapshot.sh · rollback.sh · dry-run.sh · w.sh · w3.sh · install.sh

These call claude -p and bill your Claude Code subscription. They are the book's central skill, and they're not stubbed:

chapters/01-your-own-stopwatch/graph.sh
chapters/02-when-not-to-build-a-graph/decide.sh   and loop.sh
chapters/03-state-outside-the-model/run.sh
chapters/04-your-first-real-graph/rg.sh
chapters/12-the-next-thirty-days/scaffold.sh      and workflows/dep-check.js
the chapter 10 client entry point (claude -p --json-schema)

What that costs, on the author's rig (Appendix B.1: macOS 25.5.0, ten cores, Claude Code 2.1.220): the floor for one node is $0.0178, the five-node review graph came to $0.16060, and the twelve-cent stub scaffold came to $0.13047. Those are the author's numbers on the author's machine. Yours will differ, and measuring yours is the whole point of chapters 5 and 9.

To run the graph's shape with no model and no bill at all:

bash chapters/11-everything-goes-wrong/dry-run.sh

That's the book's own answer, not a simulation invented here. It puts a stub on PATH and runs the real orchestrator, so a bug in rg.sh still shows up.

Not tested here: whether the Claude Code runtime honours the three hooks' exit codes. Their own exit codes and stdout are checked on every verify.sh run; the runtime's honouring of them is vendor-documented and needs a signed-in Claude Code and a real tool call. Fire each one yourself once, somewhere nothing is at stake.

Why this repo doesn't ship a live .claude/

The book installs three live command hooks into one .claude/settings.json, and each of them is supposed to stop something:

  • budget.sh writes a counter into the working directory and exits 2 after two tool batches, halting the agentic loop of any Claude Code session running there.
  • require-results.sh exits 2 unless results.json exists, trapping every subagent.
  • gate.sh denies any Bash command containing deploy.

A live .claude/ anywhere in this clone would inflict all three on anyone who opened it. Nesting it under a chapter folder doesn't help either: project subagents are found "by walking up from the current working directory", so a reader who cds into a chapter (exactly what a chapter README tells them to do) makes that folder the project root.

So the files are stored un-nested, as agents/, hooks/ and settings/, with every filename kept exactly as the book prints it. The copy table above and install.sh place them. This is the one place where the repo's layout differs from the book's, and it's the only one.

Known bugs, gotchas, testing

GOTCHAS.md has the list: five things in the book's printed scripts that behave differently from what their own chapter says, each with the command that proves it, plus what broke while building this.

bash verify.sh

It asserts the book's own load-bearing outputs (TOTAL 0.16060 USD across 5 nodes, 2 passed, 1 failed, MERGE … (1.00), graph LOSES on both axes - do not ship it), runs bash -n over every script, parses every JSON file, checks the three hook scripts' exit codes, and runs with a tripwire on PATH so "no model call" is checked rather than claimed. It prints its check count and exits non-zero if that count is ever zero. CI runs the same command.

Contributing

Fixes are welcome: a broken command, a wrong path, a portability problem on your shell. New features are out of scope, because this repo mirrors the book on purpose: if it does something the book doesn't teach, a reader who followed along stops recognising it.

License

MIT. See LICENSE.

Educational software, provided as-is, without warranty of any kind.

About

Point a metered, verified, replayable agent graph at a repository you own. Companion code to the book. Educational software, from youcanbuildthings.com.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages