Skip to content

Commit 2ad033a

Browse files
Copilotpelikhan
andauthored
Condense README into a focused Rig quick start
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 65d7638 commit 2ad033a

1 file changed

Lines changed: 29 additions & 179 deletions

File tree

‎README.md‎

Lines changed: 29 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -1,211 +1,61 @@
1-
# rig
1+
# Rig
22

3-
`rig` is a minimal TypeScript agent harness skill for typed agents, workflows,
4-
and runnable `rig` markdown fences.
3+
**Small TypeScript agents with typed inputs, validated outputs, and composable workflows.** Write a program, hand it to the Rig skill, or run it with the launcher. Rig uses the Copilot SDK by default and also supports other [engines](skills/rig/engines.md).
54

6-
## Install
5+
## Get started
6+
7+
Install the skill for your coding agent (GitHub CLI 2.90+):
78

89
```bash
910
gh skill install githubnext/rig rig
1011
```
1112

12-
Requires GitHub CLI 2.90.0 or later. Running programs requires Node.js 24 or
13-
later and the skill's SDK dependencies provided by the host. `gh skill install`
14-
copies skill files; it does not install their SDK packages. The `run.ts` entry
15-
point launches programs without invoking a package manager.
16-
17-
Use `gh skill list` to find the installed skill directory.
18-
The launcher examples below use paths from a repository
19-
checkout; for an installed skill, substitute its directory for `skills/rig`.
20-
21-
`skills/rig/SKILL.md` is the canonical, publishable skill manifest.
22-
23-
To run from a checkout:
13+
To run programs locally, use Node.js 24+ and install the dependencies from a checkout:
2414

2515
```bash
2616
git clone https://github.com/githubnext/rig.git
2717
cd rig
2818
npm ci
2919
```
3020

31-
On the Microsoft network or VPN, use the 1ES public npm feed without changing
32-
your npm configuration:
33-
34-
```bash
35-
npm ci --registry=https://ms-feed-25.pkgs.visualstudio.com/1es-public/_packaging/npm-public/npm/registry/ --replace-registry-host=npmjs
36-
```
37-
38-
The dependency overrides pin compatible versions available in that feed,
39-
including Vite and its test/build dependencies. When updating them, verify both
40-
package metadata and tarball availability before refreshing the lockfile.
41-
42-
## Use Rig in 2 ways
43-
44-
### 1) As a skill for Rig programs that use the Copilot SDK
45-
46-
Pin the skill and shared launcher template in your workflow:
47-
48-
```yaml
49-
imports:
50-
- githubnext/rig/.github/workflows/shared/rig.md@<full-commit-sha>
51-
engine:
52-
id: copilot
53-
copilot-sdk: true
54-
skills:
55-
- githubnext/rig/skills/rig/SKILL.md@<full-commit-sha>
56-
tools:
57-
bash: ["printf", "node"]
58-
```
59-
60-
The [shared Rig template](.github/workflows/shared/rig.md) provisions Node.js 24
61-
and allows `printf` and `node`. In this repository, import
62-
`shared/rig.md` instead. Without the template, configure these prerequisites
63-
explicitly; see the [Agentic Workflows reference](skills/rig/agentic-workflows.md#configuration).
64-
Grant `copilot-requests: write` and provision the skill's dependencies in the host.
65-
For Copilot SDK workflows, use `printf '%s\n' ... | node` rather than heredocs,
66-
which gh-aw v0.91.1's SDK permission parser rejects. Single-quote each source
67-
line and escape literal apostrophes as `'"'"'`. Grant additional
68-
commands only for the program's own tool calls. This is a smaller tool
69-
allowlist, not a security boundary: Node can still start subprocesses.
70-
71-
The [Rig Skill Integration workflow](.github/workflows/rig-skill-integration.md)
72-
tests the skill from the current checkout daily or via `workflow_dispatch`.
73-
It runs three `small` Copilot SDK judges (clarity, safety, feasibility) against
74-
a harmless dummy request and computes the majority verdict in TypeScript.
75-
There is no synthesis call or retry; missing or invalid results fail the run.
76-
Success is recorded in the run logs without creating an issue or pull request.
77-
78-
Matching daily/manual fixtures cover [Codex](.github/workflows/rig-skill-integration-codex.md),
79-
[Gemini](.github/workflows/rig-skill-integration-gemini.md), and
80-
[Pi](.github/workflows/rig-skill-integration-pi.md) through their Rig adapters.
81-
Codex and Pi use `copilot/gpt-5.3-codex`, and Gemini requires `GEMINI_API_KEY`.
82-
Pi mounts a trusted, fixed-fixture `run_rig` extension through `engine.driver`
83-
instead of launching through Bash.
84-
See [provider workflow setup and limitations](skills/rig/agentic-workflows.md#other-provider-adapters).
85-
86-
Then write a Rig program. Here is a release coordinator with specialized
87-
subagents. Their ordering is prompt-directed; use `workflow()` for deterministic
88-
orchestration.
21+
Save this as `review.ts`:
8922

9023
```ts
91-
import { agent, p, s } from "rig";
24+
import { agent, s } from "rig";
9225

93-
// Agent role: summarize the release candidate changes.
94-
const analyzeChanges = agent({ model: "small",
95-
input: s.object({ diff: s.string, commits: s.string }),
96-
output: s.object({ summary: s.string, highlights: s.array(s.string) }),
97-
instructions: "Summarize the release candidate changes.",
98-
});
99-
// Agent role: choose the safest semantic version bump.
100-
const chooseVersion = agent({ model: "small",
101-
input: s.object({ summary: s.string, highlights: s.array(s.string) }),
102-
output: s.object({ bump: s.enum("patch", "minor", "major"), rationale: s.string }),
103-
instructions: "Choose the safest semantic version bump.",
104-
});
105-
// Agent role: draft the release note from the chosen version bump.
106-
const draftRelease = agent({ model: "small",
107-
input: s.object({ bump: s.enum("patch", "minor", "major"), rationale: s.string, summary: s.string }),
108-
output: s.object({ title: s.string, checklist: s.array(s.string), risks: s.array(s.string) }),
109-
instructions: "Draft the release note from the chosen version bump.",
110-
});
111-
// Agent role: plan the next release using the provided specialists.
112-
const releaseAgent = agent({ model: "small",
113-
instructions: p`Use ${p.bash("git diff -- .")} and ${p.bash("git log --oneline -20")} as context. Delegate to analyzeChanges, then chooseVersion with the analysis, then draftRelease with the selected bump, rationale, and summary. Return the combined release plan.`,
114-
output: s.object({ title: s.string, bump: s.enum("patch", "minor", "major"), checklist: s.array(s.string), risks: s.array(s.string) }),
115-
agents: { analyzeChanges, chooseVersion, draftRelease },
26+
// Agent role: assess a proposed change.
27+
export default agent({
28+
model: "small",
29+
input: s.string,
30+
output: s.object({
31+
summary: s.string,
32+
risk: s.enum("low", "medium", "high"),
33+
}),
34+
instructions: "Review the proposed change. Summarize it and assess its risk.",
11635
});
117-
118-
export default releaseAgent;
11936
```
12037

121-
### 2) Run a Rig program with `skills/rig/run.ts`
122-
123-
By default, Rig selects an engine from `COPILOT_SDK_URI`, `RIG_ENGINE`, or
124-
supported provider API-key variables. Without those settings it uses Copilot
125-
over HTTP at `localhost:7777`. To have the launcher start Copilot over stdio,
126-
append `--server` to a run command; this requires an installed, authenticated
127-
Copilot CLI. Other engines require their SDK dependencies or CLI and credentials;
128-
see the [engine reference](skills/rig/engines.md).
129-
Its [integration guide](skills/rig/engines.md#choosing-an-integration)
130-
compares engine capabilities, model selection, tool ownership, and output
131-
enforcement.
132-
133-
Use the fixed `printf '%s\n'` format with one single-quoted argument per source
134-
line. Escape literal apostrophes as `'"'"'`; do not use source as the format
135-
string or double-quote it. See the
136-
[inline-program guide](skills/rig/runtime.md#inline-programs) for quoting rules
137-
and [launcher details](skills/rig/launcher-details.md#heredocs-outside-the-copilot-sdk-workflow-driver)
138-
for heredoc alternatives outside the SDK workflow driver.
139-
140-
**Design on the fly** — just describe what you want as a string and let the model figure out the rest:
38+
With an installed, authenticated Copilot CLI, run:
14139

14240
```bash
143-
printf '%s\n' \
144-
'export default "Run npm test, diagnose any failures, apply the smallest safe fix, and repeat up to 3 times.";' \
145-
| node skills/rig/run.ts
41+
printf '%s\n' 'Replace the login form' | node skills/rig/run.ts review.ts --server
14642
```
14743

148-
Or ask Copilot (with the skill) to generate a full program for you. Describe your goal in natural language and Copilot returns a runnable `rig` markdown fence like this:
149-
150-
````markdown
151-
```rig
152-
import { agent, p, s } from "rig";
153-
// Agent role: diagnose failing tests and decide if the loop is done.
154-
const diagnose = agent({
155-
model: "small",
156-
input: s.object({ ok: s.boolean, stdout: s.string, exitCode: s.number }),
157-
output: s.object({ done: s.boolean, rootCause: s.string }),
158-
instructions: "Diagnose test failures. Set done to true if all tests passed.",
159-
});
160-
// Agent role: apply the smallest safe fix for the root cause.
161-
const fix = agent({
162-
model: "small",
163-
output: s.object({ summary: s.string, changed: s.boolean }),
164-
instructions: "Apply the smallest safe fix for the root cause.",
165-
});
166-
// Agent role: run a RALF loop iterating diagnose-fix cycles until tests pass.
167-
const ralfLoop = agent({
168-
model: "small",
169-
output: s.object({ iterations: s.number, fixed: s.boolean }),
170-
agents: { diagnose, fix },
171-
instructions: p`Run ${p.bash("npm test")} then loop: diagnose failures, fix, repeat up to 3 times.`,
172-
});
173-
export default ralfLoop;
174-
```
175-
````
176-
177-
Pass the fence contents directly to the launcher with a literal pipeline:
44+
The launcher reads stdin, runs the exported agent, and prints the validated result. To check without making a model call:
17845

17946
```bash
180-
printf '%s\n' \
181-
'<one single-quoted argument per source line of the rig fence>' \
182-
| node skills/rig/run.ts
47+
node skills/rig/run.ts review.ts --typecheck
18348
```
18449

185-
Or run a program file:
50+
`gh skill install` copies the skill but **does not install SDK dependencies**. For an installed skill, find its directory with `gh skill list` and substitute it for `skills/rig` in the commands above. Without `--server`, Rig selects an engine from your environment or uses the default Copilot endpoint; see [running programs](skills/rig/runtime.md) for launch options.
18651

187-
```bash
188-
printf '%s\n' 'Review this diff' | node skills/rig/run.ts src/program.ts
189-
```
52+
## In agentic workflows
19053

191-
Use `--typecheck` to validate a program without running it:
54+
Pin the [Rig skill](skills/rig/SKILL.md) and [shared launcher template](.github/workflows/shared/rig.md) to full commit SHAs. The template provides Node.js 24 and a narrow `printf`/`node` allowlist; the consuming workflow must enable the Copilot SDK, grant `copilot-requests: write`, and provision dependencies. See the [workflow setup guide](skills/rig/agentic-workflows.md) for the exact configuration and credential handoff.
19255

193-
```bash
194-
node skills/rig/run.ts --typecheck < program.ts
195-
```
56+
## Explore
19657

197-
This runs a preinstalled TypeScript compiler using Node directly. The
198-
`typescript` package must be available in the workspace or skill dependency
199-
tree; Rig does not download it or invoke npm/npx.
200-
201-
## Docs
202-
203-
See [skills/rig/SKILL.md](skills/rig/SKILL.md) for construction rules,
204-
[skills/rig/runtime.md](skills/rig/runtime.md) for launch essentials,
205-
[skills/rig/engines.md](skills/rig/engines.md) for SDK adapters,
206-
[skills/rig/agentic-workflows.md](skills/rig/agentic-workflows.md) for workflow configuration,
207-
[skills/rig/debugging.md](skills/rig/debugging.md) for logging, and
208-
[skills/rig/harness-tools.md](skills/rig/harness-tools.md) for registering a
209-
trusted SDK launch tool with pipe-based credentials, and
210-
[skills/rig/claude-workflow-conversion.md](skills/rig/claude-workflow-conversion.md)
211-
for porting Claude Code dynamic workflows to rig.
58+
- [Skill guide](skills/rig/SKILL.md) — the canonical program and construction rules.
59+
- [Agent API](skills/rig/agent-api.md) and [prompt intents](skills/rig/prompt-intents.md) — schemas, inputs, and workspace context.
60+
- [Dynamic workflows](skills/rig/dynamic-workflows.md) — deterministic orchestration.
61+
- [Samples](skills/rig/samples/) — ready-to-read agent and workflow patterns.

0 commit comments

Comments
 (0)