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: 34 additions & 0 deletions skills/rig/references/claude-workflow-conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,39 @@ export default audit;
human decision should return a structured `needs_human` result and be re-run
with the answer in its input.

## Incremental migration with rig/globals

When doing a first-pass port, keep the flat module structure by importing
`call`, `pipeline`, and `parallel` from `"rig/globals"` instead of
destructuring them from `workflow({ body })`. The launcher runs every program
inside a workflow context, so ambient calls are live at module top level:

```ts
import { agent, phase, log, s } from "rig";
import { call, pipeline } from "rig/globals";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] The prose (line 158) mentions parallel as one of three imports, but the code example only imports call and pipelineparallel is absent from both the import and the example body.

Either drop parallel from the prose to match the example, or add it to the import and show a usage so the claim matches the code.

💡 Minimal fix — drop from prose
-`call`, `pipeline`, and `parallel` from `"rig/globals"` instead of
+`call` and `pipeline` from `"rig/globals"` instead of


// Agent role: summarize one file.
const summarize = agent({
model: "small",
input: s.object({ file: s.path }),
output: s.object({ summary: s.string }),
instructions: "Summarize the file.",
});

phase("Discover");
log("listing source files");
const raw = await call.text("List TypeScript source files, one per line.");
const files = (raw ?? "").split("\n").map((f) => f.trim()).filter(Boolean);

phase("Summarize");
const summaries = await pipeline(files, (file) => call(summarize, { file }, { label: file }));
export default summaries;
```

Move `call` and `pipeline` calls inside `workflow({ body })` once the port is
stable — it enables unit testing and makes input typing explicit.
`"rig/globals"` is a stepping stone, not a final form.

## Example programs

These samples in `skills/rig/samples/` are direct ports of common Claude dynamic
Expand All @@ -162,6 +195,7 @@ workflow patterns — use them as starting points when converting a script:
| [310-workflow-audit-verify.md](../samples/310-workflow-audit-verify.md) | `args`→`input`, `parallel`, `pipeline`, `phase`, `call.json` — mirrors the canonical find-and-verify pattern |
| [320-budget-aware-crawler.md](../samples/320-budget-aware-crawler.md) | `log`, `budget.remaining()`, `until` convergence loop |
| [330-nested-workflow-composition.md](../samples/330-nested-workflow-composition.md) | `call.workflow` (rig equivalent of `workflow(ref, args)`) sharing the parent's limiter and budget |
| [360-parallel-branch-analysis-workflow.md](../samples/360-parallel-branch-analysis-workflow.md) | `parallel(thunks)` as a barrier — use instead of `Promise.all` when porting |

## Related references

Expand Down
Loading