@openora/create 0.4.1-canary.405 → 0.4.1-canary.407

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.
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/env node
2
+ // Watches one MR or PR (branch or number) and prints one line, then exits, when babysit has work on it:
3
+ // failed | conflicts | threads <ids> | green (with --until-green) | merged | closed | watched | error <message>
4
+ // A thread waits for an answer until the account this runs as left a final reaction on its last comment (thumbsup
5
+ // or question; eyes only means picked up and stays pending) or that comment is from that account (the person
6
+ // replying by hand). It is reported once it stayed the same for two checks, so a review with ten comments is
7
+ // one line. A thread whose last-comment id is in
8
+ // .claude/reviews/<branch with / as +>.drafted.json in the main checkout has a drafted reply waiting
9
+ // for the person to post it; a new comment changes the id and reports the thread again.
10
+ // Run it in the background:
11
+ // node babysit.mjs <branch|number> [--until-green] WATCH_DEBUG=1 prints every check to stderr
12
+ // It takes <git common dir>/babysit/<number>.pid, naming its Claude session until the MR merges or
13
+ // closes; another live session holding it prints `watched`, so two sessions never fix the same MR.
14
+ // --once checks one time, for a caller that polls on its own (a scheduler): threads are reported at
15
+ // once, `green` only for a draft (mark it ready), and `none` means nothing to do.
16
+ import { execFileSync } from 'node:child_process';
17
+ import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
18
+ import { basename, dirname, join } from 'node:path';
19
+
20
+ const EVERY_MS = 120_000;
21
+ // ponytail: a repo with no CI on the last commit reads green after this (never under --once); a head-SHA match on checks if it matters
22
+ const NO_CI_MS = 10 * 60_000;
23
+ const MAX_ERRORS = 5;
24
+ const FAILED = [
25
+ 'FAILURE',
26
+ 'ERROR',
27
+ 'CANCELLED',
28
+ 'TIMED_OUT',
29
+ 'ACTION_REQUIRED',
30
+ 'STARTUP_FAILURE',
31
+ 'failed',
32
+ 'canceled',
33
+ ];
34
+
35
+ const [target, ...flags] = process.argv.slice(2);
36
+ if (!target) {
37
+ console.error('usage: babysit.mjs <branch|number> [--until-green | --once]');
38
+ process.exit(2);
39
+ }
40
+ const untilGreen = flags.includes('--until-green');
41
+ const once = flags.includes('--once');
42
+
43
+ const run = (cmd, args) =>
44
+ execFileSync(cmd, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
45
+ const json = (cmd, args) => JSON.parse(run(cmd, args));
46
+ const commonDir = run('git', ['rev-parse', '--path-format=absolute', '--git-common-dir']).trim();
47
+ const mainCheckout = basename(commonDir) === '.git' ? dirname(commonDir) : commonDir;
48
+
49
+ const draftedIds = (branch) => {
50
+ try {
51
+ const file = join(
52
+ mainCheckout,
53
+ '.claude/reviews',
54
+ `${branch.replaceAll('/', '+')}.drafted.json`,
55
+ );
56
+ return new Set(JSON.parse(readFileSync(file, 'utf8')).map(String));
57
+ } catch {
58
+ return new Set();
59
+ }
60
+ };
61
+ const unansweredIds = (lastComments, me, branch) => {
62
+ const drafted = draftedIds(branch);
63
+ return lastComments
64
+ .filter((comment) => comment.author !== me && !comment.reactors.includes(me))
65
+ .map((comment) => String(comment.id))
66
+ .filter((id) => !drafted.has(id))
67
+ .sort();
68
+ };
69
+
70
+ const THREADS = `query($owner: String!, $name: String!, $number: Int!, $endCursor: String) {
71
+ viewer { login }
72
+ repository(owner: $owner, name: $name) { pullRequest(number: $number) {
73
+ reviewThreads(first: 100, after: $endCursor) {
74
+ nodes { isResolved comments(last: 1) { nodes { id body author { login } reactions(first: 50) { nodes { content user { login } } } } } }
75
+ pageInfo { hasNextPage endCursor }
76
+ }
77
+ comments(last: 1) { nodes { id body author { login } reactions(first: 50) { nodes { content user { login } } } } }
78
+ latestReviews(first: 20) { nodes { id state body author { login } reactions(first: 50) { nodes { content user { login } } } } }
79
+ } }
80
+ }`;
81
+
82
+ function github() {
83
+ const pr = json('gh', [
84
+ 'pr',
85
+ 'view',
86
+ target,
87
+ '--json',
88
+ 'number,url,state,isDraft,headRefName,mergeable,statusCheckRollup',
89
+ ]);
90
+ const [, owner, name] = new URL(pr.url).pathname.split('/');
91
+ const args = [
92
+ 'api',
93
+ 'graphql',
94
+ '--paginate',
95
+ '--slurp',
96
+ '-f',
97
+ `query=${THREADS}`,
98
+ '-f',
99
+ `owner=${owner}`,
100
+ '-f',
101
+ `name=${name}`,
102
+ '-F',
103
+ `number=${pr.number}`,
104
+ ];
105
+ const pages = json('gh', args).map((page) => page.data);
106
+ const open = pages
107
+ .flatMap(({ repository }) => repository.pullRequest.reviewThreads.nodes)
108
+ .filter((thread) => !thread.isResolved)
109
+ .flatMap((thread) => thread.comments.nodes)
110
+ .concat(pages[0].repository.pullRequest.comments.nodes)
111
+ // a summary-only review has no thread: changes requested or a body is a request until answered
112
+ .concat(
113
+ (pages[0].repository.pullRequest.latestReviews?.nodes ?? []).filter(
114
+ (review) => review.state === 'CHANGES_REQUESTED' || review.body?.trim(),
115
+ ),
116
+ )
117
+ .map((comment) => ({
118
+ ...comment,
119
+ author: comment.author?.login,
120
+ reactors: comment.reactions.nodes
121
+ .filter((reaction) => reaction.content !== 'EYES')
122
+ .map((reaction) => reaction.user?.login),
123
+ }));
124
+ const checks = pr.statusCheckRollup ?? [];
125
+ const ci = !checks.length
126
+ ? null
127
+ : checks.some((check) => FAILED.includes(check.conclusion || check.state))
128
+ ? 'failed'
129
+ : checks.some((check) =>
130
+ check.status
131
+ ? check.status !== 'COMPLETED'
132
+ : check.state === 'PENDING' || check.state === 'EXPECTED',
133
+ )
134
+ ? 'running'
135
+ : 'passed';
136
+ return {
137
+ number: pr.number,
138
+ state: pr.state.toLowerCase(),
139
+ draft: pr.isDraft,
140
+ conflicts: pr.mergeable === 'CONFLICTING',
141
+ ci,
142
+ unanswered: unansweredIds(open, pages[0].viewer.login, pr.headRefName),
143
+ };
144
+ }
145
+
146
+ function gitlab() {
147
+ const mr = json('glab', ['mr', 'view', target, '-F', 'json']);
148
+ const discussions = run('glab', [
149
+ 'api',
150
+ '--paginate',
151
+ '--output',
152
+ 'ndjson',
153
+ `projects/${mr.project_id}/merge_requests/${mr.iid}/discussions?per_page=100`,
154
+ ])
155
+ .split('\n')
156
+ .filter(Boolean)
157
+ .map((line) => JSON.parse(line));
158
+ const open = discussions
159
+ .map((discussion) => discussion.notes.filter((note) => !note.system))
160
+ .filter(
161
+ (notes) =>
162
+ notes.length &&
163
+ !(
164
+ notes.some((note) => note.resolvable) &&
165
+ notes.every((note) => !note.resolvable || note.resolved)
166
+ ),
167
+ )
168
+ .map((notes) => notes.at(-1))
169
+ .map((note) => ({
170
+ ...note,
171
+ author: note.author?.username,
172
+ reactors: json('glab', [
173
+ 'api',
174
+ `projects/${mr.project_id}/merge_requests/${mr.iid}/notes/${note.id}/award_emoji`,
175
+ ])
176
+ .filter((award) => award.name !== 'eyes')
177
+ .map((award) => award.user?.username),
178
+ }));
179
+ const pipeline = mr.head_pipeline?.sha === mr.sha ? mr.head_pipeline.status : null;
180
+ const ci = !pipeline
181
+ ? null
182
+ : FAILED.includes(pipeline)
183
+ ? 'failed'
184
+ : ['success', 'skipped', 'manual'].includes(pipeline)
185
+ ? 'passed'
186
+ : 'running';
187
+ const state = mr.state === 'opened' ? 'open' : mr.state === 'merged' ? 'merged' : 'closed';
188
+ const me = json('glab', ['api', 'user']).username;
189
+ return {
190
+ number: mr.iid,
191
+ state,
192
+ draft: mr.draft === true,
193
+ conflicts: mr.has_conflicts === true,
194
+ ci,
195
+ unanswered: unansweredIds(open, me, mr.source_branch),
196
+ };
197
+ }
198
+
199
+ // The lock names the Claude session this runs under, not this process: the watcher exits on every
200
+ // line of work, and the session still owns the MR while it fixes it. The session ending frees it.
201
+ // ponytail: a pid reused by an unrelated process after a crash reads as alive; the next reboot clears it.
202
+ // Without a `claude` ancestor (another agent) the lock lives only as long as this process.
203
+ const sessionPid = (() => {
204
+ try {
205
+ let pid = process.ppid;
206
+ for (let depth = 0; depth < 10 && pid > 1; depth++) {
207
+ const [parent, ...args] = run('ps', ['-o', 'ppid=,args=', '-p', String(pid)])
208
+ .trim()
209
+ .split(/\s+/);
210
+ // the native binary, or `node …/bin/claude` for an npm install
211
+ if (args.slice(0, 2).some((arg) => basename(arg) === 'claude')) return pid;
212
+ pid = Number(parent);
213
+ }
214
+ } catch {}
215
+ return process.pid;
216
+ })();
217
+ const lockFile = (number) => join(commonDir, 'babysit', `${number}.pid`);
218
+ const alive = (pid) => {
219
+ try {
220
+ process.kill(pid, 0);
221
+ return true;
222
+ } catch (error) {
223
+ return error.code === 'EPERM';
224
+ }
225
+ };
226
+ const holder = (number) => {
227
+ try {
228
+ return Number(readFileSync(lockFile(number), 'utf8'));
229
+ } catch {
230
+ return null;
231
+ }
232
+ };
233
+ const heldByOther = (number) => {
234
+ const pid = holder(number);
235
+ return pid !== null && pid !== sessionPid && alive(pid);
236
+ };
237
+ let held = null;
238
+ const hold = (number) => {
239
+ if (held === number) return;
240
+ mkdirSync(dirname(lockFile(number)), { recursive: true });
241
+ try {
242
+ writeFileSync(lockFile(number), String(sessionPid), { flag: 'wx' });
243
+ } catch (error) {
244
+ if (error.code !== 'EEXIST') throw error;
245
+ if (heldByOther(number)) return;
246
+ writeFileSync(lockFile(number), String(sessionPid));
247
+ }
248
+ held = number;
249
+ };
250
+ const release = (number) =>
251
+ holder(number) === sessionPid && rmSync(lockFile(number), { force: true });
252
+ process.on('exit', () => sessionPid === process.pid && held !== null && release(held));
253
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) process.on(signal, () => process.exit(0));
254
+
255
+ let current = null;
256
+ const say = (line) => {
257
+ const word = line.split(' ')[0];
258
+ if (['merged', 'closed'].includes(word)) release(current);
259
+ // --once holds only for work, so a quiet check leaves the MR free for another session
260
+ if (once && ['failed', 'conflicts', 'threads', 'green'].includes(word)) hold(current);
261
+ console.log(line);
262
+ process.exit(0);
263
+ };
264
+ const status = /github\.com/.test(run('git', ['remote', 'get-url', 'origin'])) ? github : gitlab;
265
+ const started = Date.now();
266
+ let seen = null;
267
+ let errors = 0;
268
+ for (;;) {
269
+ try {
270
+ const now = status();
271
+ errors = 0;
272
+ if (process.env.WATCH_DEBUG) console.error(JSON.stringify(now));
273
+ current = now.number;
274
+ if (now.state !== 'open') say(now.state);
275
+ if (heldByOther(now.number)) say('watched');
276
+ if (!once) hold(now.number);
277
+ if (now.conflicts) say('conflicts');
278
+ if (now.ci === 'failed') say('failed');
279
+ const ids = now.unanswered.join(' ');
280
+ if (ids && (once || ids === seen)) say(`threads ${ids}`);
281
+ seen = ids;
282
+ const green = now.ci === 'passed' || (now.ci === null && Date.now() - started >= NO_CI_MS);
283
+ if (untilGreen && green && !ids) say('green');
284
+ if (once) say(now.ci === 'passed' && !ids && now.draft ? 'green' : 'none');
285
+ } catch (reason) {
286
+ if (once || ++errors >= MAX_ERRORS)
287
+ say(`error ${reason instanceof Error ? reason.message.split('\n')[0] : reason}`);
288
+ }
289
+ await new Promise((resolve) => setTimeout(resolve, EVERY_MS));
290
+ }
@@ -16,7 +16,7 @@ description: Commit, push, and open a pull request on this repo's forge, targeti
16
16
  4. **Commit.** Conventional-commit message (`feat:`, `fix:`, `docs:`, `refactor:`, `chore:`); the scope is a commitlint-enum package or app, never the ticket key; for ticket work the key goes at the END of the subject (e.g. `feat(web): add deposit limits ({{trackerKey}}-123)`). No "Co-Authored-By" / "Generated with" trailers.
17
17
  5. **Verify the commit.** Run `pnpm verify` on the committed, clean tree: it is the pre-MR gate and records the verified commit. The `guard-mr` hook refuses to open the pull request until that record matches HEAD. Don't push a red tree.
18
18
  6. **Push** the current branch - but STOP and get an explicit per-action "yes push" from the user FIRST. The one exception: run by `ship` without `--ask`, the `/ship` invocation is that yes for its ticket branch only. Report the commit SHA, then ask. Invoking this skill is NOT push authorization. Pushing to a shared/env branch (`{{mrTarget}}`, `stage`, `prod`) without that explicit yes is forbidden. Only after the yes: `git push -u origin <current>`.
19
- 7. **Open the pull request as a draft** using the command in `docs/agents/forge.md` (only after the push is confirmed and done). Run by `ship`: stop here, its step 7 marks the request ready. Otherwise start `node .rulesync/skills/ship/watch-pr.mjs <branch> --until-green` as a background command, never a sleep loop; at `green` mark the request ready for review (`docs/agents/forge.md`). Red stays a draft: fix it first. Reuse an open request for the same source -> target instead of creating a duplicate, and never delete a long-lived branch on merge.
19
+ 7. **Open the pull request as a draft** using the command in `docs/agents/forge.md` (only after the push is confirmed and done). Run by `ship`: stop here, its step 7 marks the request ready. Otherwise start `node .rulesync/skills/babysit/babysit.mjs <branch> --until-green` as a background command, never a sleep loop; at `green` mark the request ready for review (`docs/agents/forge.md`). Red stays a draft: fix it first. Reuse an open request for the same source -> target instead of creating a duplicate, and never delete a long-lived branch on merge.
20
20
  8. **Report** the pull-request URL back to the user, and the OSS PR URL when paired.
21
21
 
22
22
  ## Pull-request description
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: review
3
3
  targets: ['*']
4
- description: Multi-agent code review of the working branch against this repo's conventions, OSS-core boundaries, frontend rules, security, and operator-domain fit. Fans out a configurable number of parallel reviewers, each grounded in the rule docs, then synthesizes one verdict. Use on "review this", "code review", "/review", optionally "--agents N", "--base <ref>", "--fix", "--post" (publish findings to the pull request as inline comments + a summary verdict), "--yes" (post without confirming), "--ci" (non-interactive, exit code from the verdict), a pull-request number, or paths.
4
+ description: Multi-agent code review of the working branch against this repo's conventions, OSS-core boundaries, frontend rules, security, and operator-domain fit. Fans out a configurable number of parallel reviewers, each grounded in the rule docs, then synthesizes one verdict. Use on "review this", "code review", "/review", optionally "--agents N", "--base <ref>", "--fix", "--ci" (non-interactive, exit code from the verdict), a pull-request number, or paths. Findings come back as draft comments (file:line + text) for a person to post; it never posts.
5
5
  ---
6
6
 
7
7
  # review ({{name}})
@@ -11,7 +11,7 @@ You are the orchestrator: scope the diff, fan out N reviewers across dimensions,
11
11
  Checklist - tick as you go:
12
12
 
13
13
  ```
14
- - [ ] 1. Parse args (--agents / --base / MR# / paths / --fix / --post / --yes / --ci)
14
+ - [ ] 1. Parse args (--agents / --base / MR# / paths / --fix / --ci)
15
15
  - [ ] 2. Run the precheck: scope, mechanical facts, domain hits; if empty, ask (or APPROVED under --ci)
16
16
  - [ ] 2a. Previous review? Go incremental from its SHA and carry its findings
17
17
  - [ ] 3. Collect task context (ticket AC + MR discussion)
@@ -20,7 +20,7 @@ Checklist - tick as you go:
20
20
  - [ ] 4. Cover all seven dimensions; spawn the two-lens roster in ONE message, whatever the diff size
21
21
  - [ ] 5. Dedup + apply the evidence gate
22
22
  - [ ] 6. Report one DIMENSION line per dimension + one verdict (+ apply fixes only if --fix)
23
- - [ ] 7. Post to the MR as inline comments + summary (only if --post)
23
+ - [ ] 7. Draft the comments + summary for a person to post (§8)
24
24
  ```
25
25
 
26
26
  ## 1. Parse `$ARGUMENTS`
@@ -28,12 +28,10 @@ Checklist - tick as you go:
28
28
  - `--agents N` - parallel reviewers (2-4); default 2 (§5).
29
29
  - `--base <ref>` - diff base; default `{{mrTarget}}`.
30
30
  - `--full` - ignore the previous review (§2a) and review the whole change.
31
- - `<number>` - a pull request: read its patch and intent with the commands in `docs/agents/forge.md`. Only your own: a pull request whose author is not the forge user you are logged in as is refused (say so and stop); a person reviews it, with the `pr-manual-review` skill when the repo has one. `--ci` (the forge bot) is exempt. So `--post` only ever posts on your own pull request.
31
+ - `<number>` - a pull request: read its patch and intent with the commands in `docs/agents/forge.md`. Only your own: a pull request whose author is not the forge user you are logged in as is refused (say so and stop); a person reviews it, with the `pr-manual-review` skill when the repo has one. `--ci` (the forge bot) is exempt.
32
32
  - paths - restrict review to those files/dirs.
33
33
  - `--fix` - apply BLOCK/WARN fixes after the review; default report-only.
34
- - `--post` - publish findings to the pull request as inline diff-line comments + a one-line summary verdict (§8). Requires a pull-request number. Draft-and-confirm by default.
35
- - `--yes` - with `--post`, skip the confirmation and publish straight away.
36
- - `--ci` - non-interactive: never ask, never post, never fix; print only the §7 machine block. Implies `--full`: a gate never trusts a prior-review marker, since anyone who can comment on the pull request can post one for the current head. The model cannot set the process exit code; the CI job derives it from the output, e.g. `claude -p '/review --ci' > review.txt; [ "$(grep -c '^DIMENSION: ' review.txt)" -eq 7 ] && grep -q '^VERDICT: APPROVED' review.txt` - a review that skipped a dimension fails the job even when it approves. An empty diff is APPROVED with zero findings.
34
+ - `--ci` - non-interactive: never ask, never draft, never fix; print only the §7 machine block. Implies `--full`: a gate never trusts a prior-review marker, since anyone who can comment on the pull request can post one for the current head. The model cannot set the process exit code; the CI job derives it from the output, e.g. `claude -p '/review --ci' > review.txt; [ "$(grep -c '^DIMENSION: ' review.txt)" -eq 7 ] && grep -q '^VERDICT: APPROVED' review.txt` - a review that skipped a dimension fails the job even when it approves. An empty diff is APPROVED with zero findings.
37
35
 
38
36
  ## 2. Scope the diff
39
37
 
@@ -210,7 +208,7 @@ Dedup by `file:line`, order BLOCK -> WARN -> INFO.
210
208
 
211
209
  **Save the state** after every review, `--ci` included: write `.claude/reviews/<pr or branch>.json` in the main checkout (for an OSS branch: in its `{{ossDir}}/.worktrees/<branch, / as +>/`, since the OSS main checkout is read-only here and `guard-review` reads the worktree too) with `sha` (the full `git rev-parse HEAD` reviewed), `base`, `verdict` (the bare `APPROVED` or `CHANGES REQUESTED`; the `guard-review` hook reads it before every push and new MR/PR), every open finding (new, `still open`, `carried`), and the `DIMENSION:` lines.
212
210
 
213
- Default and `--post`: a human-readable report - one line per finding `[SEV] file:line - finding - evidence - rule cited - fix`, one `TRACE:` line per traced entry point (format below), one status line per AC bullet, the `PRIOR:` lines, the `SKIPPED:` count, the seven `DIMENSION:` lines, and **APPROVED** / **CHANGES REQUESTED** with the most critical finding last. `--post` rewrites those findings into the §8 comments.
211
+ Default: a human-readable report - one line per finding `[SEV] file:line - finding - evidence - rule cited - fix`, one `TRACE:` line per traced entry point (format below), one status line per AC bullet, the `PRIOR:` lines, the `SKIPPED:` count, the seven `DIMENSION:` lines, and **APPROVED** / **CHANGES REQUESTED** with the most critical finding last, then the §8 drafts.
214
212
 
215
213
  `--ci`: print exactly this block and nothing else - a CI job parses it line by line:
216
214
 
@@ -231,11 +229,11 @@ Severities: `[BLOCK]` must fix before merge (core edit, boundary break, authz/se
231
229
 
232
230
  If `--fix`: apply BLOCK + WARN fixes in the working tree (smallest diff satisfying the cited rule), run `/check`, report green/red. Leave INFO untouched. Never commit or push.
233
231
 
234
- ## 8. Post to the pull request (`--post`)
232
+ ## 8. Draft comments for the pull request
235
233
 
236
- Only when `--post` is set and the target is a pull-request number. Turns findings into terse review comments: one line each, brief why, backtick every identifier.
234
+ Agent sessions never post on a pull request: no inline comment, reply, review, or verdict note (a hook blocks it). Turn findings into terse draft comments a person posts by hand: one line each, brief why, backtick every identifier.
237
235
 
238
- **What gets a comment.** Severity decides the verdict, not what gets posted. Every verified finding is posted unless it matches one of these, and the report names which:
236
+ **What gets a comment.** Severity decides the verdict, not what gets drafted. Every verified finding becomes a draft unless it matches one of these, and the report names which:
239
237
 
240
238
  - D1 the code does not do what the finding says;
241
239
  - D2 a duplicate - merge it into the other;
@@ -246,15 +244,13 @@ Only when `--post` is set and the target is a pull-request number. Turns finding
246
244
 
247
245
  Nothing else is a drop reason: not "theoretical", "unlikely", "no consumer yet", "a sibling does the same", "by design", "the lockfile pins it", or "performance only".
248
246
 
249
- A finding gets its own inline comment only when a concrete trigger leads to wrong or stranded money (a debit or hold that cannot be reversed, a credit that is blocked), an authz or security bypass, a compliance gap (audit, RG, KYC, geo), data loss, a crash or 5xx, a broken public contract or declared rule (a type not exported where its siblings are, an undeclared audit action, untyped error data, a loose dependency pin), a race that persists state breaking an invariant the change adds, request-path work that grows with table size, a test that passes with the feature removed or its mock unconfigured, an unmet AC, or code that does not do what the title claims. Everything else - test gaps, naming, boundary nits, actor metadata, a weaker variant of a posted defect - joins an inline comment on the same file or becomes one line in the summary note. Merging never launders: each merged point passes the same bar on its own. A merged comment leads with its most severe finding, anchors on its line, and keeps its strongest fix. At most six inline comments.
247
+ A finding gets its own inline comment only when a concrete trigger leads to wrong or stranded money (a debit or hold that cannot be reversed, a credit that is blocked), an authz or security bypass, a compliance gap (audit, RG, KYC, geo), data loss, a crash or 5xx, a broken public contract or declared rule (a type not exported where its siblings are, an undeclared audit action, untyped error data, a loose dependency pin), a race that persists state breaking an invariant the change adds, request-path work that grows with table size, a test that passes with the feature removed or its mock unconfigured, an unmet AC, or code that does not do what the title claims. Everything else - test gaps, naming, boundary nits, actor metadata, a weaker variant of a drafted defect - joins an inline comment on the same file or becomes one line in the summary note. Merging never launders: each merged point passes the same bar on its own. A merged comment leads with its most severe finding, anchors on its line, and keeps its strongest fix. At most six inline comments.
250
248
 
251
- 1. **Draft.** Rewrite each finding as a terse comment keyed to its `file:line`, in the posting user's voice: when their instructions name a voice or writing guide, read it before drafting. Each comment is 1-3 sentences: what breaks, the trigger, the fix. No mechanism chain, no secondary evidence, no add-ons - the author asks if unclear. Most comments start straight with the point; soften at most one in three, never with the same opener twice in a pull request. Compose the summary as ONE sentence stating whether the changes block prod/push, e.g. `Not a blocker for push - a few cleanups worth doing.` or `Blocker: the finding in `x.ts` must be fixed before we push.` Then one short line per minor finding.
252
- 2. **Dedupe.** Read every existing thread on the pull request, resolved or not, per `docs/agents/forge.md`. Drop a draft that an existing thread already raises, even worded differently; when it adds a new fact, reply to that thread instead of opening a new one. Drop the summary when every finding was dropped.
253
- 3. **Confirm.** Show all drafted comments + the summary and stop for approval - UNLESS `--yes`, then skip straight to posting.
254
- 4. **Post inline comments** anchored to the diff, using the "Inline review comments" command in `docs/agents/forge.md`. Anchor on the NEW-file line of an added (`+`) line (`git show <src-branch>:<file> | grep -n`), and verify each response actually carries a line anchor - an unanchored fallback comment must be deleted and retried, never left behind.
255
- 5. **Post the summary** as one general comment on the pull request, per the same file, ending with the hidden marker `<!-- review:sha=<reviewed HEAD SHA> -->` so the next review on any machine can go incremental (§2a).
256
- 6. Report back the count posted + the summary verdict. Never resolve threads; never push.
257
- 7. `[oss]` findings go to the paired OSS PR instead, by `<worktree>/docs/standards/skills/review.md` "Posting to the PR", after their own confirmation. That PR is public: no operator name, no internal URL, no ticket text beyond the bare key.
249
+ 1. **Draft.** Rewrite each finding as a terse comment keyed to its `file:line`, in the user's voice: when their instructions name a voice or writing guide, read it before drafting. Each comment is 1-3 sentences: what breaks, the trigger, the fix. No mechanism chain, no secondary evidence, no add-ons - the author asks if unclear. Most comments start straight with the point; soften at most one in three, never with the same opener twice in a pull request. Compose the summary as ONE sentence stating whether the changes block prod/push, e.g. `Not a blocker for push - a few cleanups worth doing.` or `Blocker: the finding in `x.ts` must be fixed before we push.` Then one short line per minor finding.
250
+ 2. **Dedupe.** On a pull request, read every existing thread, resolved or not, per `docs/agents/forge.md`. Drop a draft that an existing thread already raises, even worded differently; when it adds a new fact, draft it as a reply to that thread and name the thread. Drop the summary when every finding was dropped.
251
+ 3. **Anchor.** Key each inline draft to the NEW-file line of an added (`+`) line (`git show <src-branch>:<file> | grep -n`), so it pastes onto the right diff line.
252
+ 4. **Print** the drafts as `file:line` followed by the comment text, then the summary ending with the hidden marker `<!-- review:sha=<reviewed HEAD SHA> -->` so the next review on any machine can go incremental (§2a) once the person posts it. Never post, never resolve threads, never push.
253
+ 5. `[oss]` findings are drafted for the paired OSS PR instead, by `<worktree>/docs/standards/skills/review.md` "Draft comments". That PR is public: no operator name, no internal URL, no ticket text beyond the bare key.
258
254
 
259
255
  ## 9. Several pull requests in one run
260
256
 
@@ -27,11 +27,11 @@ The orchestrator: one ticket key in, a green MR in Code Review out. You own the
27
27
 
28
28
  ## What ship may write without asking
29
29
 
30
- - Jira, on this ticket only: the Plan comment (and its test cases where the repo's `test-plan` skill keeps them), a questions comment, a blocker comment, the MR link comment, and the transitions to In Progress and to Code Review. Nothing else: no field edits, no other transitions, no other tickets.
30
+ - Jira, on this ticket and its sub-tasks only: the Plan comment (and its test cases where the repo's `test-plan` skill keeps them), a questions comment, a blocker comment, the MR link comment, the transitions to In Progress and to Code Review, and for a `Split:` plan one sub-task per slice under this ticket (1b). Nothing else: no field edits, no other transitions, no other tickets.
31
31
  - Git: commits on the ticket branch `<type>/{{trackerKey}}-XXX/<slug>` and pushing it. Never a push to `{{mrTarget}}`, `stage`, `prod` or any shared branch.
32
32
  - Force-push: only `git push --force-with-lease` on the ticket branch, and only while every commit on the remote branch past `{{mrTarget}}` is your own (`git log --format=%ae origin/{{mrTarget}}..origin/<branch>` shows only your `git config user.email`). Someone else's commit there: merge, never push over it. Never a plain `--force`.
33
33
  - Merging: into a feature branch only (`{{mrTarget}}` merged into the ticket branch to clear conflicts, a stacked MR into its parent ticket branch). Never into `{{mrTarget}}`, `dev`, `develop`, `stage`, `staging`, `prod`, `production`, `main` or `master`.
34
- - The forge: opening the MR for that branch and reacting on its review threads (`eyes` picked up, `thumbsup` fixed, `question` needs an answer). Never a reply, review or comment on the MR: the developer writes MR text by hand. Your `thumbsup` or `question` on a thread's last comment is what tells `watch-pr.mjs` it is handled; `eyes` alone stays pending.
34
+ - The forge: opening the MR for that branch, reacting on its review threads (`eyes` picked up, `thumbsup` fixed, `question` needs an answer) and resolving a thread the fix addressed. Never a comment, reply, review or verdict note on the MR (a hook blocks them): the developer writes MR text by hand, so replies are drafts the user posts. Your `thumbsup` or `question` on a thread's last comment is what tells `babysit.mjs` it is handled; `eyes` alone stays pending.
35
35
  - Slack: nothing. Announcing the MR is the forge integration's job, so ship never drafts a notice.
36
36
 
37
37
  ## Do what the work needs, inside the worktree
@@ -69,6 +69,7 @@ Every run starts here, so a run that died midway resumes where it stopped. Read
69
69
 
70
70
  | State | Next step |
71
71
  | ------------------------------------------- | ------------------------------------------- |
72
+ | `ship-slice` sub-tasks, or a Plan listing slices | 1b. The next sub-task |
72
73
  | No Plan comment on the ticket | 1. Plan |
73
74
  | Plan, no branch | 2. Build |
74
75
  | Branch, no MR | 3. Test, 4. Review, 4b. Evidence, 5. Open the MR |
@@ -77,16 +78,28 @@ Every run starts here, so a run that died midway resumes where it stopped. Read
77
78
  | MR open, CI running, or green and answered | 7. Ready for review |
78
79
  | MR merged or closed | Report it, do nothing |
79
80
 
80
- A comment added to the ticket after the Plan comment that changes scope sends you back to 1.
81
+ A comment added to the ticket after the Plan comment that changes scope sends you back to 1. On a ticket with `ship-slice` sub-tasks it is a blocker comment instead: changing the split is a person's call.
81
82
 
82
83
  ### 1. Plan
83
84
 
84
- Start `planner` with the ticket key. It returns either `Asked:` with questions, or the plan.
85
+ Start `planner` with the ticket key. It returns `Asked:` with questions, `Split:` with slices, or the plan.
85
86
 
86
87
  - `Asked:` -> post the questions as one comment on the ticket, report them, stop.
88
+ - `Split:` -> 1b. `--ask`: show the slices and stop for approval first. On a sub-task it never splits again (sub-tasks cannot nest): post a blocker comment that the slice is too big and the parent needs a new split, report it, stop.
87
89
  - A plan -> post it, without its Core-only section, as one comment titled "Plan" (test cases where the repo's `test-plan` skill keeps them, if it has one), move the ticket to In Progress. `--ask`: show it and stop for approval.
88
90
  - A Core-only section -> write the work order per `handoff.md` and drop that slice; ship the rest.
89
91
 
92
+ ### 1b. Sub-tasks
93
+
94
+ A split ticket is delivered through its sub-tasks, so progress lives in Jira and a fresh session resumes from it.
95
+
96
+ - Post the Plan comment first (next bullet), so the slice list exists before any sub-task. Then create one per slice under the ticket, in delivery order, each labeled `ship-slice`, in the **create-task** skill's format (the slice's title, what changes, why it is safe alone, what it depends on and how, its test cases). `ship-slice` sub-tasks already under the ticket are reused, never created again; any other sub-task (manual QA, say) is not a slice and is left alone. A resumed run creates any slice the Plan lists that has no sub-task yet. Only a `ship-slice` sub-task counts as a sub-task in this skill, and the ticket's parent (an epic) does not make it one.
97
+ - No Plan comment yet: post one titled "Plan" that lists the slices in delivery order (the `Split:` list, then the sub-task keys once created), and move the ticket to In Progress.
98
+ - Each sub-task then runs this skill from 1 as its own ticket: its own plan, branch `<type>/<sub-task key>/<slug>`, MR and transitions.
99
+ - The next one is the first sub-task in order that is not yet in Code Review or later. One that needs another's code starts once that one has an MR, and is stacked on it: its worktree branches off that branch, and 2, 4, 5, 6 and 7 use that branch in place of `{{mrTarget}}` (in 5, on GitHub open the MR with `gh stack`, on GitLab pass the parent branch as `--target-branch`); when that MR merges, rebase onto `{{mrTarget}}` and retarget. One that needs another released starts only once that one is released (merged into `{{mrTarget}}` is not released: released is the deploy marker `docs/agents/forge.md` names showing the merge commit; no evidence -> blocker comment and stop); until then report what it waits on and stop.
100
+ - One sub-task per run, in this order. First, each earlier sub-task MR that is red or has unanswered threads gets 6, ending once its fix is pushed (no 7 for it); an earlier draft sub-task MR that is green or still running goes to 7 with `--until-green`. Then, if no sub-task is left to deliver, the "None left" bullet below. Then, with three sub-task MRs open and unmerged, report that the next waits for a merge and stop. Otherwise deliver the next one, which stops at `green` in 7. The next `/ship` on the ticket, in a fresh session, starts the one after.
101
+ - None left: move the ticket to Code Review, report every sub-task MR, stop.
102
+
90
103
  ### 2. Build
91
104
 
92
105
  Add a worktree for the ticket branch off the freshly fetched `{{mrTarget}}`, per the repo's worktree rules (its own database and Redis db). Start `builder` in it with the plan. Run the **create-plugin** skill's steps through it for each overlay, adapter or page slice.
@@ -106,7 +119,7 @@ Start `tester` in the worktree with the plan's test cases, for its verify pass:
106
119
 
107
120
  ### 4. Review
108
121
 
109
- Run the **review** skill on the branch against `{{mrTarget}}`, without `--post`: its precheck, risk tier, request trace and evidence gate run before any reviewer reads the diff. Hand its reviewers the tester's AC table, mutation rows included, so they dig where testing could not reach. This is the self-review the MR is opened on: people reviewing the MR later read it by hand and do not run an AI review again, so nothing goes out that this step has not passed.
122
+ Run the **review** skill on the branch against `{{mrTarget}}`: its precheck, risk tier, request trace and evidence gate run before any reviewer reads the diff. Hand its reviewers the tester's AC table, mutation rows included, so they dig where testing could not reach. This is the self-review the MR is opened on: people reviewing the MR later read it by hand and do not run an AI review again, so nothing goes out that this step has not passed.
110
123
 
111
124
  Every finding with a fix gets fixed, whatever its severity, but only once it holds. Dedupe across reviewers, then check each yourself before anything changes: open its `file:line` and confirm the evidence on this branch. One that doesn't hold (wrong line, the code already handles it, a claim the code doesn't show) is dropped and goes to the MR description with why. A product call the ticket doesn't settle goes to `expert`, then is fixed or rides along as an open question. Send the rest to `builder` in one go, then 3 for the cases they touch and 4 again. A later round of 4 reviews only the commits since the last one and whether each sent finding is fixed. Clean means the review skill says **APPROVED** and no finding is left that holds; only then 4b.
112
125
 
@@ -130,26 +143,26 @@ Run the repo's `fix-pipeline` skill on a red pipeline or conflicts, `fix-review-
130
143
  - Each thread is checked against the code on this branch first: correct | already handled | wrong on this branch | out of scope. Only a correct one changes code; the rest get an answer.
131
144
  - A red job is reproduced locally first; `builder` fixes its cause. Never skip or loosen a test.
132
145
  - Every fix goes to `builder`. Then `tester` re-runs the cases the fix touches and leaves a test that fails without it, and 4 runs on the new commits. Then 4b records again only the ACs the fix touched and the shots of the screens it changed, joins the walkthrough again, and it replaces the old one in the MR description. Nothing is pushed untested.
133
- - Push the ticket branch without asking (a force-push only as above). React per thread instead of replying: `thumbsup` and resolve when the fix addressed it, `question` when it needs an answer or you disagree; that thread stays open and its question goes in the ticket's questions comment, the single place for open questions.
146
+ - Push the ticket branch without asking (a force-push only as above). Then draft one reply per thread in the user's voice, with what changed and the test that proves it, or why nothing changed, and print them for the user to post; never post them. React per thread too: `thumbsup` and resolve when the fix addressed it, `question` when it needs an answer or you disagree (that thread stays open and its question goes in the ticket's questions comment, the single place for open questions). Record every thread you handled (a drafted reply, or a bot note that needs none) as the babysit skill does, in `.claude/reviews/<branch with / as +>.replies.md` and `.drafted.json`, so the watcher and a resumed run skip it.
134
147
 
135
148
  Then 7.
136
149
 
137
150
  ### 7. Ready for review
138
151
 
139
- Start `node <this skill's folder>/watch-pr.mjs <branch> --until-green` as a background command, never a sleep loop in the session. It prints one line and exits when there is work:
152
+ Run the **babysit** skill's loop on the MR, with step 6 above as its fix rules: start `node <babysit skill's folder>/babysit.mjs <branch> --until-green` as a background command, never a sleep loop in the session. It prints one line and exits when there is work:
140
153
 
141
154
  - `failed` or `conflicts` -> 6, then watch again. Still red after three fixes -> blocker comment, report, stop. Ten fix rounds in total after the push (pipeline and threads together) and the MR still is not ready -> blocker comment, report, stop: a person takes it from there.
142
155
  - `threads <ids>` (unanswered for two checks in a row, from a person or a bot) -> 6 for those, then watch again. A thread the forge's AI review opens is a blocker it found on this head: it counts like a person's.
143
- - `green` -> check the MR is ready (below). Ready: mark the draft ready for review (`docs/agents/forge.md`), report "Ready for review:" and the MR URL, then watch again without `--until-green`. Not ready: it stays a draft. Fix what is yours (the description, an unanswered thread) and watch again with `--until-green`; what only a person can supply (an UNCHECKED row) -> report "Draft, missing:" and the list, stop.
144
- - `merged` or `closed` -> report it, drop the worktree's database and Redis db, stop. `error ...` -> report it, stop.
156
+ - `green` -> check the MR is ready (below). Ready: mark the draft ready for review (`docs/agents/forge.md`), report "Ready for review:" and the MR URL, then watch again without `--until-green`. A `ship-slice` sub-task stops here instead. Not ready: it stays a draft. Fix what is yours (the description, an unanswered thread) and watch again with `--until-green`; what only a person can supply (an UNCHECKED row) -> report "Draft, missing:" and the list, stop.
157
+ - `merged` or `closed` -> report it, drop the worktree's database and Redis db, stop. `watched` (another session has it) or `error ...` -> report it, stop.
145
158
 
146
- Ready means: the pipeline on the last commit is green, no conflicts with `{{mrTarget}}`, every thread has an answer, no money, KYC, responsible-gambling or authz case or mutation row is UNCHECKED or SURVIVED, and the description holds the AC table, the screenshots and the UNCHECKED rows.
159
+ Ready means: the pipeline on the last commit is green, no conflicts with `{{mrTarget}}`, every thread has an answer or a drafted reply listed in the report as waiting for the user to post, no money, KYC, responsible-gambling or authz case or mutation row is UNCHECKED or SURVIVED, and the description holds the AC table, the screenshots and the UNCHECKED rows.
147
160
 
148
- Keep watching until the MR merges or closes, for as long as the session lives. You never merge it: who approves and who merges is in `docs/agents/forge.md`. A caller that says it watches the MR itself (a headless run) gets the report at `green`, and you stop there; it brings the ticket back through `/ship {{trackerKey}}-XXX`, which lands on 6.
161
+ Keep watching until the MR merges or closes, for as long as the session lives (a `ship-slice` sub-task stops at `green`). You never merge it: who approves and who merges is in `docs/agents/forge.md`. A caller that says it watches the MR itself (a headless run) gets the report at `green`, and you stop there; it brings the ticket back through `/ship {{trackerKey}}-XXX`, which lands on 6.
149
162
 
150
163
  ## Rules
151
164
 
152
- - One ticket, one branch, one MR.
165
+ - One ticket or sub-task, one branch, one MR.
153
166
  - You edit no code, commit nothing and run no gate yourself, however small the fix: every fix goes to `builder`. Code changed after 3 means 3 runs again for the cases it touches, and 4 for the new commits.
154
167
  - A subagent that stops short (no gate output, uncommitted work) goes back to it once, never finished by you.
155
168
  - Never claim a step passed without its output: the gate from HEAD, the AC table, the review findings.
@@ -24,16 +24,38 @@ You plan one ticket for a downstream igaming built on `@openora/*`. You change n
24
24
 
25
25
  Per AC, before planning: empty and error states, authz negatives, concurrency and idempotency, jurisdiction and currency variants, migration impact on existing rows, every screen that shows the same data. Each unknown becomes a stated assumption in the plan or a question - none stay silent. Ask only what changes what gets built; default the rest and say so.
26
26
 
27
+ ## Split a big ticket
28
+
29
+ One MR is one step a person can review in one sitting and revert on its own. Split when any of these holds:
30
+
31
+ - more than 15 test cases, or more than about 400 changed lines;
32
+ - a schema, event or contract change together with the code that stops using the old shape;
33
+ - work in more than one repo, or in more than one deployable process;
34
+ - a money, KYC, responsible-gambling or authz change mixed with anything else.
35
+
36
+ Every slice:
37
+
38
+ - ships alone: merged and deployed by itself, every path it does not switch works as before, and reverting it alone is safe;
39
+ - expands before it contracts: add the column, table, event or port first, move the readers in a later slice, drop the old shape last; a new path stays off behind config until the slice that switches it on;
40
+ - carries its own test cases, with one per existing path it must not break;
41
+ - names the slices it depends on, and for each whether it needs that slice's code (stacked on it) or needs it released first (waits for its release: merged into `{{mrTarget}}` is not released).
42
+
43
+ ## Plan one slice
44
+
45
+ Input that is one slice of a split (a sub-task labeled `ship-slice`, or a slice ship says it hands over): plan that slice as written; a later comment on the slice itself still wins. Check it against the current code first, since other work may have landed since the split, and fit the plan to what is there; never add scope and never reply `Split:`. A slice that no longer holds (its work already landed, or it is now too big for one MR) gets `Asked:` saying so: changing the split is a person's call.
46
+
27
47
  ## Reply
28
48
 
29
49
  Either, on its own first line, `Asked:` and the questions, batched, each with the options you see.
30
50
 
51
+ Or, for a ticket that needs splitting, `Split:` on its own first line, then the slices in delivery order, each with a title (imperative, under 80 characters), what changes, why it is safe alone, what it depends on and how, its size (S, M or L) and its test cases. At least two slices; one is a plan. Nothing more: each slice gets its own plan when ship reaches it, and that plan never splits again.
52
+
31
53
  Or the plan:
32
54
 
33
55
  - **Goal** - one line. **AC** - quoted from the ticket; missing or vague AC drafted by you and marked proposed.
34
56
  - **Decisions** - each with its source (who, where, date), so nobody reopens them.
35
57
  - **Plan** - a `- [ ]` checklist: what changes where (file or module), the simplest approach that meets every case, what is left out.
36
- - **Test cases** - every AC first, then one per real risk beyond the ticket: code that calls what changes, boundaries, bad or empty data, permissions, double submit and concurrency, stored data, other screens showing the same value. Each with its priority (P1 blocks money, KYC, RG or play; P2 works with a workaround; P3 cosmetic), how it is checked (unit, API E2E, browser E2E, manual) and what the tester sees. 5-15 cases; more means the ticket needs splitting - say so. If the repo has a `test-plan` skill, write the cases in its format.
58
+ - **Test cases** - every AC first, then one per real risk beyond the ticket: code that calls what changes, boundaries, bad or empty data, permissions, double submit and concurrency, stored data, other screens showing the same value. Each with its priority (P1 blocks money, KYC, RG or play; P2 works with a workaround; P3 cosmetic), how it is checked (unit, API E2E, browser E2E, manual) and what the tester sees. 5-15 cases (a slice of a split ticket may have fewer); more means the ticket needs splitting: reply `Split:` instead (for one slice, `Asked:`, see above). If the repo has a `test-plan` skill, write the cases in its format.
37
59
  - **Access** - every account or session outside the repo the work needs (a cloud CLI profile, a provider's dashboard or sandbox API, a third-party console), each with what it is for, a read-only check that proves the session works (`aws sts get-caller-identity --profile <p>`, a CLI's `auth status`, a dashboard page that shows you logged in) and the login a person runs. Ask for the narrowest one that does the job, a sandbox or dev account over prod. "None" when the repo and its local stack are enough.
38
60
  - **Core-only** - last, and only if a slice can only be done in `@openora/*` core: the slice and why the outside-in path fails. The orchestrator keeps this section out of the ticket.
39
61
 
@@ -1,8 +1,8 @@
1
1
  # Code forge: GitHub
2
2
 
3
- Code review for `{{gitRemotePath}}` happens on GitHub pull requests, driven by the [`gh`](https://cli.github.com) CLI. Every skill that opens, reads, or comments on a pull request reads this file instead of hardcoding commands, so a repo on a different forge rewrites this one file and the skills keep working.
3
+ Code review for `{{gitRemotePath}}` happens on GitHub pull requests, driven by the [`gh`](https://cli.github.com) CLI. Every skill that opens or reads a pull request reads this file instead of hardcoding commands, so a repo on a different forge rewrites this one file and the skills keep working.
4
4
 
5
- Swapping forge: keep the headings below and replace the commands. For GitLab that is `glab`, "merge request" for "pull request", `glab mr create --draft`, `glab mr update <n> --ready`, `glab mr view/diff/note`, and `glab api "projects/<path-with-%2F>/merge_requests/<n>/discussions"` with a `position` object for inline comments.
5
+ Swapping forge: keep the headings below and replace the commands. For GitLab that is `glab`, "merge request" for "pull request", `glab mr create --draft`, `glab mr update <n> --ready`, `glab mr view/diff`, `glab api "projects/<path-with-%2F>/merge_requests/<n>/discussions"` to read threads, and `glab api -X PUT ".../discussions/<id>" -f resolved=true` to resolve one.
6
6
 
7
7
  ## Coordinates
8
8
 
@@ -14,6 +14,7 @@ Swapping forge: keep the headings below and replace the commands. For GitLab tha
14
14
  - Topic branch (`feat/*`, `fix/*`, `{{trackerKey}}-*`) -> `{{mrTarget}}`.
15
15
  - A repo that promotes through environment branches adds them here (for example `{{mrTarget}}` -> `stage` -> `prod`) and never opens a PR straight from a topic branch to the last one.
16
16
  - If the current branch is not listed, target `{{mrTarget}}`.
17
+ - Released: a change counts as released only when this repo's deploy marker shows its merge commit (name the marker here: the tag, deploy job or environment version that ships `{{mrTarget}}`). Merged is not released.
17
18
 
18
19
  ## Open a pull request
19
20
 
@@ -38,19 +39,18 @@ Reuse an open PR for the same head -> base instead of opening a duplicate: `gh p
38
39
 
39
40
  `gh` has no command to upload an image. Open the PR in the browser and drag the one walkthrough video into the description; GitHub inserts the embed markdown, keep it. If a file cannot be uploaded, say in the description that it is available from the author. Never paste a local path.
40
41
 
41
- ## Inline review comments
42
+ ## Review comments
42
43
 
43
- Anchor each comment to a line of the diff on the head commit:
44
+ Agent sessions never post on a pull request: no inline comment, reply, review, or verdict note. A PreToolUse hook (`.rulesync/hooks/guard-comments.mjs`) blocks the CLI and API calls. Draft each comment as `file:line` (the NEW-file line of an added line on the head commit) plus its text, and print them for the user to post by hand.
45
+
46
+ Resolving a thread your fix addressed stays allowed:
44
47
 
45
48
  ```
46
- gh api "repos/{{gitRemotePath}}/pulls/<n>/comments" \
47
- -f body="<comment>" -f commit_id="<head-sha>" -f path="<file>" -F line=<new-line> -f side=RIGHT
49
+ gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "<thread-node-id>"}) { thread { isResolved } } }'
48
50
  ```
49
51
 
50
- Take `<head-sha>` from `gh pr view <n> --json headRefOid`. Anchor on the NEW-file line of an added line. Verify the response carries a non-null `line`; if it came back as a plain issue comment, delete it and retry rather than leaving an unanchored note. Post the verdict itself as one summary comment: `gh pr comment <n> --body "<one sentence>"`.
51
-
52
52
  ## Rules
53
53
 
54
54
  - Never push without an explicit per-action confirmation from the user.
55
55
  - Never merge a pull request unless the user asks for that exact action.
56
- - Never resolve someone else's review thread.
56
+ - Resolve only a thread your fix addressed; a question or a disagreement stays open for the reviewer.
@@ -38,5 +38,5 @@ Run the protocol above and distill: goal in one line, AC quoted as bullets, deci
38
38
 
39
39
  - Never comment on, transition, or edit a Jira issue or Confluence page unless the user asks for that exact write. Reading authorizes nothing.
40
40
  - The one standing exception: `/ship {{trackerKey}}-<n>` is the ask for its own writes on that ticket - the Plan, questions, blocker and MR-link comments, the test cases where the `test-plan` skill keeps them, and the transitions to In Progress and Code Review. Nothing else.
41
- - Review comments go through `review --post`, draft-and-confirm, using the commands in `docs/agents/forge.md`.
41
+ - Review comments and thread replies are drafts the user posts by hand; never post them (see "Review comments" in `docs/agents/forge.md`).
42
42
  - Slack: draft only, never send.