/gap:gapfrom gap — graph as policy
Compiles natural-language robot tasks into typed, verified skill graphs for execution on simulators or real robots. Covers graph authoring, registry management, capability checks, and trace debugging.
Ships in gap — graph as policy. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
GaP compiles robot tasks into typed, verified skill graphs and executes them. The policy is the graph: nodes call tools (perception models, planners, robot motions) or run skill scripts; postcondition checkpoints verify progress against the simulator state. Two kinds of repos exist:
graph-as-policy, imports as gap) — CLI, runtime,
builder, codegen, connectors (LIBERO sim / real Franka & UR);skills/<name>/SKILL.md
strategies, tools/<name>/SKILL.md model-backed tools).
open-robot-skills is
the canonical public registry, normally cloned side-by-side with the
engine and auto-discovered. Any number of registries layer by precedence.Ground truth: gap <command> --help is authoritative;
references/cli.md here is a generated snapshot. When working inside a
checkout, prefer its docs/ (design.md, runtime.md, skills.md, safety.md)
over the digests in this skill.
gap run --real ... or gap.connector.real(...) unless the
human has explicitly confirmed that specific run in this conversation.
Real-robot work requires a human with the E-stop in hand and
docs/safety.md read. Do not weaken this gate, ever.gap run <graph> --validate-only), then sim
(--sim), and only then discuss real hardware.--checkpoints raise on anything real; warn (the default) in sim.sim.check_success, or gap benchmark --gate.Always start by finding out what exists and what can run:
uv run gap check # inside a checkout (or just `gap check` if on PATH)
gap check --format json # machine-readable; parse this when deciding
If the CLI is missing, set up from scratch (Linux; GPU needed for sim):
git clone --recurse-submodules https://github.com/graph-robots/graph-as-policy.git
git clone https://github.com/graph-robots/open-robot-skills.git # side-by-side
cd graph-as-policy
uv sync --extra quickstart # engine + sim + sam3/grounding-dino/geometry
uv run gap skills check --download # verify bundles + prefetch model weights
Gotchas: cloning without --recurse-submodules breaks uv sync
("does not appear to be a Python project") — run
git submodule update --init; --extra grocery|all need CUDA_HOME set
(cuRobo compiles CUDA at install); sim runs want MUJOCO_GL=egl.
Env vars that matter: OPENROUTER_API_KEY (default codegen provider) /
Vertex via gcloud ADC + GOOGLE_CLOUD_PROJECT;
GAP_LLM_PROVIDER + GAP_LLM_MODEL pin a non-default provider per
shell (vertex also needs uv run --extra vertex); GAP_SKILLS_PATH
(colon-separated registry roots); HF_TOKEN (gated weights);
GAP_LLM_CACHE_DIR, GAP_LLM_NO_CACHE.
gap registry list # active registries, precedence order
gap skills list # every bundle (skills + tools) + registry
gap skills table --format markdown # paste-ready catalog
gap tools list # flat tool catalog with live schemas
gap tools show geometry.compute_obb # full input/output schema + runnability
gap check # what is operational HERE + fix hints
gap check is the decision input: a bundle is READY (deps importable,
declared GPU/env requirements met) or NOT READY with a fix hint; each
skill is READY or BLOCKED by the tool bundles it needs. Apply the fix
hints (uv sync --extra X, export KEY=...) before attempting tasks that
need those bundles. Resolution precedence for registries: --skills
flags > $GAP_SKILLS_PATH > project pyproject [tool.gap].registries >
~/.config/gap/registries.toml > the side-by-side open-robot-skills
checkout. Details: references/registries.md.
MUJOCO_GL=egl uv run gap run examples/libero_quickstart/graph \
--sim libero_object/0 --checkpoints warn
--validate-only first when in doubt — structural validation without a
robot.--inputs key=value binds top-level workflow inputs.--record-video (sim only) saves <trace-dir>/run_video.mp4 of the run.dag_trace.json + per-node assets) under
--trace-dir (default outputs/run_<timestamp>). Read it for node
inputs/outputs, checkpoint results, and failures.gap viz serves an interactive trial browser at localhost:9432.examples/ each have a README: libero_quickstart (start
here), grocery_fulfillment (benchmark-gated), steered_policy,
collect_and_train, cable_ur, real_franka_pick_place.Programmatic equivalent:
import gap
conn = gap.connector.sim("libero", task="libero_object/0")
result = gap.execute("examples/libero_quickstart/graph", conn,
checkpoints="warn")
print(result.success, result.exit_status, result.trace_path)
When this skill is running inside Claude Code, you are the codegen
pipeline — do NOT call gap generate. Turning a task into a graph is a
§4 hand-authoring job: read the task, pick skills from the active
registries, build the nodes with gap.builder, attach checkpoints, and
drive gap run --validate-only to a clean pass. You are a stronger model
than the one gap generate would dispatch to, and you stay in the loop to
fix validation errors — so author directly, don't shell out.
gap generate is the headless path: benchmark grids, cron, or
gap.agent.generate_sync() called from code — any run with no interactive
model present. It dispatches a coordinator → per-subgraph → checkpoint
pipeline to the configured provider's API (--provider/--model; see
gap check for what's configured). Reach for it only when there is no
Claude in the loop.
# headless only — NOT the path to use from inside Claude Code:
uv run gap generate "pick up the alphabet soup and put it in the basket" \
--provider openrouter --out outputs/soup
This is how you turn a task into a graph. The loop:
gap skills list). Canonical pick-and-place shape: perceive target →
perceive container → grasp → transport.gap tools show <tool> gives exact input/output fields (what you bind with Ref); each
chosen skill's SKILL.md gives its recommended inner state flow and
canonical scripts. Mirror them — they are the contract the skill was
validated with.Subgraphs and the top-level Workflow, then write a
script file for every type="script" node.validate=True checkpoints per subgraph so success is
verified against sim ground truth, not assumed (a grasp/place with no
checkpoint is unverified).gap run --validate-only) until clean,
then sim.from gap.builder import Workflow, Subgraph, Ref
sg = Subgraph(name="grasp_sg", skill="grasping-direct-ik")
sg.add_input("target_obb", type_name="OrientedBoundingBox")
sg.add_node("open", type="tool", tool="robot.open_gripper")
sg.add_node("grasp", type="tool", tool="geometry.top_down_grasp_candidates",
inputs={"obb": Ref("in.target_obb")})
sg.add_exit("grasped")
sg.set_on_error("failed")
sg.add_edge("START", "open"); sg.add_edge("open", "grasp")
sg.add_edge("grasp", "grasped"); sg.add_edge("grasped", "END")
wf = Workflow(name="my_task")
wf.add_subgraph(sg)
wf.add_node("grasp_node", type="subgraph", ref="grasp_sg")
wf.add_node("done", type="end", status="success")
wf.add_edge("START", "grasp_node")
wf.add_conditional_edges("grasp_node", {"grasped": "done", "failed": "done"},
router_field="exit")
wf.save("my_graph/workflow.json")
Iterate against the validator until clean — failures cite rule codes (workflow W1–W8, subgraph S1–S11):
uv run gap run my_graph --validate-only
Wire tool names exactly as gap tools list reports them; bind dataflow
with Ref("node.field") / Ref("in.<input>"). Add postcondition
checkpoints (sg.add_checkpoint(...)) so success is verified, not
assumed. Full surface + rule digest: references/authoring-graphs.md.
uv run gap skills new my-skill --kind skill # or --kind tool
# targets the highest-precedence registry; --registry NAME to choose
The scaffold includes SKILL.md, scripts/example.py (or tools.py), and
a unit-test skeleton tests/test_my_skill.py. Then:
name == dirname; description must contain a
"Use when …" sentence (it is the planner's entire view of the
bundle); GaP extensions only under the gap: key; declare
gap.requires: ({gpu: true, env: [KEY], env_any: [...], weights: true},
or {}) so gap check can vouch for it.def run(ctx, *, typed_kwargs) -> TypedDict,
call tools via ctx.tool("bundle.fn", ...), load prompt templates via
load_prompt(__package__, name, **vars). Tool bundles:
@tool(name="bundle.fn", summary=..., tags=...) with lazy heavy
imports — importing tools.py must never import torch (test-enforced).pyproject.toml ([] when no deps) and run uv lock.gap.testing.FakeContext (canned tool responses,
call assertions) and make_test_observation (synthetic RGB-D);
GPU/LLM smokes go behind the gpu/llm markers (deselected by
default).gap skills check && gap skills test my-skill && gap check.Full contract, test patterns, PR checklist: references/authoring-bundles.md.
gap registry init ~/my-lab-skills --name my-lab-skills --add # new registry
gap registry add lab ~/existing-skills # layer existing
gap registry list # inspect
Registries are local directories (clone remote ones yourself). Multiple
registries merge; earlier entries shadow same-named bundles (loud
warning) — fork-and-shadow one bundle instead of forking the whole
public registry. Projects pin their set in pyproject.toml
[tool.gap].registries = ["./skills", "../open-robot-skills"].
--validate-only (digest table in references/authoring-graphs.md).dag_trace.json in the trace dir (per-node
inputs/outputs/subcalls), or browse with gap viz.gap trace-diff <trace_a> <trace_b>.references/troubleshooting.md. gap check's fix hints are
the first stop.Only after ALL of: the human explicitly confirmed this exact command in
this conversation; the same graph passed in sim; --validate-only is
clean; --checkpoints raise; the human has read docs/safety.md
(E-stop, clear workspace; robot.go_home is disabled on real robots by
design). Reference setups: examples/real_franka_pick_place/
(Franka + Robotiq via robots_realtime), examples/cable_ur/
(UR + ZED, perception-only).
references/cli.md — generated --help for every commandreferences/registries.md — the registry model + config filesreferences/authoring-graphs.md — builder API, workflow v3, W*/S* rulesreferences/authoring-bundles.md — SKILL.md contract, tests, PR checklistreferences/troubleshooting.md — failure → fix table, trace anatomydocs/design.md, docs/runtime.md, docs/skills.md,
docs/safety.md, examples/*/README.mdWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub graph-robots/graph-as-policy --plugin gapOther plugins' skills for the same job