rig
AGENTS.md14 starsChanged 20 days agoMITView on GitHub
Rig is a minimal TypeScript agent harness. The core runtime (skills/rig/rig.ts) provides declarative agent construction with typed input/output shapes, prompt intents, and a Copilot SDK runtime. All imports use the "rig" path alias (resolved via tsconfig paths + vitest alias). copilotEngine is exported directly from rig for client construction.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- agentic-workflowsSkill
- npmSkill
- rigSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
13 rules. About 0 are common, 3 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
All imports use the "rig" path alias (resolved via tsconfig paths + vitest alias).
- Very specific: line 36
Keep the core (skills/rig/rig.ts) self-contained.
- Very specific: line 38
Use node: prefix for Node.js built-in imports
- Very specific: line 41
Use small as the model identifier in examples, tests, and defaults
- Distinctive: line 42
Do not add legacy compatibility bridges.
- Very specific: line 46
Treat skills/rig/SKILL.md as prompt context: keep only high-frequency construction rules, decisions, and a minimal canonical example.
- Very specific: line 48
Put detailed API tables, edge cases, provider behavior, and scenario-specific patterns in focused files under skills/rig/.
- Distinctive: line 50
Prefer one representative example, decision tables, and checklists over repeated prose.
- Very specific: line 51
Keep each fact canonical. A compact rule may be summarized in SKILL.md, but its examples and edge cases should live in one reference file.
- Very specific: line 52
Add new material to SKILL.md only when it changes how most Rig programs should be generated.
- Very specific: line 53
When the API changes, update the affected reference and then audit SKILL.md, README.md, and samples for stale summaries or links.
- Very specific: line 54
Before finishing documentation changes, verify relative links and compare wc -l -w -c skills/rig/*.md with the previous version.
- Distinctive: line 61
All unit tests must pass before committing
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Project Overview
Rig is a minimal TypeScript agent harness. The core runtime (skills/rig/rig.ts) provides declarative agent construction with typed input/output shapes, prompt intents, and a Copilot SDK runtime.
Architecture
skills/rig/rig.ts — Core runtime (agent, p, copilotEngine, schemas)
skills/rig/samples/ — Markdown sample programs; see skills/rig/samples.md for pattern buckets and task families
src/samples/ — TypeScript examples and provider integration fixtures
skills/rig/ — Focused documentation loaded on demand from SKILL.md
src/engines/copilot.test.ts — Copilot engine unit tests (vitest)
src/rig.test.ts — Unit tests (vitest)
scripts/run-sample.test.ts — Sample runner with a stub Copilot SDK client (dry-run)
skills/rig/SKILL.md — Compact skill entry point and reference routerAll imports use the "rig" path alias (resolved via tsconfig paths + vitest alias). copilotEngine is exported directly from rig for client construction.
Commands
| Task | Command |
| Typecheck | npm run typecheck |
| Unit tests | npm test |
| Run samples (stub) | npm run sample |
| Refresh sample catalog | npm run sample:catalog |
| Check catalog and duplicate programs | npm run sample:check |
| Run single sample (stub) | RIG_SAMPLE=02 npm run sample |
| Run a sample for real | echo "<input>" | node skills/rig/rig.ts <program-file> (npm run sample:run) |
Code Style
- Keep the core (
skills/rig/rig.ts) self-contained;@github/copilot-sdkis imported directly inskills/rig/rig.ts - Minimal comments; code should be self-explanatory
- Use
node:prefix for Node.js built-in imports - Types are colocated with the module that defines them, not in separate
.d.tsfiles - Trailing underscore on object keys (
key_) means optional field - Use
smallas the model identifier in examples, tests, and defaults - Do not add legacy compatibility bridges; update callers, samples, and docs to the current API
Skill Documentation
- Treat
skills/rig/SKILL.mdas prompt context: keep only high-frequency construction rules, decisions, and a minimal canonical example. - Target roughly 200 lines or fewer. Use line/word/byte counts as regression signals, not as a reason to compress prose until it is unclear.
- Put detailed API tables, edge cases, provider behavior, and scenario-specific patterns in focused files under
skills/rig/. - Route every reference from
SKILL.mdwith a short “read when” description so an agent can load only the relevant secondary context. - Prefer one representative example, decision tables, and checklists over repeated prose. Remove duplication before adding guidance.
- Keep each fact canonical. A compact rule may be summarized in
SKILL.md, but its examples and edge cases should live in one reference file. - Add new material to
SKILL.mdonly when it changes how most Rig programs should be generated; otherwise update or add a focused reference. - When the API changes, update the affected reference and then audit
SKILL.md,README.md, and samples for stale summaries or links. - Before finishing documentation changes, verify relative links and compare
wc -l -w -c skills/rig/*.mdwith the previous version.
Testing
- Framework: vitest
- Tests live in
src/rig.test.ts(agent definition, invocation, validation, and prompt intent coverage) - Stub the Copilot SDK client with
vi.mock("@github/copilot-sdk", ...) - All unit tests must pass before committing
- Samples run via a stub Copilot SDK client that synthesizes shape-conforming output from the prompt's
<output_schema>block
Key Concepts
- Schema helpers (
s.*):s.string,s.number,s.boolean,s.unknown,s.array,s.object,s.record,s.enum,s.optional. Schemas are always built withs.*; there is no shape-descriptor promotion. - Prompt intents (
p.*):p.bash(cmd),p.read(path),p.write(path, content)— declarative placeholders resolved into prompt instructions, not executed in-process - Prompts:
p\...`template tag composes instructions with inlinep.*` helpers - Runtime transport: Copilot SDK sessions are created by the harness; use launcher
--serverto switch to stdio transport. - Repair: built-in addon re-prompts on parse/validation failure up to
maxTurns, and other addons can still steer retry prompts.
Sample guide
skills/rig/samples.md— generated inventory with pattern buckets, topic clusters, and task families. Retired sample replacements are tracked separately inskills/rig/sample-retirements.json. Runnpm run sample:catalogafter adding/removing samples;npm run sample:checkrejects stale inventory and exact duplicates within a format. Review the nearest family before adding a new lesson.20-issue-reproducer.ts— chained diagnosis, fix planning, and review36-subagent-delegation.ts— focused-agent delegation47-prompt-intents.ts— prompt intent primitives50-end-to-end-release-agent.ts— end-to-end release workflow orchestration
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

