Skip to content

Commit f94f547

Browse files
Copilotpelikhan
andauthored
Update README with exciting multi-agent example and design-on-the-fly section (#291)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 733898f commit f94f547

1 file changed

Lines changed: 64 additions & 13 deletions

File tree

‎README.md‎

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,83 @@ skills:
2222
- githubnext/rig/skills/rig/SKILL.md@<full-commit-sha>
2323
```
2424
25-
Then write a Rig program:
25+
Then write a Rig program. Here is a full release pipeline with specialized sub-agents:
2626
2727
```ts
2828
import { agent, p, s } from "rig";
2929

30-
// Agent role: review the current diff and return prioritized findings.
31-
const reviewDiff = agent({
32-
model: "small",
33-
instructions: p`Review ${p.bash("git diff -- .")} and return only the declared output.`,
34-
output: s.object({
35-
summary: s.string,
36-
risk: s.enum("low", "medium", "high"),
37-
}),
30+
// Agent role: summarize the release candidate changes.
31+
const analyzeChanges = agent({ model: "small",
32+
input: s.object({ diff: s.string, commits: s.string }),
33+
output: s.object({ summary: s.string, highlights: s.array(s.string) }),
34+
instructions: "Summarize the release candidate changes.",
35+
});
36+
// Agent role: choose the safest semantic version bump.
37+
const chooseVersion = agent({ model: "small",
38+
input: s.object({ summary: s.string, highlights: s.array(s.string) }),
39+
output: s.object({ bump: s.enum("patch", "minor", "major"), rationale: s.string }),
40+
instructions: "Choose the safest semantic version bump.",
41+
});
42+
// Agent role: draft the release note from the chosen version bump.
43+
const draftRelease = agent({ model: "small",
44+
input: s.object({ bump: s.enum("patch", "minor", "major"), rationale: s.string, summary: s.string }),
45+
output: s.object({ title: s.string, checklist: s.array(s.string), risks: s.array(s.string) }),
46+
instructions: "Draft the release note from the chosen version bump.",
47+
});
48+
// Agent role: plan the next release using the provided specialists.
49+
const releaseAgent = agent({ model: "small",
50+
instructions: p`Plan the next release using ${p.bash("git diff --stat -- .")} and ${p.bash("git log --oneline -20")}.`,
51+
output: s.object({ title: s.string, bump: s.enum("patch", "minor", "major"), checklist: s.array(s.string), risks: s.array(s.string) }),
52+
agents: { analyzeChanges, chooseVersion, draftRelease },
3853
});
3954

40-
export default reviewDiff;
55+
export default releaseAgent;
4156
```
4257

4358
### 2) Run a Rig program directly with `skills/rig/rig.ts`
4459

45-
Pipe an inline program to the launcher:
60+
**Design on the fly** — just describe what you want as a string and let the model figure out the rest:
61+
62+
```bash
63+
cat <<'RIG' | node skills/rig/rig.ts
64+
export default "Run npm test, diagnose any failures, apply the smallest safe fix, and repeat up to 3 times.";
65+
RIG
66+
```
67+
68+
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:
69+
70+
````markdown
71+
```rig
72+
import { agent, p, s } from "rig";
73+
// Agent role: diagnose failing tests and decide if the loop is done.
74+
const diagnose = agent({
75+
model: "small",
76+
input: s.object({ ok: s.boolean, stdout: s.string, exitCode: s.number }),
77+
output: s.object({ done: s.boolean, rootCause: s.string }),
78+
instructions: "Diagnose test failures. Set done to true if all tests passed.",
79+
});
80+
// Agent role: apply the smallest safe fix for the root cause.
81+
const fix = agent({
82+
model: "small",
83+
output: s.object({ summary: s.string, changed: s.boolean }),
84+
instructions: "Apply the smallest safe fix for the root cause.",
85+
});
86+
// Agent role: run a RALF loop iterating diagnose-fix cycles until tests pass.
87+
const ralfLoop = agent({
88+
model: "large",
89+
output: s.object({ iterations: s.number, fixed: s.boolean }),
90+
agents: { diagnose, fix },
91+
instructions: p`Run ${p.bash("npm test")} then loop: diagnose failures, fix, repeat up to 3 times.`,
92+
});
93+
export default ralfLoop;
94+
```
95+
````
96+
97+
Extract the fence contents and pipe them directly to the launcher:
4698

4799
```bash
48100
cat <<'RIG' | node skills/rig/rig.ts
49-
// Agent role: summarize this repository in one sentence.
50-
export default "Summarize this repository in one sentence.";
101+
# paste the rig fence contents here
51102
RIG
52103
```
53104

0 commit comments

Comments
 (0)