@ludecker/aaac 1.0.0 → 1.1.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.
- package/README.md +4 -3
- package/package.json +13 -1
- package/src/cli.mjs +39 -5
- package/src/generators/generate-commands.mjs +120 -3
- package/src/generators/generate-graph.mjs +17 -0
- package/src/lib/install.mjs +1 -0
- package/src/lib/run-engine-paths.mjs +33 -0
- package/src/run-engine/advance-phase.mjs +192 -0
- package/src/run-engine/debug-run.mjs +38 -0
- package/src/run-engine/gate-write.mjs +95 -0
- package/src/run-engine/init-run.mjs +165 -0
- package/src/run-engine/lib.mjs +136 -0
- package/src/run-engine/log-dump.mjs +76 -0
- package/src/run-engine/log-trace.mjs +18 -0
- package/src/run-engine/log.mjs +343 -0
- package/src/run-engine/record-task.mjs +56 -0
- package/src/run-engine/stop-check.mjs +55 -0
- package/templates/cursor/aaac/complexity.yaml +98 -0
- package/templates/cursor/aaac/contracts/commands/fix-bug.yaml +10 -3
- package/templates/cursor/aaac/contracts/commands/fix-module.yaml +41 -0
- package/templates/cursor/aaac/contracts/skills/investigation.yaml +22 -1
- package/templates/cursor/aaac/contracts/skills/planning.yaml +17 -0
- package/templates/cursor/aaac/contracts/skills/validation.yaml +9 -1
- package/templates/cursor/aaac/dispatch.md +30 -5
- package/templates/cursor/aaac/enforcement.json +22 -0
- package/templates/cursor/aaac/fitness-functions.yaml +8 -0
- package/templates/cursor/aaac/governance/gates.json +3 -1
- package/templates/cursor/aaac/graph.project.yaml +237 -5
- package/templates/cursor/aaac/layers.md +3 -1
- package/templates/cursor/aaac/lifecycle/lifecycle.json +41 -1
- package/templates/cursor/aaac/lifecycle/phases.json +1 -0
- package/templates/cursor/aaac/observability/telemetry.yaml +60 -0
- package/templates/cursor/aaac/observability/verb-debug.yaml +170 -0
- package/templates/cursor/aaac/ontology.json +10 -1
- package/templates/cursor/aaac/run/RUN.md +2 -0
- package/templates/cursor/aaac/run/schema.json +9 -0
- package/templates/cursor/aaac/scripts/generate-runtime-registry.mjs +115 -0
- package/templates/cursor/aaac/scripts/run-engine/advance-phase.mjs +192 -0
- package/templates/cursor/aaac/scripts/run-engine/debug-run.mjs +38 -0
- package/templates/cursor/aaac/scripts/run-engine/gate-write.mjs +95 -0
- package/templates/cursor/aaac/scripts/run-engine/init-run.mjs +165 -0
- package/templates/cursor/aaac/scripts/run-engine/lib.mjs +136 -0
- package/templates/cursor/aaac/scripts/run-engine/log-dump.mjs +76 -0
- package/templates/cursor/aaac/scripts/run-engine/log-trace.mjs +18 -0
- package/templates/cursor/aaac/scripts/run-engine/log.mjs +343 -0
- package/templates/cursor/aaac/scripts/run-engine/record-task.mjs +56 -0
- package/templates/cursor/aaac/scripts/run-engine/stop-check.mjs +55 -0
- package/templates/cursor/agents/aaac-log-debug.md +72 -0
- package/templates/cursor/agents/fix-code-path.md +27 -0
- package/templates/cursor/agents/fix-hypothesis-validate.md +26 -0
- package/templates/cursor/agents/fix-inventory-confirm.md +22 -0
- package/templates/cursor/agents/fix-recent-changes.md +22 -0
- package/templates/cursor/agents/fix-regression-scope.md +27 -0
- package/templates/cursor/agents/fix-repro-verify.md +21 -0
- package/templates/cursor/agents/fix-repro.md +29 -0
- package/templates/cursor/agents/fix-runtime-evidence.md +22 -0
- package/templates/cursor/agents/fix-test-failures.md +23 -0
- package/templates/cursor/agents/playwright-check-run.md +44 -0
- package/templates/cursor/hooks/aaac-before-submit.sh +3 -0
- package/templates/cursor/hooks/aaac-pre-tool.sh +4 -0
- package/templates/cursor/hooks/aaac-stop.sh +3 -0
- package/templates/cursor/hooks/aaac-subagent-start.sh +3 -0
- package/templates/cursor/hooks.json +30 -0
- package/templates/cursor/policies/minimal-complexity.md +101 -0
- package/templates/cursor/rules/aaac-enforcement.mdc +42 -0
- package/templates/cursor/skills/shared/execution/SKILL.md +1 -1
- package/templates/cursor/skills/shared/fitness-functions/SKILL.md +23 -7
- package/templates/cursor/skills/shared/investigation/SKILL.md +91 -18
- package/templates/cursor/skills/shared/investigation/orchestrator/SKILL.md +12 -4
- package/templates/cursor/skills/shared/planning/SKILL.md +74 -8
- package/templates/cursor/skills/shared/reporting/SKILL.md +2 -1
- package/templates/cursor/skills/shared/root-cause/SKILL.md +14 -3
- package/templates/cursor/skills/shared/testing/SKILL.md +26 -5
- package/templates/cursor/skills/shared/validation/SKILL.md +48 -13
- package/templates/cursor/skills/shared/verbs/_dispatch-utils.md +20 -1
- package/templates/cursor/skills/shared/verbs/_lifecycle.md +3 -2
- package/templates/cursor/skills/shared/verbs/check/orchestrator/SKILL.md +4 -1
- package/templates/cursor/skills/shared/verbs/create/orchestrator/SKILL.md +2 -2
- package/templates/cursor/skills/shared/verbs/fix/orchestrator/SKILL.md +21 -11
- package/templates/cursor/skills/shared/verbs/fix/orchestrator/contract.yaml +19 -4
- package/templates/cursor/skills/shared/verbs/update/orchestrator/SKILL.md +2 -2
- package/templates/cursor/skills/shared/verification/SKILL.md +2 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Agent: fix-repro
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Confirm the reported symptom and produce deterministic reproduction steps.
|
|
8
|
+
|
|
9
|
+
## Inputs (from parent)
|
|
10
|
+
|
|
11
|
+
- Intent (symptom + expected behavior)
|
|
12
|
+
- Domain slug and inventory path when available
|
|
13
|
+
- Route, URL, error message, or CLI output if provided
|
|
14
|
+
|
|
15
|
+
## Procedure
|
|
16
|
+
|
|
17
|
+
1. Restate **Issue**, **Symptoms**, **Expected** in one line each
|
|
18
|
+
2. Find the smallest path to reproduce (route, component, query, migration, CLI command)
|
|
19
|
+
3. List **repro steps** numbered (max 8 steps)
|
|
20
|
+
4. Note **environment** (local dev, production, browser, auth state)
|
|
21
|
+
5. Mark **repro_confirmed**: yes | partial | no — with evidence
|
|
22
|
+
|
|
23
|
+
## Return
|
|
24
|
+
|
|
25
|
+
- Findings (bullets, product language in summary)
|
|
26
|
+
- Evidence (`path:line`, log snippet, test name — no secrets)
|
|
27
|
+
- Gaps (what could not be reproduced)
|
|
28
|
+
- `repro_confirmed`: yes | partial | no
|
|
29
|
+
- Confidence: high | medium | low
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Agent: fix-runtime-evidence
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Gather runtime evidence — logs, CI, MCP, browser errors — for the symptom.
|
|
8
|
+
|
|
9
|
+
## Procedure
|
|
10
|
+
|
|
11
|
+
1. If intent mentions CI or deploy → use `ci-investigator` subagent pattern or read recent workflow logs
|
|
12
|
+
2. If database/RLS → Supabase MCP `get_logs`, `get_advisors` (project `anseivwusnyiwopihnqu`)
|
|
13
|
+
3. If Render deploy → check deployment status via Render MCP when available
|
|
14
|
+
4. If error message pasted → search codebase for matching string
|
|
15
|
+
5. Never log secrets or tokens
|
|
16
|
+
|
|
17
|
+
## Return
|
|
18
|
+
|
|
19
|
+
- Runtime signals (errors, status codes, advisor findings)
|
|
20
|
+
- Evidence sources (CI run, log type, MCP tool)
|
|
21
|
+
- Whether symptom is **production-only** or **local-only**
|
|
22
|
+
- Confidence: high | medium | low
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Agent: fix-test-failures
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files unless running tests is required — prefer read-only test discovery.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Find existing tests, failures, and coverage gaps related to the symptom.
|
|
8
|
+
|
|
9
|
+
## Procedure
|
|
10
|
+
|
|
11
|
+
1. Search domain inventory for test paths and vitest config
|
|
12
|
+
2. Run targeted tests only when necessary (`pnpm test` scoped to relevant package)
|
|
13
|
+
3. List **failing tests** with assertion message and file
|
|
14
|
+
4. List **missing coverage** — behavior with no test near suspect code
|
|
15
|
+
5. Propose **minimal test** that would catch regression (describe only — do not implement)
|
|
16
|
+
|
|
17
|
+
## Return
|
|
18
|
+
|
|
19
|
+
- Existing tests covering symptom area
|
|
20
|
+
- Failures (name, file, message)
|
|
21
|
+
- Coverage gaps
|
|
22
|
+
- Suggested regression test (one sentence)
|
|
23
|
+
- Confidence: high | medium | low
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Agent: playwright-check-run
|
|
2
|
+
|
|
3
|
+
## Role
|
|
4
|
+
|
|
5
|
+
Run AAAC verb contract Playwright checks and optional public-site smoke during verify.
|
|
6
|
+
|
|
7
|
+
## When
|
|
8
|
+
|
|
9
|
+
**Verify phase** for commands whose verb is `create`, `update`, or `fix` (including aliases such as `fix-module`, `create-component`, `update-module`).
|
|
10
|
+
|
|
11
|
+
**Report phase** for commands whose verb is `check` (including `check-module`, `check-component`, …) — readonly; contract checks only.
|
|
12
|
+
|
|
13
|
+
Contract checks always run. Browser smoke runs only when `PLAYWRIGHT_BASE_URL` is set.
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
From repo root:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm --filter @ludecker/aaac test:e2e
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Optional website smoke (dev server or deployed URL):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
PLAYWRIGHT_BASE_URL=http://localhost:3000 pnpm --filter @ludecker/aaac test:e2e
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Interactive debugging:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm --filter @ludecker/aaac test:e2e:ui
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## What passes
|
|
36
|
+
|
|
37
|
+
- `runtime-registry.json` command entries match `graph.yaml` `verb_runtime` for the command verb
|
|
38
|
+
- Fix verb includes `investigate_swarm` and `root_cause` before `plan`
|
|
39
|
+
- Check verb has no `execute` or `plan` — pending matches `verb_runtime.check`
|
|
40
|
+
- Skipped browser tests when `PLAYWRIGHT_BASE_URL` is unset (CI default)
|
|
41
|
+
|
|
42
|
+
## Return
|
|
43
|
+
|
|
44
|
+
Exit code, failing spec file names, contract mismatch details (command vs `verb_runtime`), browser smoke failures with route and status.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"beforeSubmitPrompt": [
|
|
5
|
+
{
|
|
6
|
+
"command": ".cursor/hooks/aaac-before-submit.sh",
|
|
7
|
+
"matcher": "UserPromptSubmit"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"preToolUse": [
|
|
11
|
+
{
|
|
12
|
+
"command": ".cursor/hooks/aaac-pre-tool.sh",
|
|
13
|
+
"matcher": "Write|StrReplace|Delete|EditNotebook|ApplyPatch",
|
|
14
|
+
"failClosed": true
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"subagentStart": [
|
|
18
|
+
{
|
|
19
|
+
"command": ".cursor/hooks/aaac-subagent-start.sh",
|
|
20
|
+
"failClosed": false
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"stop": [
|
|
24
|
+
{
|
|
25
|
+
"command": ".cursor/hooks/aaac-stop.sh",
|
|
26
|
+
"loop_limit": 5
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Policy: Minimal complexity
|
|
2
|
+
|
|
3
|
+
**SSOT:** [.cursor/aaac/complexity.yaml](../aaac/complexity.yaml)
|
|
4
|
+
|
|
5
|
+
**Applies to:** `create`, `update`, `fix` commands (and domain orchestrators in those modes).
|
|
6
|
+
|
|
7
|
+
**Loaded with:** master-rules, implementation, mcp-and-deploy — before plan phase on mutating verbs.
|
|
8
|
+
|
|
9
|
+
## Optimization target
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
User request
|
|
13
|
+
→ Simplest solution that satisfies all stated requirements
|
|
14
|
+
→ NOT the most elegant or future-proof architecture
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Optimize **capability / complexity**, not capability alone.
|
|
18
|
+
|
|
19
|
+
## Strategy priority (mandatory)
|
|
20
|
+
|
|
21
|
+
Before proposing new artifacts, search and document in the plan:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
1. Reuse existing function / component / module
|
|
25
|
+
2. Extend existing (minimal additive change)
|
|
26
|
+
3. Modify existing in place
|
|
27
|
+
4. Create new — only when 1–3 cannot satisfy a stated requirement
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Default verb bias:** prefer `update` over `create` when intent is ambiguous.
|
|
31
|
+
|
|
32
|
+
## YAGNI
|
|
33
|
+
|
|
34
|
+
Future requirements **do not exist** unless the user explicitly stated them.
|
|
35
|
+
|
|
36
|
+
Reject plan items justified only by:
|
|
37
|
+
|
|
38
|
+
- maybe later / might need
|
|
39
|
+
- future-proofing / scalability / extensibility
|
|
40
|
+
- generic framework / plugin system / event bus “for flexibility”
|
|
41
|
+
|
|
42
|
+
If the user did state a future requirement, cite their exact words in `requirement_map`.
|
|
43
|
+
|
|
44
|
+
## Complexity score
|
|
45
|
+
|
|
46
|
+
Sum weights from [complexity.yaml](../aaac/complexity.yaml) for each **net-new** artifact in the plan.
|
|
47
|
+
|
|
48
|
+
| Verb | Max score (block above) |
|
|
49
|
+
|------|-------------------------|
|
|
50
|
+
| fix | 5 |
|
|
51
|
+
| update | 8 |
|
|
52
|
+
| create | 12 |
|
|
53
|
+
|
|
54
|
+
Lower score wins when comparing alternatives. Document rejected higher-score options in `rejected_alternatives`.
|
|
55
|
+
|
|
56
|
+
## Plan artifact (required)
|
|
57
|
+
|
|
58
|
+
Before `validate` gate on create/update/fix, write to Run `artifacts.plan`:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
requirement_map:
|
|
62
|
+
- requirement: "User can export CSV"
|
|
63
|
+
satisfies_with: ["ExportButton", "GET /api/export"]
|
|
64
|
+
complexity_score: 2
|
|
65
|
+
complexity_breakdown:
|
|
66
|
+
new_component: 0
|
|
67
|
+
new_api_endpoint: 1
|
|
68
|
+
modify: 1
|
|
69
|
+
reuse:
|
|
70
|
+
- "ExportButton pattern from packages/ui"
|
|
71
|
+
modify:
|
|
72
|
+
- "apps/website/app/api/export/route.ts (extend existing export handler)"
|
|
73
|
+
create:
|
|
74
|
+
- artifact: "GET /api/export/csv"
|
|
75
|
+
kind: new_api_endpoint
|
|
76
|
+
requirement_ref: "User can export CSV"
|
|
77
|
+
why_not_reuse: "No existing CSV export route"
|
|
78
|
+
rejected_alternatives:
|
|
79
|
+
- option: "Event bus + background queue + retry framework"
|
|
80
|
+
complexity_score: 14
|
|
81
|
+
rejected_because: "No requirement for async or retries"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Gate enforcement
|
|
85
|
+
|
|
86
|
+
| Gate | Check |
|
|
87
|
+
|------|-------|
|
|
88
|
+
| **validate** | Plan fields present; no unjustified create; YAGNI |
|
|
89
|
+
| **fitness_functions** | `minimal_complexity` pass; score ≤ threshold |
|
|
90
|
+
|
|
91
|
+
On fail → Run `blocked`, `awaiting_approval: true` — same as other gates.
|
|
92
|
+
|
|
93
|
+
## Fix verb
|
|
94
|
+
|
|
95
|
+
Fix plans must be **minimal correct change** — smallest diff that resolves root cause. Prefer modify over create. Score threshold is strictest (5).
|
|
96
|
+
|
|
97
|
+
## Pruning mindset
|
|
98
|
+
|
|
99
|
+
On create/update, ask: **what existing code can this replace or extend?**
|
|
100
|
+
|
|
101
|
+
Deletion and simplification are in scope for `update`/`fix` when they reduce complexity without breaking requirements.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: AAAC pipeline enforcement — hooks block edits until Run reaches execute phase. Applies to ALL slash commands.
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AAAC enforcement (mandatory)
|
|
7
|
+
|
|
8
|
+
**Runtime SSOT:** [.cursor/hooks.json](../hooks.json), [.cursor/aaac/enforcement.json](../aaac/enforcement.json)
|
|
9
|
+
|
|
10
|
+
Every AAAC slash command (`/fix-module`, `/update-module`, `/write-article`, …) **must** execute inside a **Run**. This is not optional.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
1. **Cursor Hooks enabled** — Settings → Hooks; restart Cursor after `.cursor/hooks.json` changes
|
|
15
|
+
2. **Registry current** — `node .cursor/aaac/generate-graph.mjs`
|
|
16
|
+
|
|
17
|
+
## Hook behavior (automatic)
|
|
18
|
+
|
|
19
|
+
| Hook | Effect |
|
|
20
|
+
|------|--------|
|
|
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 |
|
|
23
|
+
| `subagentStart` | Counts Task launches for swarm phase validation |
|
|
24
|
+
| `stop` | Follow-up if Run not `completed` |
|
|
25
|
+
|
|
26
|
+
## Agent obligations
|
|
27
|
+
|
|
28
|
+
1. **First action** after AAAC command: confirm Run exists for **this chat** (`.cursor/aaac/state/active-runs/{conversation_id}.json`). If missing, the `beforeSubmitPrompt` hook creates it automatically.
|
|
29
|
+
2. **Never skip phases.** Complete swarms, write Run artifacts, then advance:
|
|
30
|
+
```bash
|
|
31
|
+
node .cursor/aaac/scripts/run-engine/advance-phase.mjs <run_id> <phase>
|
|
32
|
+
```
|
|
33
|
+
3. **Swarm minimums** (enforced by advance-phase):
|
|
34
|
+
- `discover`: 4 Task agents
|
|
35
|
+
- `investigate_swarm`: 7 Task agents
|
|
36
|
+
- `research_swarm`: 6 Task agents
|
|
37
|
+
4. **Code edits only in `execute`** (hook-enforced). Before execute: artifacts only under `.cursor/aaac/state/runs/`.
|
|
38
|
+
5. **Complete the Run** — advance through `report`, set status completed.
|
|
39
|
+
|
|
40
|
+
## If edit is denied
|
|
41
|
+
|
|
42
|
+
Continue the pipeline — do not work around hooks. Full dispatch: [.cursor/aaac/dispatch.md](../aaac/dispatch.md)
|
|
@@ -21,7 +21,7 @@ Orchestrator phase `execute` after approved plan.
|
|
|
21
21
|
## Actions
|
|
22
22
|
|
|
23
23
|
- Edit files per plan and implementation skill
|
|
24
|
-
- `apply_migration` for new/changed `supabase/migrations/` (project `
|
|
24
|
+
- `apply_migration` for new/changed `supabase/migrations/` (project `anseivwusnyiwopihnqu` — see [supabase-mcp.mdc](../../../rules/supabase-mcp.mdc))
|
|
25
25
|
- `track()` for user-facing mutations
|
|
26
26
|
- Structured logging on server async paths
|
|
27
27
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: shared-fitness-functions
|
|
3
3
|
description: >-
|
|
4
4
|
Score architecture fitness functions before execute; re-check in verify.
|
|
5
|
-
Not user-facing.
|
|
5
|
+
Includes minimal_complexity for create/update/fix. Not user-facing.
|
|
6
6
|
disable-model-invocation: true
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -12,13 +12,28 @@ disable-model-invocation: true
|
|
|
12
12
|
|
|
13
13
|
## SSOT
|
|
14
14
|
|
|
15
|
-
[fitness-functions.yaml](../../../aaac/fitness-functions.yaml)
|
|
15
|
+
[fitness-functions.yaml](../../../aaac/fitness-functions.yaml)
|
|
16
|
+
Complexity config: [complexity.yaml](../../../aaac/complexity.yaml)
|
|
16
17
|
|
|
17
18
|
## Procedure
|
|
18
19
|
|
|
19
20
|
1. Filter `functions` where command `object` ∈ `applies_to`
|
|
20
|
-
2.
|
|
21
|
-
3.
|
|
21
|
+
2. For **create / update / fix**, always score `minimal_complexity` (see `applies_to_verbs`)
|
|
22
|
+
3. Load linked skill or policy per function
|
|
23
|
+
4. Score each: `pass` | `warning` | `fail` against planned changes in Run `artifacts.plan`
|
|
24
|
+
|
|
25
|
+
## minimal_complexity (mutating verbs)
|
|
26
|
+
|
|
27
|
+
Policy: [minimal-complexity.md](../../../policies/minimal-complexity.md)
|
|
28
|
+
|
|
29
|
+
| Check | fail |
|
|
30
|
+
|-------|------|
|
|
31
|
+
| `complexity_score` ≤ verb threshold | score above threshold |
|
|
32
|
+
| Reuse-first documented | create without `why_not_reuse` |
|
|
33
|
+
| YAGNI | speculative architecture in plan |
|
|
34
|
+
| fix minimalism | fix plan score > 5 or large create list |
|
|
35
|
+
|
|
36
|
+
**Blocking** — same as `security` and `layer_boundaries`.
|
|
22
37
|
|
|
23
38
|
## Output
|
|
24
39
|
|
|
@@ -30,13 +45,14 @@ score:
|
|
|
30
45
|
security: pass | warning | fail
|
|
31
46
|
layer_boundaries: pass | warning | fail
|
|
32
47
|
performance: pass | warning | fail
|
|
48
|
+
minimal_complexity: pass | warning | fail
|
|
33
49
|
blocking_failures: [function names — empty if none]
|
|
34
50
|
```
|
|
35
51
|
|
|
52
|
+
Store on Run `artifacts.fitness` and `gates.results.fitness_functions`.
|
|
53
|
+
|
|
36
54
|
## Gates
|
|
37
55
|
|
|
38
|
-
- Any **fail** on `security` or
|
|
56
|
+
- Any **fail** on `security`, `layer_boundaries`, or **`minimal_complexity`** → **STOP** before execute
|
|
39
57
|
- **warning** → document in report; may proceed if validation passed
|
|
40
58
|
- Re-run abbreviated score in [verification](../verification/SKILL.md) after execute
|
|
41
|
-
|
|
42
|
-
Turns "read architecture.md" into enforceable checks.
|
|
@@ -1,46 +1,119 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: shared-investigation
|
|
3
3
|
description: >-
|
|
4
|
-
Deep investigation
|
|
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
|
-
|
|
15
|
+
**Default: readonly.** Artifacts stored on Run under `artifacts.investigation`.
|
|
15
16
|
|
|
16
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
90
|
+
Pass to [validation](../validation/SKILL.md) and [root-cause](../root-cause/SKILL.md).
|
|
91
|
+
|
|
92
|
+
---
|
|
27
93
|
|
|
28
|
-
|
|
94
|
+
## Mode B — Incident path (review-incident)
|
|
29
95
|
|
|
30
|
-
|
|
96
|
+
**Applies to:** `/review-incident`, `swarm-check` alias — investigation only unless `--fix`.
|
|
31
97
|
|
|
32
|
-
|
|
98
|
+
Launch **4 parallel** `Task` subagents in one message:
|
|
33
99
|
|
|
34
|
-
|
|
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
|
-
|
|
107
|
+
Layman report via [reporting](../reporting/SKILL.md) — <250 words unless user asked for detail.
|
|
37
108
|
|
|
38
|
-
|
|
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
|
-
|
|
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.
|
|
19
|
-
2.
|
|
20
|
-
3. [reporting](
|
|
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
|
-
|
|
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,
|
|
5
|
-
orchestrator approves.
|
|
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 `
|
|
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
|
-
##
|
|
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
|
|
28
|
-
|
|
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
|
|
96
|
+
Orchestrator gates `execute` — no implementation until plan passes **validate** and **fitness_functions** (`minimal_complexity`).
|
|
@@ -21,7 +21,8 @@ disable-model-invocation: true
|
|
|
21
21
|
- Tests: …
|
|
22
22
|
- Intent: …
|
|
23
23
|
- Confidence: architecture / requirements / scope
|
|
24
|
-
-
|
|
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)
|