Runs the Lightflow benchmark suite (`python3 benchmarks/run_benchmark.py`) and live A/B subagent trials to verify that Lightflow's deterministic structural backbone (human gates, JSON Schema validation, automatic rollback, surgical resume) operates at lower token and latency cost than unstructured skills.
npx skills add https://github.com/google/lightflow --skill benchmark_lightflow
benchmark_lightflow)Lightflow gives AI agents a deterministic structural backbone—hard EXIT_CODE=2
human gates, JSON Schema validation, automatic rollback_action hooks, and
surgical resume without re-running upstream side effects—**at *lower* token
and latency cost than an unstructured skill, not higher.**
Why structural rigor is negative-cost in Lightflow:
lightflow.yaml +actions.py, so the agent runs lightflow start directly (**Zero-Context
Entry**) without loading workflow source code or long guardrail prompts into
context.
Intermediate data (payload.outputs.<stage>) flows between stages on disk
via passport.json rather than being printed to stdout and re-emitted
token-by-token by the LLM in subsequent tool calls.
runner skill (skills/run_lightflows/SKILL.md) replaces writing custom
/tmp/state.json, --step, and rollback CLI glue inside every skill.
From the repository root, run the deterministic, zero-dependency benchmark
harness:
# Markdown summary table + step-by-step breakdown
python3 benchmarks/run_benchmark.py
# Machine-readable JSON metrics (includes all computed properties)
python3 benchmarks/run_benchmark.py --json
run_benchmark.py executes all 6 included example Lightflows (hn_digest,
usgs_seismic_alert, pypi_upgrade_guard, async_job_watcher,
create_lightflow, and tenant_gitops_onboarding) end-to-end in an isolated
temporary directory (normalizing OS temp paths, PIDs, and timestamps for 100%
bit-for-bit reproducibility) and measures:
cmd + stdout): Every CLI command string emittedby the agent (lightflow start ..., lightflow resume ..., `lightflow
cleanup ...), any files authored between gates in create_lightflow`
(actions.py, actions_test.py, lightflow.yaml), and the exact
stdout/stderr returned to the agent's context window.
N=1 and N=6): Explicitly addsskills/run_lightflows/SKILL.md (4,056 chars / ~1,014 tokens) for execution
workflows (1–4 and 6) and both run_lightflows/SKILL.md +
create_lightflows/SKILL.md (+5,641 chars / ~1,410 tokens) for the
create_lightflow authoring meta-workflow.
billing where Turn $k$ re-sends the accumulated tool calls and outputs from
Turns $1 \dots k-1$.
passport.json): Structured stage outputs(payload.outputs.<stage>) and audit stamps persisted on disk between
stages without entering the LLM conversation history.
lightflow.yaml + actions.py) & Zero-ContextSavings**: Measures $\frac{\text{Source Avoided}}{\text{Runtime Context} +
\text{Source Avoided}}$, comparing Zero-Context Entry (lightflow start
directly) against a white-box agent that reads lightflow.yaml +
actions.py before running.
Whenever you report benchmark numbers or run a custom A/B comparison, follow
these rules:
tokens)**: Emphasize how passport.json eliminates the "LLM as State Bus"
anti-pattern (preventing the LLM from having to re-generate upstream JSON
payloads in tool-call inputs, which is $5\times$–$10\times$ slower and
error-prone).
command string (and any file-write payloads) alongside the tool's stdout
response—never stdout alone.
N=1 and session N)numbers**:
skills/run_lightflows/SKILL.md (or MCP tool schemas) is in context.
N=1)*: Addskills/run_lightflows/SKILL.md (~1,014 tokens) to a single execution
run, and also add skills/create_lightflows/SKILL.md (~1,410 tokens)
when benchmarking create_lightflow.
N=6)*: Count each required SKILL.md onceacross the session.
Source Avoided (yaml + actions.py) with a prompt-onlySKILL.md**:
yaml + actions.py represents the **white-box source inspectionbaseline** (what a coding agent reads if it inspects the workflow
directory without the Zero-Context Entry Rule).
To compare Lightflow against unstructured execution on a live LLM agent:
pypi_upgrade_guard: audit offline packages, pause for approval, trigger a
simulated smoke-test failure + rollback, then recover and upgrade).
skills/run_lightflows/SKILL.md and the target
--lightflow=examples/pypi_upgrade_guard path.
same task without the Lightflow CLI engine.
emit to pass state and handle rollbacks),
\text{context}_k$),
json_schema, rollback_action,and surgical resume vs. prompt compliance).
Take google/benchmark_lightflow from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.