@ludecker/aaac 1.1.5 → 1.2.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 (104) hide show
  1. package/README.md +27 -12
  2. package/package.json +9 -9
  3. package/src/cli.mjs +19 -7
  4. package/src/generators/generate-commands.mjs +25 -1
  5. package/src/generators/generate-graph.mjs +9 -1
  6. package/src/lib/install.mjs +13 -1
  7. package/src/lib/sweep-project-docs.mjs +348 -0
  8. package/src/run-engine/advance-phase.mjs +23 -0
  9. package/src/run-engine/debug-run.mjs +0 -0
  10. package/src/run-engine/gate-write.mjs +13 -0
  11. package/src/run-engine/lib.mjs +153 -5
  12. package/src/run-engine/log-dump.mjs +0 -0
  13. package/src/run-engine/log-trace.mjs +0 -0
  14. package/templates/cursor/aaac/enforcement.json +96 -5
  15. package/templates/cursor/aaac/graph.project.yaml +44 -5
  16. package/templates/cursor/aaac/lifecycle/lifecycle.json +26 -0
  17. package/templates/cursor/aaac/lifecycle/phases.json +9 -1
  18. package/templates/cursor/aaac/ontology.json +1 -0
  19. package/templates/cursor/aaac/project.config.json +36 -0
  20. package/templates/cursor/aaac/scripts/remediation/auto-check-swarm-synthesis.mjs +75 -0
  21. package/templates/cursor/aaac/scripts/remediation/auto-dispatch-queue-from-health.mjs +78 -0
  22. package/templates/cursor/aaac/scripts/remediation/bootstrap-autonomous.mjs +113 -0
  23. package/templates/cursor/aaac/scripts/remediation/capture-verify-baseline.mjs +66 -0
  24. package/templates/cursor/aaac/scripts/remediation/capture-wave-snapshot.mjs +79 -0
  25. package/templates/cursor/aaac/scripts/remediation/check-swarm-raw.template.json +26 -0
  26. package/templates/cursor/aaac/scripts/remediation/classify-fallow-issues.mjs +77 -0
  27. package/templates/cursor/aaac/scripts/remediation/classify-verify-failure.mjs +176 -0
  28. package/templates/cursor/aaac/scripts/remediation/compute-satisfaction.mjs +344 -0
  29. package/templates/cursor/aaac/scripts/remediation/debt-sweep-gate.mjs +202 -0
  30. package/templates/cursor/aaac/scripts/remediation/dispatch-rules.json +44 -0
  31. package/templates/cursor/aaac/scripts/remediation/fallow-fp-rules.json +87 -0
  32. package/templates/cursor/aaac/scripts/remediation/fallow-scan.mjs +219 -0
  33. package/templates/cursor/aaac/scripts/remediation/handle-yield.mjs +240 -0
  34. package/templates/cursor/aaac/scripts/remediation/init-campaign.mjs +211 -0
  35. package/templates/cursor/aaac/scripts/remediation/lib/autonomous-mode.mjs +63 -0
  36. package/templates/cursor/aaac/scripts/remediation/lib/campaign-focus.mjs +87 -0
  37. package/templates/cursor/aaac/scripts/remediation/lib/fallow-classifier.mjs +190 -0
  38. package/templates/cursor/aaac/scripts/remediation/lib/fallow-health-targets.mjs +56 -0
  39. package/templates/cursor/aaac/scripts/remediation/lib/fallow-metrics.mjs +119 -0
  40. package/templates/cursor/aaac/scripts/remediation/lib/invoke-cursor-agent.mjs +51 -0
  41. package/templates/cursor/aaac/scripts/remediation/lib/reconcile-run-manifest.mjs +41 -0
  42. package/templates/cursor/aaac/scripts/remediation/lib/regression-analysis.mjs +55 -0
  43. package/templates/cursor/aaac/scripts/remediation/lib/remediation-config.mjs +69 -0
  44. package/templates/cursor/aaac/scripts/remediation/lib/remediation-progress.mjs +58 -0
  45. package/templates/cursor/aaac/scripts/remediation/lib/remediation-watch-loop.mjs +168 -0
  46. package/templates/cursor/aaac/scripts/remediation/lib/runner-exec.mjs +156 -0
  47. package/templates/cursor/aaac/scripts/remediation/lib/runner-state.mjs +145 -0
  48. package/templates/cursor/aaac/scripts/remediation/lib/verify-metrics.mjs +205 -0
  49. package/templates/cursor/aaac/scripts/remediation/merge-check-swarm.mjs +257 -0
  50. package/templates/cursor/aaac/scripts/remediation/plan-waves-from-queue.mjs +85 -0
  51. package/templates/cursor/aaac/scripts/remediation/prepare-check-context.mjs +148 -0
  52. package/templates/cursor/aaac/scripts/remediation/record-fallow-fp.mjs +107 -0
  53. package/templates/cursor/aaac/scripts/remediation/record-iteration-step.mjs +56 -0
  54. package/templates/cursor/aaac/scripts/remediation/remediation-cli.mjs +157 -0
  55. package/templates/cursor/aaac/scripts/remediation/remediation-cursor-watch.sh +10 -0
  56. package/templates/cursor/aaac/scripts/remediation/remediation-runner-daemon.sh +13 -0
  57. package/templates/cursor/aaac/scripts/remediation/remediation-runner.mjs +748 -0
  58. package/templates/cursor/aaac/scripts/remediation/remediation-yield-watcher.mjs +40 -0
  59. package/templates/cursor/aaac/scripts/remediation/remediator-gate.mjs +405 -0
  60. package/templates/cursor/aaac/scripts/remediation/repair-fallow-start-baseline.mjs +118 -0
  61. package/templates/cursor/aaac/scripts/remediation/runner-health-check.mjs +164 -0
  62. package/templates/cursor/aaac/scripts/remediation/satisfaction-loop-gate.mjs +286 -0
  63. package/templates/cursor/aaac/scripts/remediation/validate-campaign-complete.mjs +191 -0
  64. package/templates/cursor/aaac/scripts/remediation/verify-remediation-iteration.mjs +112 -0
  65. package/templates/cursor/aaac/scripts/run-engine/advance-phase.mjs +23 -0
  66. package/templates/cursor/aaac/scripts/run-engine/debug-run.mjs +0 -0
  67. package/templates/cursor/aaac/scripts/run-engine/gate-write.mjs +13 -0
  68. package/templates/cursor/aaac/scripts/run-engine/lib.mjs +153 -5
  69. package/templates/cursor/aaac/scripts/run-engine/log-dump.mjs +0 -0
  70. package/templates/cursor/aaac/scripts/run-engine/log-trace.mjs +0 -0
  71. package/templates/cursor/agents/doc-conformance.md +25 -0
  72. package/templates/cursor/agents/implementation-review.md +21 -0
  73. package/templates/cursor/agents/remediation-check-app-inventory.md +32 -0
  74. package/templates/cursor/agents/remediation-check-app-ssot.md +24 -0
  75. package/templates/cursor/agents/remediation-check-app-trace.md +29 -0
  76. package/templates/cursor/agents/remediation-check-architecture-boundaries.md +21 -0
  77. package/templates/cursor/agents/remediation-check-architecture-decomposition.md +25 -0
  78. package/templates/cursor/agents/remediation-check-architecture-deps.md +23 -0
  79. package/templates/cursor/agents/remediation-check-risk.md +37 -0
  80. package/templates/cursor/agents/remediation-e2e-gate.md +30 -0
  81. package/templates/cursor/agents/remediation-remediator.md +69 -0
  82. package/templates/cursor/agents/test-author.md +27 -0
  83. package/templates/cursor/commands/remediate-app.md +212 -0
  84. package/templates/cursor/hooks/aaac-before-submit.sh +0 -0
  85. package/templates/cursor/hooks/aaac-pre-tool.sh +0 -0
  86. package/templates/cursor/hooks/aaac-stop.sh +0 -0
  87. package/templates/cursor/hooks/aaac-subagent-start.sh +0 -0
  88. package/templates/cursor/rules/aaac-enforcement.mdc +10 -3
  89. package/templates/cursor/skills/shared/execution/SKILL.md +7 -3
  90. package/templates/cursor/skills/shared/governance/implementation/SKILL.md +396 -28
  91. package/templates/cursor/skills/shared/implementation-review/SKILL.md +49 -0
  92. package/templates/cursor/skills/shared/planning/SKILL.md +5 -0
  93. package/templates/cursor/skills/shared/remediation/SKILL.md +51 -0
  94. package/templates/cursor/skills/shared/remediation/babysit/SKILL.md +223 -0
  95. package/templates/cursor/skills/shared/remediation/check-swarm/SKILL.md +114 -0
  96. package/templates/cursor/skills/shared/remediation/orchestrator/SKILL.md +275 -0
  97. package/templates/cursor/skills/shared/remediation/orchestrator/contract.yaml +116 -0
  98. package/templates/cursor/skills/shared/test-authoring/SKILL.md +58 -0
  99. package/templates/cursor/skills/shared/testing/SKILL.md +6 -0
  100. package/templates/cursor/skills/shared/verbs/create/orchestrator/SKILL.md +5 -3
  101. package/templates/cursor/skills/shared/verbs/fix/orchestrator/SKILL.md +5 -3
  102. package/templates/cursor/skills/shared/verbs/update/orchestrator/SKILL.md +5 -3
  103. package/templates/cursor/skills/shared/verification/SKILL.md +5 -3
  104. package/templates/docs/agentic_architecture.md +169 -97
@@ -0,0 +1,69 @@
1
+ # Agent: remediation-remediator
2
+
3
+ ## Role
4
+
5
+ Execute the **Remediator** step when `remediator-gate.mjs` or `debt-sweep-gate.mjs` exits **3** (`action: remediate`).
6
+
7
+ ## Critical rule
8
+
9
+ **Exit 3 is not a stop signal.** The parent orchestrator must:
10
+
11
+ 1. Apply the handoff inline
12
+ 2. Re-run the gate with `--attempt N+1` (or debt-sweep retry_command)
13
+ 3. Repeat until promote (exit 0) or true block (exit 1 after debt sweep exhaustion)
14
+
15
+ Never set `campaign.status=blocked` on exit 3. Never skip remaining waves.
16
+
17
+ ## Trigger
18
+
19
+ ```bash
20
+ node .cursor/aaac/scripts/remediation/remediator-gate.mjs \
21
+ --campaign-id <id> --iteration <n> --mode wave|debt \
22
+ --wave-index <w> --run-id <run_id> --attempt 1
23
+ ```
24
+
25
+ Read stdout JSON. When `action === "remediate"` OR `orchestrator_must_not_stop === true`:
26
+
27
+ - Apply handoff **inside parent `execute` or `debt_sweep` phase** (same chat — no nested Run)
28
+
29
+ ## Handoff fields
30
+
31
+ | Field | Use |
32
+ |-------|-----|
33
+ | `handoff.command` | `fix-module` or `fix-bug` |
34
+ | `handoff.domain` | e.g. `frontend`, `backend` |
35
+ | `handoff.intent` | Full intent including validator output |
36
+ | `handoff.file_paths` | Prioritize these files |
37
+ | `handoff.log_path` | **Read full log** — primary evidence source |
38
+ | `handoff.layer` | Failed layer |
39
+ | `retry_command` | Exact re-run command after fix |
40
+
41
+ ## Evidence (mandatory)
42
+
43
+ 1. Read `handoff.log_path` or `iterations/{n}/verify-logs/{mode}-{layer}.log`
44
+ 2. Do **not** rely on truncated `stderr_tail` alone
45
+ 3. For wave regression handoffs, fix only **introduced** layers (`introduced_layers` in payload)
46
+
47
+ ## Execution
48
+
49
+ 1. Load `iterations/{n}/remediator-handoff-attempt-{attempt}.json`
50
+ 2. Run fix-module / fix-bug **inline** (discover → execute → test_execute → verify)
51
+ 3. Re-run gate using `retry_command` from payload
52
+ 4. Repeat until `action: promote` | `promote_wave` | `defer_to_debt_sweep` | `debt_sweep_complete`
53
+
54
+ ## Wave vs debt
55
+
56
+ | Mode | Fix scope |
57
+ |------|-----------|
58
+ | `wave` | Only layers in `introduced_layers` (new regression) |
59
+ | `debt` | All failing layers until strict pass |
60
+
61
+ ## Return
62
+
63
+ ```yaml
64
+ status: promoted | deferred | debt_sweep_complete | remediate_again
65
+ attempt: number
66
+ max_attempts: number
67
+ layers_fixed: []
68
+ remaining_failures: []
69
+ ```
@@ -0,0 +1,27 @@
1
+ # Agent: test-author
2
+
3
+ **Phase:** `test_execute` only. Parent orchestrator must **not** write test files — this agent does.
4
+
5
+ ## Role
6
+
7
+ Author behavioral tests for changes made in `execute`. Read plan `tests_to_add[]`, implementation diff, and domain inventory test conventions.
8
+
9
+ ## Must
10
+
11
+ - Write only `*.test.*`, `*.spec.*`, or paths under `__tests__/` / `tests/`
12
+ - Cover behaviors from `requirement_map`, not implementation details
13
+ - Match existing test framework (vitest, playwright) in the touched package
14
+ - Include [_task-prompt-policy.md](../skills/shared/_task-prompt-policy.md) policies
15
+
16
+ ## Must not
17
+
18
+ - Edit production/source files (non-test paths)
19
+ - Weaken assertions to make tests pass
20
+ - Duplicate tests that already cover the behavior
21
+
22
+ ## Return
23
+
24
+ - Files created/modified (paths only)
25
+ - Behaviors covered (one line each)
26
+ - Gaps — behaviors still untested
27
+ - Confidence: high | medium | low
@@ -0,0 +1,212 @@
1
+ # remediate-app
2
+
3
+ AAAC: `/remediate-app [domain] "<intent>"`
4
+
5
+ **Layer:** system
6
+ **Campaign loop** — Fallow suite (dead-code + dupes + health) → check swarm → ranked fix waves → **regression wave gates** → **mandatory debt sweep** → satisfaction loop.
7
+
8
+ ## Dispatch
9
+
10
+ 1. [.cursor/aaac/dispatch.md](../aaac/dispatch.md)
11
+ 2. [.cursor/aaac/graph.yaml](../aaac/graph.yaml) — **`remediate-app`**
12
+ 3. [skills/shared/remediation/orchestrator/SKILL.md](../skills/shared/remediation/orchestrator/SKILL.md)
13
+
14
+ ## Hard invariants
15
+
16
+ - **Exit 3 = continue** — never stop the campaign on `remediate` handoff
17
+ - **Waves use regression gate** — pre-existing TS/vitest debt does not block cleanup waves
18
+ - **Debt sweep is mandatory** — all layers must pass before report
19
+ - **All planned waves must run** — no skipping on verify failure
20
+ - **Satisfaction exit 3 = next iteration** — never report when score < threshold and iterations remain
21
+ - **Fallow start baselines are immutable** — `fallow-start-baseline.json` (dead-code), `fallow-start-dupes-baseline.json`, `fallow-start-health-baseline.json` set once at campaign start (dupes/health auto-backfill on first scan if missing)
22
+ - **Fallow false positives excluded from satisfaction** — dead-code score uses actionable issues; dupes uses `clone_groups`; health uses `health_score`
23
+
24
+ ## Intent tokens
25
+
26
+ | Token | Default | Example |
27
+ |-------|---------|---------|
28
+ | `max_iterations` | `5` | `max_iterations=8` |
29
+ | `max_waves_per_iteration` | `3` | `max_waves_per_iteration=2` |
30
+ | `max_debt_sweep_rounds` | `10` | `max_debt_sweep_rounds=15` |
31
+ | `max_remediator_attempts_per_wave` | `3` | `max_remediator_attempts_per_wave=5` |
32
+ | `max_remediator_attempts_per_debt_round` | `3` | `max_remediator_attempts_per_debt_round=5` |
33
+ | `satisfaction_threshold` | `85` | `satisfaction_threshold=90` |
34
+ | `autonomous` | auto when threshold≥100 or max_iterations≥10 | `autonomous` / `manual` |
35
+ | `resume` | — | `resume campaign_20260617_abc123` |
36
+
37
+ ## Example
38
+
39
+ ```text
40
+ /remediate-app "whole repo; max_iterations=5; satisfaction_threshold=85"
41
+ /remediate-app cms "Fallow cleanup until regression clean"
42
+ /remediate-app cms "manual; max_iterations=3"
43
+ ```
44
+
45
+ Ensure dev server is running when Playwright is enabled — see `project.config.json` → `remediation.verify.dev_server`.
46
+
47
+ ## Two-tier verification
48
+
49
+ ### Wave gate (regression — after each fix wave)
50
+
51
+ ```bash
52
+ node .cursor/aaac/scripts/remediation/capture-wave-snapshot.mjs \
53
+ --campaign-id <id> --iteration <n> --wave-index <w>
54
+
55
+ node .cursor/aaac/scripts/remediation/remediator-gate.mjs \
56
+ --campaign-id <id> --iteration <n> --mode wave --wave-index <w> \
57
+ --run-id <run_id> --attempt 1
58
+ ```
59
+
60
+ Promotes when errors did **not increase** vs pre-wave snapshot. Pre-existing debt is deferred to debt sweep.
61
+
62
+ **Exit 3** → run [remediation-remediator.md](../agents/remediation-remediator.md) → `--attempt N+1` → **do not stop**.
63
+
64
+ ### Debt sweep (strict — after all waves)
65
+
66
+ ```bash
67
+ node .cursor/aaac/scripts/remediation/debt-sweep-gate.mjs \
68
+ --campaign-id <id> --iteration <n> --run-id <run_id> --round 1 --attempt 1
69
+ ```
70
+
71
+ Loops until typecheck, vitest, go test, build, and Playwright all pass.
72
+
73
+ ### Satisfaction loop (after debt sweep)
74
+
75
+ ```bash
76
+ node .cursor/aaac/scripts/remediation/compute-satisfaction.mjs \
77
+ --campaign-id <id> --iteration <n>
78
+
79
+ node .cursor/aaac/scripts/remediation/satisfaction-loop-gate.mjs \
80
+ --campaign-id <id> --iteration <n> --run-id <run_id> --advance
81
+ ```
82
+
83
+ | Code | Meaning |
84
+ |------|---------|
85
+ | `0` + `complete` | Threshold met → allow `report` |
86
+ | `0` + `partial_complete` | Max iterations → allow partial `report` |
87
+ | `3` + `continue_loop` | Score below threshold → **iteration N+1, return to scan** |
88
+
89
+ ### Campaign complete check
90
+
91
+ ```bash
92
+ node .cursor/aaac/scripts/remediation/validate-campaign-complete.mjs \
93
+ --campaign-id <id> --iteration <n> --require-debt-sweep --require-satisfaction-loop
94
+ ```
95
+
96
+ ### Repair corrupted Fallow baseline (legacy campaigns)
97
+
98
+ ```bash
99
+ node .cursor/aaac/scripts/remediation/repair-fallow-start-baseline.mjs \
100
+ --campaign-id <id> --total 1649 --dupes-clone-groups 171 --health-score 87.7
101
+ ```
102
+
103
+ ## Fallow scan suite (scan phase)
104
+
105
+ `fallow-scan.mjs` runs three Fallow commands from `frontend/`:
106
+
107
+ | Layer | Command | Artifact | Baseline file | Scoring metric |
108
+ |-------|---------|----------|---------------|----------------|
109
+ | Dead code | `fallow dead-code` | `iterations/{n}/fallow-scan.json` | `fallow-start-baseline.json` | actionable issues (excludes FP) |
110
+ | Dupes | `fallow dupes` | `iterations/{n}/fallow-dupes.json` | `fallow-start-dupes-baseline.json` | `clone_groups` reduction |
111
+ | Health | `fallow health --score` | `iterations/{n}/fallow-health.json` | `fallow-start-health-baseline.json` | `health_score` improvement |
112
+
113
+ Combined summary: `iterations/{n}/fallow-scan-bundle.json`
114
+
115
+ ### Satisfaction weights (40% Fallow total)
116
+
117
+ | Component | Weight |
118
+ |-----------|--------|
119
+ | `fallow_dead_code` | 0.25 |
120
+ | `fallow_dupes` | 0.10 |
121
+ | `fallow_health` | 0.05 |
122
+ | `structural_clean` | 0.15 |
123
+ | `unit_tests` | 0.15 |
124
+ | `build` | 0.10 |
125
+ | `e2e` | 0.20 |
126
+
127
+ Regression blocks completion when actionable dead-code, `clone_groups`, or `health_score` regresses vs immutable baselines.
128
+
129
+ ## Exit codes (remediator-gate / debt-sweep-gate / satisfaction-loop-gate)
130
+
131
+ | Code | Meaning | Agent action |
132
+ |------|---------|--------------|
133
+ | `0` | Promote / debt sweep complete | Continue pipeline |
134
+ | `1` | Blocked (max rounds / infra) | Report with handoff |
135
+ | `3` | Remediate / continue loop | **Fix inline or advance iteration — never stop, never report** |
136
+
137
+ ## Persistence
138
+
139
+ `.cursor/aaac/state/campaigns/{campaign_id}/` — see orchestrator SKILL for layout.
140
+
141
+ Full verify logs: `iterations/{n}/verify-logs/*.log` (not stderr tails).
142
+
143
+ ## Fallow false positives (SSOT)
144
+
145
+ Fallow raw counts include issues that are not real debt. The loop bridges swarm knowledge into metrics via **check-app + check-architecture mirrors** (7-agent swarm).
146
+
147
+ ### check_swarm flow
148
+
149
+ ```bash
150
+ # After fallow-scan + classify
151
+ node .cursor/aaac/scripts/remediation/prepare-check-context.mjs \
152
+ --campaign-id <id> --iteration <n> --run-id <run_id>
153
+
154
+ # 7 parallel readonly Task agents (see skills/shared/remediation/check-swarm/SKILL.md)
155
+ # Parent collects JSON → iterations/{n}/check-swarm-raw.json
156
+
157
+ node .cursor/aaac/scripts/remediation/merge-check-swarm.mjs \
158
+ --campaign-id <id> --iteration <n> --run-id <run_id>
159
+ ```
160
+
161
+ | Agent wave | Mirrors | Purpose |
162
+ |------------|---------|---------|
163
+ | check-app (×3) | `/check-app` | Workers, barrels, lazy routes, trace-file |
164
+ | check-architecture (×3) | `/check-architecture` | Boundaries, blast radius, dupes families |
165
+ | check-risk (×1) | remediation guard | FP registry, protected paths |
166
+
167
+ ```bash
168
+ # Auto-runs after every fallow-scan
169
+ node .cursor/aaac/scripts/remediation/classify-fallow-issues.mjs \
170
+ --campaign-id <id> --iteration <n>
171
+
172
+ # check-risk swarm records confirmed false positives
173
+ node .cursor/aaac/scripts/remediation/record-fallow-fp.mjs \
174
+ --campaign-id <id> --path src/hooks/useCryptoPriceWorker.ts \
175
+ --classification false_positive --reason dynamically_loaded_worker --source check-risk
176
+ ```
177
+
178
+ | File | Purpose |
179
+ |------|---------|
180
+ | `fallow-fp-rules.json` | Rule SSOT (workers, overlay barrels, barrel heuristics) |
181
+ | `fallow-false-positives.json` | Campaign registry (swarm + manual overrides) |
182
+ | `iterations/{n}/fallow-classification.json` | Per-scan classified inventory |
183
+ | `iterations/{n}/check-context.json` | Swarm input SSOT (Fallow inventory + dupes top groups) |
184
+ | `iterations/{n}/check-swarm-merge.json` | Merged FP/protected paths + reclassified totals |
185
+ | `artifacts/check_app_validate.yaml` | check-app mirror verdict |
186
+ | `artifacts/check_architecture_fitness.yaml` | check-architecture mirror criteria |
187
+ | `artifacts/protected_paths.yaml` | Wave exclusion list (mandatory in dispatch-queue) |
188
+
189
+ **Satisfaction** uses `actionable_total` for dead-code (excludes `false_positive`), `clone_groups` for dupes, and `health_score` for health. Waves must not delete paths in `fallow-false-positives.json`.
190
+
191
+ ## Autonomous platform (runner + babysit)
192
+
193
+ Long campaigns (`satisfaction_threshold=100`, many iterations) must use the **shell runner**, not chat turns alone.
194
+
195
+ | Layer | Path |
196
+ |-------|------|
197
+ | Shell runner | `.cursor/aaac/scripts/remediation/remediation-runner.mjs` |
198
+ | Daemon | `.cursor/aaac/scripts/remediation/remediation-runner-daemon.sh` |
199
+ | Health | `.cursor/aaac/scripts/remediation/runner-health-check.mjs` |
200
+ | Babysit skill | [skills/shared/remediation/babysit/SKILL.md](../skills/shared/remediation/babysit/SKILL.md) |
201
+
202
+ ```bash
203
+ # Bootstrap (after /remediate-app creates Run + campaign)
204
+ node .cursor/aaac/scripts/remediation/remediation-runner.mjs \
205
+ --run-id <run_id> --campaign-id <campaign_id> --until-yield
206
+
207
+ # Babysit: handle exit 3 yields, then --ack-yield <type>, repeat until exit 0
208
+ ```
209
+
210
+ Stop-hook `loop_limit` (200) is a **guardrail** for short chat continuations — not the primary loop driver.
211
+
212
+ **Autonomous is baked into `init-campaign.mjs`:** when `campaign.config.autonomous`, the orchestrator reads `artifacts/autonomous_bootstrap.json` and follows [babysit/SKILL.md](../skills/shared/remediation/babysit/SKILL.md) — no extra user prompt required.
File without changes
File without changes
File without changes
File without changes
@@ -19,7 +19,7 @@ Every AAAC slash command (`/fix-module`, `/update-module`, `/write-article`, …
19
19
  | Hook | Effect |
20
20
  |------|--------|
21
21
  | `beforeSubmitPrompt` | Detects `/command` → creates Run scoped to **`conversation_id`** (this chat only) |
22
- | `preToolUse` | **Denies** Write/StrReplace/Delete for **this chat only** until execute phase |
22
+ | `preToolUse` | **Denies** edits outside allowed phases; **phase-scoped paths** — `execute` = prod only, `test_execute` = tests only |
23
23
  | `subagentStart` | Counts Task launches for swarm phase validation |
24
24
  | `stop` | Follow-up if Run not `completed` |
25
25
 
@@ -34,12 +34,19 @@ Every AAAC slash command (`/fix-module`, `/update-module`, `/write-article`, …
34
34
  - `discover`: 4 Task agents (check verbs: `check_swarm` 3)
35
35
  - `investigate_swarm`: 7 Task agents
36
36
  - `research_swarm`: 6 Task agents
37
- 4. **Verify gate (create / update / fix):** before advancing past `verify`, run:
37
+ - `test_execute`: 1 test-author Task agent (mutating verbs)
38
+ - `verify`: 3 Task agents (all create/update/fix — not fix-only)
39
+ - `review_swarm`: 3 readonly reviewers (mutating verbs)
40
+ 4. **Agent separation (mutating verbs):**
41
+ - **Writer** — parent in `execute` only (no test files)
42
+ - **Tester** — test-author subagent in `test_execute` only
43
+ - **Reviewer** — readonly swarm in `review_swarm` (not the execute agent)
44
+ 5. **Verify gate (create / update / fix):** before advancing past `verify`, run:
38
45
  ```bash
39
46
  node .cursor/aaac/scripts/run-engine/verify-website-build.mjs --run-id <run_id>
40
47
  ```
41
48
  `advance-phase.mjs verify` runs this automatically and blocks on missing static assets or failed `vite build` (catches favicon/path regressions).
42
- 5. **Code edits only in `execute`** (hook-enforced). Before execute: artifacts only under `.cursor/aaac/state/runs/`.
49
+ 5. **Edits:** prod code in `execute`; test files in `test_execute` only. Run artifacts under `.cursor/aaac/state/runs/` anytime.
43
50
  6. **Complete the Run** — advance through `report`, set status completed.
44
51
 
45
52
  ## If edit is denied
@@ -15,18 +15,22 @@ Orchestrator phase `execute` after approved plan.
15
15
  ## Mandatory
16
16
 
17
17
  1. Read [governance/implementation/SKILL.md](../governance/implementation/SKILL.md)
18
- 2. Read domain inventory when present (`domains/<slug>/update/inventory/`)
18
+ 2. Read domain [inventory](../../../domains/) constraints
19
19
  3. Read [policies/](../../../policies/)
20
20
 
21
21
  ## Actions
22
22
 
23
- - Edit files per plan and implementation skill
24
- - Apply database migrations via configured MCP when your project uses one (see [mcp-and-deploy.md](../../../policies/mcp-and-deploy.md) and `{{DOCS_ROOT}}/project_context.md`)
23
+ - Edit **production/source** files per plan and implementation skill
24
+ - **Do not** create or edit test files (`*.test.*`, `*.spec.*`, `__tests__/`) deferred to `test_execute` / [test-authoring](../test-authoring/SKILL.md)
25
+ - `apply_migration` for new/changed `supabase/migrations/` (project `anseivwusnyiwopihnqu` — see [supabase-mcp.mdc](../../../rules/supabase-mcp.mdc))
26
+ - `track()` for user-facing mutations
25
27
  - Structured logging on server async paths
26
28
 
27
29
  ## Must not
28
30
 
29
31
  - Invent plan during execution
32
+ - Write or edit test files (hooks block in `execute`; use `test_execute`)
33
+ - Self-review implementation (use [implementation-review](../implementation-review/SKILL.md) in `review_swarm`)
30
34
  - Race guards or useEffect-driven mutations (implementation ban)
31
35
  - Skip schema validation at boundaries
32
36