all-for-claudecode 2.12.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 +14 -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 +43 -1
  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 +191 -0
  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 +162 -0
  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 +40 -87
  64. package/skills/setup/conflict-detection.md +33 -0
  65. package/skills/spec/SKILL.md +6 -9
  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).
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: afc:resolve
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 number or URL>"
5
+ allowed-tools:
6
+ - Read
7
+ - Grep
8
+ - Glob
9
+ - Bash
10
+ - Edit
11
+ - Write
12
+ - AskUserQuestion
13
+ model: sonnet
14
+ ---
15
+
16
+ # /afc:resolve — LLM Review Comment Resolution
17
+
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.
19
+
20
+ ## Arguments
21
+
22
+ - `$ARGUMENTS` — (required) Any format that identifies a PR (number, URL, cross-repo, etc.)
23
+
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"`
27
+
28
+ ## Execution Steps
29
+
30
+ ### 1. Prerequisites
31
+
32
+ ```bash
33
+ gh --version >/dev/null 2>&1 && gh auth status >/dev/null 2>&1
34
+ ```
35
+
36
+ Fails → `[afc:resolve] Error: gh CLI not installed or not authenticated.` → **abort**.
37
+
38
+ ### 2. Identify PR
39
+
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`.
41
+
42
+ If "PR Context" above shows `PR_FETCH_FAILED`, parse `$ARGUMENTS` manually and retry.
43
+
44
+ ### 3. Collect Review Data
45
+
46
+ ```bash
47
+ gh api repos/{owner}/{repo}/pulls/{number}/comments --paginate
48
+ ```
49
+
50
+ Also fetch review threads for resolve (Step 8). See [graphql.md](graphql.md) for the query.
51
+
52
+ ### 4. Filter Bot Comments
53
+
54
+ Keep only comments from authors whose login ends with `[bot]`. Tag `outdated` comments as `[OUTDATED]`.
55
+
56
+ 0 bot comments → `No LLM bot review comments found on PR #{number}.` → **exit**.
57
+
58
+ ### 5. Check Working Tree
59
+
60
+ ```bash
61
+ git status --porcelain
62
+ ```
63
+
64
+ Dirty → list files, ask user to confirm before proceeding.
65
+
66
+ ### 6. Classify
67
+
68
+ Read each comment's target file (±10 lines context), then classify:
69
+
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 |
75
+
76
+ **Key: when in doubt, classify as DISCUSS. Be conservative with VALID.**
77
+
78
+ ### 7. Present Summary
79
+
80
+ **MUST output before any code changes:**
81
+
82
+ ```
83
+ PR #{number}: {title}
84
+ Branch: {headRefName}
85
+ Bot comments: {total} ({bot_names})
86
+
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}
90
+ ```
91
+
92
+ ### 8. Handle DISCUSS
93
+
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
98
+
99
+ ### 9. Apply Fixes
100
+
101
+ For each VALID item:
102
+ 1. Read target file
103
+ 2. Apply minimal fix via Edit
104
+ 3. Verify modified area
105
+
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.
107
+
108
+ ### 10. Resolve Threads on GitHub
109
+
110
+ See [graphql.md](graphql.md) for the mutation.
111
+
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 |
120
+
121
+ GraphQL failure → warn, **do not abort**.
122
+
123
+ ### 11. Commit
124
+
125
+ No fixes applied → skip to Step 12.
126
+
127
+ Show summary + resolved thread count → **wait for user confirmation** (NFR-003).
128
+
129
+ ```
130
+ resolve LLM review comments on #{number}
131
+
132
+ - fix: {description} ({bot_name})
133
+ - skip: {reason} (NOISE, {count} items)
134
+ ```
135
+
136
+ Do **NOT** push.
137
+
138
+ ### 12. Output Report
139
+
140
+ **MUST always output**, even if interrupted:
141
+
142
+ ```
143
+ Resolve complete
144
+ ├─ PR: #{number} — {title}
145
+ ├─ Bot comments: {total} ({bot_names})
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})
152
+ └─ Push: not pushed (run 'git push' when ready)
153
+ ```
154
+
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.
158
+
159
+ ## Notes
160
+
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