From 932b2e2944482be13c6d851fdd1ac950e1f7b8af Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 08:39:58 +0000 Subject: [PATCH] docs: add rig/globals incremental migration section and parallel sample link Close the discoverability gap in claude-workflow-conversion.md: - Add 'Incremental migration with rig/globals' section showing the flat-module porting pattern (import call/pipeline from rig/globals at top level) - Add sample 360-parallel-branch-analysis-workflow.md to the example table so parallel(thunks) barrier usage is cross-referenced from the conversion guide Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../references/claude-workflow-conversion.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/skills/rig/references/claude-workflow-conversion.md b/skills/rig/references/claude-workflow-conversion.md index ad2fac9..b29f713 100644 --- a/skills/rig/references/claude-workflow-conversion.md +++ b/skills/rig/references/claude-workflow-conversion.md @@ -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"; + +// 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 @@ -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