5-phase-workflow 1.9.5 → 2.0.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 (44) hide show
  1. package/README.md +68 -420
  2. package/bin/install.js +294 -64
  3. package/bin/sync-agents.js +50 -11
  4. package/docs/findings.md +3 -3
  5. package/docs/workflow-guide.md +110 -1046
  6. package/package.json +6 -5
  7. package/src/agents/step-executor-agent.md +49 -0
  8. package/src/agents/step-orchestrator-agent.md +111 -0
  9. package/src/agents/verification-agent.md +78 -0
  10. package/src/commands/5/address-review-findings.md +69 -403
  11. package/src/commands/5/apply-review-findings.md +66 -0
  12. package/src/commands/5/configure.md +110 -76
  13. package/src/commands/5/discuss-feature.md +47 -57
  14. package/src/commands/5/eject.md +7 -6
  15. package/src/commands/5/implement.md +202 -0
  16. package/src/commands/5/plan.md +164 -0
  17. package/src/commands/5/reconfigure.md +30 -29
  18. package/src/commands/5/reply-pr-comments.md +46 -0
  19. package/src/commands/5/review.md +95 -0
  20. package/src/commands/5/split.md +190 -0
  21. package/src/commands/5/synchronize-agents.md +4 -4
  22. package/src/commands/5/triage-pr-comments.md +70 -0
  23. package/src/commands/5/update.md +8 -8
  24. package/src/hooks/check-updates.js +50 -7
  25. package/src/hooks/plan-guard.js +28 -22
  26. package/src/hooks/statusline.js +50 -4
  27. package/src/skills/configure-docs-index/SKILL.md +16 -20
  28. package/src/skills/configure-skills/SKILL.md +12 -12
  29. package/src/templates/AGENTS.md +94 -0
  30. package/src/templates/workflow/FIX-PLAN.md +1 -1
  31. package/src/templates/workflow/PLAN-COMPACT.md +42 -0
  32. package/src/templates/workflow/PLAN.md +58 -34
  33. package/src/templates/workflow/REVIEW-FINDINGS.md +7 -16
  34. package/src/templates/workflow/REVIEW-SUMMARY.md +5 -0
  35. package/src/templates/workflow/STATE.json +32 -3
  36. package/src/agents/component-executor.md +0 -57
  37. package/src/commands/5/implement-feature.md +0 -381
  38. package/src/commands/5/plan-feature.md +0 -293
  39. package/src/commands/5/plan-implementation.md +0 -333
  40. package/src/commands/5/quick-implement.md +0 -375
  41. package/src/commands/5/review-code.md +0 -212
  42. package/src/commands/5/verify-implementation.md +0 -277
  43. package/src/templates/workflow/FEATURE-SPEC.md +0 -100
  44. package/src/templates/workflow/VERIFICATION-REPORT.md +0 -103
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: configure-skills
3
- description: Generates project-specific create-*/run-* skills and scoped rules from the current codebase. Used during /5:implement-feature CONFIGURE.
4
- allowed-tools: Read, Write, Bash, Glob, Grep
3
+ description: Generates project-specific create-*/run-* skills and scoped rules from the current codebase. Used during /5:implement CONFIGURE.
4
+ allowed-tools: Read, Write, Bash, Glob, Grep, create-skill, scaffold-skill
5
5
  model: sonnet
6
6
  context: fork
7
7
  user-invocable: false
@@ -11,7 +11,7 @@ user-invocable: false
11
11
 
12
12
  ## Overview
13
13
 
14
- This skill handles skill and rule generation during Phase 3 (implement-feature) for the CONFIGURE feature. It is called by step-executor to create project-specific skills and scoped rules.
14
+ This skill handles skill and rule generation during implementation for the CONFIGURE feature. It is called by step-executor to create project-specific skills and scoped rules.
15
15
 
16
16
  It handles two tasks:
17
17
 
@@ -28,10 +28,10 @@ This skill supports two modes. The skill generation and rule generation logic is
28
28
 
29
29
  ### Full Mode (default)
30
30
 
31
- Used by `/5:configure` → `/5:implement-feature CONFIGURE` flow.
31
+ Used by `/5:configure` → `/5:implement CONFIGURE` flow.
32
32
 
33
- - **Input:** Pattern/command selections from feature spec (`.5/features/CONFIGURE/feature.md`)
34
- - **Behavior:** Creates all selected skills and rules from scratch based on feature spec requirements
33
+ - **Input:** Pattern/command selections from unified plan (`.5/features/CONFIGURE/plan.md`)
34
+ - **Behavior:** Creates all selected skills and rules from scratch based on unified plan requirements
35
35
 
36
36
  ### Refresh Mode
37
37
 
@@ -53,7 +53,7 @@ If `tools.skillCreator.available` is `true` in `.5/config.json`, use the skill-c
53
53
 
54
54
  If skill-creator is not available, use the existing template-based generation below — no degradation in workflow behavior.
55
55
 
56
- **Reads:** Pattern selections from feature spec (`.5/features/CONFIGURE/feature.md`)
56
+ **Reads:** Pattern selections from unified plan (`.5/features/CONFIGURE/plan.md`)
57
57
 
58
58
  **Creates:** SKILL.md files in `.claude/skills/{name}/SKILL.md`
59
59
 
@@ -61,7 +61,7 @@ If skill-creator is not available, use the existing template-based generation be
61
61
 
62
62
  Skills are determined by what patterns exist in the codebase (detected during `/5:configure`) and what the user selected — not by project type.
63
63
 
64
- For EACH pattern selected by the user in the feature spec:
64
+ For EACH pattern selected by the user in the unified plan:
65
65
 
66
66
  1. **Find examples** - Read 2-3 files from the pattern's location
67
67
  2. **Extract conventions:**
@@ -124,13 +124,13 @@ Based on {example-file}, new {patterns} should follow:
124
124
 
125
125
  ## B. Generate Command Skills (run-*)
126
126
 
127
- **Reads:** Command selections from feature spec (`.5/features/CONFIGURE/feature.md`)
127
+ **Reads:** Command selections from unified plan (`.5/features/CONFIGURE/plan.md`)
128
128
 
129
129
  **Creates:** SKILL.md files in `.claude/skills/run-{command}/SKILL.md`
130
130
 
131
131
  ### B1. Command-Based Skill Generation
132
132
 
133
- For EACH command selected by the user in the feature spec:
133
+ For EACH command selected by the user in the unified plan:
134
134
 
135
135
  1. **Read the source** - Check package.json scripts, Makefile, etc.
136
136
  2. **Document the command:**
@@ -219,7 +219,7 @@ For each applicable rule:
219
219
  1. **Derive `paths:` globs** from detected file locations (e.g., if tests are at `src/**/*.test.ts` and `tests/**/*.spec.ts`, use those patterns)
220
220
  2. **Convert analysis observations into imperative directives** — "Use X", "Always Y", "Never Z"
221
221
  3. **Keep each file 15-40 lines** — be concise and actionable
222
- 4. **Do not repeat** the 6 mandatory coding guidelines from `AGENTS.md`
222
+ 4. **Do not repeat** the general guidance sections from `AGENTS.md`
223
223
 
224
224
  Write files to `.claude/rules/`:
225
225
 
@@ -311,4 +311,4 @@ Component D (Rules): SKIPPED - rules.generate is false in config
311
311
  - DO NOT hardcode conventions - always derive from actual project analysis
312
312
  - DO NOT generate empty or placeholder skill or rule files
313
313
  - DO NOT assume command syntax - always read from actual config files (package.json, Makefile, etc.)
314
- - DO NOT repeat the 6 mandatory coding guidelines from `AGENTS.md` in rule files
314
+ - DO NOT repeat the general guidance sections from `AGENTS.md` in rule files
@@ -0,0 +1,94 @@
1
+ # Repository Guide
2
+
3
+ {PROJECT_OVERVIEW}
4
+
5
+ ## Build & Run Commands
6
+
7
+ {BUILD_RUN_COMMANDS}
8
+
9
+ ## Skill Usage
10
+
11
+ Before implementing changes, always check the available skills for relevant implementation guidance.
12
+
13
+ Use skills to understand project-specific workflows, commands, testing expectations, and implementation conventions before editing code.
14
+
15
+ ## Workflow Rules
16
+
17
+ When running `/5:` workflow commands, follow the command instructions exactly as written.
18
+ Do not skip steps, combine phases, or proceed to actions not specified in the current command.
19
+ Each phase produces a specific artifact - do not create artifacts belonging to other phases.
20
+
21
+ ## Coding Guidelines
22
+
23
+ 1. Prefer explicit types or contracts for public APIs, data transfer shapes, service methods, hooks, and async return values where the language supports them.
24
+ 2. Keep comments and docs concise; document constraints and non-obvious behavior, not the obvious.
25
+ 3. Keep files focused and bounded; split broad controllers, services, hooks, and components early.
26
+ 4. Extract helpers or classes when logic starts mixing orchestration, parsing, IO, and mapping in one place.
27
+ 5. Favor SRP and DRY, but follow surrounding module conventions before introducing new abstractions.
28
+ 6. Keep features modular: wire backend providers in feature modules, keep UI state in hooks, and avoid cross-layer shortcuts.
29
+
30
+ ## Simplicity First
31
+
32
+ - No features beyond what was asked.
33
+ - No abstractions for single-use code.
34
+ - No flexibility or configurability that was not requested.
35
+ - No error handling for impossible scenarios.
36
+ - If you write 200 lines and it could be 50, rewrite it.
37
+
38
+ Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
39
+
40
+ ## Testing
41
+
42
+ - Add unit tests for business logic when they provide real value.
43
+ - Do not create unit tests just to satisfy coverage or test trivial code.
44
+ - New features must be covered by e2e or integration tests where practical.
45
+ - Bug fixes should include a regression test when practical.
46
+
47
+ ## Surgical Changes
48
+
49
+ Touch only what you must. Clean up only your own mess.
50
+ When editing existing code:
51
+
52
+ - Do not improve adjacent code, comments, or formatting.
53
+ - Do not refactor things that are not broken.
54
+ - Match existing style, even if you would do it differently.
55
+ - If you notice unrelated dead code, mention it; do not delete it.
56
+
57
+ When your changes create orphans:
58
+
59
+ - Remove imports, variables, functions, and files that your changes made unused.
60
+ - Do not remove pre-existing dead code unless asked.
61
+
62
+ The test: Every changed line should trace directly to the user's request.
63
+
64
+ ## Goal-Driven Execution
65
+
66
+ Define success criteria. Loop until verified.
67
+
68
+ Transform tasks into verifiable goals:
69
+
70
+ - "Add validation" -> "Write tests for invalid inputs, then make them pass"
71
+ - "Fix the bug" -> "Write a test that reproduces it, then make it pass"
72
+ - "Refactor X" -> "Ensure tests pass before and after"
73
+
74
+ For multi-step tasks, state a brief plan:
75
+
76
+ 1. [Step] -> verify: [check]
77
+ 2. [Step] -> verify: [check]
78
+ 3. [Step] -> verify: [check]
79
+
80
+ Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
81
+
82
+ ## Project Documentation
83
+
84
+ {PROJECT_DOCUMENTATION_LINKS}
85
+
86
+ ## Codebase Index
87
+
88
+ {CODEBASE_INDEX_LINKS}
89
+
90
+ ## Index Freshness
91
+
92
+ If the codebase index files are more than one day old, regenerate them by running `.5/index/rebuild-index.sh` before relying on them.
93
+
94
+ {CUSTOM_DOCUMENTATION}
@@ -16,7 +16,7 @@
16
16
 
17
17
  ## Feature Gap Fixes
18
18
 
19
- {If no feature gaps or Layer 2 was skipped: "No feature gaps found." or "Skipped — no feature.md available."}
19
+ {If no feature gaps or Layer 2 was skipped: "No feature gaps found." or "Skipped — no plan.md available."}
20
20
 
21
21
  | # | File | Issue | Fix | Complexity |
22
22
  |---|------|-------|-----|------------|
@@ -0,0 +1,42 @@
1
+ ---
2
+ ticket: {TICKET-ID}
3
+ feature: {feature-name}
4
+ created: {ISO-timestamp}
5
+ planFormat: compact
6
+ ---
7
+
8
+ <!-- PLAN RULES:
9
+ - Use only for low-risk changes with 1-2 components.
10
+ - Write requirements and implementation intent, not code.
11
+ - Keep the Component Checklist human-readable. Do not add step/model/pattern/verify columns.
12
+ - Decisions must be labeled [DECIDED], [FLEXIBLE], or [DEFERRED].
13
+ -->
14
+
15
+ # Plan: {TICKET-ID} - {Title}
16
+
17
+ ## Overview
18
+
19
+ {Short narrative describing the problem and desired outcome.}
20
+
21
+ ## Scope
22
+
23
+ - In: {included work}
24
+ - Out: {excluded work}
25
+
26
+ ## Acceptance Criteria
27
+
28
+ - [ ] {Observable success criterion}
29
+
30
+ ## Decisions
31
+
32
+ - [DECIDED] {Decision and rationale}
33
+
34
+ ## Existing Patterns to Follow
35
+
36
+ - `{path}` - {what pattern this provides}
37
+
38
+ ## Component Checklist
39
+
40
+ | Component | Action | Target Path | Intent |
41
+ |-----------|--------|-------------|--------|
42
+ | {component-name} | modify | `{path}` | {one-sentence intent} |
@@ -1,52 +1,76 @@
1
1
  ---
2
2
  ticket: {TICKET-ID}
3
3
  feature: {feature-name}
4
- spec: .5/features/{feature-name}/feature.md
5
4
  created: {ISO-timestamp}
6
5
  ---
7
6
 
8
7
  <!-- PLAN RULES:
9
- - This file is interpolated into agent prompts. Write it as instructions, not documentation.
10
- - Description column: one action-oriented sentence per component
11
- - Pattern File column: path to an existing file the executor MUST read before implementing (establishes conventions)
12
- - Verify column: a concrete command or check the executor runs after implementing (grep pattern, test command, build check)
13
- - Depends On column: name of a component this one depends on (for cross-step data dependencies), or "—" if none
14
- - Implementation Notes: scoped with [global], [Step N], or [component-name] prefixes the orchestrator filters per agent
15
- - Components table must cover all functional requirements from feature.md
16
- - Three test tiers: unit (always required for logic), integration (when framework detected + cross-module/DB/API), e2e (when framework detected + endpoints/UI flows)
17
- - Every "create" component with logic (services, controllers, repositories, utilities) must have a corresponding unit test component
18
- - Integration/e2e test components are planned only when the project has the corresponding framework
19
- - Declarative-only components (types, interfaces, route wiring) are exempt from test requirements
8
+ - One planning artifact only: this file.
9
+ - Write requirements and implementation intent, not code.
10
+ - Keep the Component Checklist human-readable. Do not add step/model/pattern/verify columns; step-orchestrator-agent derives those into state.json.
11
+ - Existing Patterns to Follow should name high-value files and conventions so the orchestrator can wire executor prompts cheaply.
12
+ - Decisions must be labeled [DECIDED], [FLEXIBLE], or [DEFERRED].
13
+ - Omit optional sections when they would only contain "none", "n/a", or placeholder content.
20
14
  -->
21
15
 
22
- # Implementation Plan: {TICKET-ID}
16
+ # Plan: {TICKET-ID} - {Title}
23
17
 
24
- {One sentence summary of what this plan builds}
18
+ ## Overview
25
19
 
26
- ## Components
20
+ {Short narrative describing the problem, desired outcome, and why this change is needed.}
27
21
 
28
- | Step | Component | Action | File | Description | Pattern File | Verify | Complexity | Depends On |
29
- |------|-----------|--------|------|-------------|-------------|--------|------------|------------|
30
- | 1 | {name} | create | {path} | {what it does} | {existing file to read first} | {grep/test command} | simple | — |
31
- | 1 | {name} | create | {path} | {what it does} | {pattern} | {verify} | simple | — |
32
- | 2 | {name} | create | {path} | {what it does} | {pattern} | {verify} | moderate | {step-1-component} |
33
- | 2 | {name} | modify | {path} | {what to change} | {target file} | {verify} | moderate | — |
34
- | 3 | {name} | create | {path} | {what it does} | {pattern} | {verify} | complex | {step-2-component} |
35
- | 4 | {name} unit tests | create | {test-path} | Test {what it tests} | {existing test} | {test command} | moderate | {tested-component} |
36
- | 4 | {name} integration tests | create | {test-path} | Test {cross-module interaction} | {existing test} | {test command} | moderate | {tested-component} |
37
- | 4 | {name} e2e tests | create | {test-path} | Test {user-facing flow end-to-end} | {existing test} | {test command} | moderate | {tested-component} |
22
+ ## What Changes
38
23
 
39
- ## Testing Strategy
24
+ - {Logical behavior or capability that changes}
25
+ - {User-visible or system-visible outcome}
40
26
 
41
- {Which test tiers apply to this feature and why. E.g.: "Unit tests for service logic. Integration tests for API endpoints using Supertest. No e2e — no UI changes."}
27
+ ## Existing Patterns to Follow
42
28
 
43
- ## Implementation Notes
29
+ - `{path}` - {what pattern this provides}
30
+ - `{path}` - {what convention this establishes}
44
31
 
45
- - [global] Follow the pattern from {existing-file} for {component-type}
46
- - [Step N] {Convention or context relevant to all components in step N}
47
- - [{component-name}] {Key business rule or integration point specific to this component}
32
+ ## Constraints
48
33
 
49
- ## Verification
34
+ - {Technical, product, compatibility, performance, or rollout constraint}
50
35
 
51
- - Build: {command or "auto"}
52
- - Test: {command or "auto"}
36
+ ## Scope
37
+
38
+ ### In
39
+
40
+ - {Included work}
41
+
42
+ ### Out
43
+
44
+ - {Explicitly excluded work}
45
+
46
+ ## Acceptance Criteria
47
+
48
+ - [ ] {Observable success criterion}
49
+ - [ ] {Observable success criterion}
50
+
51
+ ## Decisions
52
+
53
+ - [DECIDED] {Decision and rationale}
54
+ - [FLEXIBLE] {Area where implementation may choose the best local pattern}
55
+ - [DEFERRED] {Work intentionally not included}
56
+
57
+ ## Module Impact
58
+
59
+ | Module/Area | Impact |
60
+ |-------------|--------|
61
+ | {module} | {create/modify/delete behavior at a high level} |
62
+
63
+ ## Component Checklist
64
+
65
+ | Component | Action | Target Path | Intent |
66
+ |-----------|--------|-------------|--------|
67
+ | {component-name} | create | `{path}` | {one-sentence intent} |
68
+ | {component-name} | modify | `{path}` | {one-sentence intent} |
69
+
70
+ ## Technical Notes
71
+
72
+ - {Important implementation context, invariants, or migration notes}
73
+
74
+ ## Alternatives Considered
75
+
76
+ - {Alternative}: {why it was not chosen}
@@ -8,15 +8,12 @@
8
8
 
9
9
  ## How to Use This File
10
10
 
11
- 1. Review each finding below
12
- 2. For each finding, choose an action:
13
- - `[FIX]` - Apply this fix automatically (leave as-is)
14
- - `[SKIP]` - Don't apply this fix (change FIX to SKIP)
15
- - `[MANUAL]` - Custom instructions (change FIX to MANUAL and add instructions)
16
- 3. Save this file
17
- 4. Run: `/5:address-review-findings`
11
+ 1. Review this file if you want context before applying fixes
12
+ 2. Run: `/5:address-review-findings`
13
+ 3. The command will present each finding one by one with a recommendation
14
+ 4. Choose `fix`, `wont_fix`, `wait`, or provide textual instructions
18
15
 
19
- The command will read your annotations and apply marked fixes.
16
+ The command records your decisions separately and applies only findings marked `fix`.
20
17
 
21
18
  ---
22
19
 
@@ -38,12 +35,6 @@ The command will read your annotations and apply marked fixes.
38
35
  {raw output from reviewer}
39
36
  ```
40
37
 
41
- **Action:** [FIX]
42
-
43
- **Custom Instructions:** (only if you selected [MANUAL])
44
- <!-- Add detailed instructions here if you want a custom fix -->
45
-
46
-
47
38
  ---
48
39
 
49
40
  ## Summary
@@ -54,5 +45,5 @@ The command will read your annotations and apply marked fixes.
54
45
  - Manual Review: {N}
55
46
 
56
47
  **Next Steps:**
57
- 1. Edit this file to mark which findings to fix
58
- 2. Run: `/5:address-review-findings`
48
+ 1. Run: `/5:address-review-findings`
49
+ 2. Decide on each finding interactively
@@ -11,6 +11,7 @@
11
11
  - **User-Resolved Questions:** {N}
12
12
  - **Manual Review Needed:** {N}
13
13
  - **Skipped by User:** {N}
14
+ - **Deferred by User:** {N}
14
15
 
15
16
  ## Applied Fixes (User Approved)
16
17
 
@@ -29,6 +30,10 @@
29
30
 
30
31
  - `{file-path}:{line}` - User chose not to apply
31
32
 
33
+ ## Deferred Issues
34
+
35
+ - `{file-path}:{line}` - User chose to wait
36
+
32
37
  ## Files Modified
33
38
 
34
39
  - {file-path} ({N} fixes applied)
@@ -4,11 +4,40 @@
4
4
  "status": "in-progress",
5
5
  "currentStep": 1,
6
6
  "totalSteps": 0,
7
- "pendingComponents": [],
7
+ "steps": [
8
+ {
9
+ "number": 1,
10
+ "name": "{step-name}",
11
+ "mode": "parallel",
12
+ "model": "haiku",
13
+ "components": []
14
+ }
15
+ ],
16
+ "pendingComponents": [
17
+ {
18
+ "name": "{component-name}",
19
+ "action": "create",
20
+ "step": 1,
21
+ "mode": "parallel",
22
+ "model": "haiku",
23
+ "file": "{target-path}",
24
+ "sourceFile": null,
25
+ "description": "{one-sentence intent}",
26
+ "dependsOn": [],
27
+ "patternRefs": [],
28
+ "verifyCommands": [],
29
+ "notes": []
30
+ }
31
+ ],
8
32
  "completedComponents": [],
9
- "failedAttempts": [],
33
+ "recentFailures": [],
34
+ "baseline": {},
35
+ "latestCommandResults": [],
36
+ "verificationStatus": "pending",
10
37
  "verificationResults": {},
11
- "commitResults": [],
38
+ "verifiedAt": null,
39
+ "latestCommitResults": [],
40
+ "eventLog": ".5/features/{feature-name}/state-events.jsonl",
12
41
  "startedAt": "{ISO-timestamp}",
13
42
  "lastUpdated": "{ISO-timestamp}"
14
43
  }
@@ -1,57 +0,0 @@
1
- ---
2
- name: component-executor
3
- description: Implements individual components by following existing codebase patterns. Spawned by /5:implement-feature orchestrator.
4
- tools: Read, Write, Edit, Glob, Grep, Bash, context7
5
- ---
6
-
7
- <role>
8
- You are a Component Executor. You implement individual components for a feature.
9
- You follow existing codebase patterns. You do NOT deviate from the plan.
10
- </role>
11
-
12
- <process>
13
- ## Implementation Process
14
-
15
- 1. **Read required files FIRST** — If your prompt includes a `Pattern File` or `Read First` field, you MUST read every listed file before writing any code. This establishes ground truth and prevents assumptions about conventions, naming, or structure.
16
- 2. **For creating files:**
17
- - Read the pattern file (from step 1) to understand conventions
18
- - Create the new file following the same patterns exactly
19
- - If no pattern file was provided, find a similar existing file via Glob and read it
20
- 3. **For modifying files:**
21
- - Read the target file
22
- - Apply the described change via Edit
23
- - Verify the change is correct
24
- 4. **Run verify command** — If your prompt includes a `Verify` field, run that command and confirm it passes. If it fails, fix the issue (subject to the 3-attempt limit). If no verify command was provided, verify each file exists after changes.
25
- </process>
26
-
27
- <output-format>
28
- When done, output your result in this exact format:
29
-
30
- ---RESULT---
31
- STATUS: success | failed
32
- FILES_CREATED: [comma-separated paths]
33
- FILES_MODIFIED: [comma-separated paths]
34
- VERIFY: passed | failed | skipped
35
- DEVIATIONS: none | {brief list of auto-fixes applied}
36
- ERROR: none | {error description}
37
- ---END---
38
- </output-format>
39
-
40
- <deviation-rules>
41
- ## Deviation Rules
42
-
43
- You WILL discover unplanned work. Handle as follows:
44
-
45
- | Trigger | Action | Permission |
46
- |---------|--------|------------|
47
- | Bug/error in existing code | Fix → verify → note in result | Auto |
48
- | Missing import/dependency | Add → verify → note in result | Auto |
49
- | Missing validation/auth/logging | Add → verify → note in result | Auto |
50
- | Blocking issue (prevents task completion) | Fix → verify → note in result | Auto |
51
- | Architectural change needed (new DB table, schema change, service switch) | STOP → report in ERROR field | Ask user |
52
- | Auth error ("401", "Not authenticated", "Set ENV_VAR") | STOP → report as AUTH_GATE in ERROR | Ask user |
53
-
54
- **Priority:** Architectural/Auth (ask) > Auto-fix rules > Unsure (treat as architectural, ask)
55
-
56
- **3-attempt limit:** If you have attempted 3 auto-fixes on a SINGLE issue and it still fails, STOP. Report the issue in the ERROR field with `ATTEMPTS_EXHAUSTED: {description}`. Do not keep trying — the orchestrator will handle it.
57
- </deviation-rules>