Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions skills/rig/claude-workflow-conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Then read [Behavior differences](#behavior-differences-to-keep-in-mind) before y
| `Workflow({ scriptPath, args })` from a session | `cat args.json \| node skills/rig/rig.ts program.ts` | See [runtime](runtime.md) |

Globals such as `phase` and `log` also exist as module-level imports from `rig`.
In a flat script, `budget` has no ambient import: use
`const { budget } = currentWorkflow()!` (from `rig`) at module scope; it is the
same meter that `body({ budget })` receives. `until` is only available on the
`body` context.
The launcher runs every program — including one whose root export is an `agent` —
inside a workflow run, so a partially ported script can call `phase()` and `log()`
at top level before the orchestration itself moves into `workflow({ body })`.
Expand Down
6 changes: 5 additions & 1 deletion skills/rig/samples/340-flat-workflow-port.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const meta = { name: "triage", description: "Triage open issues",
phases: ["Fetch", "Triage"] }

phase("Fetch")
log(`agent budget: ${budget.remaining()} of ${budget.total}`)
const raw = await agent("List the 5 most recent open GitHub issues, one per line.")
const issues = (raw ?? "").split("\n").map((s) => s.trim()).filter(Boolean)

Expand All @@ -38,12 +39,15 @@ return verdicts.filter(Boolean).filter((v) => v.priority === "high").length

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

// Mirrors the Claude dynamic workflow's injected `call`/`pipeline` globals.
// `rig/globals` proxies delegate to the launcher's active workflow run.
// `budget` has no ambient import: read it from the active run context.
const { budget } = currentWorkflow()!;

phase("Fetch");
log(`agent budget: ${budget.remaining()} of ${budget.total}`);
const raw = await call.text("List the 5 most recent open GitHub issues, one per line.");
const issues = (raw ?? "").split("\n").map((s: string) => s.trim()).filter(Boolean);

Expand Down