all-for-claudecode 2.13.0 → 2.14.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 (72) hide show
  1. package/.claude-plugin/marketplace.json +24 -5
  2. package/.claude-plugin/plugin.json +15 -4
  3. package/README.md +12 -0
  4. package/agents/afc-appsec-expert.md +19 -26
  5. package/agents/afc-architect.md +9 -2
  6. package/agents/afc-backend-expert.md +16 -4
  7. package/agents/afc-design-expert.md +17 -7
  8. package/agents/afc-impl-worker.md +7 -1
  9. package/agents/afc-infra-expert.md +16 -6
  10. package/agents/afc-legal-expert.md +16 -18
  11. package/agents/afc-marketing-expert.md +15 -5
  12. package/agents/afc-pm-expert.md +16 -5
  13. package/agents/afc-pr-analyst.md +1 -1
  14. package/agents/afc-security.md +7 -2
  15. package/agents/afc-tech-advisor.md +18 -30
  16. package/docs/agent-authoring-guide.md +144 -0
  17. package/docs/context-management-harness.md +293 -0
  18. package/docs/orchestration-modes.md +228 -0
  19. package/docs/skill-authoring-guide.md +153 -0
  20. package/hooks/hooks.json +27 -2
  21. package/package.json +4 -3
  22. package/schemas/hooks.schema.json +1 -1
  23. package/schemas/marketplace.schema.json +6 -1
  24. package/schemas/plugin.schema.json +0 -4
  25. package/scripts/afc-pipeline-manage.sh +1 -0
  26. package/scripts/afc-post-compact.sh +54 -0
  27. package/scripts/afc-spec-guard.sh +7 -7
  28. package/scripts/afc-stop-failure.sh +46 -0
  29. package/scripts/afc-sync-cache.sh +8 -2
  30. package/scripts/afc-tdd-guard.sh +7 -5
  31. package/scripts/afc-user-prompt-submit.sh +38 -0
  32. package/scripts/pre-compact-checkpoint.sh +10 -0
  33. package/scripts/session-start-context.sh +10 -0
  34. package/skills/architect/SKILL.md +1 -9
  35. package/skills/auto/SKILL.md +228 -910
  36. package/skills/auto/skill-advisor.md +306 -0
  37. package/skills/checkpoint/SKILL.md +7 -1
  38. package/skills/clarify/SKILL.md +3 -2
  39. package/skills/consult/SKILL.md +30 -123
  40. package/skills/consult/peer-mode.md +61 -0
  41. package/skills/debug/SKILL.md +3 -21
  42. package/skills/ideate/SKILL.md +1 -77
  43. package/skills/ideate/brief-template.md +73 -0
  44. package/skills/implement/SKILL.md +68 -260
  45. package/skills/init/SKILL.md +79 -129
  46. package/skills/init/reference.md +55 -0
  47. package/skills/issue/SKILL.md +51 -76
  48. package/skills/launch/SKILL.md +5 -0
  49. package/skills/learner/SKILL.md +1 -25
  50. package/skills/learner/suggestion-format.md +49 -0
  51. package/skills/plan/SKILL.md +1 -5
  52. package/skills/pr-comment/SKILL.md +38 -51
  53. package/skills/principles/SKILL.md +3 -7
  54. package/skills/qa/SKILL.md +3 -14
  55. package/skills/release-notes/SKILL.md +6 -5
  56. package/skills/resolve/SKILL.md +75 -158
  57. package/skills/resolve/graphql.md +48 -0
  58. package/skills/resume/SKILL.md +10 -5
  59. package/skills/review/SKILL.md +56 -202
  60. package/skills/review/perspectives.md +118 -0
  61. package/skills/security/SKILL.md +4 -22
  62. package/skills/security/cross-boundary-verification.md +22 -0
  63. package/skills/setup/SKILL.md +38 -87
  64. package/skills/setup/conflict-detection.md +33 -0
  65. package/skills/spec/SKILL.md +1 -5
  66. package/skills/tasks/SKILL.md +47 -70
  67. package/skills/test/SKILL.md +4 -16
  68. package/skills/triage/SKILL.md +38 -85
  69. package/skills/triage/coupling-detection.md +13 -0
  70. package/skills/triage/pr-analysis-prompt.md +46 -0
  71. package/skills/validate/SKILL.md +24 -62
  72. package/skills/validate/validation-categories.md +39 -0
@@ -16,6 +16,10 @@ model: sonnet
16
16
  > Analyzes a PR and posts a structured review comment to GitHub.
17
17
  > Reuses existing triage reports when available. Asks for user confirmation before posting.
18
18
 
19
+ ## Pre-fetch
20
+
21
+ !`gh pr view $0 --json number,title,headRefName,author,body,additions,deletions,changedFiles,labels,reviewDecision,state,url 2>/dev/null || echo "PR_FETCH_FAILED"`
22
+
19
23
  ## Arguments
20
24
 
21
25
  - `$ARGUMENTS` — PR number (required), with optional severity filter
@@ -23,71 +27,53 @@ model: sonnet
23
27
  - `42 --severity critical,warning` — Only include Critical and Warning findings
24
28
  - `42 --severity critical` — Only include Critical findings
25
29
 
26
- Parse the arguments:
30
+ Parse:
27
31
  1. Extract the PR number (first numeric argument)
28
- 2. Extract `--severity` filter if present (comma-separated list of: `critical`, `warning`, `info`)
29
- 3. If no PR number is found, ask the user: "Which PR number should I review?"
32
+ 2. Extract `--severity` filter if present (comma-separated: `critical`, `warning`, `info`)
33
+ 3. If no PR number found, ask the user: "Which PR number should I review?"
30
34
 
31
35
  ## Execution Steps
32
36
 
33
37
  ### 1. Collect PR Information
34
38
 
35
- ```bash
36
- gh pr view {number} --json number,title,headRefName,author,body,additions,deletions,changedFiles,labels,reviewDecision,state
37
- ```
39
+ Use the pre-fetched PR metadata. If the pre-fetch returned `PR_FETCH_FAILED`, output `[afc:pr-comment] Error: PR not found or gh not available.` and abort.
38
40
 
41
+ Fetch the diff:
39
42
  ```bash
40
43
  gh pr diff {number}
41
44
  ```
42
45
 
43
- Verify the PR exists and is open. If closed/merged, inform the user and ask whether to proceed anyway.
46
+ Verify the PR is open. If closed/merged, inform the user and ask whether to proceed anyway.
44
47
 
45
48
  ### 2. Check for Existing Triage Report
46
49
 
47
- Look for a recent triage report that covers this PR:
48
-
49
50
  ```bash
50
51
  ls -t .claude/afc/memory/triage/*.md 2>/dev/null | head -5
51
52
  ```
52
53
 
53
- If a report exists from today, search it for `PR #{number}` analysis. If found, reuse that analysis as the basis for the review instead of re-analyzing from scratch.
54
+ If a report from today contains `PR #{number}` analysis, reuse it as the review basis instead of re-analyzing from scratch.
54
55
 
55
56
  ### 3. Analyze PR (if no triage data available)
56
57
 
57
- If no existing triage report covers this PR, perform a focused review of the diff.
58
-
59
- Examine the diff from the following perspectives (abbreviated from review.md):
60
-
61
- #### A. Code Quality
62
- - Style compliance, naming conventions, unnecessary complexity
63
-
64
- #### B. Architecture
65
- - Layer violations, boundary crossings, structural concerns
58
+ Review the diff using perspectives A–E from [review/perspectives.md](../review/perspectives.md):
66
59
 
67
- #### C. Security
68
- - XSS, injection, sensitive data exposure, auth issues
60
+ - **A. Code Quality** — style compliance, naming, unnecessary complexity
61
+ - **B. Architecture** layer violations, boundary crossings, structural concerns
62
+ - **C. Security** — XSS, injection, sensitive data exposure, auth issues
63
+ - **D. Performance** — latency concerns, unnecessary computation, resource leaks
64
+ - **E. Maintainability** — function/file size, naming clarity, readability
69
65
 
70
- #### D. Performance
71
- - Latency concerns, unnecessary computation, resource leaks
72
-
73
- #### E. Maintainability
74
- - Function/file size, naming clarity, readability
75
-
76
- Classify each finding with a severity:
77
- - **Critical (C)** — Must fix before merge. Bugs, security vulnerabilities, data loss risks.
78
- - **Warning (W)** — Should fix. Code quality issues, potential problems, maintainability concerns.
79
- - **Info (I)** — Nice to have. Suggestions, minor improvements, style preferences.
66
+ Classify each finding:
67
+ - **Critical (C)** — Must fix before merge: bugs affecting users, security vulnerabilities, data loss risks
68
+ - **Warning (W)** — Should fix: code quality issues, potential problems, maintainability concerns
69
+ - **Info (I)** — Nice to have: suggestions, minor improvements, style preferences
80
70
 
81
71
  ### 4. Apply Severity Filter
82
72
 
83
- If `--severity` was specified, filter findings to only include the specified severity levels.
84
-
85
- Default (no filter): include all severity levels.
73
+ If `--severity` was specified, filter findings to only the listed levels. Default: include all.
86
74
 
87
75
  ### 5. Generate Review Comment
88
76
 
89
- Compose the review comment in this format:
90
-
91
77
  ```markdown
92
78
  ## AFC Code Review — PR #{number}
93
79
 
@@ -119,8 +105,7 @@ Compose the review comment in this format:
119
105
  *Reviewed by [all-for-claudecode](https://github.com/anthropics/claude-code)*
120
106
  ```
121
107
 
122
- If there are zero findings after filtering, the comment should be:
123
-
108
+ If zero findings after filtering:
124
109
  ```markdown
125
110
  ## AFC Code Review — PR #{number}
126
111
 
@@ -132,12 +117,15 @@ No issues found. Code looks good!
132
117
 
133
118
  ### 6. Preview and Confirm
134
119
 
135
- Display the full review comment to the user in the console.
120
+ Display the full review comment to the user.
121
+
122
+ Determine the review event:
136
123
 
137
- Then determine the review event based on the actual severity and context of findings:
138
- - **REQUEST_CHANGES**: Use when findings indicate genuine risk to production code — bugs that would affect users, security vulnerabilities, or architectural violations that would be costly to fix later. A Critical finding in test code or documentation alone does not warrant blocking the PR.
139
- - **COMMENT**: Use when findings are improvements or concerns that the author should consider but that don't pose immediate risk. Also appropriate when Critical findings are in non-production code (tests, docs, config) or when the author has already acknowledged the concern in PR discussion.
140
- - **APPROVE**: Use when no findings exist, or when all findings are informational and the code is ready to merge.
124
+ | Event | When to use |
125
+ |-------|-------------|
126
+ | **REQUEST_CHANGES** | Critical findings in production code that pose genuine risk to users: bugs affecting functionality, security vulnerabilities, or architectural violations costly to fix post-merge. A Critical finding limited to test/docs/config alone does NOT qualify. |
127
+ | **COMMENT** | Findings are improvements the author should consider but don't block merging. Also when Critical findings are in non-production code, or the author has already acknowledged the concern in PR discussion. |
128
+ | **APPROVE** | No findings, or all findings are informational and code is ready to merge. |
141
129
 
142
130
  Tell the user:
143
131
  ```
@@ -145,15 +133,13 @@ Review event: {APPROVE|COMMENT|REQUEST_CHANGES}
145
133
  Findings: Critical {N} / Warning {N} / Info {N}
146
134
  ```
147
135
 
148
- Ask the user to confirm using AskUserQuestion with these options:
136
+ Ask for confirmation (AskUserQuestion):
149
137
  1. **Post as-is** — Post the review comment to GitHub
150
- 2. **Edit first** — Let me modify the comment before posting (user provides edits, then re-confirm)
138
+ 2. **Edit first** — Let me modify the comment before posting
151
139
  3. **Cancel** — Do not post anything
152
140
 
153
141
  ### 7. Post to GitHub
154
142
 
155
- On approval, write the review comment to a temp file and post via `--body-file` (avoids shell escaping issues with markdown):
156
-
157
143
  ```bash
158
144
  tmp_file=$(mktemp)
159
145
  cat > "$tmp_file" << 'REVIEW_EOF'
@@ -170,12 +156,13 @@ PR review posted
170
156
  ├─ PR: #{number} ({title})
171
157
  ├─ Event: {APPROVE|COMMENT|REQUEST_CHANGES}
172
158
  ├─ Findings: Critical {N} / Warning {N} / Info {N}
173
- └─ URL: {PR URL from gh pr view}
159
+ └─ URL: {PR URL}
174
160
  ```
175
161
 
176
162
  ## Notes
177
163
 
178
164
  - **User confirmation required**: Never post to GitHub without explicit user approval.
179
- - **Idempotent**: Running multiple times on the same PR creates additional review comments (GitHub does not deduplicate).
180
- - **Respects existing reviews**: This command does not dismiss or override other reviewers' reviews.
181
- - **Rate limits**: Uses a single `gh pr review` call. No rate limit concerns for normal usage.
165
+ - **Verify after posting**: After `gh pr review` completes, confirm success by checking the exit code. If it fails, report the error and suggest manual posting.
166
+ - **Idempotent**: Multiple runs create additional review comments (GitHub does not deduplicate).
167
+ - **Respects existing reviews**: Does not dismiss or override other reviewers' reviews.
168
+ - **Perspectives reference**: Full criteria for A–H in [review/perspectives.md](../review/perspectives.md). This skill uses A–E only (focused on PR-level review, not full pipeline review).
@@ -23,14 +23,9 @@ model: sonnet
23
23
  - `remove {number}`: remove a principle
24
24
  - `init`: interactive initial setup
25
25
 
26
- ## Config Load
26
+ ## Project Config (auto-loaded)
27
27
 
28
- **Always** read `.claude/afc.config.md` first.
29
-
30
- If config file is missing:
31
- 1. Ask the user: "`.claude/afc.config.md` not found. Run `/afc:init` to set up the project?"
32
- 2. If user accepts → run `/afc:init`, then **restart this command** with the original `$ARGUMENTS`
33
- 3. If user declines → **abort**
28
+ !`cat .claude/afc.config.md 2>/dev/null || echo "[CONFIG NOT FOUND] .claude/afc.config.md not found. Create it with /afc:init."`
34
29
 
35
30
  ## Execution Steps
36
31
 
@@ -108,4 +103,5 @@ Collect principles interactively:
108
103
  - **Persistent storage**: Saved to .claude/afc/memory/principles.md and maintained across sessions.
109
104
  - **Auto-referenced**: Automatically loaded and validated by /afc:plan and /afc:architect.
110
105
  - **Keep it concise**: Keep principles concise and actionable. If the list grows long enough that principles start overlapping or becoming too granular, suggest consolidation. The goal is a set of principles that can be held in working memory — typically under 15, but the right number depends on the project's complexity.
106
+ - **Verify after change**: After adding or removing a principle, re-read `principles.md` to confirm the version was bumped correctly and no formatting issues were introduced.
111
107
  - **Avoid duplication with CLAUDE.md**: Do not re-register rules already present in CLAUDE.md as principles.
@@ -26,12 +26,9 @@ model: sonnet
26
26
  - `coverage` — categories A + D (Test Confidence + API & Contract Safety)
27
27
  - Or a free-form concern (e.g., "are error messages user-friendly", "check for dead exports")
28
28
 
29
- ## Config Load
29
+ ## Project Config (auto-loaded)
30
30
 
31
- **Always** read `.claude/afc.config.md` first needed for CI Commands (YAML: ci, gate, test).
32
- Architecture, Code Style, and Project Context are auto-loaded via `.claude/rules/afc-project.md`.
33
-
34
- If config file is missing: read `CLAUDE.md` for project info. Proceed without config if neither exists.
31
+ !`cat .claude/afc.config.md 2>/dev/null || echo "[CONFIG NOT FOUND] Proceeding without config — read CLAUDE.md for project info."`
35
32
 
36
33
  ## Audit Categories
37
34
 
@@ -90,15 +87,7 @@ Checks:
90
87
 
91
88
  ## Execution Steps
92
89
 
93
- ### 1. Load Config
94
-
95
- Read `.claude/afc.config.md` (or fallback to `CLAUDE.md`). Extract:
96
- - Test command (`{config.test}`)
97
- - CI/gate commands (`{config.ci}`, `{config.gate}`)
98
- - Architecture layers (`{config.architecture}`)
99
- - Code style rules (`{config.code_style}`)
100
-
101
- ### 2. Parse Scope
90
+ ### 1. Parse Scope
102
91
 
103
92
  Interpret `$ARGUMENTS` to determine which categories to run:
104
93
 
@@ -31,15 +31,15 @@ Parse the arguments:
31
31
  - If single version: use `{version}..HEAD`
32
32
  - If empty: auto-detect with `git describe --tags --abbrev=0`
33
33
 
34
+ ## Git Context (auto-loaded)
35
+
36
+ !`git describe --tags --abbrev=0 2>/dev/null || echo "[NO_TAGS]"`
37
+ !`git log $(git describe --tags --abbrev=0 2>/dev/null || echo "")..HEAD --pretty=format:"%H %s" --no-merges 2>/dev/null || git log --pretty=format:"%H %s" --no-merges`
38
+
34
39
  ## Execution Steps
35
40
 
36
41
  ### 1. Determine Range
37
42
 
38
- ```bash
39
- # Auto-detect last tag if no range specified
40
- git describe --tags --abbrev=0 2>/dev/null
41
- ```
42
-
43
43
  - If a tag is found, set `from_tag` to that tag, `to_tag` to HEAD
44
44
  - If no tags exist, inform the user: "No tags found. Include all commits? (y/n)"
45
45
  - If a `to_tag` is specified (not HEAD), verify it exists: `git rev-parse --verify {to_tag} 2>/dev/null`
@@ -220,4 +220,5 @@ To publish these notes as a GitHub Release, run again with --post flag.
220
220
  - **Conventional Commits aware**: Projects using conventional commits get better categorization. Projects without them still get reasonable results via heuristic matching.
221
221
  - **Contributor attribution**: Best effort. GitHub username resolution requires `gh` CLI and repository access.
222
222
  - **User confirmation required**: `--post` always asks for explicit approval before publishing to GitHub.
223
+ - **Verify after publishing**: After `gh release create` completes, verify success by checking the exit code and output URL. If it fails, report the error and suggest manual creation.
223
224
  - **Idempotent**: Running without `--post` is safe to repeat. With `--post`, GitHub Releases for existing tags will fail (GitHub does not allow duplicate release tags).
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: afc:resolve
3
3
  description: "Analyze and address LLM review comments on PR — use when the user asks to resolve, fix, or respond to bot review comments (CodeRabbit, Copilot, Codex) on a pull request"
4
- argument-hint: "<PR URL, owner/repo#number, #number, or number>"
4
+ argument-hint: "<PR number or URL>"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Grep
@@ -15,231 +15,148 @@ model: sonnet
15
15
 
16
16
  # /afc:resolve — LLM Review Comment Resolution
17
17
 
18
- > Collects LLM bot review comments (CodeRabbit, Copilot, Codex, etc.) from a PR, classifies each as VALID/NOISE/DISCUSS, applies fixes for VALID items, and asks the user about DISCUSS items.
19
- > Creates a single commit with all fixes and outputs a summary report.
18
+ Collects LLM bot review comments from a PR, classifies as VALID/NOISE/DISCUSS, fixes VALID items, resolves addressed threads on GitHub, and outputs a summary report.
20
19
 
21
20
  ## Arguments
22
21
 
23
- - `$ARGUMENTS` — (required) One of:
24
- - PR number: `456` or `#456`
25
- - GitHub URL: `https://github.com/owner/repo/pull/456`
26
- - Cross-repo: `owner/repo#456`
22
+ - `$ARGUMENTS` — (required) Any format that identifies a PR (number, URL, cross-repo, etc.)
27
23
 
28
- ## Execution Steps
24
+ ## PR Context
25
+
26
+ !`gh pr view $(echo "$ARGUMENTS" | grep -oE '[0-9]+' | head -1) --json url,title,headRefName,comments 2>/dev/null || echo "PR_FETCH_FAILED"`
29
27
 
30
- ### 1. Prerequisites Check
28
+ ## Execution Steps
31
29
 
32
- Verify `gh` CLI is available and authenticated:
30
+ ### 1. Prerequisites
33
31
 
34
32
  ```bash
35
33
  gh --version >/dev/null 2>&1 && gh auth status >/dev/null 2>&1
36
34
  ```
37
35
 
38
- If either check fails:
39
- - Output: `[afc:resolve] Error: GitHub CLI (gh) is not installed or not authenticated. Install from https://cli.github.com/ and run 'gh auth login'.`
40
- - **Abort immediately.**
41
-
42
- ### 2. Parse Input
43
-
44
- Determine the input format and extract owner, repo, and PR number:
36
+ Fails `[afc:resolve] Error: gh CLI not installed or not authenticated.` → **abort**.
45
37
 
46
- 1. **GitHub URL** (`https://github.com/{owner}/{repo}/pull/{number}`):
47
- - Extract owner, repo, number from URL path segments
48
- - Set `GH_REPO_FLAG="--repo {owner}/{repo}"`
38
+ ### 2. Identify PR
49
39
 
50
- 2. **Cross-repo** (`{owner}/{repo}#{number}`):
51
- - Split on `#` — left part is `owner/repo`, right part is number
52
- - Set `GH_REPO_FLAG="--repo {owner}/{repo}"`
40
+ Extract PR number from `$ARGUMENTS` by intent. If `owner/repo` info is included, use `--repo` flag. Otherwise derive via `gh repo view --json owner,name`.
53
41
 
54
- 3. **Local number** (`456` or `#456`):
55
- - Strip leading `#` if present
56
- - Set `GH_REPO_FLAG=""` (use current repo from git remote)
57
-
58
- ### 3. Collect Review Comments
59
-
60
- Collect all review comments from the PR:
61
-
62
- ```bash
63
- gh pr view {number} {GH_REPO_FLAG} --json reviews,comments,url,title,headRefName
64
- ```
42
+ If "PR Context" above shows `PR_FETCH_FAILED`, parse `$ARGUMENTS` manually and retry.
65
43
 
66
- Additionally, collect inline review comments:
44
+ ### 3. Collect Review Data
67
45
 
68
46
  ```bash
69
47
  gh api repos/{owner}/{repo}/pulls/{number}/comments --paginate
70
48
  ```
71
49
 
72
- If `--repo` flag was not used, derive owner/repo from `gh repo view --json owner,name`.
73
-
74
- If API call fails → output the error and **abort**.
50
+ Also fetch review threads for resolve (Step 8). See [graphql.md](graphql.md) for the query.
75
51
 
76
52
  ### 4. Filter Bot Comments
77
53
 
78
- Identify LLM bot comments by checking the comment author's login:
54
+ Keep only comments from authors whose login ends with `[bot]`. Tag `outdated` comments as `[OUTDATED]`.
79
55
 
80
- **Known bot patterns**:
81
- - `coderabbitai[bot]` — CodeRabbit
82
- - `copilot[bot]` or `github-copilot[bot]` — GitHub Copilot
83
- - `codex[bot]` — Codex
84
- - Any login ending with `[bot]` — generic bot detection
56
+ 0 bot comments → `No LLM bot review comments found on PR #{number}.` → **exit**.
85
57
 
86
- **Filter rules**:
87
- - Keep only comments where the author matches a bot pattern
88
- - Discard all human reviewer comments (MVP scope)
89
- - If an inline comment is marked as `outdated` by GitHub → tag as `[OUTDATED]`
58
+ ### 5. Check Working Tree
90
59
 
91
- If 0 bot comments found:
92
- - Output: `No LLM bot review comments found on PR #{number}.`
93
- - **Exit gracefully** (success, not error).
60
+ ```bash
61
+ git status --porcelain
62
+ ```
94
63
 
95
- ### 5. Classify Each Comment
64
+ Dirty list files, ask user to confirm before proceeding.
96
65
 
97
- For each bot comment, analyze the content and classify:
66
+ ### 6. Classify
98
67
 
99
- | Classification | Criteria | Action |
100
- |---------------|----------|--------|
101
- | **VALID** | Real bug, security issue, clear improvement, correct suggestion with code context | Auto-fix |
102
- | **NOISE** | Style preference difference, intentional design choice, false positive, already addressed | Skip |
103
- | **DISCUSS** | Architecture decision needed, tradeoff exists, multiple valid approaches, no code `path`/`position` (non-code feedback) | Ask user |
68
+ Read each comment's target file (±10 lines context), then classify:
104
69
 
105
- **Classification guidelines**:
106
- - If the comment points to a concrete bug (null check, off-by-one, resource leak) → **VALID**
107
- - If the comment is about naming convention or style that differs from project rules → **NOISE**
108
- - If the comment suggests a refactor with pros/cons **DISCUSS**
109
- - If multiple bots give conflicting advice on the same line **DISCUSS**
110
- - If the comment is on an `[OUTDATED]` diff → **NOISE** (code already changed)
70
+ | Class | When | Action |
71
+ |-------|------|--------|
72
+ | **VALID** | Objectively verifiable bug, single fix approach, resolvable within existing code | Fix |
73
+ | **NOISE** | Style preference, intentional design, false positive, `[OUTDATED]` | Skip |
74
+ | **DISCUSS** | Requires judgment (new dependency, tradeoff, threshold, API change, etc.) | Ask |
111
75
 
112
- Also collect from each comment:
113
- - `file_path`: the file the comment targets
114
- - `line`: the line number (if available)
115
- - `suggestion`: the suggested change (if available)
116
- - `body`: the full comment text
76
+ **Key: when in doubt, classify as DISCUSS. Be conservative with VALID.**
117
77
 
118
- ### 6. Present Classification Summary
78
+ ### 7. Present Summary
119
79
 
120
- Before making any changes, present the classification to the user:
80
+ **MUST output before any code changes:**
121
81
 
122
82
  ```
123
83
  PR #{number}: {title}
124
84
  Branch: {headRefName}
85
+ Bot comments: {total} ({bot_names})
125
86
 
126
- Bot comments: {total_count} ({bot_names})
127
-
128
- VALID ({count}):
129
- 1. [{bot}] {file}:{line} — {1-line summary of issue}
130
- 2. [{bot}] {file}:{line} — {1-line summary of issue}
131
-
132
- NOISE ({count}):
133
- 1. [{bot}] {file}:{line} — {reason for skipping}
134
-
135
- DISCUSS ({count}):
136
- 1. [{bot}] {file}:{line} — {question for user}
87
+ VALID ({n}): 1. [{bot}] {file}:{line} — {summary}
88
+ NOISE ({n}): 1. [{bot}] {file}:{line} — {skip reason}
89
+ DISCUSS ({n}): 1. [{bot}] {file}:{line} — {question}
137
90
  ```
138
91
 
139
- ### 7. Handle DISCUSS Items
92
+ ### 8. Handle DISCUSS
140
93
 
141
- For each DISCUSS item, present to the user:
94
+ Each item present comment, target code (5 lines), tradeoff → ask user:
95
+ 1. Apply → move to VALID
96
+ 2. Skip → move to NOISE
97
+ 3. Defer → stays DISCUSS
142
98
 
143
- ```
144
- [DISCUSS #{n}] {bot_name} on {file}:{line}
99
+ ### 9. Apply Fixes
145
100
 
146
- Comment:
147
- > {original comment text, truncated to 500 chars}
101
+ For each VALID item:
102
+ 1. Read target file
103
+ 2. Apply minimal fix via Edit
104
+ 3. Verify modified area
148
105
 
149
- Target code:
150
- > {relevant code snippet, 5 lines context}
106
+ **Feedback loop**: after all fixes, run project tests if available. If tests fail → diagnose and fix → rerun. Repeat until pass or user decides to stop.
151
107
 
152
- If applied: {description of what would change}
153
- Tradeoff: {why this is not a clear-cut decision}
108
+ ### 10. Resolve Threads on GitHub
154
109
 
155
- Options:
156
- 1. Apply — treat as VALID, fix the code
157
- 2. Skip — treat as NOISE, record skip reason
158
- 3. Defer — skip for now, revisit later
159
- ```
110
+ See [graphql.md](graphql.md) for the mutation.
160
111
 
161
- Wait for user response. Reclassify based on choice:
162
- - `Apply` → move to VALID list
163
- - `Skip` move to NOISE list with user's reason
164
- - `Defer` keep as DISCUSS in report
112
+ | Classification | Resolve? |
113
+ |---------------|----------|
114
+ | VALID (fixed) | Yes |
115
+ | NOISE | Yes (user decided to skip) |
116
+ | DISCUSS-Apply | Yes |
117
+ | DISCUSS-Skip | Yes |
118
+ | DISCUSS-Defer | **No** (revisit later) |
119
+ | Already resolved | Skip |
165
120
 
166
- ### 8. Apply VALID Fixes
121
+ GraphQL failure warn, **do not abort**.
167
122
 
168
- For each VALID comment (including user-accepted DISCUSS items):
123
+ ### 11. Commit
169
124
 
170
- 1. **Read the target file** before modifying
171
- 2. **Identify the exact location** from the comment's `file_path` and `line`
172
- 3. **Apply the fix** using Edit tool:
173
- - If the bot provided a specific code suggestion → apply it
174
- - If the bot described the issue without a suggestion → implement the fix based on the description
175
- 4. **Verify** the fix doesn't break the immediate surrounding code context
125
+ No fixes applied skip to Step 12.
176
126
 
177
- If the target file is in a dirty state (uncommitted changes unrelated to this PR):
178
- - Warn user: `{file} has uncommitted changes not related to this PR. Proceed?`
179
- - If user declines → skip this fix, note in report
127
+ Show summary + resolved thread count **wait for user confirmation** (NFR-003).
180
128
 
181
- If the target file was deleted in the PR branch:
182
- - Skip, note `[FILE DELETED]` in report
183
-
184
- ### 9. Commit Changes
185
-
186
- **Before committing**, show the user a summary of all changes:
187
-
188
- ```
189
- Changes to commit:
190
- {file1}: {description of change}
191
- {file2}: {description of change}
192
- Total: {N} files changed
193
-
194
- Proceed with commit? (y/n)
195
- ```
196
-
197
- **Wait for user confirmation** before committing. This is a safety requirement.
198
-
199
- **Commit strategy**:
200
- - If VALID items ≤ 9: single commit
201
- - If VALID items ≥ 10: group by file/module into 2-3 commits
202
-
203
- **Commit message format** (single commit):
204
129
  ```
205
130
  resolve LLM review comments on #{number}
206
131
 
207
- - fix: {description} ({bot_name})
208
132
  - fix: {description} ({bot_name})
209
133
  - skip: {reason} (NOISE, {count} items)
210
134
  ```
211
135
 
212
- Do **NOT** push automatically. The user decides when to push.
136
+ Do **NOT** push.
137
+
138
+ ### 12. Output Report
213
139
 
214
- ### 10. Output Report
140
+ **MUST always output**, even if interrupted:
215
141
 
216
142
  ```
217
143
  Resolve complete
218
144
  ├─ PR: #{number} — {title}
219
145
  ├─ Bot comments: {total} ({bot_names})
220
- ├─ VALID: {count} (applied)
221
- ├─ NOISE: {count} (skipped)
222
- ├─ DISCUSS: {count} (applied: {n}, skipped: {n}, deferred: {n})
223
- ├─ Commit: {hash} ({files_changed} files, +{additions}/-{deletions})
146
+ ├─ VALID: {n} (applied)
147
+ ├─ NOISE: {n} (skipped)
148
+ ├─ DISCUSS: {n} (applied: {a}, skipped: {s}, deferred: {d})
149
+ ├─ Tests: {pass}/{total} passed
150
+ ├─ Threads resolved: {resolved}/{addressed}
151
+ ├─ Commit: {hash} ({files} files, +{add}/-{del})
224
152
  └─ Push: not pushed (run 'git push' when ready)
225
153
  ```
226
154
 
227
- If no VALID items were found (all NOISE/DISCUSS-skipped):
228
- ```
229
- Resolve complete
230
- ├─ PR: #{number} — {title}
231
- ├─ Bot comments: {total} ({bot_names})
232
- ├─ VALID: 0
233
- ├─ NOISE: {count}
234
- ├─ DISCUSS: {count} (all skipped/deferred)
235
- └─ No changes made
236
- ```
155
+ ## Completion Guarantee
156
+
157
+ MUST reach Step 12 before returning control. If user sends unrelated request mid-flow → output partial report with `[INTERRUPTED]` → then address new request.
237
158
 
238
159
  ## Notes
239
160
 
240
- - **MVP scope**: Only bot comments are analyzed. Human reviewer comments are ignored. Use `afc:review` for human-initiated code review.
241
- - **No auto-push**: Changes are committed but never pushed automatically. The user controls when to push.
242
- - **User confirmation required**: All code changes must be confirmed by the user before committing (NFR-003 safety requirement).
243
- - **Not part of auto pipeline**: This is a standalone skill invoked manually.
244
- - **Idempotency**: Re-running on the same PR will skip comments that have already been addressed (the code diff won't match the bot's original concern).
245
- - **Relationship to other skills**: `afc:review` does full code review. `afc:pr-comment` posts review comments. `afc:resolve` addresses existing bot comments. They are complementary.
161
+ - Human comments are ignored (use `afc:review`). No auto-push. Thread resolution needs `repo` scope.
162
+ - Idempotent: re-run skips already-addressed comments and resolved threads.
@@ -0,0 +1,48 @@
1
+ # GraphQL Queries for Thread Resolution
2
+
3
+ ## Fetch Review Threads
4
+
5
+ ```graphql
6
+ query($owner: String!, $repo: String!, $pr: Int!) {
7
+ repository(owner: $owner, name: $repo) {
8
+ pullRequest(number: $pr) {
9
+ reviewThreads(first: 100) {
10
+ nodes {
11
+ id
12
+ isResolved
13
+ comments(first: 1) {
14
+ nodes { databaseId body author { login } path line }
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
20
+ }
21
+ ```
22
+
23
+ Usage:
24
+ ```bash
25
+ gh api graphql -f query='...' -F owner='{owner}' -F repo='{repo}' -F pr={number}
26
+ ```
27
+
28
+ ## Resolve a Thread
29
+
30
+ ```graphql
31
+ mutation($threadId: ID!) {
32
+ resolveReviewThread(input: {threadId: $threadId}) {
33
+ thread { id isResolved }
34
+ }
35
+ }
36
+ ```
37
+
38
+ Usage:
39
+ ```bash
40
+ gh api graphql -f threadId='{thread_id}' -f query='...'
41
+ ```
42
+
43
+ ## Notes
44
+
45
+ - REST API does NOT support thread resolution — GraphQL only
46
+ - Requires `repo` scope on the GitHub token
47
+ - Thread ID comes from the fetch query above (`nodes[].id`)
48
+ - Already-resolved threads (`isResolved: true`) should be skipped
@@ -17,15 +17,20 @@ allowed-tools:
17
17
 
18
18
  - `$ARGUMENTS` — (optional) none
19
19
 
20
+ ## Checkpoint State (auto-loaded)
21
+
22
+ !`cat .claude/afc/memory/checkpoint.md 2>/dev/null || echo "[NO_CHECKPOINT]"`
23
+
20
24
  ## Execution Steps
21
25
 
22
26
  ### 1. Load Checkpoint
23
27
 
24
- Read `.claude/afc/memory/checkpoint.md`:
25
- - If not found: check **auto-memory fallback** read `~/.claude/projects/{ENCODED_PATH}/memory/checkpoint.md` (where `ENCODED_PATH` = project path with `/` replaced by `-`):
26
- - If fallback found: use it as the checkpoint source (auto-memory is written by `pre-compact-checkpoint.sh` during context compaction)
27
- - If fallback also not found: output "No saved checkpoint found. Use `/afc:checkpoint` to create one, or checkpoints are created automatically on context compaction." then **stop**
28
- - If found: parse the full contents (extract branch, commit hash, pipeline feature, task progress, modified files)
28
+ Use the pre-fetched checkpoint above. If it shows `[NO_CHECKPOINT]`:
29
+ - Check auto-memory fallback: read `~/.claude/projects/{ENCODED_PATH}/memory/checkpoint.md`
30
+ - If fallback also not found: output "No saved checkpoint found." then **stop**
31
+
32
+ If checkpoint data was pre-fetched successfully:
33
+ parse the full contents (extract branch, commit hash, pipeline feature, task progress, modified files).
29
34
 
30
35
  ### 2. Validate Environment
31
36