@iceinvein/agent-skills 0.25.0 → 0.26.0

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.
Files changed (33) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/index.js +775 -236
  3. package/package.json +2 -1
  4. package/skills/index.json +2 -2
  5. package/skills/magpie/SKILL.md +35 -18
  6. package/skills/magpie/bin/magpie.ts +28 -0
  7. package/skills/magpie/package.json +1 -1
  8. package/skills/magpie/references/critic.md +2 -2
  9. package/skills/magpie/references/peer-review.md +7 -7
  10. package/skills/magpie/references/proof.md +2 -2
  11. package/skills/magpie/scripts/__tests__/peer-run.test.ts +231 -0
  12. package/skills/magpie/scripts/__tests__/preflight.test.ts +22 -1
  13. package/skills/magpie/scripts/__tests__/setup-cmd.test.ts +14 -0
  14. package/skills/magpie/scripts/__tests__/skill-lint.test.ts +45 -4
  15. package/skills/magpie/scripts/peer-run.ts +146 -0
  16. package/skills/magpie/scripts/preflight.ts +20 -20
  17. package/skills/magpie/scripts/setup-cmd.ts +7 -1
  18. package/skills/magpie/skill.json +1 -1
  19. package/skills/sluice/SKILL.md +21 -6
  20. package/skills/sluice/references/deep-channel.md +35 -25
  21. package/skills/sluice/references/finish.md +2 -2
  22. package/skills/sluice/references/intent.md +1 -1
  23. package/skills/sluice/references/status.md +10 -4
  24. package/skills/sluice/references/test-first.md +12 -0
  25. package/skills/sluice/scripts/board-index.sh +59 -37
  26. package/skills/sluice/scripts/board.sh +72 -40
  27. package/skills/sluice/scripts/host.sh +60 -0
  28. package/skills/sluice/scripts/run-stats.sh +41 -3
  29. package/skills/sluice/scripts/session-start.sh +75 -17
  30. package/skills/sluice/scripts/status.sh +9 -5
  31. package/skills/sluice/scripts/stop-guard.sh +101 -37
  32. package/skills/sluice/scripts/transcript.sh +221 -0
  33. package/skills/sluice/skill.json +1 -1
@@ -143,7 +143,7 @@ test('references/critic.md asks for the verdict shape critic-apply accepts', asy
143
143
  expect(block).toMatch(/"keep".*"drop".*"merge"/)
144
144
  expect(block).toMatch(/"impact"[\s\S]*"likelihood"[\s\S]*"confidence"[\s\S]*"action"/)
145
145
  // The subagent writes the file itself; the old in-conversation fenced reply is gone.
146
- expect(block).toMatch(/Write tool/)
146
+ expect(block).toMatch(/[Ww]rite the file/)
147
147
  expect(block).toContain('critic: <kept> kept, <dropped> dropped, <merged> merged')
148
148
  expect(block).not.toContain('review-critic')
149
149
  })
@@ -190,10 +190,10 @@ test('references/critic.md keeps confirmed defects actionable and names what is
190
190
  expect(drop).toMatch(/what the test checks/)
191
191
  })
192
192
 
193
- test('references/peer-review.md holds the prompt and the Claude preamble', async () => {
193
+ test('references/peer-review.md holds the prompt and the same-family preamble', async () => {
194
194
  const text = await readFile(ref('peer-review.md'), 'utf8')
195
195
  expect(text).toContain('```magpie-peer-review')
196
- expect(text).toContain('```magpie-peer-review-claude-preamble')
196
+ expect(text).toContain('```magpie-peer-review-same-family-preamble')
197
197
  expect(text).toContain('review-peer-review')
198
198
  for (const ph of ['<<PRIMARY_PROVIDER>>', '<<PEER_PROVIDER>>', '<<KEPT_FINDINGS_COMPACT>>']) {
199
199
  expect(text).toContain(ph)
@@ -528,7 +528,7 @@ test('stage 6 runs the critic through critic-prompt and critic-apply subagents',
528
528
  const section = await skillSection('### 6. Critic')
529
529
  expect(section).toContain('magpie critic-prompt "$RUN_DIR"')
530
530
  expect(section).toContain('magpie critic-apply "$RUN_DIR"')
531
- expect(section).toContain('general-purpose')
531
+ expect(section).toContain('dispatch a subagent')
532
532
  // critic-apply logs its own done entry; a second one from the agent double-counts.
533
533
  expect(section).not.toMatch(/\{stage: critic, status: done\}/)
534
534
  // The in-conversation rubric and its batching paragraph are gone.
@@ -571,3 +571,44 @@ test('stage 9 takes the selection from magpie view rather than folding state/eve
571
571
  expect(section).not.toMatch(/LAST event/i)
572
572
  expect(section).not.toContain('state/events')
573
573
  })
574
+
575
+ const hostsSection = (text: string) => {
576
+ const start = text.indexOf('\n## Hosts\n')
577
+ expect(start).toBeGreaterThan(-1)
578
+ const next = text.indexOf('\n## ', start + 1)
579
+ return text.slice(start, next === -1 ? undefined : next)
580
+ }
581
+
582
+ test('SKILL.md maps subagent dispatch onto each host in a Hosts section', async () => {
583
+ const hosts = hostsSection(await readFile(SKILL, 'utf8'))
584
+ expect(hosts).toContain('Agent tool')
585
+ expect(hosts).toContain('invoke_subagent')
586
+ expect(hosts).toContain('Codex')
587
+ })
588
+
589
+ test('stage 7 runs the peer through magpie peer-run rather than codex exec', async () => {
590
+ const text = await readFile(SKILL, 'utf8')
591
+ expect(text).toContain('magpie peer-run')
592
+ expect(text).not.toContain('codex exec <')
593
+ })
594
+
595
+ test('references/peer-review.md opens its same-family preamble as a fresh independent reviewer', async () => {
596
+ const text = await readFile(ref('peer-review.md'), 'utf8')
597
+ const block =
598
+ text.match(/^(`{3,4})magpie-peer-review-same-family-preamble\n([\s\S]*?)\n\1[ \t]*$/m)?.[2] ?? ''
599
+ expect(block).toContain('fresh, independent second-opinion reviewer')
600
+ })
601
+
602
+ test('only the Hosts section names a host-specific subagent type', async () => {
603
+ const text = await readFile(SKILL, 'utf8')
604
+ expect(text.replace(hostsSection(text), '')).not.toContain('general-purpose')
605
+ const dir = new URL('../../references/', import.meta.url).pathname
606
+ for (const name of await readdir(dir)) {
607
+ expect(await readFile(ref(name), 'utf8')).not.toContain('general-purpose')
608
+ }
609
+ })
610
+
611
+ test('stage 7 fallback prepends the same-family preamble to the batch prompt file', async () => {
612
+ const section = await skillSection('### 7. Peer review')
613
+ expect(section).toMatch(/prepend the `magpie-peer-review-same-family-preamble`[^\n]*peer-prompt/)
614
+ })
@@ -0,0 +1,146 @@
1
+ import { readFile, writeFile } from 'node:fs/promises'
2
+ import { join } from 'node:path'
3
+
4
+ export type PeerProvider = 'codex' | 'claude' | 'agy'
5
+
6
+ const PROVIDERS: readonly PeerProvider[] = ['codex', 'claude', 'agy']
7
+
8
+ const BIN_VARS: Record<PeerProvider, string> = {
9
+ codex: 'MAGPIE_CODEX_BIN',
10
+ claude: 'MAGPIE_CLAUDE_BIN',
11
+ agy: 'MAGPIE_AGY_BIN',
12
+ }
13
+
14
+ const DEFAULT_TIMEOUT_SEC = 600
15
+
16
+ export type PeerConfig = { provider: PeerProvider; model: string | null; timeoutSec: number; bin: string }
17
+
18
+ export function peerConfigFromEnv(env: Record<string, string | undefined>): PeerConfig {
19
+ const name = env.MAGPIE_PEER || 'codex'
20
+ const provider = PROVIDERS.find((p) => p === name)
21
+ if (!provider) {
22
+ throw new Error(`unknown MAGPIE_PEER ${name} (want one of ${PROVIDERS.join(', ')})`)
23
+ }
24
+ let timeoutSec = DEFAULT_TIMEOUT_SEC
25
+ const rawTimeout = env.MAGPIE_PEER_TIMEOUT
26
+ if (rawTimeout !== undefined && rawTimeout !== '') {
27
+ timeoutSec = Number(rawTimeout)
28
+ if (!Number.isFinite(timeoutSec) || timeoutSec <= 0) {
29
+ throw new Error(`invalid MAGPIE_PEER_TIMEOUT ${rawTimeout} (want a positive number of seconds)`)
30
+ }
31
+ }
32
+ return {
33
+ provider,
34
+ model: env.MAGPIE_PEER_MODEL || null,
35
+ timeoutSec,
36
+ bin: env[BIN_VARS[provider]] || provider,
37
+ }
38
+ }
39
+
40
+ export function peerArgv(
41
+ provider: PeerProvider,
42
+ bin: string,
43
+ model: string | null,
44
+ prompt: string,
45
+ ): { argv: string[]; stdin: string | null } {
46
+ if (provider === 'codex') {
47
+ return { argv: [bin, 'exec', ...(model ? ['-m', model] : []), '-'], stdin: prompt }
48
+ }
49
+ if (provider === 'claude') {
50
+ return { argv: [bin, '-p', ...(model ? ['--model', model] : [])], stdin: prompt }
51
+ }
52
+ // agy reads no prompt from stdin, so it goes in as the -p argument.
53
+ return { argv: [bin, '-p', prompt, ...(model ? ['--model', model] : [])], stdin: null }
54
+ }
55
+
56
+ export function killProviderGroup(pid: number): void {
57
+ try {
58
+ process.kill(-pid, 'SIGKILL')
59
+ } catch (err) {
60
+ // The group exiting on its own between the check and the kill is the goal reached.
61
+ if ((err as NodeJS.ErrnoException).code !== 'ESRCH') throw err
62
+ }
63
+ }
64
+
65
+ export async function runPeer(
66
+ runDir: string,
67
+ batch: number | null,
68
+ env: Record<string, string | undefined>,
69
+ ): Promise<{ ok: true; outPath: string } | { ok: false; error: string }> {
70
+ let config: PeerConfig
71
+ try {
72
+ config = peerConfigFromEnv(env)
73
+ } catch (err) {
74
+ return { ok: false, error: err instanceof Error ? err.message : String(err) }
75
+ }
76
+ const suffix = batch === null ? '' : `-${batch}`
77
+ const promptPath = join(runDir, `peer-prompt${suffix}.md`)
78
+ const outPath = join(runDir, `peer${suffix}.out`)
79
+ let prompt: string
80
+ try {
81
+ prompt = await readFile(promptPath, 'utf8')
82
+ } catch (err) {
83
+ return { ok: false, error: `cannot read ${promptPath}: ${err instanceof Error ? err.message : String(err)}` }
84
+ }
85
+ const { argv, stdin } = peerArgv(config.provider, config.bin, config.model, prompt)
86
+ let proc: ReturnType<typeof Bun.spawn>
87
+ try {
88
+ // Its own process group, so a timeout can kill whatever the provider started:
89
+ // npm-installed codex and claude are node wrappers around the real process.
90
+ proc = Bun.spawn(argv, {
91
+ detached: true,
92
+ stdin: stdin === null ? 'ignore' : new Blob([stdin]),
93
+ stdout: 'pipe',
94
+ stderr: 'pipe',
95
+ })
96
+ } catch (err) {
97
+ return { ok: false, error: `cannot run ${config.bin}: ${err instanceof Error ? err.message : String(err)}` }
98
+ }
99
+ const stdoutText = new Response(proc.stdout as ReadableStream).text()
100
+ const stderrText = new Response(proc.stderr as ReadableStream).text()
101
+ let timer: ReturnType<typeof setTimeout> | undefined
102
+ const timedOut = new Promise<'timeout'>((resolve) => {
103
+ timer = setTimeout(() => resolve('timeout'), config.timeoutSec * 1000)
104
+ })
105
+ // The detached group no longer receives the terminal's Ctrl-C or hangup, so an
106
+ // interrupt has to stop the provider by hand or it keeps running and spending tokens.
107
+ const pid = proc.pid
108
+ const stopOnInterrupt = (code: number) => () => {
109
+ killProviderGroup(pid)
110
+ process.exit(code)
111
+ }
112
+ const onSigint = stopOnInterrupt(130)
113
+ const onSigterm = stopOnInterrupt(143)
114
+ const onSighup = stopOnInterrupt(129)
115
+ process.on('SIGINT', onSigint)
116
+ process.on('SIGTERM', onSigterm)
117
+ process.on('SIGHUP', onSighup)
118
+ try {
119
+ const outcome = await Promise.race([proc.exited, timedOut])
120
+ // A background child the provider left behind would hold the pipes open and
121
+ // outlive peer-run, so the group goes as soon as the provider is done.
122
+ if (outcome !== 'timeout') killProviderGroup(pid)
123
+ // A child that left the group escapes that kill and can still hold the pipes,
124
+ // so the time limit bounds the drain too.
125
+ const output = outcome === 'timeout' ? 'timeout' : await Promise.race([Promise.all([stdoutText, stderrText]), timedOut])
126
+ if (output === 'timeout') {
127
+ // A grandchild can hold the pipes open until it is reaped, so the pending
128
+ // reads are abandoned rather than awaited.
129
+ killProviderGroup(pid)
130
+ await proc.exited
131
+ return { ok: false, error: `timed out after ${config.timeoutSec}s` }
132
+ }
133
+ const [stdout, stderr] = output
134
+ if (outcome !== 0) {
135
+ const firstLine = stderr.split('\n').find((line) => line.trim() !== '')
136
+ return { ok: false, error: firstLine ?? `${config.bin} exited with code ${outcome}` }
137
+ }
138
+ await writeFile(outPath, stdout)
139
+ return { ok: true, outPath }
140
+ } finally {
141
+ clearTimeout(timer)
142
+ process.off('SIGINT', onSigint)
143
+ process.off('SIGTERM', onSigterm)
144
+ process.off('SIGHUP', onSighup)
145
+ }
146
+ }
@@ -1,9 +1,6 @@
1
- export type Deps = {
2
- bun: string
3
- gh: string
4
- codex: string
5
- git: string
6
- }
1
+ import { type PeerProvider, peerConfigFromEnv } from './peer-run.ts'
2
+
3
+ export type Deps = { bun: string; gh: string; git: string } & Partial<Record<PeerProvider, string>>
7
4
 
8
5
  export type PreflightResult = {
9
6
  ok: boolean
@@ -11,19 +8,19 @@ export type PreflightResult = {
11
8
  missing: string[]
12
9
  /** Optional binaries that did not resolve; these only degrade features, they never abort. */
13
10
  missingOptional: string[]
14
- resolved: Record<keyof Deps, string | null>
11
+ resolved: Partial<Record<keyof Deps, string | null>>
15
12
  }
16
13
 
17
- // codex only powers the optional peer-review stage; a missing codex degrades that
18
- // stage to skipped rather than blocking the whole run.
19
- const OPTIONAL_DEPS: ReadonlySet<keyof Deps> = new Set<keyof Deps>(['codex'])
14
+ // The peer provider only powers the optional peer-review stage; a missing one
15
+ // degrades that stage to a subagent of the host's own model family rather than
16
+ // blocking the run.
17
+ const OPTIONAL_DEPS: ReadonlySet<keyof Deps> = new Set<keyof Deps>(['codex', 'claude', 'agy'])
20
18
 
21
19
  export async function preflight(deps: Deps): Promise<PreflightResult> {
22
- const resolved: Record<keyof Deps, string | null> = {
23
- bun: Bun.which(deps.bun),
24
- gh: Bun.which(deps.gh),
25
- codex: Bun.which(deps.codex),
26
- git: Bun.which(deps.git),
20
+ const resolved: Partial<Record<keyof Deps, string | null>> = {}
21
+ for (const key of Object.keys(deps) as Array<keyof Deps>) {
22
+ const bin = deps[key]
23
+ if (bin !== undefined) resolved[key] = Bun.which(bin)
27
24
  }
28
25
  const unresolved = (Object.keys(resolved) as Array<keyof Deps>).filter(
29
26
  (k) => resolved[k] === null,
@@ -37,6 +34,8 @@ const HINTS: Record<string, string> = {
37
34
  bun: 'bun: install from https://bun.sh',
38
35
  gh: 'gh: install from https://cli.github.com (run `gh auth login` after)',
39
36
  codex: 'codex: install the Codex CLI per Codex docs (run `codex auth login` after)',
37
+ claude: 'claude: install Claude Code per its docs (run `claude` once to log in)',
38
+ agy: 'agy: install the Antigravity CLI per its docs and log in',
40
39
  git: 'git: install via your package manager',
41
40
  }
42
41
 
@@ -44,11 +43,12 @@ export function renderInstallHint(missing: string[]): string {
44
43
  return missing.map((m) => HINTS[m] ?? `${m}: not found on PATH`).join('\n')
45
44
  }
46
45
 
47
- export function defaultDeps(): Deps {
46
+ export function defaultDeps(env: Record<string, string | undefined> = process.env): Deps {
47
+ const peer = peerConfigFromEnv(env)
48
48
  return {
49
- bun: process.env.MAGPIE_BUN_BIN || 'bun',
50
- gh: process.env.MAGPIE_GH_BIN || 'gh',
51
- codex: process.env.MAGPIE_CODEX_BIN || 'codex',
52
- git: process.env.MAGPIE_GIT_BIN || 'git',
49
+ bun: env.MAGPIE_BUN_BIN || 'bun',
50
+ gh: env.MAGPIE_GH_BIN || 'gh',
51
+ git: env.MAGPIE_GIT_BIN || 'git',
52
+ [peer.provider]: peer.bin,
53
53
  }
54
54
  }
@@ -24,7 +24,13 @@ async function logLine(runDir: string, entry: Record<string, unknown>): Promise<
24
24
  }
25
25
 
26
26
  export async function runSetup(input: RunSetupInput): Promise<number> {
27
- const deps = input.deps ?? defaultDeps()
27
+ let deps: Deps
28
+ try {
29
+ deps = input.deps ?? defaultDeps()
30
+ } catch (err) {
31
+ process.stderr.write(`magpie: ${err instanceof Error ? err.message : String(err)}\n`)
32
+ return 2
33
+ }
28
34
  // Absolute so target.json and every git call agree on the repo whatever the cwd.
29
35
  const repoPath = resolve(input.repoPath)
30
36
  // Resolved once so the inside-repo guard checks the same path mkdir creates:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magpie",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture) plus a once-per-PR checks pass that finds tests and controls able to pass without proving their purpose, drops findings whose quoted evidence is not in the code, dedupes, runs critic subagents that re-check each finding against the worktree and set its risk label, peer-reviews via codex exec (falling back to a Claude second opinion when codex is unavailable), and serves an interactive HTML report for selecting or dismissing findings to post via gh, recording the outcome per finding as labels. Bundles a Bun CLI put on PATH by the skill's postinstall step under a bunx install, or by the plugin's bin/ under a Claude Code plugin install. Use when the user asks to review a GitHub pull request. Local mode (setup --local) runs the same pipeline on the current branch's diff from its merge base, uncommitted and untracked work included, against the caller's live tree, with no server or posting, and hands the ranked findings back in the terminal for an implementing or orchestrating agent to address. Splits oversized diffs into budgeted shards and rebuilds the diff from the local clone when gh pr diff refuses it.",
5
5
  "author": "iceinvein",
6
6
  "type": "prompt",
@@ -31,9 +31,10 @@ Two subsystems is `main`; the third is what makes it `deep`.
31
31
  `deep` stops: once for design sign-off before code, once for the plan and
32
32
  pre-flight together before Task 1. A stop ends your turn.
33
33
 
34
- A choice that is your partner's to make goes to them through `AskUserQuestion`
35
- wherever the harness has it, at a stop or between them: options to pick from,
36
- your recommendation first, not a paragraph or a lettered list to reply to.
34
+ A choice that is your partner's to make goes to them through the question tool
35
+ (`## Hosts` names it per host) wherever the harness has it, at a stop or
36
+ between them: options to pick from, your recommendation first, not a paragraph
37
+ or a lettered list to reply to.
37
38
  Asking is not itself a stop, however many options it carried, because the
38
39
  answer comes back to you and the run never left your hands. So at a stop, ask
39
40
  with the tool, then end the turn once the answers are in.
@@ -73,7 +74,7 @@ One line each. Read the reference only on friction: the moment you notice
73
74
  yourself wanting to skip the rule, or arguing that this one is the exception.
74
75
 
75
76
  - **Agree intent** before building. One question at a time, through
76
- `AskUserQuestion`. Propose approaches with a recommendation, not a survey.
77
+ the question tool. Propose approaches with a recommendation, not a survey.
77
78
  `main` agrees in a message, `deep` writes it down. `references/intent.md`
78
79
  - **Test first.** The test comes before the code; run it while it should
79
80
  still be failing, then write the least code that turns it green. Skip that
@@ -129,7 +130,7 @@ Design to `docs/specs/YYYY-MM-DD-<topic>.md`, plan to
129
130
  `docs/plans/YYYY-MM-DD-<topic>.md`, unless the repo has a convention or
130
131
  your partner states a preference. Get the design signed off before code. When
131
132
  the design's shape turns on a fork only your partner can settle, ask that one
132
- question through `AskUserQuestion`, with your recommendation, before the design
133
+ question through the question tool, with your recommendation, before the design
133
134
  is written. `references/deep-channel.md` has the test for what counts.
134
135
 
135
136
  Read the repo before the walk and before any fork question: prior designs, the
@@ -209,7 +210,7 @@ instead of to the branch at large.
209
210
 
210
211
  Pre-flight rides in that same stop: which flagged tasks get a reviewer, which
211
212
  mechanical ones the plan marked for low effort, and whether the work runs
212
- in a worktree. Ask them through `AskUserQuestion`, one question each with the
213
+ in a worktree. Ask them through the question tool, one question each with the
213
214
  counts in the options, never as a paragraph or a lettered list, then end the
214
215
  turn on the answers. Task 1 opens on their next
215
216
  instruction, and an answer that already carries one is that instruction. A
@@ -255,3 +256,17 @@ The test is whether that pipeline governs the work in front of you, not whether
255
256
  a plugin is installed. A repo whose own instructions mandate the sequence rules
256
257
  this router out exactly as the plugin does, with the plugin disabled or absent.
257
258
  Stand down and say so once, in the same breath you would have named a channel.
259
+
260
+ ## Hosts
261
+
262
+ The rest of this skill and its references name a tool by what it does: the
263
+ question tool, dispatch a subagent, the explorer, the worktree. This table is
264
+ the one place that says what each is called on each host.
265
+
266
+ | | Claude Code | Codex | Antigravity |
267
+ |---|---|---|---|
268
+ | Question tool | `AskUserQuestion` | `request_user_input`: at most three options a question, recommendation first, and at most three questions a call, so a longer set goes out in successive calls | `ask_question` |
269
+ | Dispatch a subagent | the Agent tool | `spawn_agent`, then `wait_agent` | `invoke_subagent` |
270
+ | Explorer | the Explore agent | `spawn_agent` told to read and write nothing (Codex shows no built-in explorer type) | `invoke_subagent` told to read and write nothing |
271
+ | Low effort | `subagent_type: sluice-implementer-low` (`sluice:sluice-implementer-low` under a plugin install) | `spawn_agent` with `reasoning_effort: "low"` and `fork_turns: "none"`: Codex takes an effort override only with `fork_turns: "none"`, and only when skill instructions ask, which this row is | not available: the task runs at the session's effort, and pre-flight says so |
272
+ | Worktree | the harness's worktree tool; cut by hand under `.claude/worktrees/` | `git worktree add` under `.sluice/worktrees/` | `Workspace: branch` for implementers, `git worktree add` under `.sluice/worktrees/` for the controller |
@@ -183,7 +183,7 @@ partner can settle, one whose answer changes the design's shape (where state
183
183
  lives, what shares it, which process owns it) rather than a value the design can
184
184
  leave as config, ask it as one question with your recommendation before the
185
185
  design is written, and write the design on the answer. Ask it with
186
- `AskUserQuestion` where there is one, which returns the answer without ending
186
+ the question tool where there is one, which returns the answer without ending
187
187
  the turn; without one, the question is a stop of its own, and the design is
188
188
  written, to its file, on the next turn. A design drafted across both branches of
189
189
  a fork doubles the reading and still has to be rewritten. Anything you can
@@ -219,7 +219,7 @@ Ask for three things, each cited by path:
219
219
  3. **Stated constraints.** Repo instructions, CI gates, the test runner and its
220
220
  conventions, and release steps that the design or its plan will answer to.
221
221
 
222
- Dispatch it as a read-only Explore agent where the harness has one, for the
222
+ Dispatch it to the explorer, a read-only subagent, where the harness has one, for the
223
223
  reason the reviewer is dispatched: the file dumps fill its context instead of
224
224
  yours, and you only need what it concluded. Where there is no dispatch, it is
225
225
  your own read, with the same three questions. Either way the findings go into
@@ -244,7 +244,7 @@ The spec has a fixed shape, because the intent check reads it by section:
244
244
  ```
245
245
 
246
246
  `## Intent` holds the request quoted verbatim, each question asked through
247
- `AskUserQuestion` with the answer it got, and a table mapping each ask to the
247
+ the question tool with the answer it got, and a table mapping each ask to the
248
248
  `D<n>` decisions that deliver it, or to `## Out of scope` with the reason.
249
249
  Decisions are headed `### D<n>. <title>`, which is what `plan.sh validate`
250
250
  reads. Out of scope is its own section and never a numbered decision, because
@@ -348,7 +348,7 @@ review: your own read is weaker, and your partner should know it was yours.
348
348
  ## Pre-flight
349
349
 
350
350
  Design signed off, plan written, nothing built yet. Before Task 1, stop once
351
- and settle three things with your partner. Ask them with `AskUserQuestion`,
351
+ and settle three things with your partner. Ask them with the question tool,
352
352
  one question per decision, your recommendation as the first option and the
353
353
  counts in the option text: what you are after is a decision, and a wall of
354
354
  considerations asks them to extract the decision from it first. A lettered
@@ -386,7 +386,9 @@ ratification rather than a fresh judgment, and it carries the count: six of
386
386
  nine at low effort and three at this session's, take it, put everything at the
387
387
  session's effort, or name the exceptions. The count is what your partner
388
388
  prices. "I will use low effort where it fits" prices nothing, and it also
389
- arrives after the tokens are spent.
389
+ arrives after the tokens are spent. On a host with no low-effort dispatch
390
+ (the `## Hosts` table in SKILL.md), the count says so: the marked tasks run
391
+ at the session's effort there.
390
392
 
391
393
  **Workspace, commits and concurrency.** One worktree for the plan, one per
392
394
  concurrent implementer, or straight onto the current branch; and with it who
@@ -402,7 +404,9 @@ your partner needs in front of them. Implementing onto main or master needs
402
404
  their say-so and this is where you get it. Known friction in a worktree for this
403
405
  repo, a lint target that resolves through a symlink, a build that needs its own
404
406
  install, belongs in the option text where it can affect the answer, not in a
405
- footnote after they have chosen.
407
+ footnote after they have chosen. Where a sandbox refuses `git worktree add`
408
+ (Codex under `workspace-write`, Antigravity's terminal sandbox), say so in the
409
+ question and make working in the main tree the option.
406
410
 
407
411
  That question settles where the implementers run, not whether a task may be
408
412
  dispatched at all, and the shared-tree and current-branch options have to say
@@ -419,9 +423,12 @@ down to a single question is still a stop.
419
423
 
420
424
  **Write the answers down before Task 1's first edit, in the tree the work runs
421
425
  in.** The order on the instruction that follows the stop: cut the worktree
422
- first, when that was the answer, through the harness's worktree tool, which
423
- puts this session inside it: everything below is issued from there, and issued
424
- from the main tree instead it lands in the tree the work is not in. A fresh
426
+ first, when that was the answer, as the Worktree row of the `## Hosts` table in
427
+ SKILL.md says. Where that is the harness's own worktree tool, it puts this
428
+ session inside it; where it is `git worktree add`, the session stays where it
429
+ was, so work from that path. Either way everything below is issued from the
430
+ worktree, and issued from the main tree instead it lands in the tree the work
431
+ is not in. A fresh
425
432
  worktree branches from the remote's default branch, so nothing uncommitted or
426
433
  unpushed in the main tree comes across, and `docs/` may not exist there yet.
427
434
  Move the design and plan into it yourself, each into its own directory since
@@ -545,12 +552,13 @@ reads the run state rather than the plan: it sees what has actually landed.
545
552
  in one tree contend on the git index and on `HEAD` even when their files
546
553
  never meet. One worktree per concurrent implementer, or run them serially.
547
554
  Those worktrees cost something, which is why pre-flight asks rather than
548
- assumes. Where the Agent tool refuses its own worktree isolation, cut each
549
- one yourself, `git worktree add -b <plan-branch>-t<n>
550
- .claude/worktrees/<topic>-t<n> <plan-branch>`, name the path in that task's
555
+ assumes. Where dispatching a subagent refuses its own worktree isolation, cut
556
+ each one yourself, `git worktree add -b <plan-branch>-t<n>
557
+ <worktree dir>/<topic>-t<n> <plan-branch>`, name the path in that task's
551
558
  brief as the only tree it works in, and merge each branch back once its task
552
- lands. Keep them under `.claude/worktrees/` in the repo, where the harness
553
- cuts its own: permissions scoped to the project cover that path, and a
559
+ lands. Keep them in the host's worktree directory in the repo (the
560
+ `## Hosts` table in SKILL.md), or under `.sluice/worktrees/` where the host
561
+ has none: permissions scoped to the project cover that path, and a
554
562
  sibling directory outside it can leave the implementer's Write and Edit
555
563
  denied. A refused isolation flag has not
556
564
  taken the worktree away, only the tool's way of cutting it, so falling back
@@ -566,12 +574,14 @@ reads the run state rather than the plan: it sees what has actually landed.
566
574
  - **The flip runs alone.** Nothing goes concurrent with the task carrying
567
575
  `Flips`. The invariant it establishes is what later tasks are checked
568
576
  against, and whatever landed beside it was checked against nothing.
569
- - Isolate the workspace before a multi-task plan: the harness's worktree
570
- tool, not `git worktree` yourself. That tool moves this session into the
577
+ - Isolate the workspace before a multi-task plan, as the Worktree row of the
578
+ `## Hosts` table in SKILL.md says. Where the host has a worktree tool, use
579
+ it, not `git worktree` yourself. That tool moves this session into the
571
580
  worktree, which `git worktree add` does not: cut by hand, the files are
572
581
  isolated and the session is still in the tree they came from, so every bare
573
582
  `git`, build and test command you run lands in the wrong one. Enter it by
574
- path if it already exists. Isolating through the harness's tool puts this
583
+ path if it already exists. Where it is `git worktree add`, work from that
584
+ path: run every command there, since nothing moves the session for you. Isolating through the harness's tool puts this
575
585
  session in worktree mode, which by the cap above makes concurrent
576
586
  implementers serial for the whole run, so pre-flight's workspace question
577
587
  says so in the option text. Implementing straight onto main or
@@ -592,12 +602,13 @@ reads the run state rather than the plan: it sees what has actually landed.
592
602
  - **The plan and pre-flight decide the effort, not the moment of dispatch.** A
593
603
  task with no `Effort` line goes out on this session's model and effort, and a
594
604
  downshift that was neither marked nor ratified is a saving your partner never
595
- agreed to. A task ratified at `Effort: low` goes out with
596
- `subagent_type: sluice-implementer-low` (`sluice:sluice-implementer-low`
597
- under a Claude Code plugin install), the agent sluice installs with
598
- `effort: low` and `model: inherit`: the Agent tool takes a model and no
599
- effort, so an agent definition is the one place a dispatch's effort can be
600
- set. Reviewers are the
605
+ agreed to. A task ratified at `Effort: low` goes out on the
606
+ low-effort row of the `## Hosts` table in SKILL.md. On Claude Code that is
607
+ `sluice-implementer-low`, the agent sluice installs with `effort: low` and
608
+ `model: inherit`, because a Claude dispatch takes a model and no effort, so
609
+ an agent definition is the one place its effort can be set. On Codex the
610
+ dispatch carries the effort itself, and on Antigravity the task runs at the
611
+ session's effort. Reviewers are the
601
612
  other half of that rule: a review never runs below the effort that built the
602
613
  task, so the review of an `Effort: low` task goes out on this session's
603
614
  effort and never on the low agent.
@@ -698,8 +709,7 @@ something stronger would be promising what is already in use. What a tier buys
698
709
  is a dispatch. The one effort rule that holds across all of them is that a
699
710
  review never runs below the effort that built the task, so tiers 1 and 2 over
700
711
  an `Effort: low` task go out at this session's effort rather than on
701
- `sluice-implementer-low` (`sluice:sluice-implementer-low` under a Claude Code
702
- plugin install).
712
+ the low-effort row of `## Hosts`.
703
713
 
704
714
  **Where the repo carries review tiering of its own, this table governs.** It is
705
715
  the more specific of the two: wired into `Flips`, the `Effort` marks and the
@@ -23,7 +23,7 @@ Confirm the base branch instead of assuming it; untangling a wrong merge
23
23
  costs far more than asking would have.
24
24
 
25
25
  With the suite green and the base confirmed, put exactly three options to
26
- your partner through `AskUserQuestion`, with the run ledger in the message
26
+ your partner through the question tool, with the run ledger in the message
27
27
  above them so the choice is made against
28
28
  what the work actually cost rather than against your account of it;
29
29
  `references/meter.md` owns that. Say in one clause whether the work was
@@ -59,7 +59,7 @@ the one list of them. In order:
59
59
  controller stat read plus the final whole-plan pass rather than a per-task
60
60
  dispatch" is the accurate line, and it is a coverage level rather than a
61
61
  debt. Where nothing was priced, it is a debt and says so.
62
- 5. The three options, asked through `AskUserQuestion`, and nothing after them.
62
+ 5. The three options, asked through the question tool, and nothing after them.
63
63
 
64
64
  A `deep` run closes when the work stops being yours to act on: after a local
65
65
  merge and its re-run of the suite, or when your partner leaves the branch where
@@ -1,6 +1,6 @@
1
1
  # Agree intent
2
2
 
3
- Ask one question at a time, through `AskUserQuestion` where the harness has
3
+ Ask one question at a time, through the question tool where the harness has
4
4
  it, with the options as choices and your recommendation first. Prose is the
5
5
  fallback for a harness without the tool or an answer set that is genuinely
6
6
  open, not the default.
@@ -412,9 +412,13 @@ if [ -n "$sluice_line" ]; then printf '%s\n' "$sluice_line"; fi
412
412
  `$cwd` is `workspace.current_dir` and `$session_id` is `session_id`, both from
413
413
  the JSON the harness sends on stdin. The id is what finds a run this session
414
414
  opened in a worktree it never entered, which is every run in a repo that cuts
415
- its worktrees by hand. Substitute the install path:
416
- `${CLAUDE_CONFIG_DIR:-$HOME/.claude}` where a session may set one, or
417
- `$cwd/.claude/skills/sluice/scripts/statusline.sh` for a project-local install.
415
+ its worktrees by hand. Substitute the install path for the host: on Claude
416
+ Code `${CLAUDE_CONFIG_DIR:-$HOME/.claude}` where a session may set one, or
417
+ `$cwd/.claude/skills/sluice/scripts/statusline.sh` for a project-local
418
+ install; on Antigravity `$HOME/.gemini/config/skills/sluice/scripts/statusline.sh`,
419
+ or `$cwd/.agents/skills/sluice/scripts/statusline.sh` for a project install,
420
+ wired through `statusLine.command` in `~/.gemini/antigravity-cli/settings.json`.
421
+ Codex draws no command status line, so there is nothing to wire there.
418
422
 
419
423
  Those two lines are the whole contract, and they are deliberately empty of
420
424
  judgement. Whether a run is visible from a given directory is a question about
@@ -503,7 +507,9 @@ combine with `--watch`.
503
507
 
504
508
  It reads an index of pointers, never copies, at `$SLUICE_BOARD_DIR`, else
505
509
  `$CLAUDE_CONFIG_DIR/sluice/board`, else `$HOME/.claude/sluice/board`; with none
506
- of the three set nothing is written and the board is empty. `runs/` holds one
510
+ of the three set nothing is written and the board is empty. The root is the
511
+ same on every host: Codex and Antigravity sessions set no `CLAUDE_CONFIG_DIR`,
512
+ so theirs is `$HOME/.claude/sluice/board`, one board for the machine. `runs/` holds one
507
513
  file per tree with a live run, naming the tree, and `sessions/<id>.json` one
508
514
  per routed session. `run.json` stays the single authority on a run, so the
509
515
  board can never show a stale copy of one. `SLUICE_BOARD_DIR` exists so the
@@ -51,6 +51,18 @@ function it calls. Keep helpers that exist only for tests inside the test
51
51
  files. If a production class grows a method whose only caller is a test
52
52
  reaching inside it, the test has started reshaping your design.
53
53
 
54
+ **Search the existing tests before writing a new one.** If one already pins
55
+ this behaviour on this input partition, extend it or add a row to its table
56
+ rather than starting a test beside it. Inputs the code does not branch on are
57
+ one test: a missing field and an empty one that decode to the same value take
58
+ the same path, and a second test for them catches nothing the first does not.
59
+
60
+ **Test a rule where it lives.** When a shared check owns the rule (a scoped
61
+ read, a middleware, a policy), its full table of cases belongs once, beside
62
+ that check. A new caller owes one refused case and one allowed case, enough to
63
+ show it is wired to the check. Running the owner's table again through every
64
+ caller adds tests that fail together and find no bug the owner's table misses.
65
+
54
66
  **A test goes when the behaviour it pinned is gone.** Delete it alongside the
55
67
  code, in the same commit, like anything else the change orphaned. Two tests
56
68
  pinning one behaviour are a test and a maintenance bill, so keep the clearer.