Drive bounded Loopwright runs from OAuth or subscription coding agents without GitHub Actions, GitHub Apps, or provider API keys. Host sessions in Claude Code, Codex, Antigravity, Cursor, Orca, or Pi pull leased turns via loopwright step.
Install the loopwright CLI first via Installation. Keep --run-root outside --repo and export verified overlays with loopwright inspect before committing local branch changes.
- Operating model
- Skill and prompt
- Step 1: Pull assignment
- Step 2: Execute role
- Step 3: Submit lease
- Multi-role routing
- Step 4: Apply overlay
- Recovery and exits
Delegated stepping turns Loopwright into a pull-based local coroutine (loopwright step next | submit | cancel). Your host coding agent supplies model execution over its OAuth or subscription session, while Loopwright enforces SQLite lease fencing, workspace confinement, and independent verification.
Zero Loopwright provider credentials, GitHub App keys, or workflow secrets are needed on disk or in environment variables:
| Operating mode | Entry flags | Role compilation |
|---|---|---|
| Declarative Taskpack | --taskpack .loopwright/taskpack.yaml |
Compiles roles as adapter: delegated with publication.mode: disabled |
| Managed Controller | --config, --registry, --registry-sha256 |
Uses adapter: delegated profiles with local publication.mode: disabled |
Install the standalone loopwright-step skill into your project or user skill directory:
npx skills add gpustack/loopwright --skill loopwright-stepOr copy .agents/skills/loopwright-step/SKILL.md into .agents/skills/loopwright-step/SKILL.md (repo scope) or ~/.agents/skills/loopwright-step/SKILL.md (user scope).
When running without local skills installed, paste this prompt into your coding agent inside the target checkout:
Read https://docs.gpustack.ai/loopwright/llms.txt and fetch https://docs.gpustack.ai/loopwright/latest/docs/operations/coding-agents/index.md. Drive this repository through loopwright step next and loopwright step submit using a disjoint --run-root directory outside the checkout, keep all edits confined to candidateDir, and once result.json settles completed, export a fresh inspect bundle to a new child path and apply candidate.files.json onto my current Git branch.
Choose a canonical --run-root strictly disjoint from --repo with zero symlink components (resolve pwd -P on macOS). Start a Declarative Taskpack run (native spec.preflight, --baseline-alignment, --source-revision, and --allow-privileged are supported):
RUN_ROOT="$(cd "$(mktemp -d "${TMPDIR:-/tmp}/loopwright-run.XXXXXX")" && pwd -P)"
RUN_ID="local-sync-01"
loopwright step next \
--taskpack .loopwright/taskpack.yaml \
--repo . \
--run-root "$RUN_ROOT" \
--run-id "$RUN_ID" \
--jsonFor Managed Controller runs, pin target.sourceRevision to git rev-parse HEAD and pass --config, --registry, and --registry-sha256. With --json, stdout emits NDJSON Envelope lines; when kind is "step", data returns the StepYield assignment (candidateDir, contextFiles, selection, allowedTools, scope, prompt, submissionPath, and single-use leaseToken).
Execute the yielded prompt inside candidateDir while obeying four confinement invariants:
- Isolated staging: Modify files only inside
candidateDir; leave--repoand<runRoot>/<runId>untouched. - Regular files only: Create zero symlinks (
O_NOFOLLOW), zero hardlinks (nlink === 1), and zero.gitentries. - Overlay bounds: Stay within
spec.limits.overlay(default128files /4 MiB, up to16,384files /16 GiBvia CAS streaming). - Protected & read-only invariance: Never edit
0o400/0o500protected paths,.git,<controlRoot>, orcandidateDirduringrepair === "format"or read-only review turns.
Submit the completed turn with its single-use leaseToken (add --submission-file, --status no_change|failed|blocked, or --reason when needed):
loopwright step submit \
--run-root "$RUN_ROOT" \
--run-id "$RUN_ID" \
--lease "$LEASE_TOKEN" \
--status completed \
--jsonLoopwright captures the overlay, runs independent checks (scope.v1, json-artifact.v1, no-change.v1, and local command.v1), and emits either the next StepYield or a terminal result/incident envelope. Pre-commit scan failures release authority without consuming leaseToken or deleting candidateDir so you can fix and re-submit.
Declare 1..4 ordered roles under spec.roles in .loopwright/taskpack.yaml to run multi-agent DAGs such as author-then-reviewer pipelines. step next --taskpack compiles every role as adapter: delegated automatically.
apiVersion: loopwright.dev/v1alpha1
kind: Taskpack
metadata:
name: multi-role-sync
spec:
goal:
candidate: Refresh version manifests from upstream releases and pass every local check.
noChange: Confirm tracked manifests match upstream releases and settle as no change.
scope:
writable:
- docs
- versions.json
protected:
- policy/invariants.md
roles: # Optional 1..4 roles compiled as delegated during step next
- id: author
purpose: task
provider: anthropic
model: claude-sonnet-4-6
thinking: high # Optional
tools: # Optional
- read
- write
- edit
- bash
- id: review
purpose: review
provider: openai
model: gpt-5.4
thinking: high # Optional
tools: # Optional
- read
dependsOn: # Optional
- author
upstreams:
- id: engine
kind: github-release
source: gpustack/engine
watchedPaths:
- docs
proposal:
path: docs/proposal.json
requiredFields:
- schema_version
- summary
schemaVersion: 1
verification:
localChecks:
- id: proposal-json
implementation: json-artifact.v1
externalGates: []
publication:
mode: pull_request
targetBranch: main
headBranchPrefix: auto-sync/
titleTemplate: "chore(sync) - update upstream manifests"
memory:
directory: .loopwright/memory/multi-role-sync
apply: separate-pull-request
onNoModelBudget: deterministic-observations-only
triggers:
schedule: false
workflowDispatch: true
releasePublished: false
commentCommands: []Override role models at admission without editing YAML via repeatable --role-model <roleId>=<provider>/<model>[:<thinking>] flags (up to 8 roles, persisted in run.json), then dispatch each yielded selection to a matching subagent or worker:
loopwright step next \
--taskpack .loopwright/taskpack.yaml \
--repo . \
--run-root "$RUN_ROOT" \
--run-id "$RUN_ID" \
--role-model author=anthropic/claude-opus-4-6:high \
--role-model review=openai-codex/gpt-5.4:high \
--jsonTerminal step submit deletes <runRoot>/workspaces/<runId> while keeping verified artifacts under <runRoot>/<runId>. Once result.json settles completed, export a fresh bundle to a new --output path (0700):
INSPECT_DIR="$(cd "$(mktemp -d "${TMPDIR:-/tmp}/loopwright-inspect.XXXXXX")" && pwd -P)/bundle"
loopwright inspect --run-root "$RUN_ROOT" --run-id "$RUN_ID" --output "$INSPECT_DIR" --jsonBefore applying $INSPECT_DIR/candidate.files.json onto your branch (either via the loopwright-step skill or an atomic script), verify five invariants:
- Completed lock:
$INSPECT_DIR/result.jsonsettledcompletedand matchestask.lock.jsonlockHash. - Clean baseline: Local
git status --porcelainis empty andHEADequals pinnedsourceRevision(andbaseTree.commitOidfor overlays). - Safe targets: Every path is repo-relative with zero symlinks, zero hardlinks (
nlink === 1), and zero.gitsegments. - Verified CAS blobs: Every
version: 2entry (cas://sha256/<hex>) matches its1 MiBstreamed SHA-256 and100644/100755mode. - Review diff: Inspect
git statusandgit diff, run project tests, and commit on your branch.
Rotate a lost lease after a worker crash, or cancel cleanly (exit 130):
loopwright step next --run-root "$RUN_ROOT" --run-id "$RUN_ID" --reissue-lease --json
loopwright step cancel --run-root "$RUN_ROOT" --run-id "$RUN_ID" --json| Exit code | Diagnostic or outcome |
|---|---|
0 |
Yielded awaiting_role, or settled completed / no_change |
2 / 3 |
Schema or --run-root overlap (2); blocked or CAPABILITY_UNSUPPORTED (3) |
4 / 5 / 6 |
Verification failed (4), budget exhausted (5), or DEADLINE (6) |
7 |
OWNER_BUSY, AUTHORITY_REFUSED, or RECOVERY_REQUIRED |
8 / 130 / 143 |
Artifact/store incident (8), step cancel/SIGINT (130), or SIGTERM (143) |
See also — CLI (local operator subcommands and flags) · Taskpack (manifest roles, scope, and checks) · Controller and Registry (delegated role profiles)
Next → Declarative Taskpack — author and verify a .loopwright/taskpack.yaml workflow end to end.