@ludecker/aaac 1.0.0 → 1.1.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.
Files changed (92) hide show
  1. package/README.md +4 -3
  2. package/package.json +13 -1
  3. package/src/cli.mjs +39 -5
  4. package/src/generators/generate-commands.mjs +120 -3
  5. package/src/generators/generate-graph.mjs +17 -0
  6. package/src/lib/install.mjs +1 -0
  7. package/src/lib/run-engine-paths.mjs +33 -0
  8. package/src/run-engine/advance-phase.mjs +343 -0
  9. package/src/run-engine/capability-evidence.mjs +460 -0
  10. package/src/run-engine/debug-run.mjs +38 -0
  11. package/src/run-engine/gate-write.mjs +95 -0
  12. package/src/run-engine/init-run.mjs +215 -0
  13. package/src/run-engine/lib.mjs +141 -0
  14. package/src/run-engine/log-dump.mjs +76 -0
  15. package/src/run-engine/log-trace.mjs +18 -0
  16. package/src/run-engine/log.mjs +343 -0
  17. package/src/run-engine/record-task.mjs +56 -0
  18. package/src/run-engine/stop-check.mjs +55 -0
  19. package/src/run-engine/verify-website-build.mjs +148 -0
  20. package/templates/cursor/aaac/capabilities/promotion-rules.json +64 -0
  21. package/templates/cursor/aaac/capabilities/registry.json +17 -15
  22. package/templates/cursor/aaac/complexity.yaml +98 -0
  23. package/templates/cursor/aaac/contracts/commands/fix-bug.yaml +10 -3
  24. package/templates/cursor/aaac/contracts/commands/fix-module.yaml +41 -0
  25. package/templates/cursor/aaac/contracts/skills/investigation.yaml +22 -1
  26. package/templates/cursor/aaac/contracts/skills/planning.yaml +17 -0
  27. package/templates/cursor/aaac/contracts/skills/validation.yaml +9 -1
  28. package/templates/cursor/aaac/dispatch.md +31 -6
  29. package/templates/cursor/aaac/enforcement.json +25 -0
  30. package/templates/cursor/aaac/fitness-functions.yaml +8 -0
  31. package/templates/cursor/aaac/governance/gates.json +6 -2
  32. package/templates/cursor/aaac/graph.project.yaml +237 -5
  33. package/templates/cursor/aaac/layers.md +6 -1
  34. package/templates/cursor/aaac/lifecycle/lifecycle.json +41 -1
  35. package/templates/cursor/aaac/lifecycle/phases.json +1 -0
  36. package/templates/cursor/aaac/observability/telemetry.yaml +63 -0
  37. package/templates/cursor/aaac/observability/verb-debug.yaml +170 -0
  38. package/templates/cursor/aaac/ontology.json +10 -1
  39. package/templates/cursor/aaac/run/RUN.md +2 -0
  40. package/templates/cursor/aaac/run/schema.json +11 -0
  41. package/templates/cursor/aaac/scripts/generate-runtime-registry.mjs +115 -0
  42. package/templates/cursor/aaac/scripts/run-engine/advance-phase.mjs +343 -0
  43. package/templates/cursor/aaac/scripts/run-engine/capability-evidence.mjs +460 -0
  44. package/templates/cursor/aaac/scripts/run-engine/debug-run.mjs +38 -0
  45. package/templates/cursor/aaac/scripts/run-engine/gate-write.mjs +95 -0
  46. package/templates/cursor/aaac/scripts/run-engine/init-run.mjs +215 -0
  47. package/templates/cursor/aaac/scripts/run-engine/lib.mjs +141 -0
  48. package/templates/cursor/aaac/scripts/run-engine/log-dump.mjs +76 -0
  49. package/templates/cursor/aaac/scripts/run-engine/log-trace.mjs +18 -0
  50. package/templates/cursor/aaac/scripts/run-engine/log.mjs +343 -0
  51. package/templates/cursor/aaac/scripts/run-engine/record-task.mjs +56 -0
  52. package/templates/cursor/aaac/scripts/run-engine/stop-check.mjs +55 -0
  53. package/templates/cursor/aaac/scripts/run-engine/verify-website-build.mjs +148 -0
  54. package/templates/cursor/aaac/state/capability-stats.json +5 -0
  55. package/templates/cursor/agents/aaac-log-debug.md +72 -0
  56. package/templates/cursor/agents/fix-code-path.md +27 -0
  57. package/templates/cursor/agents/fix-hypothesis-validate.md +26 -0
  58. package/templates/cursor/agents/fix-inventory-confirm.md +22 -0
  59. package/templates/cursor/agents/fix-recent-changes.md +22 -0
  60. package/templates/cursor/agents/fix-regression-scope.md +27 -0
  61. package/templates/cursor/agents/fix-repro-verify.md +21 -0
  62. package/templates/cursor/agents/fix-repro.md +29 -0
  63. package/templates/cursor/agents/fix-runtime-evidence.md +22 -0
  64. package/templates/cursor/agents/fix-test-failures.md +23 -0
  65. package/templates/cursor/agents/playwright-check-run.md +44 -0
  66. package/templates/cursor/hooks/aaac-before-submit.sh +3 -0
  67. package/templates/cursor/hooks/aaac-pre-tool.sh +4 -0
  68. package/templates/cursor/hooks/aaac-stop.sh +3 -0
  69. package/templates/cursor/hooks/aaac-subagent-start.sh +3 -0
  70. package/templates/cursor/hooks.json +30 -0
  71. package/templates/cursor/policies/minimal-complexity.md +101 -0
  72. package/templates/cursor/rules/aaac-enforcement.mdc +42 -0
  73. package/templates/cursor/skills/shared/execution/SKILL.md +1 -1
  74. package/templates/cursor/skills/shared/fitness-functions/SKILL.md +23 -7
  75. package/templates/cursor/skills/shared/investigation/SKILL.md +91 -18
  76. package/templates/cursor/skills/shared/investigation/orchestrator/SKILL.md +12 -4
  77. package/templates/cursor/skills/shared/planning/SKILL.md +74 -8
  78. package/templates/cursor/skills/shared/platform-release/SKILL.md +22 -19
  79. package/templates/cursor/skills/shared/platform-release/orchestrator/contract.yaml +27 -7
  80. package/templates/cursor/skills/shared/reporting/SKILL.md +2 -1
  81. package/templates/cursor/skills/shared/root-cause/SKILL.md +14 -3
  82. package/templates/cursor/skills/shared/testing/SKILL.md +31 -5
  83. package/templates/cursor/skills/shared/validation/SKILL.md +48 -13
  84. package/templates/cursor/skills/shared/verbs/_dispatch-utils.md +20 -1
  85. package/templates/cursor/skills/shared/verbs/_lifecycle.md +3 -2
  86. package/templates/cursor/skills/shared/verbs/check/orchestrator/SKILL.md +4 -1
  87. package/templates/cursor/skills/shared/verbs/create/orchestrator/SKILL.md +2 -2
  88. package/templates/cursor/skills/shared/verbs/fix/orchestrator/SKILL.md +21 -11
  89. package/templates/cursor/skills/shared/verbs/fix/orchestrator/contract.yaml +19 -4
  90. package/templates/cursor/skills/shared/verbs/update/orchestrator/SKILL.md +2 -2
  91. package/templates/cursor/skills/shared/verification/SKILL.md +3 -0
  92. package/templates/docs/agentic_architecture.md +236 -53
@@ -1,46 +1,119 @@
1
1
  ---
2
2
  name: shared-investigation
3
3
  description: >-
4
- Deep investigation for fix paths and review-incident. Not user-facing.
4
+ Deep fix investigation swarm mandatory parallel subagents for fix paths.
5
+ Incident subset for review-incident. Not user-facing.
5
6
  disable-model-invocation: true
6
7
  ---
7
8
 
8
9
  # Shared investigation (deep)
9
10
 
10
- **When:** fix verb lifecycle, `fix_mode` domain orchestrators, `review-incident`.
11
+ **When:** fix verb lifecycle, `fix_mode` domain orchestrators, optional deep path on `review-incident`.
11
12
 
12
13
  For create/update use [investigation-lite](../investigation-lite/SKILL.md) instead.
13
14
 
14
- Adapted from legacy swarm-check. **Default: readonly.**
15
+ **Default: readonly.** Artifacts stored on Run under `artifacts.investigation`.
15
16
 
16
- ## Frame
17
+ Contract: [investigation.yaml](../../../aaac/contracts/skills/investigation.yaml)
17
18
 
19
+ ## Frame (parent — before swarm)
20
+
21
+ ```yaml
22
+ issue: one line
23
+ symptoms: user-visible
24
+ expected: if known
25
+ scope: files/features/routes
26
+ questions: 3–5 open questions
27
+ domain: cms | ui | database | aaac | unknown
18
28
  ```
19
- Issue: one line
20
- Symptoms: user-visible
21
- Expected: if known
22
- Scope: files/features
23
- Questions: 3–5
29
+
30
+ Create Run artifact stub at `state/runs/{run_id}/artifacts/investigation-frame.yaml`.
31
+
32
+ ---
33
+
34
+ ## Mode A — Fix path (mandatory)
35
+
36
+ **Applies to:** `fix`, `fix_mode`, `/fix-module`, `/fix-bug`, resolver paths `*-fix-bug`, generic `verb-fix`.
37
+
38
+ ### Phase 0 — Discovery swarm (prerequisite)
39
+
40
+ Run [discovery](../discovery/SKILL.md) first — **4–6 parallel** agents in one message. Do not start fix swarm until discovery brief exists on Run.
41
+
42
+ ### Phase 1 — Fix investigation swarm (mandatory)
43
+
44
+ Launch **7 parallel** `Task` subagents in **one message**. `readonly: true` unless agent spec allows test runs.
45
+
46
+ | # | Agent spec | `subagent_type` | Angle |
47
+ |---|------------|-----------------|-------|
48
+ | 1 | [fix-repro.md](../../../agents/fix-repro.md) | `explore` | Repro steps + confirmation |
49
+ | 2 | [fix-code-path.md](../../../agents/fix-code-path.md) | `explore` | Execution trace + suspects |
50
+ | 3 | [fix-recent-changes.md](../../../agents/fix-recent-changes.md) | `shell` | Git log/blame on suspect paths |
51
+ | 4 | [fix-test-failures.md](../../../agents/fix-test-failures.md) | `shell` | Tests + failures + gaps |
52
+ | 5 | [fix-regression-scope.md](../../../agents/fix-regression-scope.md) | `explore` | Blast radius + dependents |
53
+ | 6 | [fix-runtime-evidence.md](../../../agents/fix-runtime-evidence.md) | `generalPurpose` | CI/logs/MCP evidence |
54
+ | 7 | [fix-inventory-confirm.md](../../../agents/fix-inventory-confirm.md) | `explore` | Inventory scope + constraints |
55
+
56
+ **Parent prompt must include:** intent, domain, inventory path, discovery brief summary, frame fields.
57
+
58
+ **Anti-patterns (hard fail):**
59
+
60
+ - Skipping swarm because "issue looks simple"
61
+ - Launching agents sequentially
62
+ - Planning or executing before swarm merge
63
+ - Fewer than 7 agents without documented gap + second wave
64
+
65
+ **Second wave (optional, max 2):** when any agent returns `confidence: low` — target the gap only.
66
+
67
+ ### Parent merge (mandatory)
68
+
69
+ Write `state/runs/{run_id}/artifacts/investigation.md`:
70
+
71
+ ```yaml
72
+ repro_steps: [numbered]
73
+ repro_confirmed: yes | partial | no
74
+ suspect_files: [path:line]
75
+ candidate_commits: [{ hash, likelihood, summary }]
76
+ test_failures: []
77
+ coverage_gaps: []
78
+ blast_radius: low | medium | high
79
+ runtime_evidence: [bullets]
80
+ constraints: [from inventory]
81
+ findings: [merged bullets]
82
+ risks: [bullets]
83
+ recommendations: [bullets]
84
+ confidence:
85
+ architecture: 0.0–1.0
86
+ requirements: 0.0–1.0
87
+ scope: 0.0–1.0
24
88
  ```
25
89
 
26
- ## Swarm
90
+ Pass to [validation](../validation/SKILL.md) and [root-cause](../root-cause/SKILL.md).
91
+
92
+ ---
27
93
 
28
- 3–6 parallel readonly agents: code path, recent changes, tests, CI (`ci-investigator` if `--ci`), logs, state flow.
94
+ ## Mode B Incident path (review-incident)
29
95
 
30
- Use [discovery](../discovery/SKILL.md) agent specs where overlapping.
96
+ **Applies to:** `/review-incident`, `swarm-check` alias — investigation only unless `--fix`.
31
97
 
32
- ## Confidence output
98
+ Launch **4 parallel** `Task` subagents in one message:
33
99
 
34
- Include `confidence.architecture`, `confidence.requirements`, `confidence.scope` for [validation](../validation/SKILL.md).
100
+ | Agent | Spec |
101
+ |-------|------|
102
+ | Repro | [fix-repro.md](../../../agents/fix-repro.md) |
103
+ | Code path | [fix-code-path.md](../../../agents/fix-code-path.md) |
104
+ | Runtime | [fix-runtime-evidence.md](../../../agents/fix-runtime-evidence.md) |
105
+ | Recent changes | [fix-recent-changes.md](../../../agents/fix-recent-changes.md) |
35
106
 
36
- ## Report
107
+ Layman report via [reporting](../reporting/SKILL.md) — <250 words unless user asked for detail.
37
108
 
38
- [reporting](../reporting/SKILL.md) layman first, <250 words unless user asked for detail.
109
+ If intent includes `--fix` or explicit fix request continue full **Mode A** swarm + fix lifecycle after report approval.
110
+
111
+ ---
39
112
 
40
113
  ## Next phase (fix only)
41
114
 
42
- Hand off to [root-cause](../root-cause/SKILL.md) before planning.
115
+ Hand off to [root-cause](../root-cause/SKILL.md) before planning. Do not skip even when root cause seems obvious.
43
116
 
44
117
  ## Fix path execution
45
118
 
46
- If intent includes fix or `fix-bug` command: after full lifecycle gates pass, orchestrator invokes `execution` + `testing` + `verification`.
119
+ After full lifecycle gates pass, orchestrator invokes `execution` + [testing](../testing/SKILL.md) (fix verify swarm) + [verification](../verification/SKILL.md).
@@ -15,8 +15,16 @@ disable-model-invocation: true
15
15
 
16
16
  ## Phases
17
17
 
18
- 1. [investigation](../SKILL.md) layman report
19
- 2. If fix requested: discovery planning execution testing verification
20
- 3. [reporting](../reporting/SKILL.md)
18
+ 1. **discover** (optional, 2 agents max) when domain unknown
19
+ 2. [investigation](../SKILL.md) **Mode B** **4 parallel** agents in one message (repro, code-path, runtime, recent-changes)
20
+ 3. [reporting](../../reporting/SKILL.md) — layman first; set Run `status: completed` unless fix path active
21
21
 
22
- Stop after report unless fix path active.
22
+ ## Fix escalation
23
+
24
+ If intent includes `--fix`, explicit "fix this", or user approves after report:
25
+
26
+ 1. Switch command workflow to `fix-module` / `fix-bug` lifecycle on same Run
27
+ 2. Run investigation **Mode A** (full 7-agent swarm) if not already done
28
+ 3. Continue: root_cause → plan → gates → execute → verify (fix verify swarm) → report
29
+
30
+ Do not execute code changes on incident path without explicit fix request or approval.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: shared-planning
3
3
  description: >-
4
- Plans AAAC changes: SSOT, layers, size budgets, state machines. Readonly until
5
- orchestrator approves. Invoked by graph — not user-facing.
4
+ Plans AAAC changes: SSOT, layers, size budgets, complexity score, requirement map.
5
+ Readonly until orchestrator approves. Mutating verbs only.
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -10,7 +10,16 @@ disable-model-invocation: true
10
10
 
11
11
  ## When
12
12
 
13
- After `discovery_swarm`. **Does not edit files.**
13
+ After `discover` / `investigate*` on **`create`, `update`, `fix`** commands. **Does not edit files.**
14
+
15
+ Other verbs: lightweight plan only (no complexity artifact).
16
+
17
+ ## Policies (mutating verbs)
18
+
19
+ Read before planning:
20
+
21
+ - [minimal-complexity.md](../../../policies/minimal-complexity.md)
22
+ - [complexity.yaml](../../../aaac/complexity.yaml) — weights and thresholds
14
23
 
15
24
  ## Agents
16
25
 
@@ -19,12 +28,69 @@ Optional parallel readonly:
19
28
  - [plan-layer-map.md](../../../agents/plan-layer-map.md)
20
29
  - [plan-state-machines.md](../../../agents/plan-state-machines.md)
21
30
 
22
- ## Plan document (internal)
31
+ ## Strategy (mandatory for create / update / fix)
32
+
33
+ Search codebase first. Document in plan **before** proposing new artifacts:
34
+
35
+ ```text
36
+ 1. reuse_existing
37
+ 2. extend_existing
38
+ 3. modify_existing
39
+ 4. create_new ← last resort; each entry needs requirement_ref + why_not_reuse
40
+ ```
41
+
42
+ Prefer **lower complexity score** when multiple options satisfy requirements.
43
+
44
+ ## Plan artifact (store on Run `artifacts.plan`)
45
+
46
+ Contract: [contracts/skills/planning.yaml](../../../aaac/contracts/skills/planning.yaml)
47
+
48
+ ```yaml
49
+ requirement_map:
50
+ - requirement: "<from user intent — quoted if possible>"
51
+ satisfies_with: ["<artifact ids>"]
52
+ complexity_score: <sum of weights for net-new items>
53
+ complexity_breakdown:
54
+ new_file: 0
55
+ new_api_endpoint: 0
56
+ # … per complexity.yaml weights
57
+ reuse: ["<existing paths or symbols>"]
58
+ modify: ["<existing paths to edit>"]
59
+ create:
60
+ - artifact: "<name>"
61
+ kind: <weight key from complexity.yaml>
62
+ requirement_ref: "<requirement text>"
63
+ why_not_reuse: "<one line>"
64
+ rejected_alternatives:
65
+ - option: "<heavier approach>"
66
+ complexity_score: <number>
67
+ rejected_because: "<no requirement / reuse suffices>"
68
+ paths_to_touch: ["<concrete file paths>"]
69
+ rollback_notes: "<when protected/critical object>"
70
+ ```
71
+
72
+ Also include:
23
73
 
24
- - User intent → concrete paths (from domain inventory)
25
74
  - SSOT owner for new state
26
75
  - Extract before add if any file ≥80% budget
27
- - Named machine states/events if async coordination added
28
- - Migration + schema steps if DB changes
76
+ - Named machine states/events **only** if user requirement demands async coordination
77
+
78
+ ## Complexity score
79
+
80
+ Sum `complexity.yaml` weights for each net-new artifact in `create`. **Edits to existing files do not add weight** (count under `modify`).
81
+
82
+ Compare to verb threshold:
83
+
84
+ | Verb | Max |
85
+ |------|-----|
86
+ | fix | 5 |
87
+ | update | 8 |
88
+ | create | 12 |
89
+
90
+ If over threshold: revise plan toward reuse/modify or document in `rejected_alternatives` and stop for gate — do not proceed to execute silently.
91
+
92
+ ## YAGNI
93
+
94
+ Do not plan for unstated future needs. See [minimal-complexity.md](../../../policies/minimal-complexity.md).
29
95
 
30
- Orchestrator gates `execute` — no implementation until plan respects domain constraints.
96
+ Orchestrator gates `execute` — no implementation until plan passes **validate** and **fitness_functions** (`minimal_complexity`).
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: shared-platform-release
3
3
  description: >-
4
- Phased release swarm coordination for release-app. Wave 1 git (blocking),
5
- Wave 2 Render deploy. Internal only.
4
+ Phased release for release-app: mandatory preflight, git, optional conditional
5
+ package publish, Render poll, verify, report.
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -11,36 +11,39 @@ disable-model-invocation: true
11
11
  ## Swarm DAG
12
12
 
13
13
  ```text
14
- Preflight (optional tests)
14
+ Wave 0: pnpm typecheck (mandatory)
15
15
 
16
16
  Wave 1: release-git ← BLOCKING
17
17
 
18
- Wave 2: release-render
18
+ Wave 1.5: conditional package publish ← OPTIONAL (project overlay; blocking when triggered)
19
19
 
20
- Parent: verification + reporting
20
+ Wave 2: release-render BLOCKING (poll until live or fail)
21
+
22
+ Wave 3: verification + reporting
21
23
  ```
22
24
 
23
- ## Wave 1launch one agent
25
+ ## Wave 0preflight
24
26
 
27
+ ```bash
28
+ pnpm typecheck
25
29
  ```
26
- Task (shell or generalPurpose): release-git
27
- Read: agents/release-git.md, ship-procedure.md
28
- Return: commit_sha, commit_message_*
29
- On failure: abort pipeline
30
- ```
31
30
 
32
- ## Wave 2 Render deploy
31
+ Always. Optional extra tests when intent requests them.
32
+
33
+ ## Wave 1 — git
34
+
35
+ Execute [agents/release-git.md](../../../agents/release-git.md) or spawn shell subagent.
36
+
37
+ ## Wave 1.5 — conditional publish (project overlay)
33
38
 
34
- Only after Wave 1 `status: success`. Pass `commit_sha` and messages.
39
+ When the project ships an npm package with the app (e.g. `@ludecker/aaac`), the project overlay supplies a conditional publish agent and detection scripts. Skip when no changes detected.
35
40
 
36
- | Agent spec | Tool |
37
- |------------|------|
38
- | [release-render.md](../../../agents/release-render.md) | generalPurpose or render-assistant MCP |
41
+ ## Wave 2 Render (mandatory)
39
42
 
40
- ## Preflight
43
+ Execute [agents/release-render.md](../../../agents/release-render.md).
41
44
 
42
- If intent contains "test" / "with tests": run `pnpm typecheck` before Wave 1.
45
+ **Never** end ship without polled deploy status.
43
46
 
44
47
  ## Reference
45
48
 
46
- Full step detail: [ship-procedure.md](ship-procedure.md)
49
+ Full steps: [ship-procedure.md](ship-procedure.md)
@@ -1,5 +1,5 @@
1
1
  name: release-app-orchestrator
2
- purpose: Ship to main with phased expert subagents (git, then parallel integrations)
2
+ purpose: Ship to main with preflight, git push, optional conditional package publish, mandatory Render deploy poll, smoke check, report
3
3
  inputs:
4
4
  domain:
5
5
  required: false
@@ -9,21 +9,41 @@ inputs:
9
9
  outputs:
10
10
  commit_sha:
11
11
  type: string
12
+ package_publish_skipped:
13
+ type: boolean
14
+ package_version:
15
+ type: string
16
+ package_tag:
17
+ type: string
18
+ package_publish_status:
19
+ type: string
12
20
  deploy_status:
13
21
  type: string
22
+ deploy_id:
23
+ type: string
24
+ smoke_http_code:
25
+ type: number
14
26
  report:
15
27
  type: markdown
16
28
  success_criteria:
17
- - git push to main succeeded
18
- - render deploy reached live or build failure reported with logs
19
- - posthog and linear agents run after git (parallel wave)
29
+ - pnpm typecheck passed
30
+ - git push to main succeeded (or HEAD already on remote)
31
+ - when package changes detected, ship checks passed and version published
32
+ - render deploy reached live for commit_sha
33
+ - smoke check returned 200
20
34
  failure_conditions:
35
+ - typecheck failed
21
36
  - git push failed
22
- - wave 2 started before commit_sha known
37
+ - wave 1.5 or 2 started before commit_sha known
38
+ - package ship checks failed when triggered
39
+ - package publish monitor timeout when triggered
40
+ - render build_failed or poll timeout
41
+ - smoke check not 200
23
42
  dependencies:
24
43
  skills: [platform-release, testing, verification, reporting]
25
44
  policies: [master-rules, mcp-and-deploy]
26
45
  verification:
46
+ - typecheck_passed
27
47
  - git_pushed
28
- - render_polled
29
- - agent_wave_order_respected
48
+ - render_polled_until_live
49
+ - smoke_200
@@ -21,7 +21,8 @@ disable-model-invocation: true
21
21
  - Tests: …
22
22
  - Intent: …
23
23
  - Confidence: architecture / requirements / scope
24
- - Fitness: pass/warning/fail summary
24
+ - Complexity: score / threshold / pass (create/update/fix only)
25
+ - Fitness: pass/warning/fail summary (include minimal_complexity)
25
26
  - Impact: blast_radius, affected domains
26
27
 
27
28
  ### Rollback (if applicable)
@@ -1,13 +1,22 @@
1
1
  ---
2
2
  name: shared-root-cause
3
3
  description: >-
4
- Deep root-cause framing after investigation on fix paths. Not user-facing.
4
+ Deep root-cause framing after investigation swarm on fix paths. Not user-facing.
5
5
  disable-model-invocation: true
6
6
  ---
7
7
 
8
8
  # Root cause (fix only)
9
9
 
10
- **When:** fix verb lifecycle — after [investigation](../investigation/SKILL.md), before planning.
10
+ **When:** fix verb lifecycle — after [investigation](../investigation/SKILL.md) Mode A merge, before planning.
11
+
12
+ **Input:** Run artifact `artifacts/investigation.md` (required).
13
+
14
+ ## Procedure
15
+
16
+ 1. Synthesize swarm outputs into one hypothesis — cite `path:line` evidence
17
+ 2. If any investigation agent had `confidence: low` **or** merged architecture confidence &lt; 0.85 → launch **1 parallel** [fix-hypothesis-validate.md](../../../agents/fix-hypothesis-validate.md) (`explore`, readonly)
18
+ 3. If validator returns `investigate_more` → **STOP, REQUEST CLARIFICATION** or run second investigation wave (max 2 agents)
19
+ 4. Write Run artifact `artifacts/root_cause.yaml`
11
20
 
12
21
  ## Output (mandatory)
13
22
 
@@ -17,8 +26,10 @@ root_cause: hypothesis with evidence (path:line)
17
26
  contributing_factors: [optional bullets]
18
27
  fix_strategy: minimal correct change (not symptom patch)
19
28
  regression_risk: low | medium | high
29
+ root_cause_confidence: 0.0–1.0
30
+ validator_action: proceed | investigate_more | skipped
20
31
  ```
21
32
 
22
- If root cause confidence &lt; 0.7 → **STOP, REQUEST CLARIFICATION** — do not plan or execute.
33
+ If `root_cause_confidence` &lt; **0.7** → **STOP, REQUEST CLARIFICATION** — do not plan or execute.
23
34
 
24
35
  Feed `fix_strategy` and `regression_risk` into [impact-analysis](../impact-analysis/SKILL.md) and [rollback](../rollback/SKILL.md).
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: shared-testing
3
3
  description: >-
4
- Runs vitest and Fallow check_changed for AAAC workflows. Software pass/fail —
5
- not goal verification. Not user-facing.
4
+ Runs vitest, Fallow check_changed, and fix repro verification swarm.
5
+ Software pass/fail — not goal verification. Not user-facing.
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -10,15 +10,41 @@ disable-model-invocation: true
10
10
 
11
11
  ## When
12
12
 
13
- Phase `test` (and `test_only` orchestrators).
13
+ Phase `verify` (and `test_only` orchestrators). On **fix** paths, run fix verify swarm **before** declaring tests complete.
14
14
 
15
- ## Steps
15
+ ## Standard steps
16
16
 
17
17
  1. Run tests from domain inventory relevant to change
18
18
  2. Invoke [unit-test-run.md](../../../agents/unit-test-run.md) pattern for targeted vitest
19
19
  3. Fallow MCP → `check_changed` on touched files when configured
20
20
  4. `ReadLints` on edited paths
21
+ 5. **Website build gate (mandatory on create / update / fix):** before advancing `verify`, run:
22
+ ```bash
23
+ node .cursor/aaac/scripts/run-engine/verify-website-build.mjs --run-id <run_id>
24
+ ```
25
+ This checks `index.html` static asset paths resolve under `apps/website/public/` (or project root for Vite dev) and runs `pnpm --filter @ludecker/website build`. `advance-phase.mjs verify` **blocks** until this passes and writes `artifacts/verify.yaml`.
26
+
27
+ ## Fix verify swarm (mandatory on fix verb / fix_mode)
28
+
29
+ After unit tests, launch **3 parallel** `Task` subagents in **one message**:
30
+
31
+ | # | Agent spec | `subagent_type` | Role |
32
+ |---|------------|-----------------|------|
33
+ | 1 | [fix-repro-verify.md](../../../agents/fix-repro-verify.md) | `shell` | Re-run repro steps from investigation artifact |
34
+ | 2 | [unit-test-run.md](../../../agents/unit-test-run.md) | `shell` | Targeted vitest for suspect area |
35
+ | 3 | [fallow-check-changed.md](../../../agents/fallow-check-changed.md) | `generalPurpose` | Static health on touched files |
36
+
37
+ Parent merges into Run `artifacts.testing`:
38
+
39
+ ```yaml
40
+ repro_status: fixed | partial | not_fixed
41
+ tests: { pass, fail, names: [] }
42
+ fallow: pass | warn | fail
43
+ lints: clean | issues
44
+ ```
45
+
46
+ If `repro_status: not_fixed` → verification must **fail** even when unit tests pass.
21
47
 
22
48
  ## Output
23
49
 
24
- Pass/fail summary with test names and Fallow verdict for `verification` skill.
50
+ Pass/fail summary with test names, repro_status, and Fallow verdict for [verification](../verification/SKILL.md).
@@ -1,16 +1,18 @@
1
1
  ---
2
2
  name: shared-validation
3
3
  description: >-
4
- Confidence gates before execute. STOP and request clarification when thresholds
5
- not met. Not user-facing.
4
+ Confidence and complexity gates before execute on create/update/fix.
5
+ STOP and request clarification when thresholds not met. Not user-facing.
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
9
- # Validation (confidence gates)
9
+ # Validation (confidence + complexity gates)
10
10
 
11
- **When:** After plan, **before** impact_analysis / execute.
11
+ **When:** After `plan`, **before** impact_analysis / execute.
12
12
 
13
- ## Thresholds (SSOT)
13
+ **Applies to:** `create`, `update`, `fix` (see [complexity.yaml](../../../aaac/complexity.yaml) `mutating_verbs`).
14
+
15
+ ## Thresholds — confidence (SSOT)
14
16
 
15
17
  From [ontology.json](../../../aaac/ontology.json) `confidence`:
16
18
 
@@ -20,22 +22,47 @@ From [ontology.json](../../../aaac/ontology.json) `confidence`:
20
22
  | requirements | 0.8 |
21
23
  | scope | 0.8 |
22
24
 
25
+ ## Thresholds — complexity (SSOT)
26
+
27
+ From [complexity.yaml](../../../aaac/complexity.yaml):
28
+
29
+ | Verb | Max `complexity_score` |
30
+ |------|------------------------|
31
+ | fix | 5 |
32
+ | update | 8 |
33
+ | create | 12 |
34
+
23
35
  ## Inputs
24
36
 
25
- - Plan from [planning](../planning/SKILL.md)
26
- - Confidence scores from [investigation-lite](../investigation-lite/SKILL.md) or [investigation](../investigation/SKILL.md) + [root-cause](../root-cause/SKILL.md)
37
+ - Plan from [planning](../planning/SKILL.md) → Run `artifacts.plan`
38
+ - Confidence scores from investigation path
27
39
  - Domain inventory constraints
40
+ - [minimal-complexity.md](../../../policies/minimal-complexity.md)
28
41
 
29
42
  ## Procedure
30
43
 
44
+ ### 1. Confidence
45
+
31
46
  1. Score each dimension 0.0–1.0 with one-line evidence
32
47
  2. Compare to thresholds
33
- 3. If **any** below threshold:
48
+
49
+ ### 2. Plan / complexity (mutating verbs only)
50
+
51
+ 1. Verify Run `artifacts.plan` has: `requirement_map`, `complexity_score`, `reuse`, `modify`, `create`, `rejected_alternatives`
52
+ 2. Every `create[]` entry must have `requirement_ref` and `why_not_reuse`
53
+ 3. Each requirement in user intent must appear in `requirement_map`
54
+ 4. Compare `complexity_score` to verb threshold
55
+ 5. Scan plan for YAGNI phrases ([complexity.yaml](../../../aaac/complexity.yaml) `yagni.reject_without_user_evidence`) — fail unless user intent cites the same need
56
+ 6. **fix:** plan must prioritize `modify` over `create`; score > 5 → fail
57
+
58
+ ### 3. Fail → block Run
59
+
60
+ If confidence below threshold **or** complexity checks fail:
34
61
 
35
62
  ```yaml
36
63
  status: blocked
37
64
  awaiting_approval: true
38
- blocked_reason: "confidence.{dimension} {score} below {threshold}"
65
+ blocked_reason: "<specific reason>"
39
66
  ```
40
67
 
41
68
  ```text
@@ -44,13 +71,21 @@ Reason: {blocked_reason}
44
71
  Run: {run_id}
45
72
  ```
46
73
 
47
- List specific questions for the user. **Do not proceed to execute** until user approves in chat.
74
+ List specific questions. **Do not proceed to execute** until user approves or plan is revised.
75
+
76
+ ### 4. Pass
77
+
78
+ Record on Run:
79
+
80
+ - `confidence` scores
81
+ - `gates.results.validate`
82
+ - `artifacts.plan` complexity fields
48
83
 
49
- 4. Record scores on Run `confidence` and gate result in `gates.results.validate`
50
- 5. If at threshold: emit gate pass, continue gate stack
84
+ Continue gate stack.
51
85
 
52
86
  ## Plan sanity checks
53
87
 
54
88
  - Plan respects inventory out-of-scope
55
89
  - Plan names files to touch (no vague "update CMS")
56
- - Protected/critical objects include rollback mention in plan or next rollback phase
90
+ - Protected/critical objects include rollback mention
91
+ - No new service/table/queue/state machine without matching `requirement_map` entry
@@ -18,6 +18,25 @@ Read before any phase:
18
18
  1. [.cursor/policies/master-rules.md](../../../policies/master-rules.md)
19
19
  2. [.cursor/policies/implementation.md](../../../policies/implementation.md)
20
20
  3. [.cursor/policies/mcp-and-deploy.md](../../../policies/mcp-and-deploy.md)
21
+ 4. [.cursor/policies/minimal-complexity.md](../../../policies/minimal-complexity.md) — **required for create / update / fix**
22
+
23
+ ## Minimal complexity (create / update / fix)
24
+
25
+ SSOT: [complexity.yaml](../../../aaac/complexity.yaml), [minimal-complexity.md](../../../policies/minimal-complexity.md)
26
+
27
+ | Phase | Responsibility |
28
+ |-------|----------------|
29
+ | **plan** | `requirement_map`, `complexity_score`, reuse/modify/create, rejected alternatives → Run `artifacts.plan` |
30
+ | **validate** | Confidence + plan fields + score ≤ threshold + YAGNI |
31
+ | **fitness_functions** | `minimal_complexity` pass (blocking) |
32
+
33
+ Optimization: **capability / complexity**, not capability alone. Default to reuse → extend → modify → create.
34
+
35
+ | Verb | Max complexity score |
36
+ |------|----------------------|
37
+ | fix | 5 |
38
+ | update | 8 |
39
+ | create | 12 |
21
40
 
22
41
  ## Confidence gates
23
42
 
@@ -49,7 +68,7 @@ When `$DOMAIN` slug maps to `domains/<slug>/update/inventory/SKILL.md`:
49
68
  1. Read inventory **first** (constraints, out-of-scope, file map)
50
69
  2. Pass inventory constraints into discovery, investigation-lite/investigation, planning, validation, execution, verification
51
70
 
52
- If inventory missing and command is `fix-bug` / `create-feature` / `update-module`:
71
+ If inventory missing and command is `fix-bug` / `fix-module` / `create-feature` / `update-module`:
53
72
 
54
73
  - Run [module-authoring](../../module-authoring/SKILL.md) discovery to bootstrap domain, **or**
55
74
  - Tell user to use generic verb command with intent
@@ -30,7 +30,8 @@ Everything executes within a Run. Observability (`decisions`, `log`, `checkpoint
30
30
  |-------|------|-------|
31
31
  | `discover` | work | discovery |
32
32
  | `investigate_lite` | work | investigation-lite |
33
- | `investigate` | work | investigation |
33
+ | `investigate` | work | investigation (legacy id; use investigate_swarm) |
34
+ | `investigate_swarm` | work | investigation Mode A |
34
35
  | `root_cause` | work | root-cause |
35
36
  | `plan` | work | planning |
36
37
  | `validate` | gate | validation |
@@ -48,7 +49,7 @@ Everything executes within a Run. Observability (`decisions`, `log`, `checkpoint
48
49
  |------|------|------------|
49
50
  | create | discover → investigate_lite → plan → execute → verify → report | pre_execute |
50
51
  | update | same | pre_execute |
51
- | fix | discover → investigate → root_cause → plan → execute → verify → report | pre_execute |
52
+ | fix | discover → investigate_swarm → root_cause → plan → execute → verify → report | pre_execute |
52
53
  | review | discover → plan → report | none |
53
54
  | check | discover → report | pre_execute_minimal |
54
55
  | test | discover → plan → verify → report | none |
@@ -17,6 +17,9 @@ Read [_dispatch-utils.md](../_dispatch-utils.md) first.
17
17
  3. **load_inventory** — when domain slug maps to inventory
18
18
  4. **object_skills** — from graph `object_skills.<object>`
19
19
  5. [check](../../check/SKILL.md) — swarm per check skill
20
- 6. [reporting](../../reporting/SKILL.md) **Answer** (yes/no/partial) then **How**
20
+ 6. **contract_checks** — `pnpm --filter @ludecker/aaac test` and `pnpm --filter @ludecker/aaac test:e2e` (includes `check-verb.check.spec.ts`); launch [playwright-check-run](../../../agents/playwright-check-run.md) at report phase
21
+ 7. [reporting](../../reporting/SKILL.md) — **Answer** (yes/no/partial) then **How**
21
22
 
22
23
  No code changes. For test runs use `test-*`; for fixes use `fix-*`.
24
+
25
+ Debug blocked runs: [aaac-log-debug](../../../agents/aaac-log-debug.md) — `debug-run`, `log-dump`, `log-trace`.