Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions skills/rig/samples/310-workflow-audit-verify.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
# 310 - Audit and Verify (Dynamic Workflow Port)

Mirrors a Claude Code dynamic workflow: fan out finders, then stream each finding
through a verifier stage. See
[claude-workflow-conversion.md](../references/claude-workflow-conversion.md).
through a verifier stage. Demonstrates the `args`→`input` translation — the most
common first step when porting a Claude dynamic workflow to rig.

**Claude dynamic workflow** (original):
```js
export const meta = { name: "audit", description: "Find and verify issues",
phases: [{ title: "Find" }, { title: "Verify" }] }
// `args` is parsed JSON supplied by the caller
phase("Find")
const found = await parallel(args.areas.map((area) => () =>
agent(`Audit ${area}. Report findings.`, { schema: FINDINGS, label: area })))
phase("Verify")
const verdicts = await pipeline(
found.filter(Boolean).flatMap((r) => r.findings),
(f) => agent(`Verify: ${f.title} in ${f.file}.`, { schema: VERDICT, phase: "Verify" }))
return verdicts.filter(Boolean).filter((v) => v.real).length
```

**Rig port** (below): `args` becomes `input` with an `s.object` schema;
`agent(prompt, { schema })` becomes `call.json(prompt, schema)`; everything else
maps 1-to-1. See
[claude-workflow-conversion.md](../references/claude-workflow-conversion.md) for
the full primitive mapping.

```rig
import { s, workflow } from "rig";

const finding = s.object({ title: s.string, file: s.path });

// Workflow role: audit source areas in parallel, then verify each finding.
// Workflow role: audit caller-supplied source areas in parallel, then verify each finding.
// `input.areas` is the rig equivalent of `args.areas` in a Claude dynamic workflow.
const audit = workflow({
meta: {
name: "audit",
description: "Find and verify repository issues",
phases: [{ title: "Find" }, { title: "Verify", detail: "one verifier per finding" }],
whenToUse: "Auditing several areas that each need independent verification.",
},
body: async ({ call, parallel, phase, pipeline }) => {
input: s.object({ areas: s.array(s.string("Source directories to audit")) }),
body: async ({ call, input, parallel, phase, pipeline }) => {
phase("Find");
const areas = ["skills", "src", "scripts"];
const found = await parallel(areas.map((area) => () =>
const found = await parallel(input.areas.map((area) => () =>
call.json(`Audit ${area}/ for risky patterns.`, s.object({ findings: s.array(finding) }), { label: area })));

phase("Verify");
Expand Down
Loading