Skip to content

Examples

Reviews uncommitted changes and auto-fixes in a loop.

id: review-uncommitted
steps:
- id: remediation
type: loop
max: 5
until: ${{ len(steps.review.result.findings) == 0 }}
steps:
- id: review
type: codex
with:
kind: review
target:
type: uncommitted
- id: fix
if: ${{ len(steps.review.result.findings) > 0 }}
retry:
max: 3
delay: 1s
type: codex
with:
kind: turn
prompt: |
Address the accepted findings from this review.
Review:
${{ toJSON(steps.review.result) }}

Drafts a plan, critiques it, refines it, then saves.

id: plan
inputs:
requirements:
type: string
output_path:
type: string
steps:
- id: draft
type: codex
with:
kind: turn
collaboration_mode: plan
prompt: |
Clarify anything missing, then draft an implementation plan:
${{ inputs.requirements }}
- id: critique
type: codex
with:
kind: turn
prompt: |
Review for gaps:
${{ steps.draft.result }}
- id: refine
type: codex
with:
kind: turn
prompt: |
Improve this plan using the critique.
Draft:
${{ steps.draft.result }}
Critique:
${{ steps.critique.result }}
- id: save
type: write_file
with:
path: ${{ inputs.output_path }}
content: ${{ steps.refine.result }}
id: implement
inputs:
requirements:
type: string
steps:
- id: build
type: claude
with:
prompt: |
Implement the following change in the current repository.
Requirements:
${{ inputs.requirements }}

Runs multiple shell checks concurrently, then summarizes them with OpenCode.

id: parallel-checks
steps:
- id: all
type: parallel
branches:
- id: unit
steps:
- id: run_unit
type: shell
with:
command: npm test
stdout:
mode: text
- id: lint
steps:
- id: run_lint
type: shell
with:
command: npm run lint
stdout:
mode: text
exports:
unit: ${{ steps.run_unit.result }}
lint: ${{ steps.run_lint.result }}
- id: report
type: opencode
with:
prompt: |
Summarize:
Unit: ${{ steps.all.result.unit }}
Lint: ${{ steps.all.result.lint }}
id: review-commit
inputs:
commit_sha:
type: string
steps:
- id: review
type: codex
with:
kind: review
target:
type: commit
sha: ${{ inputs.commit_sha }}

Use review findings as the loop condition:

until: ${{ len(steps.review.result.findings) == 0 }}

When until is omitted, the loop still succeeds and returns reason: max_reached.

- else:
steps: []
exports:
value: ${{ steps.earlier.result }}