From a420a86684d17f89a00db4264e5e8c7214db1106 Mon Sep 17 00:00:00 2001 From: pelikhan <4175913+pelikhan@users.noreply.github.com> Date: Wed, 25 Nov 2026 06:44:07 +0000 Subject: [PATCH 1/2] Initial plan From 7d9222146c5fe5c02b4a2f666f3abe73fe4bb313 Mon Sep 17 00:00:00 2001 From: pelikhan <4175913+pelikhan@users.noreply.github.com> Date: Wed, 25 Nov 2026 06:45:48 +0000 Subject: [PATCH 2/2] Clarify schema and convergence guidance Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- skills/rig/SKILL.md | 5 +++-- skills/rig/agent-api.md | 16 +++++++++++++++- skills/rig/dynamic-workflows.md | 18 +++++++++++------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/skills/rig/SKILL.md b/skills/rig/SKILL.md index b7e1614..7b55c79 100644 --- a/skills/rig/SKILL.md +++ b/skills/rig/SKILL.md @@ -19,7 +19,7 @@ import { agent, p, s } from "rig"; // Agent role: review the current diff and return prioritized findings. const reviewDiff = agent({ model: "small", - instructions: p`Review ${p.bash("git diff -- .")} and return only the declared output.`, + instructions: p`Review ${p.bash('git diff -- .')} and return only the declared output.`, output: s.object({ summary: s.string, risk: s.enum("low", "medium", "high"), @@ -58,11 +58,12 @@ the import syntax and Copilot SDK configuration. |------|--------| | Known required/optional file | `p.read(path)` / `p.readOptional(path, fallback?)` (prefer this over `cat ... || echo ...`) | | Several known files | `p.readAll(["path/a.ts", "path/b.ts"])` (explicit array of literal paths) | -| Static shell command | `p.bash(command)`; use ``p.bashRaw`...` `` for literal backslashes | +| Static shell command | `p.bash('git status --short')`; keep commands on one line and use ``p.bashRaw`...` `` for literal backslashes | | Caller-supplied path(s) | `p.readInput(field)` / `p.readAllInput(field)` with `s.path` schemas | | Discover workspace paths | `p.glob(pattern)` returns paths only; then delegate one path at a time to a subagent using `p.readInput("path")` (there is no `p.readAll(globPattern)` overload) | | Persist generated output | `p.writeOutput(field, path)` or `p.writeInput(pathField, outputField)` | | String-keyed map | `s.record(value)`; keys are always `string` — do not wrap in `s.object`; use `s.record(s.int)` for count maps | +| Date-only and non-empty values | `s.date`, `s.nonEmptyArray(item)`, `s.nonEmptyObject(value)`; see [Agent API and schemas](./agent-api.md) | | URL and file-path fields | `s.url` for URIs, `s.path` for paths, and wrappers like `s.array(s.path)` for path lists | | Numeric schema choice | `s.int` for counts/line numbers; `s.number` for measurements and ratios | | Optional versus nullable | `s.optional(shape)` for omission; `s.nullable(shape)` for explicit `null` | diff --git a/skills/rig/agent-api.md b/skills/rig/agent-api.md index 5d32233..cdaebb4 100644 --- a/skills/rig/agent-api.md +++ b/skills/rig/agent-api.md @@ -48,6 +48,8 @@ s.string s.string("description") s.nonEmptyString s.nonEmptyString("description") +s.date +s.date("description") s.url s.url("description") s.path @@ -80,6 +82,7 @@ s.literal(value, "description") Helper constraints: - `s.nonEmptyString` sets `minLength: 1`. +- `s.date` describes and validates a date-only string in `YYYY-MM-DD` form; use it instead of `s.string` when time is not part of the value. - `s.url` uses format `"uri"`; `s.path` uses format `"path"`. - `s.int` aliases `s.integer`. - Prefer `s.int` for counts/line numbers and `s.number` for measurements, scores, and ratios. @@ -109,7 +112,7 @@ Description placement: | Helper family | Description argument | |---------------|----------------------| -| Scalars (`s.string`, `s.int`, `s.path`, `s.url`, `s.boolean`, `s.unknown`) | First | +| Scalars (`s.string`, `s.int`, `s.date`, `s.path`, `s.url`, `s.boolean`, `s.unknown`) | First | | Containers (`s.array`, `s.object`, `s.record`, `s.optional`, `s.nullable`, `s.nonEmptyArray`, `s.nonEmptyObject`) | Second, after the shape/value | | `s.enum`, `s.literal` | Last | @@ -125,10 +128,21 @@ s.record(s.object({ name: s.string, age: s.number })) s.record(s.object({ path: s.path, homepage: s.url })) s.nullable(s.string) s.literal("done") +s.date s.nonEmptyArray(s.path) s.nonEmptyObject(s.boolean) ``` +For example, require a date, at least one observation, and at least one localized label: + +```ts +s.object({ + observedOn: s.date, + observations: s.nonEmptyArray(s.string), + labelsByLocale: s.nonEmptyObject(s.string), +}); +``` + Prefer `s.path` for file-system locations, `s.url` for URIs, and `s.int` for counts or line numbers. Omit schemas entirely when free-form strings are sufficient. ## Tools diff --git a/skills/rig/dynamic-workflows.md b/skills/rig/dynamic-workflows.md index 7471576..fa2d24a 100644 --- a/skills/rig/dynamic-workflows.md +++ b/skills/rig/dynamic-workflows.md @@ -188,19 +188,23 @@ errors never affect the run. Use `until` instead of an open-ended loop: ```ts -const final = await until( +type CatalogState = { + catalog: Record; + conflicts: string[]; +}; + +const final = await until( { max: 8, noProgressRounds: 2 }, async (previous, round) => { - const state = await checkAndFix(previous, round); - return { - state, - done: state.passed, - progressKey: state.failureSummary, - }; + const state: CatalogState = await checkAndFix(previous, round); + return { state, done: state.conflicts.length === 0, progressKey: JSON.stringify(state.conflicts) }; }, ); +final.catalog; // CatalogState ``` +`until(...)` gives the step's `previous` parameter (`State | undefined`) and the returned `final` value the same explicit state type. If the step result is inferred as `unknown`, provide the generic and, when needed, annotate the produced `state`. + The loop stops when `done` is true, after `max` rounds, or after `noProgressRounds` consecutive equal defined progress keys.