all-for-claudecode 2.6.0 → 2.7.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +3 -2
- package/README.md +3 -2
- package/agents/afc-architect.md +1 -1
- package/agents/afc-impl-worker.md +8 -0
- package/agents/afc-security.md +1 -1
- package/commands/analyze.md +1 -1
- package/commands/architect.md +12 -1
- package/commands/auto.md +1 -1
- package/commands/checkpoint.md +1 -1
- package/commands/clarify.md +1 -1
- package/commands/clean.md +126 -0
- package/commands/consult.md +1 -1
- package/commands/debug.md +1 -1
- package/commands/doctor.md +1 -1
- package/commands/ideate.md +1 -1
- package/commands/implement.md +3 -2
- package/commands/init.md +2 -1
- package/commands/launch.md +1 -1
- package/commands/plan.md +1 -1
- package/commands/pr-comment.md +1 -1
- package/commands/principles.md +1 -1
- package/commands/qa.md +1 -1
- package/commands/release-notes.md +1 -1
- package/commands/research.md +11 -1
- package/commands/resume.md +1 -1
- package/commands/review.md +44 -1
- package/commands/security.md +44 -3
- package/commands/spec.md +1 -1
- package/commands/tasks.md +1 -1
- package/commands/test.md +1 -1
- package/commands/triage.md +15 -1
- package/commands/validate.md +1 -1
- package/docs/phase-gate-protocol.md +13 -2
- package/hooks/hooks.json +1 -0
- package/package.json +1 -1
- package/schemas/hooks.schema.json +4 -0
- package/schemas/plugin.schema.json +5 -1
- package/scripts/afc-user-prompt-submit.sh +98 -13
- package/scripts/session-start-context.sh +12 -9
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Automated pipeline for Claude Code — spec → plan → implement → review → clean",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.7.1"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "afc",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Automated pipeline for Claude Code. Automates the full development cycle: spec → plan → implement → review → clean.",
|
|
16
|
-
"version": "2.
|
|
16
|
+
"version": "2.7.1",
|
|
17
17
|
"category": "automation",
|
|
18
18
|
"tags": ["pipeline", "automation", "spec", "plan", "implement", "review", "critic-loop"]
|
|
19
19
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "afc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Automated pipeline for Claude Code. Automates the full development cycle: spec → plan → implement → review → clean.",
|
|
5
5
|
"author": { "name": "jhlee0409", "email": "relee6203@gmail.com" },
|
|
6
6
|
"homepage": "https://github.com/jhlee0409/all-for-claudecode",
|
|
7
7
|
"repository": "https://github.com/jhlee0409/all-for-claudecode",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"keywords": ["pipeline", "automation", "spec", "plan", "implement", "review", "critic-loop"],
|
|
10
|
-
"commands": "./commands/"
|
|
10
|
+
"commands": "./commands/",
|
|
11
|
+
"hooks": "./hooks/hooks.json"
|
|
11
12
|
}
|
package/README.md
CHANGED
|
@@ -108,6 +108,7 @@ Performance: ✓ no N+1 queries
|
|
|
108
108
|
| `/afc:implement` | Execute code implementation with CI gates |
|
|
109
109
|
| `/afc:test` | Test strategy planning and test writing |
|
|
110
110
|
| `/afc:review` | Code review with architecture/security scanning |
|
|
111
|
+
| `/afc:clean` | Pipeline artifact cleanup and codebase hygiene |
|
|
111
112
|
| `/afc:research` | Technical research with persistent storage |
|
|
112
113
|
| `/afc:debug` | Bug diagnosis and fix |
|
|
113
114
|
| `/afc:init` | Project setup — detects stack and generates config |
|
|
@@ -171,7 +172,7 @@ Every hook fires automatically — no configuration needed after install.
|
|
|
171
172
|
| `Notification` | Desktop alerts (macOS/Linux) |
|
|
172
173
|
| `TaskCompleted` | CI gate (shell) + acceptance criteria verification (LLM) |
|
|
173
174
|
| `SubagentStop` | Tracks subagent completion in pipeline log |
|
|
174
|
-
| `UserPromptSubmit` |
|
|
175
|
+
| `UserPromptSubmit` | **Inactive**: detects intent keywords and suggests matching afc skill. **Active**: injects Phase/Feature context + drift checkpoint at threshold prompts |
|
|
175
176
|
| `PermissionRequest` | Auto-allows CI commands during implement/review |
|
|
176
177
|
| `ConfigChange` | Audits/blocks settings changes during active pipeline |
|
|
177
178
|
| `TeammateIdle` | Prevents Agent Teams idle during implement/review |
|
|
@@ -259,7 +260,7 @@ No. Pure markdown commands + bash hook scripts. No npm packages are imported at
|
|
|
259
260
|
Debug-based RCA: traces the error, forms a hypothesis, applies a targeted fix. Halts after 3 failed attempts with full diagnosis.
|
|
260
261
|
|
|
261
262
|
### Can I run individual phases?
|
|
262
|
-
Yes. Each phase has its own command (`/afc:spec`, `/afc:plan`, `/afc:implement`, `/afc:review`). `/afc:auto` runs them all.
|
|
263
|
+
Yes. Each phase has its own command (`/afc:spec`, `/afc:plan`, `/afc:implement`, `/afc:review`, `/afc:clean`). `/afc:auto` runs them all.
|
|
263
264
|
|
|
264
265
|
### What are Critic Loops?
|
|
265
266
|
Convergence-based quality checks after each phase. They evaluate output against criteria and auto-fix issues until stable. 4 verdicts: PASS, FAIL, ESCALATE (asks user), DEFER.
|
package/agents/afc-architect.md
CHANGED
|
@@ -32,6 +32,14 @@ The orchestrator pre-assigns tasks to you via the prompt. Do NOT self-claim task
|
|
|
32
32
|
- Gate command result
|
|
33
33
|
5. Do NOT call TaskList or TaskUpdate — the orchestrator handles task state management
|
|
34
34
|
|
|
35
|
+
## Cross-Phase Awareness
|
|
36
|
+
|
|
37
|
+
When implementing tasks that call functions modified in a previous phase:
|
|
38
|
+
- Read the callee's current implementation (it may have changed in the previous phase)
|
|
39
|
+
- Verify that your call pattern is compatible with the callee's actual behavior (side effects, return values, error handling)
|
|
40
|
+
- If `{config.test}` is available, run it after completing tasks that depend on cross-phase changes
|
|
41
|
+
- If no E2E/integration tests are configured, note in your output: "⚠ Cross-phase dependency on {function} — no E2E verification available"
|
|
42
|
+
|
|
35
43
|
## Rules
|
|
36
44
|
|
|
37
45
|
- Always read existing files before modifying them
|
package/agents/afc-security.md
CHANGED
package/commands/analyze.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:analyze
|
|
3
|
-
description: "General-purpose code and component analysis"
|
|
3
|
+
description: "General-purpose code and component analysis — use when the user asks to analyze code, trace a flow, audit consistency, understand how something works, or inspect components"
|
|
4
4
|
argument-hint: "<analysis target or question>"
|
|
5
5
|
user-invocable: true
|
|
6
6
|
context: fork
|
package/commands/architect.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:architect
|
|
3
|
-
description: "Architecture analysis and design advice"
|
|
3
|
+
description: "Architecture analysis and design advice — use when the user asks about architecture, system design, layer boundaries, or wants structural design review"
|
|
4
4
|
argument-hint: "[analysis target or design question]"
|
|
5
5
|
context: fork
|
|
6
6
|
agent: afc-architect
|
|
@@ -59,6 +59,17 @@ Task("analyze features/timeline", subagent_type: Explore)
|
|
|
59
59
|
Task("analyze widgets/timeline", subagent_type: Explore)
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
**Cross-Module Import Chain Verification** (after Explore agents return):
|
|
63
|
+
|
|
64
|
+
When parallel Explore agents are used, the orchestrator must verify cross-module boundaries that no single agent can see:
|
|
65
|
+
|
|
66
|
+
1. From each agent's dependency map, extract **outbound imports** that cross module boundaries
|
|
67
|
+
2. For each cross-module import chain (e.g., widget → feature → shared), read the actual import statements at the boundary files
|
|
68
|
+
3. Verify against {config.architecture} rules: does the full chain respect layer direction, not just each module's internal imports?
|
|
69
|
+
4. Report any cross-module violations not surfaced by individual agents
|
|
70
|
+
|
|
71
|
+
Do not trust agent-summarized import relationships for cross-boundary chains — re-read the boundary files directly.
|
|
72
|
+
|
|
62
73
|
### 3. Write Analysis
|
|
63
74
|
|
|
64
75
|
Structure analysis results and **print to console**:
|
package/commands/auto.md
CHANGED
package/commands/checkpoint.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:checkpoint
|
|
3
|
-
description: "Save session state"
|
|
3
|
+
description: "Save session state — use when the user asks to save progress, checkpoint the session, or preserve current work state"
|
|
4
4
|
argument-hint: "[checkpoint message]"
|
|
5
5
|
model: haiku
|
|
6
6
|
allowed-tools:
|
package/commands/clarify.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:clarify
|
|
3
|
-
description: "Resolve spec ambiguities"
|
|
3
|
+
description: "Resolve spec ambiguities — auto-triggered when requirements are unclear to ask clarifying questions before proceeding"
|
|
4
4
|
argument-hint: "[focus area: security, performance, UI flow]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools:
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: afc:clean
|
|
3
|
+
description: "Pipeline artifact cleanup and codebase hygiene — use when the user asks to clean up artifacts, remove pipeline files, or finalize after implementation"
|
|
4
|
+
argument-hint: "[feature name — defaults to current pipeline feature]"
|
|
5
|
+
model: haiku
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /afc:clean — Pipeline Cleanup
|
|
9
|
+
|
|
10
|
+
> Runs the clean phase independently: artifact cleanup, dead code scan, CI verification, memory update, and pipeline flag release.
|
|
11
|
+
> Equivalent to Phase 5 of `/afc:auto`. Use after manually running spec/plan/implement/review phases.
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
|
|
15
|
+
- `$ARGUMENTS` — (optional) Feature name to clean up. Defaults to the currently active pipeline feature.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- Pipeline must be active (`afc_state_is_active`) OR a feature name must be provided
|
|
20
|
+
- If pipeline is active, the current phase should be `review` or later
|
|
21
|
+
|
|
22
|
+
## Execution Steps
|
|
23
|
+
|
|
24
|
+
### 1. Resolve Feature
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/afc-pipeline-manage.sh" phase clean
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- If pipeline is active: read feature from state
|
|
31
|
+
- If `$ARGUMENTS` provides a feature name: use that (for manual cleanup without active pipeline)
|
|
32
|
+
- If neither: exit with error — `"No active pipeline and no feature specified. Usage: /afc:clean [feature-name]"`
|
|
33
|
+
|
|
34
|
+
Set `PIPELINE_ARTIFACT_DIR` = `.claude/afc/specs/{feature}/`
|
|
35
|
+
|
|
36
|
+
### 2. Artifact Cleanup (scope-limited)
|
|
37
|
+
|
|
38
|
+
- **Delete only the `.claude/afc/specs/{feature}/` directory created by the current pipeline**
|
|
39
|
+
- If other `.claude/afc/specs/` subdirectories exist, **do not delete them** (only inform the user of their existence)
|
|
40
|
+
- Do not leave pipeline intermediate artifacts in the codebase
|
|
41
|
+
|
|
42
|
+
### 3. Dead Code Scan
|
|
43
|
+
|
|
44
|
+
- Detect unused imports from the implementation process (check with `{config.ci}`)
|
|
45
|
+
- Remove empty directories from moved/deleted files
|
|
46
|
+
- Detect unused exports (re-exports of moved code from original locations etc.)
|
|
47
|
+
|
|
48
|
+
### 4. Final CI Gate
|
|
49
|
+
|
|
50
|
+
- Run `{config.ci}` final execution
|
|
51
|
+
- Auto-fix on failure (max 2 attempts)
|
|
52
|
+
|
|
53
|
+
### 5. Memory Update
|
|
54
|
+
|
|
55
|
+
- Reusable patterns found during pipeline -> record in `.claude/afc/memory/`
|
|
56
|
+
- If there were `[AUTO-RESOLVED]` items -> record decisions in `.claude/afc/memory/decisions/`
|
|
57
|
+
- **If retrospective.md exists** -> record as patterns missed by the Plan phase Critic Loop in `.claude/afc/memory/retrospectives/` (reuse as RISK checklist items in future runs)
|
|
58
|
+
- **If review-report.md exists** -> copy to `.claude/afc/memory/reviews/{feature}-{date}.md` before .claude/afc/specs/ deletion
|
|
59
|
+
- **If research.md exists** and was not already persisted in Plan phase -> copy to `.claude/afc/memory/research/{feature}.md`
|
|
60
|
+
- **Agent memory consolidation**: check each agent's MEMORY.md line count -- if either exceeds 100 lines, invoke the respective agent to self-prune:
|
|
61
|
+
```
|
|
62
|
+
Task("Memory cleanup: afc-architect", subagent_type: "afc:afc-architect",
|
|
63
|
+
prompt: "Your MEMORY.md exceeds 100 lines. Read it, prune old/redundant entries, and rewrite to under 100 lines following your size limit rules.")
|
|
64
|
+
```
|
|
65
|
+
(Same pattern for afc-security if needed. Skip if both are under 100 lines.)
|
|
66
|
+
- **Memory rotation**: for each memory subdirectory, check file count and prune oldest files if over threshold:
|
|
67
|
+
| Directory | Threshold | Action |
|
|
68
|
+
|-----------|-----------|--------|
|
|
69
|
+
| `quality-history/` | 30 files | Delete oldest files beyond threshold |
|
|
70
|
+
| `reviews/` | 40 files | Delete oldest files beyond threshold |
|
|
71
|
+
| `retrospectives/` | 30 files | Delete oldest files beyond threshold |
|
|
72
|
+
| `research/` | 50 files | Delete oldest files beyond threshold |
|
|
73
|
+
| `decisions/` | 60 files | Delete oldest files beyond threshold |
|
|
74
|
+
- Sort by filename ascending (oldest first), delete excess
|
|
75
|
+
- Log: `"Memory rotation: {dir} pruned {N} files"`
|
|
76
|
+
- Skip directories that do not exist or are under threshold
|
|
77
|
+
|
|
78
|
+
### 6. Quality Report
|
|
79
|
+
|
|
80
|
+
Generate `.claude/afc/memory/quality-history/{feature}-{date}.json` with pipeline metrics (if pipeline was active):
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"feature": "{feature}",
|
|
84
|
+
"date": "{YYYY-MM-DD}",
|
|
85
|
+
"totals": { "changed_files": N }
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
Create `.claude/afc/memory/quality-history/` directory if it does not exist.
|
|
89
|
+
|
|
90
|
+
### 7. Checkpoint Reset
|
|
91
|
+
|
|
92
|
+
Clear `.claude/afc/memory/checkpoint.md` **and** `~/.claude/projects/{ENCODED_PATH}/memory/checkpoint.md` (pipeline complete = session goal achieved; `ENCODED_PATH` = project path with `/` replaced by `-`).
|
|
93
|
+
|
|
94
|
+
### 8. Timeline Finalize
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/afc-pipeline-manage.sh" log pipeline-end "Pipeline complete: {feature}"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 9. Release Pipeline Flag
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/afc-pipeline-manage.sh" end
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
- Stop Gate Hook deactivated
|
|
107
|
+
- Change tracking log deleted
|
|
108
|
+
- Safety tag removed (successful completion)
|
|
109
|
+
- Phase rollback tags removed (handled automatically by pipeline end)
|
|
110
|
+
|
|
111
|
+
### 10. Output Summary
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Clean complete: {feature}
|
|
115
|
+
├─ Artifacts: {N} files deleted from .claude/afc/specs/{feature}/
|
|
116
|
+
├─ Dead code: {N} items removed
|
|
117
|
+
├─ CI: PASSED
|
|
118
|
+
├─ Memory: {N} files persisted, {N} rotated
|
|
119
|
+
└─ Pipeline flag: released
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Notes
|
|
123
|
+
|
|
124
|
+
- This command is safe to run multiple times (idempotent -- skips already-deleted artifacts)
|
|
125
|
+
- If no pipeline is active and no feature is specified, the command exits with an informative error
|
|
126
|
+
- When run standalone (not as part of auto), the quality report captures only the information available at clean time
|
package/commands/consult.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:consult
|
|
3
|
-
description: "Expert consultation —
|
|
3
|
+
description: "Expert consultation — use when the user asks for expert advice, wants to consult a specialist, or needs domain-specific guidance on backend, infra, PM, design, marketing, legal, or tech decisions"
|
|
4
4
|
argument-hint: "[domain?] \"[question]\" [brief|deep]"
|
|
5
5
|
model: sonnet
|
|
6
6
|
---
|
package/commands/debug.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:debug
|
|
3
|
-
description: "Bug diagnosis and fix"
|
|
3
|
+
description: "Bug diagnosis and fix — use when the user reports a bug, error, crash, exception, broken behavior, or something not working and wants root-cause analysis and a targeted fix"
|
|
4
4
|
argument-hint: "[bug description, error message, or reproduction steps]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/doctor.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:doctor
|
|
3
|
-
description: "Diagnose project health and plugin setup"
|
|
3
|
+
description: "Diagnose project health and plugin setup — use when the user asks for a health check, wants to diagnose project issues, or verify plugin installation"
|
|
4
4
|
argument-hint: "[--verbose]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/ideate.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:ideate
|
|
3
|
-
description: "Explore and structure a product idea"
|
|
3
|
+
description: "Explore and structure a product idea — use when the user wants to brainstorm, ideate, explore what to build, or create a product brief from a rough concept"
|
|
4
4
|
argument-hint: "[rough idea or problem statement]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/implement.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:implement
|
|
3
|
-
description: "Execute code implementation"
|
|
3
|
+
description: "Execute code implementation — use when the user asks to implement a feature, execute a planned refactor, modify code from a plan, or build something"
|
|
4
4
|
argument-hint: "[task ID or phase specification]"
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -271,7 +271,7 @@ When a worker agent returns an error:
|
|
|
271
271
|
|
|
272
272
|
#### Phase Completion Gate (3 steps)
|
|
273
273
|
|
|
274
|
-
> **Always** read `${CLAUDE_PLUGIN_ROOT}/docs/phase-gate-protocol.md` first and perform the 3 steps (CI gate → Mini-Review → Auto-Checkpoint) in order.
|
|
274
|
+
> **Always** read `${CLAUDE_PLUGIN_ROOT}/docs/phase-gate-protocol.md` first and perform the 3–4 steps (CI gate → Mini-Review → Integration/E2E Gate (conditional) → Auto-Checkpoint) in order.
|
|
275
275
|
> Cannot advance to the next phase without passing the gate. Abort and report to user after 3 consecutive CI failures.
|
|
276
276
|
|
|
277
277
|
After passing the gate, create a phase rollback point:
|
|
@@ -320,6 +320,7 @@ After CI passes, run a convergence-based Critic Loop to verify design alignment
|
|
|
320
320
|
- **SCOPE_ADHERENCE**: Compare `git diff` changed files against plan.md File Change List. Flag any file modified that is NOT in the plan. Flag any planned file NOT modified. Provide "M of N files match" count.
|
|
321
321
|
- **ARCHITECTURE**: Validate changed files against `{config.architecture}` rules (layer boundaries, naming conventions, import paths). Provide "N of M rules checked" count.
|
|
322
322
|
- **CORRECTNESS**: Cross-check implemented changes against spec.md acceptance criteria (AC). Verify each AC has corresponding code. Provide "N of M AC verified" count.
|
|
323
|
+
- **SIDE_EFFECT_SAFETY**: For tasks that changed call order, error handling, or state flow: verify that callee behavior is compatible with the new call pattern. Provide "{M} of {N} behavioral changes verified" count.
|
|
323
324
|
- **Adversarial 3-perspective** (mandatory each pass):
|
|
324
325
|
- Skeptic: "Which implementation assumption is most likely wrong?"
|
|
325
326
|
- Devil's Advocate: "How could this implementation be misused or fail unexpectedly?"
|
package/commands/init.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:init
|
|
3
|
-
description: "Project initial setup"
|
|
3
|
+
description: "Project initial setup — use when the user asks to set up the project, initialize afc, configure the plugin, or detect the tech stack"
|
|
4
4
|
argument-hint: "[additional context]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
@@ -260,6 +260,7 @@ User-only (not auto-triggered — inform user on request):
|
|
|
260
260
|
- `afc:checkpoint` — inform user when session save is requested
|
|
261
261
|
- `afc:resume` — inform user when session restore is requested
|
|
262
262
|
- `afc:principles` — inform user when project principles management is requested
|
|
263
|
+
- `afc:clean` — inform user when pipeline cleanup is requested (artifact cleanup, dead code scan, pipeline flag release)
|
|
263
264
|
- `afc:triage` — inform user when parallel PR/issue triage is requested
|
|
264
265
|
- `afc:pr-comment` — inform user when posting PR review comments to GitHub is requested
|
|
265
266
|
- `afc:release-notes` — inform user when generating release notes from git history is requested
|
package/commands/launch.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:launch
|
|
3
|
-
description: "Generate release artifacts"
|
|
3
|
+
description: "Generate release artifacts — use when the user asks to prepare a release, bump version, publish a package, or create release tags"
|
|
4
4
|
argument-hint: "[version tag or 'auto']"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/plan.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:plan
|
|
3
|
-
description: "Implementation design"
|
|
3
|
+
description: "Implementation design — use when the user asks to plan, design an implementation, create a file change map, or figure out how to implement something"
|
|
4
4
|
argument-hint: "[additional context or constraints]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/pr-comment.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:pr-comment
|
|
3
|
-
description: "Post PR review comments to GitHub"
|
|
3
|
+
description: "Post PR review comments to GitHub — use when the user asks to comment on a PR, post review feedback, or submit structured PR review comments"
|
|
4
4
|
argument-hint: "<PR number> [--severity critical,warning,info]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/principles.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:principles
|
|
3
|
-
description: "Manage project principles"
|
|
3
|
+
description: "Manage project principles — use when the user asks to add, remove, or view project coding principles and conventions"
|
|
4
4
|
argument-hint: "[action: add, remove, init]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/qa.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:qa
|
|
3
|
-
description: "Project quality audit — detect gaps
|
|
3
|
+
description: "Project quality audit — use when the user asks for a quality audit, QA check, test confidence assessment, or wants to detect gaps in error handling and code health"
|
|
4
4
|
argument-hint: "[scope: all, tests, errors, coverage, or specific concern]"
|
|
5
5
|
user-invocable: true
|
|
6
6
|
context: fork
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:release-notes
|
|
3
|
-
description: "Generate user-facing release notes from git history"
|
|
3
|
+
description: "Generate user-facing release notes from git history — use when the user asks to write release notes, summarize changes between versions, or generate a changelog"
|
|
4
4
|
argument-hint: "[v1.0.0..v2.0.0 | v2.0.0 | --post]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/research.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:research
|
|
3
|
-
description: "Technical research"
|
|
3
|
+
description: "Technical research — use when the user asks to research a topic, investigate a technology, compare libraries, or explore options before deciding"
|
|
4
4
|
argument-hint: "[research topic]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
@@ -51,6 +51,16 @@ Source priority:
|
|
|
51
51
|
2. **Codebase** (existing patterns in the current project)
|
|
52
52
|
3. **Community** (GitHub Issues, blogs)
|
|
53
53
|
|
|
54
|
+
### 3.5. Reconcile Findings
|
|
55
|
+
|
|
56
|
+
After parallel agents return, the orchestrator checks for conflicts between sources:
|
|
57
|
+
|
|
58
|
+
1. Compare codebase agent findings (current usage patterns) against web agent findings (official docs, latest versions)
|
|
59
|
+
2. If a codebase pattern conflicts with official documentation (e.g., deprecated API, changed behavior in newer version):
|
|
60
|
+
- Flag the conflict explicitly in Findings rather than silently adopting one source
|
|
61
|
+
- Note: "Current codebase uses {pattern} but official docs recommend {alternative} since {version/date}"
|
|
62
|
+
3. If no conflicts → proceed to Summarize
|
|
63
|
+
|
|
54
64
|
### 4. Summarize Conclusions
|
|
55
65
|
|
|
56
66
|
```markdown
|
package/commands/resume.md
CHANGED
package/commands/review.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:review
|
|
3
|
-
description: "Code review"
|
|
3
|
+
description: "Code review — use when the user asks to review code, analyze a PR diff, do a code review, or evaluate code quality and correctness"
|
|
4
4
|
argument-hint: "[scope: file path, PR number, or staged]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
@@ -51,6 +51,23 @@ If config file is missing:
|
|
|
51
51
|
|
|
52
52
|
Choose review orchestration based on the number of changed files:
|
|
53
53
|
|
|
54
|
+
**Pre-scan: Call Chain Context** (for Parallel Batch and Review Swarm modes only):
|
|
55
|
+
|
|
56
|
+
Before distributing files to review agents, collect cross-boundary context:
|
|
57
|
+
|
|
58
|
+
1. For each changed file, identify **outbound calls** to other changed files (imports + function calls)
|
|
59
|
+
2. For each outbound call target, extract: function signature + 1-line side-effect summary (e.g., "mutates playlist state", "triggers async cascade")
|
|
60
|
+
3. Include this context in each review agent's prompt:
|
|
61
|
+
```
|
|
62
|
+
## Cross-File Context
|
|
63
|
+
This file calls:
|
|
64
|
+
- `deleteVideo()` in api/videos.ts → internally auto-advances to next video if current is deleted
|
|
65
|
+
- `getNextVideo()` in api/playlist.ts → pops pending keyword queue first, falls back to normal next
|
|
66
|
+
Review findings should account for these behaviors.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For Direct review mode (≤5 files): skip pre-scan — orchestrator already has full context.
|
|
70
|
+
|
|
54
71
|
#### 5 or fewer files: Direct review
|
|
55
72
|
Review all files directly in the current context (no delegation).
|
|
56
73
|
|
|
@@ -152,6 +169,31 @@ For each changed file, examine from the following perspectives:
|
|
|
152
169
|
- Open/Closed principle adherence where applicable
|
|
153
170
|
- Future modification cost — would a reasonable feature request require rewriting or only extending?
|
|
154
171
|
|
|
172
|
+
### 3.5. Cross-Boundary Verification
|
|
173
|
+
|
|
174
|
+
After individual/parallel reviews complete, the **orchestrator** performs a cross-boundary check on behavioral findings:
|
|
175
|
+
|
|
176
|
+
1. **Filter**: From all collected findings, select those involving:
|
|
177
|
+
- Call order changes (function A now calls B before C)
|
|
178
|
+
- Error handling modifications (try/catch scope changes, error propagation changes)
|
|
179
|
+
- State mutation changes (new writes to shared state, removed cleanup)
|
|
180
|
+
|
|
181
|
+
2. **Verify**: For each behavioral finding rated Critical or Warning:
|
|
182
|
+
- Read the **callee's implementation** (the function/method being called)
|
|
183
|
+
- Check: does the callee's internal behavior (side effects, state changes, return values) actually conflict with the change?
|
|
184
|
+
- If no conflict → downgrade: Critical → Info, Warning → Info (append "verified: no cross-boundary impact")
|
|
185
|
+
- If confirmed conflict → keep severity, enrich description with callee behavior details
|
|
186
|
+
|
|
187
|
+
3. **Output**: Append verification summary before Review Output:
|
|
188
|
+
```
|
|
189
|
+
Cross-Boundary Check: {N} behavioral findings verified
|
|
190
|
+
├─ Confirmed: {M} (severity kept)
|
|
191
|
+
├─ Downgraded: {K} (false positive — callee compatible)
|
|
192
|
+
└─ Skipped: {J} (no behavioral change)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
This step runs in the orchestrator context (not delegated), as it requires reading code across file boundaries that individual review agents cannot see.
|
|
196
|
+
|
|
155
197
|
### 4. Review Output
|
|
156
198
|
|
|
157
199
|
```markdown
|
|
@@ -197,6 +239,7 @@ Run the critic loop until convergence. Safety cap: 5 passes.
|
|
|
197
239
|
|-----------|------------|
|
|
198
240
|
| **COMPLETENESS** | Were all changed files reviewed? Are there any missed perspectives (A through H)? |
|
|
199
241
|
| **SPEC_ALIGNMENT** | Cross-check implementation against spec.md: (1) every SC (success criterion) is satisfied — provide `{M}/{N} SC verified` count, (2) every acceptance scenario (GWT) has corresponding code path, (3) no spec constraint is violated by the implementation |
|
|
242
|
+
| **SIDE_EFFECT_AWARENESS** | For findings involving call order changes, error handling modifications, or state mutation changes: did the reviewer verify the callee's internal behavior? If a Critical finding assumes a side effect without reading the target implementation → auto-downgrade to Info with note "cross-boundary unverified". Provide "{M} of {N} behavioral findings verified" count. |
|
|
200
243
|
| **PRECISION** | Are the findings actual issues, not false positives? |
|
|
201
244
|
|
|
202
245
|
**On FAIL**: auto-fix and continue to next pass.
|
package/commands/security.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:security
|
|
3
|
-
description: "Security scan (read-only)"
|
|
3
|
+
description: "Security scan (read-only) — use when the user asks for a security scan, security review, vulnerability check, or threat assessment"
|
|
4
4
|
argument-hint: "[scan scope: file/directory path or full]"
|
|
5
5
|
context: fork
|
|
6
6
|
agent: afc-security
|
|
@@ -46,11 +46,52 @@ For dependency audit command: infer from `packageManager` field in `package.json
|
|
|
46
46
|
### 2. Agent Teams (if more than 10 files)
|
|
47
47
|
|
|
48
48
|
Use parallel agents for wide-scope scans:
|
|
49
|
+
|
|
50
|
+
**Pre-scan: Data Flow Context** (before distributing to agents):
|
|
51
|
+
|
|
52
|
+
1. For each changed file, identify **input entry points** (user input, API params, URL params, form data) and **sanitization calls** (validation, escaping, encoding)
|
|
53
|
+
2. Trace input flow across changed files: where does user input enter? Where is it sanitized? Where is it consumed?
|
|
54
|
+
3. Include this context in each agent's prompt:
|
|
55
|
+
```
|
|
56
|
+
## Data Flow Context
|
|
57
|
+
Input flows relevant to your scan scope:
|
|
58
|
+
- User input enters via `req.body` in api/routes.ts → sanitized by `validateInput()` in shared/validation.ts → consumed in features/user.ts
|
|
59
|
+
- URL params enter via `req.params` in api/routes.ts → NO sanitization found → used in features/search.ts
|
|
60
|
+
Account for these flows when assessing injection/XSS severity.
|
|
61
|
+
```
|
|
62
|
+
|
|
49
63
|
```
|
|
50
|
-
Task("Security scan: src/features/", subagent_type: general-purpose
|
|
51
|
-
|
|
64
|
+
Task("Security scan: src/features/", subagent_type: general-purpose,
|
|
65
|
+
prompt: "... {include Data Flow Context} ...")
|
|
66
|
+
Task("Security scan: src/shared/api/", subagent_type: general-purpose,
|
|
67
|
+
prompt: "... {include Data Flow Context} ...")
|
|
52
68
|
```
|
|
53
69
|
|
|
70
|
+
For scans with ≤10 files: skip pre-scan — orchestrator has full context.
|
|
71
|
+
|
|
72
|
+
### 2.5. Cross-Boundary Verification
|
|
73
|
+
|
|
74
|
+
After parallel agent results are collected, the **orchestrator** performs cross-boundary verification on injection/vulnerability findings:
|
|
75
|
+
|
|
76
|
+
1. **Filter**: From all findings, select those involving:
|
|
77
|
+
- Injection vulnerabilities (SQL, command, XSS) where input origin is in another agent's scan scope
|
|
78
|
+
- Authentication/authorization checks where the guard is in a different directory slice
|
|
79
|
+
- Sensitive data exposure where the data source and the exposure point are in different slices
|
|
80
|
+
|
|
81
|
+
2. **Verify**: For each Critical or High finding:
|
|
82
|
+
- Read the **upstream code** (where input enters or is sanitized)
|
|
83
|
+
- Check: is the input actually sanitized before reaching the flagged consumption point?
|
|
84
|
+
- If sanitized → downgrade: Critical → Low, High → Low (append "verified: input sanitized at {location}")
|
|
85
|
+
- If NOT sanitized → keep severity, enrich with full data flow path
|
|
86
|
+
|
|
87
|
+
3. **Output**: Append verification summary before Output Results:
|
|
88
|
+
```
|
|
89
|
+
Cross-Boundary Check: {N} injection/vulnerability findings verified
|
|
90
|
+
├─ Confirmed: {M} (severity kept — no upstream sanitization)
|
|
91
|
+
├─ Downgraded: {K} (false positive — sanitized upstream)
|
|
92
|
+
└─ Skipped: {J} (single-file scope, no cross-boundary flow)
|
|
93
|
+
```
|
|
94
|
+
|
|
54
95
|
### 3. Security Check Items
|
|
55
96
|
|
|
56
97
|
#### A. Injection (A03:2021)
|
package/commands/spec.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:spec
|
|
3
|
-
description: "Generate feature specification"
|
|
3
|
+
description: "Generate feature specification — use when the user asks to write a spec, define requirements, create acceptance criteria, or specify a feature"
|
|
4
4
|
argument-hint: "[feature description in natural language]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/tasks.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:tasks
|
|
3
|
-
description: "Task decomposition"
|
|
3
|
+
description: "Task decomposition — auto-invoked during implement phase to break down plan into executable tasks with dependency tracking"
|
|
4
4
|
argument-hint: "[constraints/priority directives]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools:
|
package/commands/test.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:test
|
|
3
|
-
description: "Test strategy planning and test writing"
|
|
3
|
+
description: "Test strategy planning and test writing — use when the user asks to write tests, add test coverage, improve coverage, create unit/integration/e2e tests, or plan a testing strategy"
|
|
4
4
|
argument-hint: "[target: file path, feature name, or coverage]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
package/commands/triage.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:triage
|
|
3
|
-
description: "Parallel triage of open PRs and issues"
|
|
3
|
+
description: "Parallel triage of open PRs and issues — use when the user asks to triage PRs, review open issues, or prioritize the backlog of pull requests and issues"
|
|
4
4
|
argument-hint: "[scope: --pr, --issue, --all (default), or specific numbers]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
@@ -145,6 +145,20 @@ Task("Deep triage PR #{number}", subagent_type: "afc:afc-pr-analyst",
|
|
|
145
145
|
|
|
146
146
|
If `--deep` flag was specified, run Phase 2 for **all** PRs regardless of Phase 1 classification.
|
|
147
147
|
|
|
148
|
+
### 3.5. Cross-PR Coupling Detection
|
|
149
|
+
|
|
150
|
+
After Phase 1 (and Phase 2 if applicable) results are collected, detect file-level coupling between PRs:
|
|
151
|
+
|
|
152
|
+
1. Extract changed file lists from each PR's diff (already available from Phase 1 agent outputs)
|
|
153
|
+
2. For each file, check if it appears in multiple PRs' changed file lists
|
|
154
|
+
3. If shared files are found, annotate affected PRs with a coupling flag:
|
|
155
|
+
```
|
|
156
|
+
COUPLING: PR #{A} and PR #{B} both modify src/shared/utils.ts
|
|
157
|
+
```
|
|
158
|
+
4. Include coupling information in the consolidated report's Priority Actions table and per-PR details
|
|
159
|
+
|
|
160
|
+
This helps identify merge-order dependencies and potential conflict risks that no single-PR agent can detect.
|
|
161
|
+
|
|
148
162
|
### 4. Consolidate Triage Report
|
|
149
163
|
|
|
150
164
|
Merge Phase 1 and Phase 2 results into a single report:
|
package/commands/validate.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: afc:validate
|
|
3
|
-
description: "Artifact consistency validation (read-only)"
|
|
3
|
+
description: "Artifact consistency validation (read-only) — auto-invoked to verify spec, plan, and task artifacts are consistent with each other"
|
|
4
4
|
argument-hint: "[validation scope: spec-plan, tasks-only]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
context: fork
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Phase Completion Gate (3 Steps)
|
|
1
|
+
# Phase Completion Gate (3–4 Steps)
|
|
2
2
|
|
|
3
|
-
After each Phase completes, perform **3
|
|
3
|
+
After each Phase completes, perform **3–4 step verification** sequentially (Step 2.5 is conditional):
|
|
4
4
|
|
|
5
5
|
## Step 1. CI Gate
|
|
6
6
|
|
|
@@ -29,6 +29,17 @@ Quantitatively inspect changed files within the Phase against `{config.code_styl
|
|
|
29
29
|
- If issues found → fix immediately, then re-run CI Gate (Step 1)
|
|
30
30
|
- If no issues → `✓ Phase {N} Mini-Review passed`
|
|
31
31
|
|
|
32
|
+
## Step 2.5. Integration/E2E Gate (conditional)
|
|
33
|
+
|
|
34
|
+
When the phase contains **behavioral changes** (call order modifications, error handling changes, state mutation changes — not pure additions or style fixes):
|
|
35
|
+
|
|
36
|
+
1. Check if `{config.test}` includes integration or E2E tests
|
|
37
|
+
2. If yes → run `{config.test}` and verify pass
|
|
38
|
+
3. If fail → debug-based RCA (same protocol as Step 1)
|
|
39
|
+
4. If `{config.test}` is empty or has no E2E coverage → skip with note: `⚠ No E2E test configured — behavioral changes not integration-tested`
|
|
40
|
+
|
|
41
|
+
This gate is skipped for phases with only additive changes (new files, new functions with no existing callers).
|
|
42
|
+
|
|
32
43
|
## Step 3. Auto-Checkpoint
|
|
33
44
|
|
|
34
45
|
After passing the Phase gate, automatically save session state:
|
package/hooks/hooks.json
CHANGED
package/package.json
CHANGED
|
@@ -45,9 +45,13 @@
|
|
|
45
45
|
"type": "string",
|
|
46
46
|
"description": "Path to commands directory"
|
|
47
47
|
},
|
|
48
|
+
"agents": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "Path to agents directory"
|
|
51
|
+
},
|
|
48
52
|
"hooks": {
|
|
49
53
|
"type": "string",
|
|
50
|
-
"description": "Path to hooks
|
|
54
|
+
"description": "Path to hooks configuration file"
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# UserPromptSubmit Hook: Two modes of operation:
|
|
5
|
-
# 1. Pipeline INACTIVE:
|
|
5
|
+
# 1. Pipeline INACTIVE: Detect user intent from prompt and inject specific skill routing hint
|
|
6
6
|
# 2. Pipeline ACTIVE: Inject Phase/Feature context + drift checkpoint at thresholds
|
|
7
|
-
# Exit 0 immediately if no action needed (minimize overhead)
|
|
8
7
|
|
|
9
8
|
# shellcheck source=afc-state.sh
|
|
10
9
|
. "$(dirname "$0")/afc-state.sh"
|
|
@@ -15,30 +14,116 @@ cleanup() {
|
|
|
15
14
|
}
|
|
16
15
|
trap cleanup EXIT
|
|
17
16
|
|
|
18
|
-
#
|
|
19
|
-
cat
|
|
17
|
+
# Read stdin (contains user prompt JSON)
|
|
18
|
+
INPUT=$(cat)
|
|
20
19
|
|
|
21
|
-
# --- Branch: Pipeline INACTIVE
|
|
22
|
-
#
|
|
23
|
-
#
|
|
20
|
+
# --- Branch: Pipeline INACTIVE -> intent-based skill routing ---
|
|
21
|
+
# The model has CLAUDE.md routing table but static instructions lose effectiveness
|
|
22
|
+
# as context grows. Reading the actual prompt and suggesting a SPECIFIC skill
|
|
23
|
+
# is far more actionable than a generic "check routing table" reminder.
|
|
24
24
|
if ! afc_state_is_active; then
|
|
25
|
+
|
|
26
|
+
# Extract prompt text from stdin JSON
|
|
27
|
+
USER_TEXT=""
|
|
28
|
+
if command -v jq >/dev/null 2>&1; then
|
|
29
|
+
USER_TEXT=$(printf '%s' "$INPUT" | jq -r '.prompt // empty' 2>/dev/null || true)
|
|
30
|
+
else
|
|
31
|
+
# shellcheck disable=SC2001
|
|
32
|
+
# Note: sed fallback truncates at first embedded escaped quote — acceptable for keyword matching
|
|
33
|
+
USER_TEXT=$(printf '%s' "$INPUT" | sed 's/.*"prompt"[[:space:]]*:[[:space:]]*"//;s/".*//' 2>/dev/null || true)
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Skip if prompt is already an explicit slash command
|
|
37
|
+
if printf '%s' "$USER_TEXT" | grep -qE '^\s*/afc:' 2>/dev/null; then
|
|
38
|
+
exit 0
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Normalize: lowercase + truncate for matching
|
|
42
|
+
LOWER=$(printf '%s' "$USER_TEXT" | tr '[:upper:]' '[:lower:]' | cut -c1-500)
|
|
43
|
+
|
|
44
|
+
# Early exit for empty prompts (context-only messages, malformed JSON)
|
|
45
|
+
if [ -z "$LOWER" ]; then
|
|
46
|
+
if command -v jq >/dev/null 2>&1; then
|
|
47
|
+
jq -n --arg c "[afc] If this request matches an afc skill, invoke it via Skill tool. See CLAUDE.md routing table." \
|
|
48
|
+
'{"hookSpecificOutput":{"additionalContext":$c}}'
|
|
49
|
+
else
|
|
50
|
+
printf '{"hookSpecificOutput":{"additionalContext":"[afc] If this request matches an afc skill, invoke it via Skill tool. See CLAUDE.md routing table."}}\n'
|
|
51
|
+
fi
|
|
52
|
+
exit 0
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Intent detection: priority-ordered if/elif chain.
|
|
56
|
+
# Each pattern targets strong-signal phrases to minimize false positives.
|
|
57
|
+
# The model retains final authority — this is a hint, not enforcement.
|
|
58
|
+
SKILL=""
|
|
59
|
+
# High confidence: distinctive multi-word or rare keywords
|
|
60
|
+
if printf '%s' "$LOWER" | grep -qE '(bug|broken|debug|not working|crash|exception)' 2>/dev/null; then
|
|
61
|
+
SKILL="afc:debug"
|
|
62
|
+
elif printf '%s' "$LOWER" | grep -qE '(code review|pr review)' 2>/dev/null; then
|
|
63
|
+
SKILL="afc:review"
|
|
64
|
+
elif printf '%s' "$LOWER" | grep -qE '(write test|add test|test coverage|improve coverage)' 2>/dev/null; then
|
|
65
|
+
SKILL="afc:test"
|
|
66
|
+
elif printf '%s' "$LOWER" | grep -qE '(security scan|security review|security audit|vulnerabilit)' 2>/dev/null; then
|
|
67
|
+
SKILL="afc:security"
|
|
68
|
+
elif printf '%s' "$LOWER" | grep -qE '(architecture|architect|system design)' 2>/dev/null; then
|
|
69
|
+
SKILL="afc:architect"
|
|
70
|
+
elif printf '%s' "$LOWER" | grep -qE '(doctor|health check|diagnose.*project)' 2>/dev/null; then
|
|
71
|
+
SKILL="afc:doctor"
|
|
72
|
+
elif printf '%s' "$LOWER" | grep -qE '(quality audit|qa audit|project quality)' 2>/dev/null; then
|
|
73
|
+
SKILL="afc:qa"
|
|
74
|
+
elif printf '%s' "$LOWER" | grep -qE '(new release|version bump|changelog|publish.*package)' 2>/dev/null; then
|
|
75
|
+
SKILL="afc:launch"
|
|
76
|
+
# Medium confidence: still distinctive but broader
|
|
77
|
+
elif printf '%s' "$LOWER" | grep -qE '(specification|requirements|acceptance criteria)' 2>/dev/null; then
|
|
78
|
+
SKILL="afc:spec"
|
|
79
|
+
elif printf '%s' "$LOWER" | grep -qE '(brainstorm|ideate|what to build|product brief)' 2>/dev/null; then
|
|
80
|
+
SKILL="afc:ideate"
|
|
81
|
+
elif printf '%s' "$LOWER" | grep -qE '(expert advice)' 2>/dev/null; then
|
|
82
|
+
SKILL="afc:consult"
|
|
83
|
+
elif printf '%s' "$LOWER" | grep -qE '(analyz|trace.*flow|how does.*work)' 2>/dev/null; then
|
|
84
|
+
SKILL="afc:analyze"
|
|
85
|
+
elif printf '%s' "$LOWER" | grep -qE '(research|investigat|compare.*lib)' 2>/dev/null; then
|
|
86
|
+
SKILL="afc:research"
|
|
87
|
+
# Lower confidence: common verbs
|
|
88
|
+
elif printf '%s' "$LOWER" | grep -qE '(implement|add feature|refactor|modify.*code)' 2>/dev/null; then
|
|
89
|
+
SKILL="afc:implement"
|
|
90
|
+
elif printf '%s' "$LOWER" | grep -qE '(review)' 2>/dev/null; then
|
|
91
|
+
SKILL="afc:review"
|
|
92
|
+
elif printf '%s' "$LOWER" | grep -qE '(spec[^a-z]|spec$)' 2>/dev/null; then
|
|
93
|
+
SKILL="afc:spec"
|
|
94
|
+
elif printf '%s' "$LOWER" | grep -qE '(plan[^a-z]|plan$)' 2>/dev/null; then
|
|
95
|
+
SKILL="afc:plan"
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# Build output (no TASK HYGIENE in inactive mode — stop-gate handles cleanup scope)
|
|
99
|
+
if [ -n "$SKILL" ]; then
|
|
100
|
+
HINT="[afc:route -> ${SKILL}] Detected intent from user prompt. Invoke /${SKILL} via Skill tool."
|
|
101
|
+
else
|
|
102
|
+
HINT="[afc] If this request matches an afc skill, invoke it via Skill tool. See CLAUDE.md routing table."
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
if command -v jq >/dev/null 2>&1; then
|
|
106
|
+
jq -n --arg c "$HINT" '{"hookSpecificOutput":{"additionalContext":$c}}'
|
|
107
|
+
else
|
|
108
|
+
printf '{"hookSpecificOutput":{"additionalContext":"%s"}}\n' "$HINT"
|
|
109
|
+
fi
|
|
25
110
|
exit 0
|
|
26
111
|
fi
|
|
27
112
|
|
|
28
|
-
# --- Branch: Pipeline ACTIVE
|
|
113
|
+
# --- Branch: Pipeline ACTIVE -> existing Phase/Feature context ---
|
|
29
114
|
|
|
30
|
-
# Read Feature/Phase + JSON-safe processing (strip special characters)
|
|
115
|
+
# Read Feature/Phase + JSON-safe processing (strip special characters + newlines)
|
|
31
116
|
FEATURE="$(afc_state_read feature || echo '')"
|
|
32
|
-
FEATURE="$(printf '%s' "$FEATURE" | tr -d '"' | cut -c1-100)"
|
|
117
|
+
FEATURE="$(printf '%s' "$FEATURE" | tr -d '"\n\r' | cut -c1-100)"
|
|
33
118
|
PHASE="$(afc_state_read phase || echo 'unknown')"
|
|
34
|
-
PHASE="$(printf '%s' "$PHASE" | tr -d '"' | cut -c1-100)"
|
|
119
|
+
PHASE="$(printf '%s' "$PHASE" | tr -d '"\n\r' | cut -c1-100)"
|
|
35
120
|
|
|
36
121
|
# Increment per-phase prompt counter + pipeline-wide total
|
|
37
122
|
CALL_COUNT=$(afc_state_increment promptCount 2>/dev/null || echo 0)
|
|
38
123
|
afc_state_increment totalPromptCount >/dev/null 2>&1 || echo "[afc:prompt-submit] totalPromptCount increment failed" >&2
|
|
39
124
|
|
|
40
125
|
# Build context message
|
|
41
|
-
CONTEXT="[Pipeline: ${FEATURE}] [Phase: ${PHASE}]"
|
|
126
|
+
CONTEXT="[Pipeline: ${FEATURE}] [Phase: ${PHASE}] [TASK HYGIENE: Mark completed tasks via TaskUpdate(status: completed) -- do not leave stale tasks]"
|
|
42
127
|
|
|
43
128
|
# Drift checkpoint: inject plan constraints at every N prompts during implement/review
|
|
44
129
|
# AFC_DRIFT_THRESHOLD sourced from afc-state.sh (SSOT)
|
|
@@ -53,7 +138,7 @@ fi
|
|
|
53
138
|
|
|
54
139
|
# Output additionalContext to stdout (injected into Claude context)
|
|
55
140
|
# Use jq for safe JSON encoding; printf fallback strips remaining quotes
|
|
56
|
-
if command -v jq
|
|
141
|
+
if command -v jq >/dev/null 2>&1; then
|
|
57
142
|
jq -n --arg c "$CONTEXT" '{"hookSpecificOutput":{"additionalContext":$c}}'
|
|
58
143
|
else
|
|
59
144
|
SAFE_CONTEXT="${CONTEXT//\\/\\\\}"
|
|
@@ -30,9 +30,11 @@ ENCODED_PATH="${PROJECT_PATH//\//-}"
|
|
|
30
30
|
MEMORY_DIR="$HOME/.claude/projects/$ENCODED_PATH/memory"
|
|
31
31
|
CHECKPOINT="$MEMORY_DIR/checkpoint.md"
|
|
32
32
|
OUTPUT=""
|
|
33
|
+
PIPELINE_ACTIVE=0
|
|
33
34
|
|
|
34
35
|
# 1. Check for active pipeline
|
|
35
36
|
if afc_state_is_active; then
|
|
37
|
+
PIPELINE_ACTIVE=1
|
|
36
38
|
FEATURE=$(afc_state_read feature || true)
|
|
37
39
|
OUTPUT="[AFC PIPELINE ACTIVE] Feature: $FEATURE"
|
|
38
40
|
|
|
@@ -77,17 +79,18 @@ if [ -f "$PLUGIN_ROOT/package.json" ]; then
|
|
|
77
79
|
fi
|
|
78
80
|
fi
|
|
79
81
|
|
|
80
|
-
# 2.
|
|
82
|
+
# 2. Auto-memory checkpoint cleanup (prevent stale context pollution)
|
|
83
|
+
# Auto-memory files are auto-loaded into every conversation by Claude Code.
|
|
84
|
+
# Stale checkpoints from previous sessions can confuse the model.
|
|
85
|
+
# Only remove auto-memory when project-local copy also exists (prevents stranded checkpoint data loss).
|
|
81
86
|
LOCAL_CHECKPOINT="$PROJECT_DIR/.claude/afc/memory/checkpoint.md"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
CHECKPOINT_FILE="$LOCAL_CHECKPOINT"
|
|
85
|
-
elif [ -f "$CHECKPOINT" ]; then
|
|
86
|
-
CHECKPOINT_FILE="$CHECKPOINT"
|
|
87
|
+
if [ "$PIPELINE_ACTIVE" -eq 0 ] && [ -f "$CHECKPOINT" ] && [ -f "$LOCAL_CHECKPOINT" ]; then
|
|
88
|
+
rm -f "$CHECKPOINT"
|
|
87
89
|
fi
|
|
88
90
|
|
|
89
|
-
if
|
|
90
|
-
|
|
91
|
+
# 3. Check if project-local checkpoint exists (for user notification only)
|
|
92
|
+
if [ -f "$LOCAL_CHECKPOINT" ]; then
|
|
93
|
+
RAW_LINE=$(grep 'Auto-generated:' "$LOCAL_CHECKPOINT" 2>/dev/null || echo "")
|
|
91
94
|
FIRST_LINE=$(printf '%s\n' "$RAW_LINE" | head -1)
|
|
92
95
|
CHECKPOINT_DATE="${FIRST_LINE##*Auto-generated: }"
|
|
93
96
|
if [ -n "$CHECKPOINT_DATE" ]; then
|
|
@@ -99,7 +102,7 @@ if [ -n "$CHECKPOINT_FILE" ]; then
|
|
|
99
102
|
fi
|
|
100
103
|
fi
|
|
101
104
|
|
|
102
|
-
#
|
|
105
|
+
# 4. Check for safety tag
|
|
103
106
|
HAS_SAFETY_TAG=$(cd "$PROJECT_DIR" 2>/dev/null && git tag -l 'afc/pre-*' 2>/dev/null | head -1 || echo "")
|
|
104
107
|
if [ -n "$HAS_SAFETY_TAG" ]; then
|
|
105
108
|
if [ -n "$OUTPUT" ]; then
|