opencode-skills-collection 4.0.45 → 4.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-skills/.antigravity-install-manifest.json +25 -1
- package/bundled-skills/agy-delegate/SKILL.md +168 -0
- package/bundled-skills/agy-delegate/references/dispatch-and-poll.md +140 -0
- package/bundled-skills/agy-delegate/references/multi-task-queues.md +59 -0
- package/bundled-skills/agy-delegate/references/review-and-land.md +103 -0
- package/bundled-skills/agy-delegate/references/writing-the-brief.md +124 -0
- package/bundled-skills/aider-delegate/SKILL.md +227 -0
- package/bundled-skills/aider-delegate/references/dispatch-and-poll.md +154 -0
- package/bundled-skills/aider-delegate/references/multi-task-queues.md +68 -0
- package/bundled-skills/aider-delegate/references/review-and-land.md +101 -0
- package/bundled-skills/aider-delegate/references/writing-the-brief.md +142 -0
- package/bundled-skills/babysit-pr/SKILL.md +343 -0
- package/bundled-skills/claude-delegate/SKILL.md +182 -0
- package/bundled-skills/claude-delegate/references/dispatch-and-poll.md +220 -0
- package/bundled-skills/claude-delegate/references/multi-task-queues.md +66 -0
- package/bundled-skills/claude-delegate/references/review-and-land.md +117 -0
- package/bundled-skills/claude-delegate/references/writing-the-brief.md +158 -0
- package/bundled-skills/cline-delegate/SKILL.md +140 -0
- package/bundled-skills/cline-delegate/references/dispatch-and-poll.md +142 -0
- package/bundled-skills/cline-delegate/references/multi-task-queues.md +58 -0
- package/bundled-skills/cline-delegate/references/review-and-land.md +80 -0
- package/bundled-skills/cline-delegate/references/writing-the-brief.md +129 -0
- package/bundled-skills/codex-delegate/SKILL.md +177 -0
- package/bundled-skills/codex-delegate/references/dispatch-and-poll.md +161 -0
- package/bundled-skills/codex-delegate/references/multi-task-queues.md +66 -0
- package/bundled-skills/codex-delegate/references/review-and-land.md +126 -0
- package/bundled-skills/codex-delegate/references/writing-the-brief.md +125 -0
- package/bundled-skills/commandcode-delegate/SKILL.md +188 -0
- package/bundled-skills/commandcode-delegate/references/dispatch-and-poll.md +222 -0
- package/bundled-skills/commandcode-delegate/references/multi-task-queues.md +81 -0
- package/bundled-skills/commandcode-delegate/references/review-and-land.md +144 -0
- package/bundled-skills/commandcode-delegate/references/writing-the-brief.md +147 -0
- package/bundled-skills/copilot-delegate/SKILL.md +159 -0
- package/bundled-skills/copilot-delegate/references/dispatch-and-poll.md +143 -0
- package/bundled-skills/copilot-delegate/references/multi-task-queues.md +58 -0
- package/bundled-skills/copilot-delegate/references/review-and-land.md +80 -0
- package/bundled-skills/copilot-delegate/references/writing-the-brief.md +140 -0
- package/bundled-skills/cursor-delegate/SKILL.md +170 -0
- package/bundled-skills/cursor-delegate/references/dispatch-and-poll.md +162 -0
- package/bundled-skills/cursor-delegate/references/multi-task-queues.md +59 -0
- package/bundled-skills/cursor-delegate/references/review-and-land.md +93 -0
- package/bundled-skills/cursor-delegate/references/writing-the-brief.md +126 -0
- package/bundled-skills/debate-review/SKILL.md +85 -0
- package/bundled-skills/debate-review/assets/prompts/review-debate.md +51 -0
- package/bundled-skills/debate-review/assets/prompts/review-main.md +64 -0
- package/bundled-skills/debate-review/assets/prompts/review-rebuttal.md +42 -0
- package/bundled-skills/debate-review/references/comment-format.md +63 -0
- package/bundled-skills/debate-review/references/schema.md +95 -0
- package/bundled-skills/delegate-setup/SKILL.md +215 -0
- package/bundled-skills/delegate-setup/references/schema.md +100 -0
- package/bundled-skills/delegate-setup/references/setup-dialogue.md +101 -0
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +1 -1
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/users/aas-core.md +1 -1
- package/bundled-skills/docs/users/bundles.md +1 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +3 -3
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/falsify/SKILL.md +263 -0
- package/bundled-skills/falsify/references/bias-catalog.md +42 -0
- package/bundled-skills/falsify/references/mental-models.md +135 -0
- package/bundled-skills/falsify/templates/thinking-ledger.md +104 -0
- package/bundled-skills/graceful-shutdown/SKILL.md +379 -0
- package/bundled-skills/grok-delegate/SKILL.md +179 -0
- package/bundled-skills/grok-delegate/references/dispatch-and-poll.md +171 -0
- package/bundled-skills/grok-delegate/references/multi-task-queues.md +67 -0
- package/bundled-skills/grok-delegate/references/review-and-land.md +130 -0
- package/bundled-skills/grok-delegate/references/writing-the-brief.md +119 -0
- package/bundled-skills/kimi-delegate/SKILL.md +137 -0
- package/bundled-skills/kimi-delegate/references/dispatch-and-poll.md +134 -0
- package/bundled-skills/kimi-delegate/references/multi-task-queues.md +58 -0
- package/bundled-skills/kimi-delegate/references/review-and-land.md +92 -0
- package/bundled-skills/kimi-delegate/references/writing-the-brief.md +132 -0
- package/bundled-skills/omp-delegate/SKILL.md +186 -0
- package/bundled-skills/omp-delegate/references/dispatch-and-poll.md +155 -0
- package/bundled-skills/omp-delegate/references/multi-task-queues.md +59 -0
- package/bundled-skills/omp-delegate/references/review-and-land.md +95 -0
- package/bundled-skills/omp-delegate/references/writing-the-brief.md +149 -0
- package/bundled-skills/opencode-delegate/SKILL.md +189 -0
- package/bundled-skills/opencode-delegate/references/dispatch-and-poll.md +156 -0
- package/bundled-skills/opencode-delegate/references/multi-task-queues.md +68 -0
- package/bundled-skills/opencode-delegate/references/review-and-land.md +125 -0
- package/bundled-skills/opencode-delegate/references/writing-the-brief.md +142 -0
- package/bundled-skills/pi-delegate/SKILL.md +148 -0
- package/bundled-skills/pi-delegate/references/dispatch-and-poll.md +146 -0
- package/bundled-skills/pi-delegate/references/multi-task-queues.md +59 -0
- package/bundled-skills/pi-delegate/references/review-and-land.md +95 -0
- package/bundled-skills/pi-delegate/references/writing-the-brief.md +132 -0
- package/bundled-skills/qoder-delegate/SKILL.md +151 -0
- package/bundled-skills/qoder-delegate/references/dispatch-and-poll.md +119 -0
- package/bundled-skills/qoder-delegate/references/multi-task-queues.md +43 -0
- package/bundled-skills/qoder-delegate/references/review-and-land.md +66 -0
- package/bundled-skills/qoder-delegate/references/writing-the-brief.md +85 -0
- package/bundled-skills/sandbase-mcp/SKILL.md +194 -0
- package/bundled-skills/ui-slop-score/SKILL.md +2 -2
- package/bundled-skills/unsloth-finetuning/SKILL.md +352 -0
- package/bundled-skills/vibe-delegate/SKILL.md +147 -0
- package/bundled-skills/vibe-delegate/references/dispatch-and-poll.md +144 -0
- package/bundled-skills/vibe-delegate/references/multi-task-queues.md +59 -0
- package/bundled-skills/vibe-delegate/references/review-and-land.md +87 -0
- package/bundled-skills/vibe-delegate/references/writing-the-brief.md +131 -0
- package/bundled-skills/warp-delegate/SKILL.md +192 -0
- package/bundled-skills/warp-delegate/references/dispatch-and-poll.md +163 -0
- package/bundled-skills/warp-delegate/references/multi-task-queues.md +80 -0
- package/bundled-skills/warp-delegate/references/review-and-land.md +123 -0
- package/bundled-skills/warp-delegate/references/writing-the-brief.md +105 -0
- package/bundled-skills/zcode-delegate/SKILL.md +202 -0
- package/bundled-skills/zcode-delegate/references/dispatch-and-poll.md +113 -0
- package/bundled-skills/zcode-delegate/references/multi-task-queues.md +87 -0
- package/bundled-skills/zcode-delegate/references/review-and-land.md +81 -0
- package/bundled-skills/zcode-delegate/references/writing-the-brief.md +120 -0
- package/package.json +1 -1
- package/skills_index.json +660 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Dispatch and poll
|
|
2
|
+
|
|
3
|
+
`scripts/relay.mjs` is the dispatch layer. It wraps `opencode run`, runs the brief under the chosen
|
|
4
|
+
agent, captures everything, and writes a structured `result.json`. Your job collapses to: run one
|
|
5
|
+
command, then read one file. Everything OpenCode-specific lives in the helper, which is what keeps the
|
|
6
|
+
loop portable across orchestrators.
|
|
7
|
+
|
|
8
|
+
## Before the first run: check the binary
|
|
9
|
+
|
|
10
|
+
Two gotchas, both worth 30 seconds:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
command -v opencode # the active binary on PATH
|
|
14
|
+
opencode --version # the relay records this in result.json too
|
|
15
|
+
opencode auth list # at least one provider credential must be present
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Dispatching
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --model <provider/model> --cd /path/to/repo
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
(`<skill-dir>` is wherever this skill is installed — the folder containing its `SKILL.md`. On Claude
|
|
25
|
+
Code it's the printed "Base directory for this skill"; on other orchestrators substitute that install
|
|
26
|
+
path. See [`SKILL.md`](../SKILL.md) if you need to locate it.)
|
|
27
|
+
|
|
28
|
+
Options:
|
|
29
|
+
|
|
30
|
+
| Flag | Effect |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `--brief <file>` | The brief. Omit it to read the brief from stdin (`node relay.mjs … < brief.txt`). |
|
|
33
|
+
| `--cd <dir>` | Working root for OpenCode (default: current directory). |
|
|
34
|
+
| `--lane <name>` | Fleet lane from `delegate-setup` config. Applies that lane's dials; fails if the lane's `implementer` is not this relay. Explicit dial flags win. |
|
|
35
|
+
| `--model <name>` | Model as `provider/model`. **Required on a fresh run** — OpenCode has no safe default (a bare `opencode run` errors); a resumed run inherits its session's model. |
|
|
36
|
+
| `--agent <name>` | OpenCode agent (default: `build`, write-capable). |
|
|
37
|
+
| `--read-only` | Shortcut for `--agent plan` — review/diagnosis with no edits. |
|
|
38
|
+
| `--variant <name>` | Provider reasoning effort (e.g. `high`, `max`, `minimal`). |
|
|
39
|
+
| `--no-auto` | The relay passes `opencode`'s `--auto` (auto-approve permissions) **by default** so a headless run doesn't hang on a prompt; `--no-auto` drops it and honors the agent's own permission config instead. A `--read-only`/`plan` run never gets `--auto`, so it can't be auto-approved into edits. |
|
|
40
|
+
| `--resume-last` | Continue the most recent OpenCode session; send only the delta brief (see review-and-land). |
|
|
41
|
+
| `--session <id>` | Continue a specific session id (`ses_…`); send only the delta brief. |
|
|
42
|
+
| `--pure` | Run OpenCode without external plugins (cleaner event stream). |
|
|
43
|
+
| `--timeout <dur>` | Relay-side watchdog (e.g. `30m`, `2h`); on expiry the child is killed and `result.json` gets `status: "timeout"`. Off by default. |
|
|
44
|
+
| `--out-dir <dir>` | Where artifacts go (default: a fresh dir under the system temp dir). |
|
|
45
|
+
|
|
46
|
+
Artifacts default to the system temp dir on purpose: the repo under review stays clean, so the
|
|
47
|
+
touched-files report shows only OpenCode's edits and nothing of the helper's own.
|
|
48
|
+
|
|
49
|
+
## The result
|
|
50
|
+
|
|
51
|
+
`<out-dir>/result.json` is the contract. Fields:
|
|
52
|
+
|
|
53
|
+
- `schema` — the result-format version (currently `delegate-relay.result.v1`)
|
|
54
|
+
- `tool` — `opencode`
|
|
55
|
+
- `status` — `completed` | `failed` | `timeout` | `aborted` | `opencode_unavailable`
|
|
56
|
+
- `exitCode` — mirrors OpenCode's exit code; `128` plus the signal number if the child was killed; `127` if `opencode` isn't on PATH; on a `timeout` the relay forces a non-zero code even when the child exited `0` after the watchdog's SIGTERM
|
|
57
|
+
- `signal` — the signal that killed the child, otherwise `null`
|
|
58
|
+
- `opencodeVersion` — the binary that actually ran
|
|
59
|
+
- `agent` — the agent selected for this dispatch (`build`, `plan`, …)
|
|
60
|
+
- `sessionId` — feed this to a later `--session <id>` (or use `--resume-last`)
|
|
61
|
+
- `finalMessage` — OpenCode's assembled final text (the `<structured_output_contract>` you asked for).
|
|
62
|
+
Empty if OpenCode stopped without emitting a closing summary — ask for the report explicitly
|
|
63
|
+
- `touchedFiles` — `git status --porcelain` lines in the working root: your review starting point.
|
|
64
|
+
`null` (not `[]`) when git can't report — `git` missing, or a non-repo run; `[]` means git ran and
|
|
65
|
+
the tree is clean
|
|
66
|
+
- `cost` — total run cost in USD, summed from the step events (`null` if none were reported)
|
|
67
|
+
- `briefPath` / `eventsPath` / `finalPath` — the exact brief relay sent, the raw JSON event stream, and
|
|
68
|
+
the final-message file
|
|
69
|
+
- `workdir`, `model`, `auto`, `resumed`, `resumeLast`, `startedAt`, `finishedAt`
|
|
70
|
+
- `stderrTail` — last ~20 stderr lines; present on every run that did not complete (`failed`, `timeout`, `aborted`), absent on `completed`,
|
|
71
|
+
`opencode_unavailable`, and launch failures
|
|
72
|
+
- `error` — present on a launch failure, and on `timeout` and `aborted` runs
|
|
73
|
+
|
|
74
|
+
The helper also prints a summary to stdout and exits with OpenCode's exit code, so a wrapping script can
|
|
75
|
+
branch on success/failure directly.
|
|
76
|
+
|
|
77
|
+
## Waiting for completion
|
|
78
|
+
|
|
79
|
+
The helper blocks until OpenCode finishes. Back it with whatever your orchestrator offers:
|
|
80
|
+
|
|
81
|
+
- **Claude Code:** run the `Bash` call with `run_in_background: true`; you're notified on completion,
|
|
82
|
+
then read `result.json`.
|
|
83
|
+
- **Plain shell / other agents:** foreground for short tasks, or background and poll — `node relay.mjs
|
|
84
|
+
… &` in bash/zsh (including Git Bash/WSL), or your shell's equivalent (`Start-Job` in PowerShell,
|
|
85
|
+
`start /b` in cmd). A run is done when `result.json` exists with a `status`. **But** a pre-run usage
|
|
86
|
+
error (bad args, empty brief) exits with code 2 *before* writing any file — so check the exit code
|
|
87
|
+
too, don't only watch for the file. (A missing `opencode` binary exits 127 but *does* write a
|
|
88
|
+
`result.json` with status `opencode_unavailable`.)
|
|
89
|
+
|
|
90
|
+
Trust the working tree and the process state over any progress display. A run is finished when the
|
|
91
|
+
process has exited and `result.json` is written — not when a status line says so.
|
|
92
|
+
|
|
93
|
+
## When a run misbehaves
|
|
94
|
+
|
|
95
|
+
- **`status: opencode_unavailable` (exit 127):** `opencode` isn't on PATH or isn't found. Install
|
|
96
|
+
(`npm i -g opencode-ai`) and `opencode auth login`, then re-dispatch.
|
|
97
|
+
- **an `error` mentioning `version preflight` (`failed`, or `timeout` at exit 124):** the bounded
|
|
98
|
+
`opencode --version` probe exited non-zero or hung past its cap (10s, or `--timeout` when shorter),
|
|
99
|
+
so opencode was never dispatched; only the relay's own artifacts may already exist under
|
|
100
|
+
`--out-dir`. Check the install by running `opencode --version` yourself.
|
|
101
|
+
- **`status: failed`:** read `result.json`'s `stderrTail` and the tail of `eventsPath` for the cause.
|
|
102
|
+
Common causes: an auth lapse, an unknown `--model` or `--agent`, or a permission the run needed but
|
|
103
|
+
the agent didn't grant. Fix the cause and re-dispatch; don't paper over it by doing the work yourself
|
|
104
|
+
unless that's what the user wants.
|
|
105
|
+
- **`status: timeout`:** the `--timeout` watchdog killed the run. The working tree may hold a
|
|
106
|
+
half-applied change — inspect it before deciding between a longer `--timeout`, a smaller brief,
|
|
107
|
+
or a resume.
|
|
108
|
+
- **`status: aborted`:** the relay itself was killed (its parent's timeout, a stopped task, a
|
|
109
|
+
closed terminal) and forwarded the kill to opencode. The result is written before the relay exits;
|
|
110
|
+
inspect the working tree before re-dispatching. On native Windows a hard kill of the relay is
|
|
111
|
+
uncatchable (Node supports no `SIGTERM` handler there), so this status may never get written -
|
|
112
|
+
a relay process that is gone without a `result.json` is an aborted run; inspect the working
|
|
113
|
+
tree and `events.jsonl` directly.
|
|
114
|
+
- **`status: failed` with `signal: "SIGKILL"`:** the host ended the child — commonly the OOM killer
|
|
115
|
+
or a supervisor timeout, not an implementer error. Free up host memory or split the task into
|
|
116
|
+
smaller briefs, then re-dispatch.
|
|
117
|
+
- **Empty `finalMessage`:** OpenCode finished without emitting a closing text summary (common when it
|
|
118
|
+
completes purely through tool calls). The edits may still be correct — check `touchedFiles` and the
|
|
119
|
+
diff. To get a report next time, add a `<structured_output_contract>` block (see
|
|
120
|
+
[writing-the-brief.md](writing-the-brief.md)).
|
|
121
|
+
- **A run hangs:** an agent with an `ask` permission can block waiting for approval that never comes in
|
|
122
|
+
headless mode. Runs pass `--auto` by default precisely to avoid this — so a hang almost always means
|
|
123
|
+
you passed `--no-auto`. Either drop it, or set the agent's permissions to *allow* (not ask) the
|
|
124
|
+
actions the task needs.
|
|
125
|
+
|
|
126
|
+
## Recovering lost work
|
|
127
|
+
|
|
128
|
+
`events.jsonl` in the run directory records every event the implementer streamed. If finished
|
|
129
|
+
work is lost — the run killed late, or the working tree damaged afterward — read the event log
|
|
130
|
+
before re-dispatching: it identifies which files and tool commands were involved, which scopes
|
|
131
|
+
what needs redoing. Whether it also carries the edit contents depends on what the CLI streams,
|
|
132
|
+
so treat any reconstruction as unverified until it matches a working-tree diff — when the tree
|
|
133
|
+
still holds the work, preserve the tree rather than replaying the log.
|
|
134
|
+
|
|
135
|
+
## What the helper is doing (and the alternatives)
|
|
136
|
+
|
|
137
|
+
Under the hood the helper runs roughly:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
opencode run --format json --agent build -m provider/model < brief.txt # fresh run (model required)
|
|
141
|
+
opencode run --format json --continue --agent build < delta-brief.txt # resume most recent (inherits model)
|
|
142
|
+
opencode run --format json --session ses_… --agent build < delta-brief.txt # resume a specific session
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The brief is fed on **stdin**, never as an argument — which is why a multi-line, XML-tagged brief needs
|
|
146
|
+
no quoting. The `--format json` stream is newline-delimited JSON events; the relay assembles
|
|
147
|
+
`finalMessage` from the `text` events and pulls `sessionId` from the event stream. OpenCode selects an
|
|
148
|
+
agent for each prompt, so the helper passes the requested agent on fresh and resumed runs.
|
|
149
|
+
|
|
150
|
+
If you ever want it, raw `opencode run` is fine for one-offs — you just give up the captured
|
|
151
|
+
`result.json`, touched-files summary, and session-id extraction the helper does for you.
|
|
152
|
+
|
|
153
|
+
## The commit boundary
|
|
154
|
+
|
|
155
|
+
The helper never commits — by design, not omission. The robust contract is: OpenCode edits the working
|
|
156
|
+
tree, the orchestrator reviews and commits. See [review-and-land.md](review-and-land.md).
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Multi-task queues
|
|
2
|
+
|
|
3
|
+
The single-task loop scales to a queue, and that's where delegation pays off most — a removal split
|
|
4
|
+
across layers, a migration touching many files, a refactor sweep. The discipline that makes a queue
|
|
5
|
+
trustworthy is sequencing and bookkeeping, not parallelism.
|
|
6
|
+
|
|
7
|
+
## Run sequentially, one commit per task
|
|
8
|
+
|
|
9
|
+
Resist the urge to fan out the whole queue at once. Run tasks **one at a time, in dependency order**,
|
|
10
|
+
landing each (review + gates + commit) before dispatching the next. Three reasons:
|
|
11
|
+
|
|
12
|
+
- **Later tasks assume earlier ones landed.** Task 3's brief can say "the X added in the previous step
|
|
13
|
+
exists" only if the previous step actually committed.
|
|
14
|
+
- **One commit per task** keeps the history reviewable and any single step revertible.
|
|
15
|
+
- **Each review is honest.** A clean working tree before each dispatch means the next task's
|
|
16
|
+
`touchedFiles` shows only *its* changes, not a pile-up from earlier tasks.
|
|
17
|
+
|
|
18
|
+
Parallelism is occasionally worth it for genuinely independent tasks on separate files, but it
|
|
19
|
+
sacrifices the clean-tree-per-task property and makes review harder. Default to sequential. (Each fresh
|
|
20
|
+
`relay.mjs` dispatch starts a new OpenCode session, so independent tasks don't share context — fold any
|
|
21
|
+
shared constraint into each brief, see below.)
|
|
22
|
+
|
|
23
|
+
## Carry decided constraints forward
|
|
24
|
+
|
|
25
|
+
Implementation surfaces facts the original plan didn't have: a helper got named, a fixture lives in a
|
|
26
|
+
specific place, an interface was chosen. When a later task depends on one of those, **fold it into that
|
|
27
|
+
task's brief** as an explicit line. A fresh OpenCode session has no memory of the earlier run, so a
|
|
28
|
+
constraint that emerged in task 2 must be restated in task 5's brief or it won't hold. This is the queue
|
|
29
|
+
equivalent of keeping briefs self-contained.
|
|
30
|
+
|
|
31
|
+
## Keep a progress file
|
|
32
|
+
|
|
33
|
+
For anything longer than two or three tasks — especially a run the human steps away from — maintain a
|
|
34
|
+
single progress file alongside the work. It's the durable record that survives your own context limits
|
|
35
|
+
and lets the human catch up at a glance. A shape that works:
|
|
36
|
+
|
|
37
|
+
- **Status table** — each task: queued / at-implementer / reviewed+committed (with the commit hash).
|
|
38
|
+
- **Per-task review notes** — what landed, what you verified, the gate outcome. One short paragraph.
|
|
39
|
+
- **"Needs your eyes"** — design decisions OpenCode made, non-blocking nitpicks, anything you want the
|
|
40
|
+
human to overrule or confirm. This is the section they read first.
|
|
41
|
+
- **End-of-run checklist** — what happens after the last task (push, open/update the PR, manual checks
|
|
42
|
+
the human should do).
|
|
43
|
+
|
|
44
|
+
Update it as each task lands, not in a batch at the end — if the run is interrupted, the file is still
|
|
45
|
+
accurate.
|
|
46
|
+
|
|
47
|
+
## Close with a coherence check
|
|
48
|
+
|
|
49
|
+
Per-task review proves each step in isolation; it doesn't prove the steps cohere. After the last task,
|
|
50
|
+
verify the whole:
|
|
51
|
+
|
|
52
|
+
- Run the full test/build once more on the final tree — not just the last task's slice.
|
|
53
|
+
- Do a repo-wide check for the thing the queue was about (e.g. after a removal, grep the entire tree
|
|
54
|
+
for any surviving reference; after a rename, confirm no stragglers).
|
|
55
|
+
- For schema work, replay all the new migrations from a clean state and check for drift.
|
|
56
|
+
- Then push and open or update the PR, with a description that reflects what actually shipped.
|
|
57
|
+
|
|
58
|
+
## When to stop and ask
|
|
59
|
+
|
|
60
|
+
Proceed without asking on anything that follows from the agreed plan — that's the point of the human
|
|
61
|
+
opting into the queue. Stop and surface when:
|
|
62
|
+
|
|
63
|
+
- A task can't be completed correctly within its brief's scope (a scope change is the human's call).
|
|
64
|
+
- A review finds something that calls the *plan* into question, not just the implementation.
|
|
65
|
+
- The gates reveal a problem that affects tasks already "done."
|
|
66
|
+
|
|
67
|
+
Then report where you are, what's committed, and what the open question is — and wait. A queue that
|
|
68
|
+
quietly works around a broken assumption produces a lot of commits in the wrong direction.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Review and land
|
|
2
|
+
|
|
3
|
+
OpenCode did the typing; you own the judgment. This is where delegation earns its keep or quietly ships
|
|
4
|
+
a mistake. The discipline is simple to state and easy to skip under time pressure: **verify against
|
|
5
|
+
reality, never against the self-report — and read the diff as generated code, which fails in ways a
|
|
6
|
+
green gate can't see.**
|
|
7
|
+
|
|
8
|
+
## Check the tests before trusting the gates
|
|
9
|
+
|
|
10
|
+
If the diff touches existing tests, review those edits *first* — before the gate re-run means anything.
|
|
11
|
+
A weakened assertion, an added skip, or a deleted test makes the gate measure less than it did before
|
|
12
|
+
the run; green is only meaningful if the yardstick wasn't shortened.
|
|
13
|
+
|
|
14
|
+
- **Unbriefed edits to existing tests are a contract change, not part of the fix.** The brief asked for
|
|
15
|
+
an implementation; nothing in it authorized moving the goalposts. Flag them, don't absorb them.
|
|
16
|
+
- **Skipped, disabled, or commented-out tests added in this diff:** treat the underlying test as failing
|
|
17
|
+
until proven otherwise, whatever the annotation's comment claims.
|
|
18
|
+
- **Loosened assertions** (exact match relaxed to contains/truthy, error-type checks broadened, tolerance
|
|
19
|
+
widened): same treatment.
|
|
20
|
+
|
|
21
|
+
## Re-run the gates yourself
|
|
22
|
+
|
|
23
|
+
`result.json` carries OpenCode's own claim that the gates passed. Treat that as a claim, not evidence —
|
|
24
|
+
re-run the project's actual test/lint/build commands in the working tree and read the output. And keep
|
|
25
|
+
the result in proportion: **passing is necessary, not sufficient.** An implementer can *game* a gate,
|
|
26
|
+
not just misreport it — that is what the test check above and the sweep below exist to catch.
|
|
27
|
+
|
|
28
|
+
For changes with their own verification shape, go further:
|
|
29
|
+
|
|
30
|
+
- **Migrations / schema:** round-trip them (apply, reverse, re-apply on a scratch target) and check for
|
|
31
|
+
drift, rather than trusting that "the migration is reversible."
|
|
32
|
+
- **Removals / renames:** grep the codebase for dangling references to whatever was removed.
|
|
33
|
+
- **Anything stateful:** exercise the actual behavior, don't just confirm it compiles.
|
|
34
|
+
|
|
35
|
+
## Read the diff against the brief
|
|
36
|
+
|
|
37
|
+
Open the diff (`touchedFiles` in the result is your starting list) and hold it against what you asked
|
|
38
|
+
for:
|
|
39
|
+
|
|
40
|
+
- **Scope creep** — did OpenCode change things the brief said to leave untouched? Unasked refactors,
|
|
41
|
+
renames, "while I was here" edits. These are the most common quality problem in delegated work.
|
|
42
|
+
- **Scope shortfall** — did it do the whole task, including the edge cases and cleanup, or stop at the
|
|
43
|
+
first plausible version?
|
|
44
|
+
- **Quiet judgment calls** — sometimes OpenCode makes a defensible decision the brief didn't anticipate.
|
|
45
|
+
Don't just accept it because it looks reasonable; understand it and decide.
|
|
46
|
+
|
|
47
|
+
## The implementer sweep
|
|
48
|
+
|
|
49
|
+
Generated code fails in systematic ways that gates are structurally blind to — each of these can sit in
|
|
50
|
+
a diff whose tests are all green. Walk them against every diff before you commit:
|
|
51
|
+
|
|
52
|
+
- **Hardcoded success or fixture data** on a path the brief says does real work — a canned
|
|
53
|
+
`{status: "ok"}` or default return passes tests *by design*. If OpenCode couldn't implement something,
|
|
54
|
+
the diff should fail loudly, not pretend.
|
|
55
|
+
- **Catch-all error handling that returns a default** instead of propagating — the suppressed failure is
|
|
56
|
+
exactly what the gate would have caught. A broad catch is only acceptable with a recovery path the
|
|
57
|
+
contract documents.
|
|
58
|
+
- **Unverified imports and API calls** — confirm every new dependency, method, and signature exists in
|
|
59
|
+
the *installed* version (read the lockfile or the package, don't trust plausibility).
|
|
60
|
+
- **Dead weight** — unused imports, helpers nothing calls, unreachable branches, "Step 1/Step 2"
|
|
61
|
+
comment scaffolding, comments that restate the line below them.
|
|
62
|
+
- **A second way to do what the file already does** — a new HTTP client, error idiom, or logging style
|
|
63
|
+
introduced beside the existing one instead of reusing it.
|
|
64
|
+
- **New tests that assert internals** — asserting that an internal helper was called, or mocking the
|
|
65
|
+
project's own functions to isolate a "unit." Green, brittle, and worthless as regression cover.
|
|
66
|
+
- **Near-duplicate test bodies** differing by one value — fold into one data-driven test or drop the
|
|
67
|
+
copies; bloat reads as coverage but isn't.
|
|
68
|
+
- **Speculative surface** — optional parameters, config flags, or abstractions with no caller in this
|
|
69
|
+
diff or the repo. Delegated work gets the concrete behavior the brief asked for, nothing extra.
|
|
70
|
+
- **Guards for impossible cases** — null/type checks for values the code's own contract already
|
|
71
|
+
excludes. Noise that buries the validation that matters at real trust boundaries.
|
|
72
|
+
|
|
73
|
+
Anything the sweep catches goes back to OpenCode as a delta brief (below) or gets fixed in the tree
|
|
74
|
+
before commit — and either way is reported to the user (see "Surface, don't absorb").
|
|
75
|
+
|
|
76
|
+
If the `guard-skills` package is installed, run the relevant guard on the diff for the full treatment —
|
|
77
|
+
`clean-code-guard` on production code, `test-guard` on tests, `docs-guard` on documentation. The sweep
|
|
78
|
+
above is the built-in floor; the guards go deeper.
|
|
79
|
+
|
|
80
|
+
## The commit boundary
|
|
81
|
+
|
|
82
|
+
When the gates pass and the diff holds, **you commit** — the orchestrator, never the implementer. The
|
|
83
|
+
`build` agent *can* write the working tree, but committing should be the act of the party that verified
|
|
84
|
+
the work, not the one that produced it. Write a clear message describing what landed. If your project
|
|
85
|
+
attributes co-authorship, that's the place for it.
|
|
86
|
+
|
|
87
|
+
From dispatch until that commit, the uncommitted working tree is the authoritative copy of the
|
|
88
|
+
implementer's work — the only one you can commit from, and often the only copy at all. Never run `git checkout`, `reset`, `clean`, or a branch switch in the
|
|
89
|
+
workspace between those two points — however messy an interrupted run looks, inspect it first:
|
|
90
|
+
`git status`, `git diff`, `git diff --cached` for anything the implementer staged (plain
|
|
91
|
+
`git diff` is blind to the index), and open any untracked files (`??` in `git status`) directly —
|
|
92
|
+
they are the implementer's new files, and no diff shows their contents. The tree is evidence,
|
|
93
|
+
not clutter. After that inspection the
|
|
94
|
+
verdict can legitimately be to discard — work built on a premise you have since corrected, for
|
|
95
|
+
example — and then `git checkout`/`clean` is the right tool. The ban is on reflexive cleanup
|
|
96
|
+
before anyone has looked.
|
|
97
|
+
|
|
98
|
+
## Reworking: send the delta, not the whole task
|
|
99
|
+
|
|
100
|
+
If the review turns up problems, don't restate the entire brief. Continue the same OpenCode session with
|
|
101
|
+
just the correction:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
echo "The fix is right, but the test mocks the DB session - use the real migrated fixture instead, and
|
|
105
|
+
drop the now-unused import." | node "<skill-dir>/scripts/relay.mjs" --resume-last --cd /path/to/repo
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
(`<skill-dir>` is this skill's install directory — see [dispatch-and-poll.md](dispatch-and-poll.md).)
|
|
109
|
+
|
|
110
|
+
`--resume-last` keeps OpenCode's session context from the first run (and its model), so a short delta is
|
|
111
|
+
enough. Then review again — rework gets the same gate-rerun, test check, diff-read, and sweep as the
|
|
112
|
+
original, no shortcuts. Repeat until it's right, then commit.
|
|
113
|
+
|
|
114
|
+
## Surface, don't absorb
|
|
115
|
+
|
|
116
|
+
The human opted into delegation, so committing verified, gate-passing work is the agreed contract.
|
|
117
|
+
But keep them in the loop on anything that changes the shape of the work:
|
|
118
|
+
|
|
119
|
+
- **Report design decisions** OpenCode made, and any defensible-but-unrequested turns it took.
|
|
120
|
+
- **Note non-blocking nitpicks** you chose not to block on, so the human can overrule you.
|
|
121
|
+
- **Stop and ask** if correct completion requires going beyond the brief — don't expand the mandate on
|
|
122
|
+
your own. A scope change is the human's call, not yours or OpenCode's.
|
|
123
|
+
|
|
124
|
+
For a multi-task run, capture these in the progress file rather than letting them scroll past — see
|
|
125
|
+
[multi-task-queues.md](multi-task-queues.md).
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Writing the brief
|
|
2
|
+
|
|
3
|
+
A brief is the entire task as OpenCode will see it. OpenCode runs in a fresh session with **no memory of
|
|
4
|
+
your conversation, no access to your prior notes, and no shared context** — only the text you send and
|
|
5
|
+
whatever it can read from the working tree (including the repo's own `AGENTS.md`, which it picks up
|
|
6
|
+
automatically). If a constraint isn't in the brief or discoverable in the repo, it doesn't exist for
|
|
7
|
+
OpenCode. The single most common failure is a brief that assumes context OpenCode doesn't have.
|
|
8
|
+
|
|
9
|
+
## Match the model to the brief
|
|
10
|
+
|
|
11
|
+
OpenCode has no default model, so every fresh dispatch names one with `--model provider/model`. Which
|
|
12
|
+
model is a two-owner decision: the **human** owns which models are allowed to run; **you, the
|
|
13
|
+
orchestrator**, pick one of them to fit the task in front of you.
|
|
14
|
+
|
|
15
|
+
- **The allowed set is the human's to state.** `opencode models` lists a few hundred models, but most
|
|
16
|
+
bill per token (OpenRouter and the like) and the CLI does not mark which are the human's
|
|
17
|
+
subscriptions. So they name their usable models — ideally once, in the target repo's `AGENTS.md` or
|
|
18
|
+
their `CLAUDE.md` (e.g. `opencode-go/…`, `zai-coding-plan/…`, `minimax-coding-plan/…`). If they
|
|
19
|
+
haven't, ask before dispatching rather than guessing a model and risking a metered bill.
|
|
20
|
+
- **Read the task's difficulty off the brief you just wrote, and match within that set.** A mechanical,
|
|
21
|
+
well-bounded brief — a rename sweep, a `moment`→`date-fns` migration, a dead-code removal — is safe on
|
|
22
|
+
a cheap, fast model. A brief whose risk lives in judgment — a concurrency fix, a money or auth path,
|
|
23
|
+
an ambiguous spec — wants a strong one, because the sweep's failure modes (plausible-but-wrong logic,
|
|
24
|
+
swallowed errors) are exactly what a weaker model produces more of.
|
|
25
|
+
- **A resumed run keeps the first run's model.** `--resume-last` / `--session` don't take `--model`; the
|
|
26
|
+
session already has one. Send only the delta brief.
|
|
27
|
+
|
|
28
|
+
## The shape that works
|
|
29
|
+
|
|
30
|
+
OpenCode responds well to compact, block-structured prompts with XML tags rather than long prose. State
|
|
31
|
+
the task, what "done" looks like, how to behave by default, and the few constraints that actually
|
|
32
|
+
matter. Add a block only when the task needs it — don't ship empty ceremony.
|
|
33
|
+
|
|
34
|
+
```xml
|
|
35
|
+
<task>
|
|
36
|
+
One or two sentences: the concrete job and where it lives. Then the specifics — current state, what to
|
|
37
|
+
change, and explicitly what to leave untouched. The "leave untouched" list is what keeps OpenCode from
|
|
38
|
+
wandering into unrelated refactors.
|
|
39
|
+
</task>
|
|
40
|
+
|
|
41
|
+
<verification_loop>
|
|
42
|
+
Run these before finishing and fix anything they surface, don't just report it:
|
|
43
|
+
<the project's real test command>
|
|
44
|
+
<the project's real lint/format command>
|
|
45
|
+
<the project's real build/typecheck command>
|
|
46
|
+
Confirm the working tree shows only the intended changes afterward.
|
|
47
|
+
</verification_loop>
|
|
48
|
+
|
|
49
|
+
<action_safety>
|
|
50
|
+
Keep changes scoped to the task. No unrelated refactors, renames, or cleanup unless required for
|
|
51
|
+
correctness. Do NOT run git add or git commit — the orchestrator commits after reviewing. Leave the
|
|
52
|
+
work uncommitted in the working tree.
|
|
53
|
+
</action_safety>
|
|
54
|
+
|
|
55
|
+
<structured_output_contract>
|
|
56
|
+
End with a report in this exact shape:
|
|
57
|
+
1. What changed and why
|
|
58
|
+
2. Files touched
|
|
59
|
+
3. Gate outcomes (paste the test/lint counts)
|
|
60
|
+
4. Anything you deviated on, left open, or want a decision on
|
|
61
|
+
</structured_output_contract>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
That four-block skeleton covers most implementation tasks. Reach for the extra blocks when the task
|
|
65
|
+
profile calls for them:
|
|
66
|
+
|
|
67
|
+
- **Debugging / open-ended fixes** — add `<completeness_contract>` (resolve fully, don't stop at the
|
|
68
|
+
first plausible fix) and `<missing_context_gating>` (don't guess missing repo facts; find them or
|
|
69
|
+
state what's unknown).
|
|
70
|
+
- **Review / diagnosis (read-only)** — add `<grounding_rules>` (ground every claim in evidence; label
|
|
71
|
+
inferences) and dispatch with `--read-only` so OpenCode runs as the `plan` agent and can't edit.
|
|
72
|
+
- **Research / recommendations** — add `<research_mode>` (separate observed facts, inferences, open
|
|
73
|
+
questions).
|
|
74
|
+
|
|
75
|
+
## Always ask for the report explicitly
|
|
76
|
+
|
|
77
|
+
The relay assembles OpenCode's final message from the text it emits when it stops. If the agent finishes
|
|
78
|
+
a task purely through tool calls and stops without a closing summary, `finalMessage` comes back empty —
|
|
79
|
+
not a relay defect, just nothing said. The `<structured_output_contract>` block is what guarantees a
|
|
80
|
+
report you can read: it tells OpenCode to end with a written summary, so the result file carries one.
|
|
81
|
+
|
|
82
|
+
## Discover the real gates — don't hardcode
|
|
83
|
+
|
|
84
|
+
`<verification_loop>` is only useful if it names the project's *actual* commands. Read the repo's
|
|
85
|
+
`AGENTS.md` / `CLAUDE.md` / `Makefile` / `package.json` first and copy the real ones in (`make test`,
|
|
86
|
+
`npm run lint`, `cargo test`, `pytest -q`, whatever it is). A brief that says "run the tests" without
|
|
87
|
+
naming them gets you an OpenCode that guesses — or skips.
|
|
88
|
+
|
|
89
|
+
## Honor the repo's conventions
|
|
90
|
+
|
|
91
|
+
OpenCode reads the repo's `AGENTS.md` automatically, so house rules there (style, forbidden patterns,
|
|
92
|
+
commit conventions) already apply. If the project forbids certain things in code — say, spec/ticket IDs
|
|
93
|
+
in comments, process language like "MVP"/"for now"/"phase N", or specific test conventions, whatever the
|
|
94
|
+
repo's own conventions ban — restate the load-bearing ones in the brief too, because OpenCode's
|
|
95
|
+
compliance is only as reliable as what's in front of it.
|
|
96
|
+
|
|
97
|
+
## One task per brief
|
|
98
|
+
|
|
99
|
+
Keep each brief to a single, bounded job. "Review this, fix what you find, update the docs, and suggest
|
|
100
|
+
a roadmap" produces a muddled run; split it into separate dispatches. One brief → one OpenCode run →
|
|
101
|
+
one commit keeps review and rollback clean, and lets a later task assume the earlier one landed.
|
|
102
|
+
|
|
103
|
+
## Premises freeze at dispatch
|
|
104
|
+
|
|
105
|
+
The implementer starts from the brief's facts and there is no steering channel mid-run. Audit the
|
|
106
|
+
fact block before sending — ownership, target branch, constraints, anything a judgment call rests
|
|
107
|
+
on. If a premise turns out wrong while the run is live, stop the run and re-dispatch a corrected
|
|
108
|
+
brief rather than discounting the output afterward; for a write-capable run, inspect the working
|
|
109
|
+
tree and reconcile any partial or premise-contaminated edits — keep or revert them — before the
|
|
110
|
+
re-dispatch.
|
|
111
|
+
|
|
112
|
+
## A worked example
|
|
113
|
+
|
|
114
|
+
```xml
|
|
115
|
+
<task>
|
|
116
|
+
In the payments service at services/billing/, the refund path double-charges when a refund is retried
|
|
117
|
+
after a network timeout (the idempotency key isn't checked before re-submitting). Make the refund
|
|
118
|
+
submission idempotent: check for an existing refund by idempotency key before creating a new one.
|
|
119
|
+
Touch only services/billing/refund.py and its tests. Leave the charge path, the API routes, and the
|
|
120
|
+
data models untouched.
|
|
121
|
+
</task>
|
|
122
|
+
|
|
123
|
+
<verification_loop>
|
|
124
|
+
Run and make green before finishing:
|
|
125
|
+
pytest tests/billing/ -q
|
|
126
|
+
ruff check services/billing/
|
|
127
|
+
Confirm git status shows only refund.py and its test file changed.
|
|
128
|
+
</verification_loop>
|
|
129
|
+
|
|
130
|
+
<action_safety>
|
|
131
|
+
Scope strictly to the refund idempotency fix. No unrelated refactors. Do NOT git add or commit; leave
|
|
132
|
+
changes in the working tree for review.
|
|
133
|
+
</action_safety>
|
|
134
|
+
|
|
135
|
+
<structured_output_contract>
|
|
136
|
+
Report: (1) the root cause and your fix, (2) files touched, (3) pytest + ruff outcomes with counts,
|
|
137
|
+
(4) anything you left open or want decided.
|
|
138
|
+
</structured_output_contract>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Send this with `relay.mjs` (see [dispatch-and-poll.md](dispatch-and-poll.md)); review the result and
|
|
142
|
+
commit it yourself (see [review-and-land.md](review-and-land.md)).
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pi-delegate
|
|
3
|
+
description: Delegate coding tasks to the Pi coding agent CLI (`pi`) only when the
|
|
4
|
+
user explicitly requests it, while the orchestrator retains review and landing responsibility.
|
|
5
|
+
risk: safe
|
|
6
|
+
category: agent-orchestration
|
|
7
|
+
source: https://github.com/amElnagdy/delegate-skills
|
|
8
|
+
source_repo: amElnagdy/delegate-skills
|
|
9
|
+
source_type: community
|
|
10
|
+
date_added: '2026-08-26'
|
|
11
|
+
license: MIT
|
|
12
|
+
license_source: https://github.com/amElnagdy/delegate-skills/blob/master/LICENSE
|
|
13
|
+
metadata:
|
|
14
|
+
version: 0.5.0
|
|
15
|
+
---
|
|
16
|
+
# Pi Delegate
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
- You want to delegate a bounded coding task to a separate `pi` implementer (`Pi`) and then review its diff yourself.
|
|
21
|
+
- The user explicitly asked for delegation to this implementer.
|
|
22
|
+
|
|
23
|
+
You are the **orchestrator**. Delegate a bounded coding task to a separate **implementer** - the Pi
|
|
24
|
+
coding agent CLI - then review what it produced and land it yourself. You write the brief and own
|
|
25
|
+
the judgment; the implementer makes changes in its own session; you verify and commit.
|
|
26
|
+
|
|
27
|
+
The loop needs only a shell command and file access, so any comparable orchestrator can drive it.
|
|
28
|
+
|
|
29
|
+
## When NOT to use this
|
|
30
|
+
|
|
31
|
+
- The task is small enough to do inline; delegation overhead is not worth it.
|
|
32
|
+
- The `pi` CLI is not installed or authenticated.
|
|
33
|
+
- You need a sandboxed implementer. Pi has no sandbox and no permission modes; `--read-only`
|
|
34
|
+
restricts the tool surface, but a write-capable run executes without prompts.
|
|
35
|
+
|
|
36
|
+
## Prerequisites (check once)
|
|
37
|
+
|
|
38
|
+
1. Install pi with `npm install -g @earendil-works/pi-coding-agent`.
|
|
39
|
+
2. Authenticate: `/login` inside pi for a subscription provider, or an API-key environment
|
|
40
|
+
variable / `pi`'s auth file for an API-key provider.
|
|
41
|
+
3. Confirm `pi --version` succeeds.
|
|
42
|
+
4. Work in, or point `--cd` at, the target git repository.
|
|
43
|
+
|
|
44
|
+
## Choose the model (optional)
|
|
45
|
+
|
|
46
|
+
Omit `--model` to use pi's configured default. To pick another, choose from `pi --list-models`
|
|
47
|
+
and pass an explicit id or pattern like `<provider>/<model-id>` or `sonnet:high`. The relay
|
|
48
|
+
accepts letters, digits, and `. _ : / -` only (the value reaches a shell on Windows), so glob
|
|
49
|
+
patterns with `*` are not forwarded.
|
|
50
|
+
|
|
51
|
+
## The loop
|
|
52
|
+
|
|
53
|
+
Run these five steps per task. Steps 1, 4, and 5 require judgment; 2 and 3 are mechanical.
|
|
54
|
+
|
|
55
|
+
### 1. Write the brief
|
|
56
|
+
|
|
57
|
+
Pi sees only the text you send plus what it can inspect in the workspace - no chat history or
|
|
58
|
+
shared context. Include the goal, current state, what to change, what to leave untouched, the
|
|
59
|
+
project's **actual** gates, and a report contract. Tell pi not to commit. Keep one task per brief.
|
|
60
|
+
Pi auto-loads `AGENTS.md`/`CLAUDE.md` context files from the workspace and its parents, so repo
|
|
61
|
+
instructions reach it without inlining. See
|
|
62
|
+
[references/writing-the-brief.md](references/writing-the-brief.md).
|
|
63
|
+
|
|
64
|
+
### 2. Dispatch
|
|
65
|
+
|
|
66
|
+
Use the bundled relay. It pipes the brief to `pi --mode json` on stdin, captures the JSON event
|
|
67
|
+
stream, and writes `result.json`. (`<skill-dir>` is the installed folder containing this
|
|
68
|
+
`SKILL.md`.)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo
|
|
72
|
+
# choose a model: add --model <id from pi --list-models>
|
|
73
|
+
# choose a provider: add --provider <name>
|
|
74
|
+
# read-only run (review/diagnosis): add --read-only
|
|
75
|
+
# trust project .pi resources: add --approve
|
|
76
|
+
# resume the most recent session: add --resume-last (delta brief only)
|
|
77
|
+
# resume a specific session: add --session <id> (delta brief only)
|
|
78
|
+
# hard time limit (watchdog): add --timeout 2h (the 30m default suits short runs; implementation briefs routinely need 1-2h)
|
|
79
|
+
# see all options: node .../relay.mjs --help
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The child process's cwd pins the workspace. The relay writes artifacts under the system temp dir
|
|
83
|
+
by default and never commits. See [references/dispatch-and-poll.md](references/dispatch-and-poll.md).
|
|
84
|
+
|
|
85
|
+
### 3. Wait for completion
|
|
86
|
+
|
|
87
|
+
The relay blocks until pi finishes. Run it with the orchestrator's background-command facility,
|
|
88
|
+
or background it in the shell and poll for `result.json`. A pre-run usage error exits 2 and writes
|
|
89
|
+
no result; a missing `pi` exits 127 and writes `status: "pi_unavailable"`.
|
|
90
|
+
|
|
91
|
+
Trust process state and the working tree over a progress display. Completion means the process
|
|
92
|
+
exited and `result.json` exists. Pi's full report is the `finalMessage` field in `result.json`
|
|
93
|
+
(also printed in full on stdout between the report markers).
|
|
94
|
+
|
|
95
|
+
### 4. Review - do not trust the self-report
|
|
96
|
+
|
|
97
|
+
Treat pi's final message and gate claims as claims:
|
|
98
|
+
|
|
99
|
+
- Re-run the project's gates yourself.
|
|
100
|
+
- Read the diff against the brief, starting with `touchedFiles`.
|
|
101
|
+
- Run relevant guard skills if installed.
|
|
102
|
+
- Round-trip migrations and grep for dangling references after removals or renames.
|
|
103
|
+
|
|
104
|
+
See [references/review-and-land.md](references/review-and-land.md).
|
|
105
|
+
|
|
106
|
+
### 5. Land it
|
|
107
|
+
|
|
108
|
+
The implementer edits the working tree; **the orchestrator commits.** Commit only after the gates
|
|
109
|
+
pass and the diff holds. If rework is needed, send a delta brief with `--resume-last` or
|
|
110
|
+
`--session <id>`, then review again.
|
|
111
|
+
|
|
112
|
+
## Autonomy and permissions
|
|
113
|
+
|
|
114
|
+
Pi has **no sandbox and no permission modes**. A default headless run reads, writes, edits, and
|
|
115
|
+
executes shell commands with no prompts - the controls are:
|
|
116
|
+
|
|
117
|
+
1. `--read-only` restricts pi's callable tools to `--tools read,grep,find,ls` across built-in,
|
|
118
|
+
extension, and custom tools. Installed extension code still runs with the user's host permissions.
|
|
119
|
+
2. The relay passes `--no-approve` by default, so project `.pi` settings, extensions, and skills
|
|
120
|
+
stay untrusted. `--approve` is the explicit opt-in for a repository the user trusts.
|
|
121
|
+
3. `touchedFiles` and the diff are the record of what changed. Inspect them after every run.
|
|
122
|
+
|
|
123
|
+
## Authorization model
|
|
124
|
+
|
|
125
|
+
Delegation is something the human opts into. Once they have ("run this queue", "proceed"),
|
|
126
|
+
committing verified, gate-passing work is the agreed contract. Two limits remain: **surface, don't
|
|
127
|
+
absorb** (report pi's design decisions, defensible-but-unasked turns, and non-blocking nitpicks)
|
|
128
|
+
and **stop for scope changes** (if correct completion needs going beyond the brief, ask instead of
|
|
129
|
+
expanding the mandate). See [references/review-and-land.md](references/review-and-land.md).
|
|
130
|
+
|
|
131
|
+
## References
|
|
132
|
+
|
|
133
|
+
- [references/writing-the-brief.md](references/writing-the-brief.md) - structure, report contract,
|
|
134
|
+
real gates, stdin delivery, and delta briefs.
|
|
135
|
+
- [references/dispatch-and-poll.md](references/dispatch-and-poll.md) - flags, artifacts,
|
|
136
|
+
`result.json`, polling, and failure recovery.
|
|
137
|
+
- [references/review-and-land.md](references/review-and-land.md) - review checklist, commit
|
|
138
|
+
boundary, and rework through pi sessions.
|
|
139
|
+
- [references/multi-task-queues.md](references/multi-task-queues.md) - sequential queues,
|
|
140
|
+
constraint carry-forward, progress tracking, and the final coherence pass.
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## Limitations
|
|
144
|
+
|
|
145
|
+
- Docs-only import — executable `scripts/relay.mjs` not included; see upstream for full runtime. Requires `pi` CLI, Node 18+, git.
|
|
146
|
+
- Relay never commits — it only returns structured result JSON; you review and land the commit.
|
|
147
|
+
|
|
148
|
+
> Adapted from [amElnagdy/delegate-skills](https://github.com/amElnagdy/delegate-skills) (MIT) — docs-only, runtime not bundled.
|