Skip to content
pwnghPublic

About

Verification receipts for Claude Code and Codex skills. Run checks against a clean Git commit, seal the results with HMAC, and verify them in GitHub Actions. Includes a deterministic C99 workflow runtime.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

flow

Proof receipts for agent-written pull requests.

Run your repository’s verification commands against a Git commit.
Give the PR a sealed record of the commands, their exit codes and their output digests.

ci license: MIT C99 runs on Linux and macOS

Terminal quick start · Install the skills · Verify a commit · Workflow runtime · Docs

Use Flow from the terminal

From a project configured with Flow, check the environment and produce a PR receipt:

npx --yes github:pwngh/flow doctor
npx --yes github:pwngh/flow prove --format markdown

For repeated use, install Flow in the project once. The local executable is named flow:

npm install --save-dev github:pwngh/flow
npx flow doctor
npx flow prove --format markdown
npx flow verify /path/to/receipt.json --check-logs

Use the GitHub-qualified form in a project without that dependency. The package is named @pwngh/flow and distributed from GitHub. The Node launcher looks for a compatible native CLI at $FLOWD_PREFIX/bin/flowd when FLOWD_PREFIX is absolute, then at flowd/flowd in a built Flow checkout. Otherwise it uses the bundled Python proof runner. Both paths use the same proof implementation. The native executable and the terminal runner installed by the setup skill use the name flowd.

Install the skills

npx skills add pwngh/flow

Choose Claude Code or Codex (or both), install flow-setup and flow-prove, then run setup once in the project. The proof runner uses Git and Python 3.10+ from your machine. It ships inside the skill and needs no C build.

Host Set up the project Prove the current commit
Codex $flow-setup $flow-prove
Claude Code, standalone skills /flow-setup /flow-prove
Claude Code, Flow plugin /flow:setup /flow:prove

To use the namespaced commands from a Flow checkout, start Claude in the target project with claude --plugin-dir /absolute/path/to/flow.

Setup inspects the project and asks which checks count as proof, whether missing proof should block a PR, and which reviewers the project uses. It writes the selected commands to .flow/prove.json, updates the Flow section in AGENTS.md and CLAUDE.md, and installs a terminal runner. Setup runs flowd doctor, then runs a live proof and verifies its receipt when the confirmed policy matches HEAD. A new or edited policy needs a commit first. Setup identifies that checkpoint so the first receipt covers the policy the team actually approved. To enforce the merge rule on GitHub, configure the App-owned receipt check described below.

Verify a commit

Run the prove skill or invoke the terminal runner printed by setup:

~/.flow/bin/flowd prove --format markdown
~/.flow/bin/flowd verify /path/to/receipt.json

Setup preserves existing native installations. It places its Python runner in $FLOW_HOME/bin (default ~/.flow/bin) as flowd or flowd-proof. If both names are occupied, use python3 -I -S /reported/path/to/flowd.py before each doctor, prove and verify command.

Prove resolves Git HEAD, reads the committed policy, and executes each selected argv in a disposable checkout of that commit. Checks share the checkout for dependency installation and generated build outputs. A check that leaves HEAD or tracked files changed prevents sealing. Include required preparation in the policy. For example:

{
  "checks": [
    {"name": "build-and-test", "argv": ["./build.sh"]}
  ]
}

Paste the complete Markdown block into the PR description, including the hidden receipt marker. It shows the full commit SHA, command for each check, duration, exit code and receipt SHA-256. Command arguments that may contain credentials are omitted from the display and can be inspected in the committed policy. Raw stdout and stderr stay in the private run directory. For scripts, the default JSON output includes the local receipt path.

Verify on another machine. Check out the same commit and supply the signer's base64-encoded 32-byte key as FLOW_KEY through your secret manager. Without that variable, Flow reads the private key at $FLOW_HOME/key (default ~/.flow/key, mode 0600). The first local proof can create this file. Verification never creates a key and exits unsuccessfully if the key is missing or different. --check-logs also compares the private captures with the signed digests. A SHA-256 comparison alone identifies matching bytes; only a successful keyed verification authenticates the receipt. Keep the key out of the repo and PR. Every holder of the shared key can issue receipts.

Require proof on GitHub. The release-gate action supports mode: receipt and posts flow/prove on the PR head. The verifier reads the live PR description and committed policies through the GitHub API. Use a dedicated per-repository key and require the check from your configured GitHub App. Receipt gate setup

Workflow runtime

A terminal: hello.flow is compiled and run and prints 42, then a recorded decision is replayed on another model and the diff lists the two steps that changed

Real output. The first run is examples/hello.flow; the replay is the score fixture from the Python binding's tests.

Flow also includes a language, a compiler and a runtime for typed workflows:

  • The language describes an agent workflow as typed steps. Each tool a step calls declares its effect: a lookup, a model call, or a change to the outside world.
  • flowc compiles a .flow file into a JSON program, the IR.
  • flowd runs the IR and writes a trace: the inputs, output and model of every step.

Python and TypeScript bindings wrap the same runtime, so a host writes only the tools. The Python binding also works with MCP both ways: it serves any flow to MCP clients, and a flow can use tools that MCP servers provide.

type Applicant    = { id: string, email: string, amount: int }
type CreditReport = { score: int, history_years: int }
type RiskDecision = { approve: bool, band: string, rationale: string }

tool fetch_credit(id: string) -> CreditReport
  effect deterministic
tool assess_risk(report: CreditReport, amount: int) -> RiskDecision
  effect model("claude-underwriter-v1")
tool notify_applicant(email: string, band: string) -> bool
  effect mutation

flow onboard(Applicant) -> RiskDecision {
  report   = fetch_credit(it.id)
  decision = assess_risk(report, it.amount)
  sent     = notify_applicant(it.email, decision.band)
  decision
}

Does it actually work?

It is a beta, and this is what stands behind it today:

  • make test passes 72 checks in flowc and 90 in flowd.
  • CI builds both under GCC and Clang with -std=c99 -pedantic -Wall -Wextra -Werror, then runs them under AddressSanitizer, UBSan and TSan.
  • CI fuzzes the two parsers that read untrusted input, and checks that the IR and the traces come out byte for byte the same.
  • CI runs the Python and TypeScript binding tests. The Python suite has 164 tests, and they include the MCP server driven by a real MCP client, in process and over stdio.

The limits are under What it will not do.

Why it is different

  • Effects are declared. Every tool says whether it is deterministic, a model call or a mutation. The compiler carries that into the IR, so the runtime knows which steps touch the outside world.
  • Every step is recorded. A trace holds each step's inputs and output, the model that answered, token counts, and hashes of the program, the input and the result.
  • Replay never repeats a side effect. A replay restores mutations from the record. Only the model steps run again, on the inputs they saw the first time.
  • Same input, same bytes. The IR is byte-deterministic. Traces of runs with the same tool results are byte-identical once the clock and the id suffix are pinned.
  • Every run names its record. flowd_last_execution_id returns the execution id that a run, resume or replay wrote (last_execution_id in Python, lastExecutionId in TypeScript).
  • A paused run resumes once. The token an approval gate returns is an opaque id, never a path. It resumes the run one time, and the steps after the gate run then.
  • Signatures are checked when tools register. A signature that does not match the IR is refused with R153; registering without one skips the check. The Python binding derives one from each method.
  • Budgets stop a run. flowd_set_budget, or Runtime.set_budget in Python, limits a run's tokens, cost and model time. The model call that goes past a limit stops the run with R161.
  • One runtime, several hosts. C, Python and TypeScript all drive the same libflowd, and read the same IR and the same traces.
  • Plain C99. The compiler and the runtime need a C compiler, flex, bison, libcurl and libcrypto.

Build the C runtime

git clone https://github.com/pwngh/flow && cd flow
./build.sh                                        # builds and tests flowc, then flowd
flowc/flowc examples/hello.flow -o /tmp/hello.ir.json
flowd/flowd run /tmp/hello.ir.json --input 16     # -> 42

That run also wrote a trace under traces/hello/. To try the language without building anything, use the playground, which compiles and runs Flow in the browser.

To run a flow with real tools, pick a binding:

  • Python: load_ir, Runtime, replay and diff, a Claude provider, and the MCP server.
  • TypeScript: the same runtime through N-API, with generated types.

Works with

Systems Linux and macOS, on x86_64 and arm64.
Hosts C through libflowd, Python 3.10 or newer, and Node through the TypeScript binding.
Models Any model, through a provider the host registers. A Claude provider ships with both bindings.
MCP Both ways, in the Python binding. It serves each flow as one MCP tool (Serve a flow to MCP clients), and a flow's tools can be served by MCP servers (Use MCP servers as a flow's tools).
Editors VS Code syntax highlighting, in vscode-flow/.

How it works

flowchart LR
  A[".flow source"] --> B["flowc"]
  B --> C["IR<br>(JSON)"]
  C --> D["flowd<br>+ your tools"]
  D --> E["trace"]
  E --> F["replay on<br>another model"]
  F --> G["diff"]
  E --> G
Loading
  1. Write the workflow: types, tools with their effects, and flows that bind one step to the next.
  2. Compile it with flowc. Type errors stop here, each with a numbered diagnostic.
  3. Run the IR with flowd. The flow's own logic runs in the runtime. The tools are yours, registered by a host.
  4. Record. Each run writes traces/<flow>/<execution id>/ with a manifest and one file per step.
  5. Replay a recorded run. With no model named, every step is restored and the result must match. With a model named, only the model steps run again.
  6. Diff the two traces to see which steps changed and how.

Commands

Command What it does
flowd doctor [--repo PATH] Checks HEAD, the proof policy, private key storage, and available skill installations.
flowd prove [--repo PATH] Executes the committed proof policy and seals a receipt.
flowd verify RECEIPT [--repo PATH] Checks the receipt seal and required checks against HEAD.
flowc file.flow -o file.ir.json Compiles a flow to IR.
flowd run file.ir.json [--flow NAME] [--input JSON] [--trace-dir DIR] Runs a flow with stub tools and writes a trace.
flowd trace <trace_dir> [--json] Prints one recorded run: its totals, then every step with its inputs and output.
flowd rerun <ir.json> <trace_dir> [--model ID] [--trace-dir DIR] Re-executes a recorded run and writes a new trace. Without --model every step is restored from the record, so no host is needed; with it the model steps run again.
flowd eval <ir.json> <traces_dir> [--model ID] [--trace-dir DIR] [--json] Re-executes every recorded run under a directory and reports what changed. Exits 1 if anything did.
flowd replay <trace_a> <trace_b> Compares two traces strictly and exits 1 if they differ.
flowd diff <trace_a> <trace_b> Reports the differences step by step, as JSON.
python -m flowd.contrib.mcp --host MODULE:CLASS Serves a flow to MCP clients over stdio.

With --model, flowd rerun and flowd eval run the model steps again on another model. From the command line that works for claude-* models, through the built-in Anthropic adapter, with ANTHROPIC_API_KEY set. Any other model needs a host that registers a provider: flowd_replay in C, Runtime.replay in the bindings.

What it will not do

  • Count local edits as proof. The receipt covers the committed policy and source at one Git SHA. Every proof reruns the checks in a fresh checkout.
  • Commit signing keys. Keys belong in a private Flow home outside Git or in a secret manager. Installing skills updates the tooling; project rules and keys have their own locations.
  • Merge or override branch protection. Flow posts a check for the exact PR head. GitHub enforces that check when the repository requires it. Merging stays with the repository's authorized workflow.
  • Resume a run after a crash. A run that crashes is not picked up again, and any change it already made stays made. For long jobs, run Flow inside a durable worker.
  • Run two flows at once on one runtime handle. Serialize library calls across threads; use separate processes for parallel runs.
  • Run arbitrary IR tools through flowd run. That command uses stub tools. Bindings can supply real callbacks. The separate flowd prove command executes the verification commands in your committed policy.

Docs

Building Toolchain, building each part by hand, and what CI runs.
Using flowc, flowd and libflowd Compiling, running, replay and diff, with the C calls.
Reproducibility What is byte-identical, and what has to be pinned.
Troubleshooting Build and runtime problems.
Releasing How a tag becomes a GitHub release and a PyPI upload.
Examples Three programs to read and run, from hello to a loan decision with a lookup, a model call and a mutation.
Changelog What has changed.
Man pages in doc/ flow(7), flow-effects(7), flow-provenance(7), flow-suspension(7), flow(5), flow-ir(5), flow-trace(5), flowc(1), flowd(1), libflowd(3).

Project layout

flowc/         # C99 compiler; ships the flowc CLI and libflowc.a
flowd/         # C99 runtime; ships the flowd CLI and libflowd.a
examples/      # small, runnable .flow programs
bindings/
  python/      # Python binding to libflowd via cffi; serves flows to MCP clients
  typescript/  # TypeScript binding to libflowd via N-API
vscode-flow/   # VS Code extension: grammar and syntax support for .flow files
web/           # WebAssembly playground: compile and run Flow in the browser
doc/           # guides and man pages

License

MIT. See LICENSE.

About

Verification receipts for Claude Code and Codex skills. Run checks against a clean Git commit, seal the results with HMAC, and verify them in GitHub Actions. Includes a deterministic C99 workflow runtime.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages