@muggleai/works 4.11.4 → 4.12.1

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 (96) hide show
  1. package/dist/{chunk-E52757MK.js → chunk-2DVZ2LYO.js} +5 -0
  2. package/dist/cli.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  5. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  6. package/dist/plugin/scripts/ensure-electron-app.sh +29 -4
  7. package/dist/plugin/skills/_shared/github-cli-recipes/line-comments-for-review.md +8 -0
  8. package/dist/plugin/skills/_shared/github-cli-recipes/loop-user-identity.md +9 -0
  9. package/dist/plugin/skills/_shared/github-cli-recipes/pr-edit.md +8 -0
  10. package/dist/plugin/skills/_shared/github-cli-recipes/pr-metadata.md +12 -0
  11. package/dist/plugin/skills/_shared/github-cli-recipes/push-to-branch.md +10 -0
  12. package/dist/plugin/skills/_shared/github-cli-recipes/reply-line-comment.md +10 -0
  13. package/dist/plugin/skills/_shared/github-cli-recipes/submitted-reviews.md +15 -0
  14. package/dist/plugin/skills/_shared/github-cli-recipes/top-level-comment.md +7 -0
  15. package/dist/plugin/skills/_shared/github-cli-recipes/unresolved-threads.md +33 -0
  16. package/dist/plugin/skills/_shared/github-cli-recipes/verify-working-tree.md +17 -0
  17. package/dist/plugin/skills/_shared/github-cli-recipes.md +20 -0
  18. package/dist/plugin/skills/_shared/pr-followup-helpers/allow-list.md +55 -0
  19. package/dist/plugin/skills/_shared/pr-followup-helpers/classify.md +63 -0
  20. package/dist/plugin/skills/_shared/pr-followup-helpers/reply-routing.md +40 -0
  21. package/dist/plugin/skills/_shared/pr-followup-helpers.md +8 -146
  22. package/dist/plugin/skills/_shared/telemetry-events/muggle-do-cycle.md +26 -0
  23. package/dist/plugin/skills/_shared/telemetry-events/muggle-do-escalation.md +19 -0
  24. package/dist/plugin/skills/_shared/telemetry-events/muggle-do-resolve-reminder.md +19 -0
  25. package/dist/plugin/skills/_shared/telemetry-events/pr-followup-bootstrap.md +20 -0
  26. package/dist/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +23 -0
  27. package/dist/plugin/skills/_shared/telemetry-events.md +15 -0
  28. package/dist/plugin/skills/do/address-reviews.md +137 -0
  29. package/dist/plugin/skills/do/build.md +5 -5
  30. package/dist/plugin/skills/do/open-prs/forward.md +80 -0
  31. package/dist/plugin/skills/do/open-prs/update.md +54 -0
  32. package/dist/plugin/skills/do/open-prs.md +6 -102
  33. package/dist/plugin/skills/do/per-comment-replies.md +61 -0
  34. package/dist/plugin/skills/do/resolve-reminder.md +70 -0
  35. package/dist/plugin/skills/muggle-do/SKILL.md +41 -45
  36. package/dist/plugin/skills/muggle-pr-followup/CLAUDE.md +25 -0
  37. package/dist/plugin/skills/muggle-pr-followup/SKILL.md +21 -43
  38. package/dist/plugin/skills/muggle-pr-followup/bootstrap.md +88 -0
  39. package/dist/plugin/skills/muggle-pr-followup/contract.md +44 -161
  40. package/dist/plugin/skills/muggle-pr-followup/output-templates/bootstrap.md +42 -0
  41. package/dist/plugin/skills/muggle-pr-followup/output-templates/escalation.md +32 -0
  42. package/dist/plugin/skills/muggle-pr-followup/output-templates/help.md +17 -0
  43. package/dist/plugin/skills/muggle-pr-followup/output-templates/inline-reply.md +17 -0
  44. package/dist/plugin/skills/muggle-pr-followup/output-templates/resolve-reminder.md +12 -0
  45. package/dist/plugin/skills/muggle-pr-followup/output-templates/watcher-log.md +21 -0
  46. package/dist/plugin/skills/muggle-pr-followup/output-templates.md +14 -0
  47. package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +104 -0
  48. package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +3 -3
  49. package/dist/release-manifest.json +4 -4
  50. package/package.json +106 -106
  51. package/plugin/.claude-plugin/plugin.json +1 -1
  52. package/plugin/.cursor-plugin/plugin.json +1 -1
  53. package/plugin/scripts/ensure-electron-app.sh +29 -4
  54. package/plugin/skills/_shared/github-cli-recipes/line-comments-for-review.md +8 -0
  55. package/plugin/skills/_shared/github-cli-recipes/loop-user-identity.md +9 -0
  56. package/plugin/skills/_shared/github-cli-recipes/pr-edit.md +8 -0
  57. package/plugin/skills/_shared/github-cli-recipes/pr-metadata.md +12 -0
  58. package/plugin/skills/_shared/github-cli-recipes/push-to-branch.md +10 -0
  59. package/plugin/skills/_shared/github-cli-recipes/reply-line-comment.md +10 -0
  60. package/plugin/skills/_shared/github-cli-recipes/submitted-reviews.md +15 -0
  61. package/plugin/skills/_shared/github-cli-recipes/top-level-comment.md +7 -0
  62. package/plugin/skills/_shared/github-cli-recipes/unresolved-threads.md +33 -0
  63. package/plugin/skills/_shared/github-cli-recipes/verify-working-tree.md +17 -0
  64. package/plugin/skills/_shared/github-cli-recipes.md +20 -0
  65. package/plugin/skills/_shared/pr-followup-helpers/allow-list.md +55 -0
  66. package/plugin/skills/_shared/pr-followup-helpers/classify.md +63 -0
  67. package/plugin/skills/_shared/pr-followup-helpers/reply-routing.md +40 -0
  68. package/plugin/skills/_shared/pr-followup-helpers.md +8 -146
  69. package/plugin/skills/_shared/telemetry-events/muggle-do-cycle.md +26 -0
  70. package/plugin/skills/_shared/telemetry-events/muggle-do-escalation.md +19 -0
  71. package/plugin/skills/_shared/telemetry-events/muggle-do-resolve-reminder.md +19 -0
  72. package/plugin/skills/_shared/telemetry-events/pr-followup-bootstrap.md +20 -0
  73. package/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +23 -0
  74. package/plugin/skills/_shared/telemetry-events.md +15 -0
  75. package/plugin/skills/do/address-reviews.md +137 -0
  76. package/plugin/skills/do/build.md +5 -5
  77. package/plugin/skills/do/open-prs/forward.md +80 -0
  78. package/plugin/skills/do/open-prs/update.md +54 -0
  79. package/plugin/skills/do/open-prs.md +6 -102
  80. package/plugin/skills/do/per-comment-replies.md +61 -0
  81. package/plugin/skills/do/resolve-reminder.md +70 -0
  82. package/plugin/skills/muggle-do/SKILL.md +41 -45
  83. package/plugin/skills/muggle-pr-followup/CLAUDE.md +25 -0
  84. package/plugin/skills/muggle-pr-followup/SKILL.md +21 -43
  85. package/plugin/skills/muggle-pr-followup/bootstrap.md +88 -0
  86. package/plugin/skills/muggle-pr-followup/contract.md +44 -161
  87. package/plugin/skills/muggle-pr-followup/output-templates/bootstrap.md +42 -0
  88. package/plugin/skills/muggle-pr-followup/output-templates/escalation.md +32 -0
  89. package/plugin/skills/muggle-pr-followup/output-templates/help.md +17 -0
  90. package/plugin/skills/muggle-pr-followup/output-templates/inline-reply.md +17 -0
  91. package/plugin/skills/muggle-pr-followup/output-templates/resolve-reminder.md +12 -0
  92. package/plugin/skills/muggle-pr-followup/output-templates/watcher-log.md +21 -0
  93. package/plugin/skills/muggle-pr-followup/output-templates.md +14 -0
  94. package/plugin/skills/muggle-pr-followup/state-schemas.md +104 -0
  95. package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +3 -3
  96. package/scripts/postinstall.mjs +36 -5
@@ -0,0 +1,33 @@
1
+ # Unresolved comment threads
2
+
3
+ For the resolve-reminder stage. GraphQL only — REST does not expose `isResolved`.
4
+
5
+ ```bash
6
+ gh api graphql -F owner=<owner> -F name=<repo> -F number=<n> -f query='
7
+ query($owner: String!, $name: String!, $number: Int!) {
8
+ repository(owner: $owner, name: $name) {
9
+ pullRequest(number: $number) {
10
+ reviewThreads(first: 100) {
11
+ nodes {
12
+ id
13
+ isResolved
14
+ comments(first: 100) {
15
+ nodes {
16
+ databaseId
17
+ author { login }
18
+ body
19
+ createdAt
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }'
27
+ ```
28
+
29
+ Filter client-side to `isResolved == false`. Classify each thread by inspecting its comments:
30
+
31
+ - **Addressed by loop** — at least one comment authored by the loop user citing a SHA in `last_seen.pushed_shas[]`.
32
+ - **Addressed by human** — at least one comment authored by a non-loop user after the original, and no addressed-by-loop signal.
33
+ - **Not addressed** — otherwise.
@@ -0,0 +1,17 @@
1
+ # Verify the working tree matches the PR
2
+
3
+ Bootstrap's environment check.
4
+
5
+ ```bash
6
+ git rev-parse --show-toplevel # cwd is a git working tree
7
+ git remote get-url origin # remote matches <owner>/<repo>
8
+ git rev-parse --abbrev-ref HEAD # current branch matches PR's headRefName
9
+ ```
10
+
11
+ Accept any remote URL form for `<owner>/<repo>` (with or without trailing `.git`):
12
+
13
+ - `https://github.com/<owner>/<repo>`
14
+ - `git@github.com:<owner>/<repo>`
15
+ - `ssh://git@github.com/<owner>/<repo>`
16
+
17
+ Any mismatch → bootstrap aborts using the wrong-checkout template in [`../../muggle-pr-followup/output-templates/bootstrap.md`](../../muggle-pr-followup/output-templates/bootstrap.md).
@@ -0,0 +1,20 @@
1
+ # GitHub CLI Recipes
2
+
3
+ Reusable `gh` / `git` snippets used by `muggle-pr-followup` (watcher + bootstrap) and `/muggle-do` (address-reviews + open-prs). Each recipe is one file — load only what you need.
4
+
5
+ Skills assume a working `gh auth status`. Auth errors surface verbatim from `gh`.
6
+
7
+ ## Index
8
+
9
+ | Recipe | Use case |
10
+ | :----- | :------- |
11
+ | [`pr-metadata`](github-cli-recipes/pr-metadata.md) | Snapshot PR state, head SHA, branch — watcher + bootstrap. |
12
+ | [`submitted-reviews`](github-cli-recipes/submitted-reviews.md) | Fetch reviews past a cursor — watcher's poll. |
13
+ | [`line-comments-for-review`](github-cli-recipes/line-comments-for-review.md) | Pull a review's line comments — `/muggle-do` per-comment routing. |
14
+ | [`unresolved-threads`](github-cli-recipes/unresolved-threads.md) | GraphQL fetch of unresolved comment threads — resolve-reminder. |
15
+ | [`reply-line-comment`](github-cli-recipes/reply-line-comment.md) | POST a threaded reply on a line comment. |
16
+ | [`top-level-comment`](github-cli-recipes/top-level-comment.md) | POST a top-level PR comment — resolve-reminder + overflow. |
17
+ | [`push-to-branch`](github-cli-recipes/push-to-branch.md) | Push + capture new SHA after address-reviews work. |
18
+ | [`verify-working-tree`](github-cli-recipes/verify-working-tree.md) | Three checks bootstrap runs before seeding state. |
19
+ | [`pr-edit`](github-cli-recipes/pr-edit.md) | Refresh title or body when address-reviews mode flips state. |
20
+ | [`loop-user-identity`](github-cli-recipes/loop-user-identity.md) | Resolve the GitHub login of the loop user. |
@@ -0,0 +1,55 @@
1
+ # Reviewer allow-list
2
+
3
+ The address-reviews flow only acts on reviews submitted by users in the **allow-list** = (requested reviewers ∪ CODEOWNERS ∪ {PR author}) − bots. Re-resolve every invocation — never cache across cycles.
4
+
5
+ The PR author is implicitly a valid reviewer: in single-account workflows, the human running the agent and the PR's author are the same identity, and the agent must honor their reviews. The agent itself never appears in the submitted-reviews list (it pushes commits and posts inline replies; it does not submit GitHub reviews), so there's no self-loop risk from including the author.
6
+
7
+ ## Step 1: requested reviewers
8
+
9
+ ```bash
10
+ gh pr view <number> --repo <owner>/<repo> --json reviewRequests,author
11
+ ```
12
+
13
+ `reviewRequests` is an array of `{ login? , slug? }`. User reviewers have `login`; team reviewers have `slug` (and `name`). Expand teams to member logins:
14
+
15
+ ```bash
16
+ gh api orgs/<org>/teams/<slug>/members --jq '.[].login'
17
+ ```
18
+
19
+ Record `prAuthor = author.login` for the inclusion step.
20
+
21
+ ## Step 2: CODEOWNERS
22
+
23
+ Look for the file in this order — first hit wins:
24
+
25
+ 1. `.github/CODEOWNERS`
26
+ 2. `CODEOWNERS`
27
+ 3. `docs/CODEOWNERS`
28
+
29
+ Read from the PR's **head branch** (not master) — a PR that adds CODEOWNERS should be informational while open, load-bearing once merged:
30
+
31
+ ```bash
32
+ gh api repos/<owner>/<repo>/contents/.github/CODEOWNERS?ref=<head_sha> --jq '.content' | base64 -d
33
+ ```
34
+
35
+ Parse line-by-line:
36
+
37
+ - Skip blank lines and lines starting with `#`.
38
+ - Each line is `<pattern> <owner1> <owner2> ...`.
39
+ - Owners are either `@user` or `@org/team`. Strip the leading `@`.
40
+ - Collect the union of all owners across all lines (don't match patterns against changed files — repo-level membership is enough).
41
+
42
+ Expand `@org/team` to member logins via the orgs/teams/members endpoint.
43
+
44
+ If no CODEOWNERS file exists in any location, the CODEOWNERS contribution is empty. Don't fail.
45
+
46
+ ## Step 3: filter
47
+
48
+ Allow-list = (requested reviewers ∪ CODEOWNERS ∪ `{prAuthor}`) − bot logins.
49
+
50
+ Bot logins:
51
+
52
+ - Ends with `[bot]` (e.g. `dependabot[bot]`)
53
+ - Exact match: `dependabot`, `github-actions`, `renovate`, `mergify`
54
+
55
+ A comment author not in the allow-list is silently ignored — do not reply, do not address.
@@ -0,0 +1,63 @@
1
+ # Classify
2
+
3
+ Classify the **review as a unit** — but reply per line comment (threaded), not per review.
4
+
5
+ ## Pre-check: self-loop filter
6
+
7
+ GitHub auto-creates a synthetic review every time the agent posts `POST /comments/<id>/replies`. That review has the loop user as author, an empty body, and contains only the agent's own reply comments (`in_reply_to_id != null`). It carries no reviewer intent and must not trigger another cycle.
8
+
9
+ A review is a **self-loop** iff:
10
+
11
+ - `body` is empty, AND
12
+ - every line comment under it has `in_reply_to_id != null`
13
+
14
+ Self-loops bypass the actionable/ambiguous decision entirely. Action: advance the cursor silently. No push, no reply, no resolve-reminder, no escalation, no entry in `escalated_review_ids`. Telemetry: emit one `cycle` event with `outcome: "self-loop-skip"`.
15
+
16
+ Only reviews that survive the self-loop check proceed to classify below.
17
+
18
+ ## Actionable vs ambiguous
19
+
20
+ | Class | Signal | Action |
21
+ | :---- | :----- | :----- |
22
+ | **actionable** | Review names at least one concrete change or asks an answerable question. Soft phrasing counts when there's a concrete referent. | Treat as amended requirements; run **one** implementation cycle for the whole review; reply **threaded per line comment** referencing the new SHA (top-level only when the review is body-only). |
23
+ | **ambiguous** | No actionable signal — pure vibes, contradictory, or depends on knowledge the loop can't access. | Escalate once with two interpretations; pause the PR. |
24
+
25
+ Default to **actionable**. CI catches wrong attempts; reviewers correct on the next round. Escalation is a round-trip with an absent user — reserve it.
26
+
27
+ Reply shape (all replies for one review reference the same SHA):
28
+
29
+ - **threaded** (default): `Done in <sha> — <attribution>. (Review #<review_id>, cycle <status>.)`
30
+ - **top-level** (fallback, body-only reviews): `Re: review #<review_id> — addressed in <sha>, cycle <status>.`
31
+ - **ambiguous**: no bot reply.
32
+
33
+ ## Worked examples — Actionable
34
+
35
+ | Review (summarized) | Why actionable |
36
+ | :------------------ | :------------- |
37
+ | 3 comments: "rename `fooBar` to `foo_bar`", "use `const` here", "fix this typo" | Three concrete edits |
38
+ | 1 comment: "could the procedure be simpler?" | Soft-phrased but the intent is clear — simplify |
39
+ | Review body: "Two things: extract validation into a helper, add a null check before the lookup." + 0 line comments | Two concrete directives in the body |
40
+ | 4 comments: "why this approach?", "is this called from X?", "does this need to handle empty array?", "what's the perf here?" | All questions, each answerable |
41
+ | 1 comment: "rewrite this module — the architecture doesn't match the spec" | Substantive rebuild, but direction is clear |
42
+ | 1 comment: "I'd lean toward the bar.ts pattern" | Concrete referent (bar.ts) — apply that pattern |
43
+
44
+ ## Worked examples — Ambiguous
45
+
46
+ | Review (summarized) | Why ambiguous |
47
+ | :------------------ | :------------ |
48
+ | 1 comment: "👀" / "hmm" / ":thinking:" | No signal at all |
49
+ | 1 comment: "this is wrong" with no target or direction | Asserts a problem but doesn't propose a fix |
50
+ | 2 comments: "use X" + "but actually don't use X" | Self-contradicting |
51
+ | 1 comment: "we discussed this offline — please address" | References context the loop doesn't have |
52
+ | 1 comment: "won't this break the prod migration we did last week?" | Implicit change request gated on knowledge the loop can't access |
53
+ | Mixed: 2 concrete directives + 1 "rethink the whole approach" | The "rethink" subverts the others; escalate to confirm scope |
54
+
55
+ Escalate per the caller's procedure (add the review id to the cursor's escalated set, emit one terminal message, pause the PR).
56
+
57
+ ## Borderline rule
58
+
59
+ If you can paraphrase the review's intent as **"do X"** (X concrete) → actionable. Pick the best interpretation; dispatch.
60
+
61
+ If you can only paraphrase as **"the reviewer is dissatisfied but I can't tell with what"** → ambiguous.
62
+
63
+ Mixed ("3 concrete + 1 dissatisfaction") usually splits: action the concrete; ask about the dissatisfaction in the reply summary. Pure ambiguity means *nothing* in the review is actionable.
@@ -0,0 +1,40 @@
1
+ # Reply routing
2
+
3
+ GitHub's PR APIs are not uniform across comment types. Route by parent type.
4
+
5
+ ## Line-level review comment (most common)
6
+
7
+ A comment attached to a specific file:line that belongs to a review thread.
8
+
9
+ ```bash
10
+ gh api \
11
+ --method POST \
12
+ -H "Accept: application/vnd.github+json" \
13
+ /repos/<owner>/<repo>/pulls/<number>/comments/<comment_id>/replies \
14
+ -f body="Done in $(git rev-parse --short HEAD) — renamed \`fooBar\` to \`foo_bar\`."
15
+ ```
16
+
17
+ The reply lands in the same review thread with `in_reply_to_id = <comment_id>`.
18
+
19
+ ## Review body (CHANGES_REQUESTED with no inline comments)
20
+
21
+ A reviewer left a summary review with `state: CHANGES_REQUESTED` and a body, but **no** inline comments. GitHub has no "reply to review body" endpoint — post a top-level PR comment that references the review:
22
+
23
+ ```bash
24
+ gh pr comment <number> --repo <owner>/<repo> --body "Re: review #<review_id> — done in $(git rev-parse --short HEAD)."
25
+ ```
26
+
27
+ ## Failing CI check
28
+
29
+ No reply. The fix commit IS the response. Include the failing check name in the commit subject:
30
+
31
+ ```
32
+ fix(ci): typecheck — narrow type of foo
33
+ fix(ci): lint — remove unused import
34
+ ```
35
+
36
+ ## Never
37
+
38
+ - Never post a top-level comment in reply to a line-level comment. It loses thread context.
39
+ - Never `gh pr review --comment` for replies — that endpoint is for *new* reviews.
40
+ - Never reply twice to the same comment. The cursor in `last_seen.json` is the only re-entry guard; advance it after every reply.
@@ -1,151 +1,13 @@
1
1
  # PR follow-up helpers
2
2
 
3
- Generic operational guidance for running a PR-comment follow-up loop on GitHub: reviewer allow-list resolution, reply routing across the different comment endpoints, and a classification rule for reviewer comments with worked examples and a borderline test. Caller-agnostic — any loop that picks one comment per tick and decides what to do with it can drive off this doc.
3
+ Generic operational guidance for PR-review follow-up. Caller-agnostic — the watcher fetches reviews, the caller (today: `/muggle-do` in address-reviews mode) reads these files to classify and decide what to do.
4
4
 
5
- The classification produces an **action shape** (in-place change, deep-cycle through the caller's implementation pipeline, reply only, escalate, etc.) — the caller maps each shape to its specific routing (which stage to dispatch, which terminal-message template to use, which reply endpoint to hit).
5
+ Each section is its own file — load only what the current step needs.
6
6
 
7
- ## Resolving the reviewer allow-list
7
+ ## Index
8
8
 
9
- Stage 8 only acts on comments authored by users in the **allow-list** = (requested reviewers ∪ CODEOWNERS) − bots − PR author. Re-resolve every tick (decision 9 in the design doc).
10
-
11
- ### Step 1: requested reviewers
12
-
13
- ```bash
14
- gh pr view <number> --repo <owner>/<repo> --json reviewRequests,author
15
- ```
16
-
17
- `reviewRequests` is an array of `{ login? , slug? }`. User reviewers have `login`; team reviewers have `slug` (and `name`). Expand teams to member logins:
18
-
19
- ```bash
20
- gh api orgs/<org>/teams/<slug>/members --jq '.[].login'
21
- ```
22
-
23
- Record `prAuthor = author.login` for the exclusion step.
24
-
25
- ### Step 2: CODEOWNERS
26
-
27
- Look for the file in this order — first hit wins:
28
-
29
- 1. `.github/CODEOWNERS`
30
- 2. `CODEOWNERS`
31
- 3. `docs/CODEOWNERS`
32
-
33
- Read from the PR's **head branch** (not master), because a PR that adds CODEOWNERS should be allowed to take effect once merged but is informational while open. In practice this means:
34
-
35
- ```bash
36
- gh api repos/<owner>/<repo>/contents/.github/CODEOWNERS?ref=<head_sha> --jq '.content' | base64 -d
37
- ```
38
-
39
- Parse line-by-line:
40
-
41
- - Skip blank lines and lines starting with `#`.
42
- - Each line is `<pattern> <owner1> <owner2> ...`.
43
- - Owners are either `@user` or `@org/team`. Strip the leading `@`.
44
- - For our purposes we don't need to match `<pattern>` against changed files — CODEOWNERS membership for the *repo* is enough. Collect the union of all owners across all lines.
45
-
46
- Expand `@org/team` to member logins via the orgs/teams/members endpoint (same as Step 1).
47
-
48
- If no CODEOWNERS file exists in any of the three locations, the CODEOWNERS contribution is empty. Don't fail.
49
-
50
- ### Step 3: filter
51
-
52
- Allow-list = (requested reviewers ∪ CODEOWNERS) − `{prAuthor}` − bot logins.
53
-
54
- Bot logins are any login matching:
55
-
56
- - Ends with `[bot]` (e.g. `dependabot[bot]`)
57
- - Exact match in the standard list: `dependabot`, `github-actions`, `renovate`, `mergify`
58
-
59
- A comment author not in the allow-list is silently ignored — do not reply, do not address.
60
-
61
- ## Reply routing
62
-
63
- GitHub's PR APIs are not uniform across comment types. Route by parent type.
64
-
65
- ### Line-level review comment
66
-
67
- A comment attached to a specific file:line that belongs to a review thread. This is the **most common** path.
68
-
69
- ```bash
70
- gh api \
71
- --method POST \
72
- -H "Accept: application/vnd.github+json" \
73
- /repos/<owner>/<repo>/pulls/<number>/comments/<comment_id>/replies \
74
- -f body="Done in $(git rev-parse --short HEAD) — renamed \`fooBar\` to \`foo_bar\`."
75
- ```
76
-
77
- The reply lands in the same review thread. The reply itself becomes a new line-level comment with `in_reply_to_id = <comment_id>`.
78
-
79
- ### Review body (CHANGES_REQUESTED with no inline comments)
80
-
81
- A reviewer left a summary review with `state: CHANGES_REQUESTED` and a body, but **no** inline comments. GitHub has no "reply to review body" endpoint — post a top-level PR comment that references the review:
82
-
83
- ```bash
84
- gh pr comment <number> --repo <owner>/<repo> --body "Re: review #<review_id> — done in $(git rev-parse --short HEAD)."
85
- ```
86
-
87
- ### Failing CI check
88
-
89
- No reply. The fix commit IS the response. Include the failing check name in the commit subject so the connection is obvious in `git log`:
90
-
91
- ```
92
- fix(ci): typecheck — narrow type of foo
93
- fix(ci): lint — remove unused import
94
- ```
95
-
96
- ### Never
97
-
98
- - Never post a top-level comment in reply to a line-level comment. It loses thread context and pollutes the PR conversation tab.
99
- - Never `gh pr review --comment` for replies — that endpoint is for *new* reviews, not replies.
100
- - Never reply twice to the same comment. The cursor in `last_seen.json` is the only re-entry guard; advance it after every reply.
101
-
102
- ## Classify
103
-
104
- Classify the **review as a unit** — but reply per line comment (threaded), not per review.
105
-
106
- | Class | Signal | Action |
107
- | :---- | :----- | :----- |
108
- | **actionable** | Review names at least one concrete change or asks an answerable question. Soft phrasing counts when there's a concrete referent. | Treat as amended requirements; run **one** implementation cycle for the whole review; reply **threaded per line comment** referencing the new SHA (top-level only when the review is body-only). |
109
- | **ambiguous** | No actionable signal — pure vibes, contradictory, or depends on knowledge the loop can't access. | Escalate once with two interpretations; pause the PR. |
110
-
111
- Default to **actionable**. CI catches wrong attempts; reviewers correct on the next round. Escalation is a round-trip with an absent user — reserve it.
112
-
113
- Reply shape (all replies for one review reference the same SHA):
114
-
115
- - **threaded** (default): `Done in <sha> — <attribution>. (Review #<review_id>, cycle <status>.)`
116
- - **top-level** (fallback, body-only reviews): `Re: review #<review_id> — addressed in <sha>, cycle <status>.`
117
- - **ambiguous**: no bot reply.
118
-
119
- ### Worked examples — Actionable reviews
120
-
121
- | Review (summarized) | Why actionable |
122
- | :------------------ | :------------- |
123
- | 3 comments: "rename `fooBar` to `foo_bar`", "use `const` here", "fix this typo" | Three concrete edits |
124
- | 1 comment: "could the procedure be simpler?" | Soft-phrased but the intent is clear — simplify; pick the best interpretation, run the cycle, reply with what was changed |
125
- | Review body: "Mostly looks good. Two things: extract the validation into a helper, and add a null check before the lookup." Plus 0 line comments. | Two concrete directives in the body |
126
- | 4 comments: "why this approach?", "is this called from X?", "does this need to handle empty array?", "what's the perf here?" | All questions but each is answerable; cycle dispatches an "answer + maybe-fix" pass and the reply summary captures each answer |
127
- | 1 comment: "rewrite this module — the architecture doesn't match the spec" | Substantive rebuild, but the direction is clear: redo the module per the spec |
128
- | 1 comment: "I'd lean toward the bar.ts pattern" | Concrete referent (bar.ts) — apply that pattern |
129
-
130
- The single review goes through one full cycle regardless of comment count.
131
-
132
- ### Worked examples — Ambiguous reviews
133
-
134
- | Review (summarized) | Why ambiguous |
135
- | :------------------ | :------------ |
136
- | 1 comment: "👀" / "hmm" / ":thinking:" | No signal at all |
137
- | 1 comment: "this is wrong" with no target or direction | Asserts a problem but doesn't propose a fix |
138
- | 2 comments: "use X" + "but actually don't use X" | Self-contradicting — can't reconcile without the reviewer |
139
- | 1 comment: "we discussed this offline — please address" | References context the loop doesn't have |
140
- | 1 comment: "won't this break the prod migration we did last week?" | Implicit change request gated on knowledge the loop can't access |
141
- | Mixed: 2 concrete directives + 1 comment "but also, rethink the whole approach" | The "rethink the whole approach" subverts the other two; escalate to confirm scope |
142
-
143
- Escalate per the caller's escalation procedure (write the review id to the cursor's escalated set, emit one terminal message with both interpretations, pause the PR until the user resolves).
144
-
145
- ### Borderline rule
146
-
147
- If you can paraphrase the review's intent as **"do X"** with X being a concrete change (one or several) — it's actionable. Pick the best interpretation and dispatch the cycle.
148
-
149
- If you can paraphrase it only as **"the reviewer is dissatisfied but I can't tell with what"** — it's ambiguous.
150
-
151
- When the review mixes both ("3 concrete directives + 1 dissatisfaction"), the safer move is usually to action the concrete directives and ask about the dissatisfaction in the reply summary. Pure ambiguity means *nothing* in the review is actionable.
9
+ | Section | Use case |
10
+ | :------ | :------- |
11
+ | [`allow-list`](pr-followup-helpers/allow-list.md) | Resolve who counts as a reviewer (requested reviewers ∪ CODEOWNERS − bots − author). |
12
+ | [`reply-routing`](pr-followup-helpers/reply-routing.md) | Pick the right reply endpoint per comment type (line, body-only, CI failure). |
13
+ | [`classify`](pr-followup-helpers/classify.md) | Per-review binary label: actionable vs ambiguous, with worked examples + borderline rule. |
@@ -0,0 +1,26 @@
1
+ # `muggle-do:cycle`
2
+
3
+ One per address-reviews invocation, regardless of outcome.
4
+
5
+ ```json
6
+ {
7
+ "skill": "muggle-do",
8
+ "event": "cycle",
9
+ "session_slug": "<slug>",
10
+ "repo": "<owner>/<repo>",
11
+ "pr_number": <int>,
12
+ "review_ids_in": [<int>, ...],
13
+ "review_ids_actionable": [<int>, ...],
14
+ "review_ids_ambiguous": [<int>, ...],
15
+ "head_sha_before": "<sha-or-null>",
16
+ "head_sha_after": "<sha-or-null>",
17
+ "outcome": "pushed" | "escalated" | "mixed" | "no-op" | "self-loop-skip"
18
+ }
19
+ ```
20
+
21
+ `outcome`:
22
+ - `"pushed"` — at least one actionable, no ambiguous, push succeeded.
23
+ - `"escalated"` — all reviews were ambiguous; no push.
24
+ - `"mixed"` — both branches happened in the same invocation.
25
+ - `"no-op"` — every input id was already in the escalated set; no work.
26
+ - `"self-loop-skip"` — review was a synthetic wrapper around the agent's own reply (empty body + all line comments are replies). Cursor advanced silently; no work, no escalation.
@@ -0,0 +1,19 @@
1
+ # `muggle-do:escalation`
2
+
3
+ Zero or one per address-reviews invocation. Fires when `/muggle-do` emits a terminal escalation message to the user.
4
+
5
+ ```json
6
+ {
7
+ "skill": "muggle-do",
8
+ "event": "escalation",
9
+ "session_slug": "<slug>",
10
+ "repo": "<owner>/<repo>",
11
+ "pr_number": <int>,
12
+ "kind": "ambiguous-review" | "design-adjustment",
13
+ "review_ids": [<int>, ...]
14
+ }
15
+ ```
16
+
17
+ `kind`:
18
+ - `"ambiguous-review"` — one or more reviews classified ambiguous in this batch.
19
+ - `"design-adjustment"` — mid-cycle, the work surfaced a design-level conflict.
@@ -0,0 +1,19 @@
1
+ # `muggle-do:resolve-reminder`
2
+
3
+ Zero or one per cycle. Fires after the resolve-reminder stage scans threads — only when actionables ran.
4
+
5
+ ```json
6
+ {
7
+ "skill": "muggle-do",
8
+ "event": "resolve-reminder",
9
+ "session_slug": "<slug>",
10
+ "repo": "<owner>/<repo>",
11
+ "pr_number": <int>,
12
+ "addressed_by_loop": <int>,
13
+ "addressed_by_human": <int>,
14
+ "not_addressed": <int>,
15
+ "comment_posted": true | false
16
+ }
17
+ ```
18
+
19
+ - `comment_posted`: false when there were zero addressed-by-loop threads; telemetry still emits so dashboards see the scan happened.
@@ -0,0 +1,20 @@
1
+ # `muggle-pr-followup:bootstrap`
2
+
3
+ One per successful bootstrap, after state seeding and before the first watcher dispatches.
4
+
5
+ ```json
6
+ {
7
+ "skill": "muggle-pr-followup",
8
+ "event": "bootstrap",
9
+ "caller": "<caller-name>",
10
+ "session_slug": "<slug>",
11
+ "repo": "<owner>/<repo>",
12
+ "pr_number": <int>,
13
+ "cursor_review_id": <int>,
14
+ "resume": true | false
15
+ }
16
+ ```
17
+
18
+ - `caller`: `"user"` for direct invocation; another skill name if relayed.
19
+ - `cursor_review_id`: `0` if no prior submitted reviews; otherwise the highest existing review id.
20
+ - `resume`: true when `--resume` was used.
@@ -0,0 +1,23 @@
1
+ # `muggle-pr-followup:tick`
2
+
3
+ One per watcher iteration (idle or not).
4
+
5
+ ```json
6
+ {
7
+ "skill": "muggle-pr-followup",
8
+ "event": "tick",
9
+ "session_slug": "<slug>",
10
+ "repo": "<owner>/<repo>",
11
+ "pr_number": <int>,
12
+ "reviews_seen": <int>,
13
+ "dispatched_review_ids": [<int>, ...],
14
+ "terminal": true | false,
15
+ "idle": true | false,
16
+ "tick_duration_ms": <int>
17
+ }
18
+ ```
19
+
20
+ - `reviews_seen`: count of new submitted reviews past the cursor, **after** filtering by the escalated set.
21
+ - `dispatched_review_ids`: review ids handed to `/muggle-do`. Empty when idle.
22
+ - `terminal`: true when this tick observed the PR merged or closed and wrote `result.md`.
23
+ - `idle`: true when no reviews were dispatched this tick.
@@ -0,0 +1,15 @@
1
+ # Telemetry Event Catalog
2
+
3
+ Canonical shapes for `muggle-local-telemetry-event-emit` events. Emission mechanics: [`telemetry-emit.md`](telemetry-emit.md).
4
+
5
+ All events share two top-level fields: `skill` and `event`. The rest is event-specific — read only the file for the event you're emitting.
6
+
7
+ ## Index
8
+
9
+ | Event | When |
10
+ | :---- | :--- |
11
+ | [`muggle-pr-followup:tick`](telemetry-events/pr-followup-tick.md) | Every watcher iteration (idle or not). |
12
+ | [`muggle-pr-followup:bootstrap`](telemetry-events/pr-followup-bootstrap.md) | Successful bootstrap, before first watcher dispatches. |
13
+ | [`muggle-do:cycle`](telemetry-events/muggle-do-cycle.md) | Every address-reviews invocation, regardless of outcome. |
14
+ | [`muggle-do:escalation`](telemetry-events/muggle-do-escalation.md) | When `/muggle-do` emits a terminal escalation message. |
15
+ | [`muggle-do:resolve-reminder`](telemetry-events/muggle-do-resolve-reminder.md) | After the resolve-reminder stage scans threads. |