@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.
- 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 +343 -0
- package/src/run-engine/capability-evidence.mjs +460 -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 +215 -0
- package/src/run-engine/lib.mjs +141 -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/src/run-engine/verify-website-build.mjs +148 -0
- package/templates/cursor/aaac/capabilities/promotion-rules.json +64 -0
- package/templates/cursor/aaac/capabilities/registry.json +17 -15
- 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 +31 -6
- package/templates/cursor/aaac/enforcement.json +25 -0
- package/templates/cursor/aaac/fitness-functions.yaml +8 -0
- package/templates/cursor/aaac/governance/gates.json +6 -2
- package/templates/cursor/aaac/graph.project.yaml +237 -5
- package/templates/cursor/aaac/layers.md +6 -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 +63 -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 +11 -0
- package/templates/cursor/aaac/scripts/generate-runtime-registry.mjs +115 -0
- package/templates/cursor/aaac/scripts/run-engine/advance-phase.mjs +343 -0
- package/templates/cursor/aaac/scripts/run-engine/capability-evidence.mjs +460 -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 +215 -0
- package/templates/cursor/aaac/scripts/run-engine/lib.mjs +141 -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/aaac/scripts/run-engine/verify-website-build.mjs +148 -0
- package/templates/cursor/aaac/state/capability-stats.json +5 -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/platform-release/SKILL.md +22 -19
- package/templates/cursor/skills/shared/platform-release/orchestrator/contract.yaml +27 -7
- 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 +31 -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 +3 -0
- package/templates/docs/agentic_architecture.md +236 -53
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Agent: fix-code-path
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Trace execution from symptom to the code that produces the behavior.
|
|
8
|
+
|
|
9
|
+
## Inputs (from parent)
|
|
10
|
+
|
|
11
|
+
- Intent and repro steps from `fix-repro` when available
|
|
12
|
+
- Domain inventory file map
|
|
13
|
+
|
|
14
|
+
## Procedure
|
|
15
|
+
|
|
16
|
+
1. Start at user-visible surface (route, component, action, migration, API)
|
|
17
|
+
2. Follow imports and call chain until data source or side effect
|
|
18
|
+
3. Identify **suspect files** (max 10) with `path:line` anchors
|
|
19
|
+
4. Note **branch points** (conditionals, env, auth, cache, ISR)
|
|
20
|
+
5. Flag **layer violations** (Supabase in page, UI fetching, duplicate SSOT)
|
|
21
|
+
|
|
22
|
+
## Return
|
|
23
|
+
|
|
24
|
+
- Execution trace (ordered bullets)
|
|
25
|
+
- Suspect files with evidence
|
|
26
|
+
- Layer or boundary issues if any
|
|
27
|
+
- Confidence: high | medium | low
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Agent: fix-hypothesis-validate
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Challenge the proposed root cause before planning — second opinion when confidence is borderline.
|
|
8
|
+
|
|
9
|
+
## Inputs
|
|
10
|
+
|
|
11
|
+
- Merged investigation + draft root_cause hypothesis
|
|
12
|
+
- Evidence from fix-code-path and fix-recent-changes
|
|
13
|
+
|
|
14
|
+
## Procedure
|
|
15
|
+
|
|
16
|
+
1. State alternative hypotheses (max 3)
|
|
17
|
+
2. For each: evidence for / against
|
|
18
|
+
3. Recommend **proceed** | **investigate_more** with specific next checks
|
|
19
|
+
4. Score root_cause confidence 0.0–1.0
|
|
20
|
+
|
|
21
|
+
## Return
|
|
22
|
+
|
|
23
|
+
- Alternative hypotheses ranked
|
|
24
|
+
- Recommended action: proceed | investigate_more
|
|
25
|
+
- root_cause_confidence: 0.0–1.0
|
|
26
|
+
- Missing evidence (if investigate_more)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Agent: fix-inventory-confirm
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Validate domain inventory against actual repo layout for the fix scope.
|
|
8
|
+
|
|
9
|
+
## Procedure
|
|
10
|
+
|
|
11
|
+
1. Read `domains/<slug>/update/inventory/SKILL.md` when domain is known
|
|
12
|
+
2. Confirm file map entries exist; flag stale or missing paths
|
|
13
|
+
3. Restate **in scope** and **out of scope** for this fix
|
|
14
|
+
4. List inventory **Section 2 constraints** that apply to the symptom
|
|
15
|
+
|
|
16
|
+
## Return
|
|
17
|
+
|
|
18
|
+
- Inventory freshness: current | stale | missing
|
|
19
|
+
- Confirmed scope boundaries
|
|
20
|
+
- Applicable constraints (bullets)
|
|
21
|
+
- Recommended domain slug if ambiguous
|
|
22
|
+
- Confidence: high | medium | low
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Agent: fix-recent-changes
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Find recent changes that could have introduced the defect.
|
|
8
|
+
|
|
9
|
+
## Procedure
|
|
10
|
+
|
|
11
|
+
1. `git log --oneline -20` on suspect paths from inventory or code-path agent
|
|
12
|
+
2. `git blame` on lines flagged by code-path agent when available
|
|
13
|
+
3. Correlate with deploy dates, migration timestamps, or PR themes if mentioned in intent
|
|
14
|
+
4. List **candidate commits** (hash + one-line summary + files touched)
|
|
15
|
+
5. Rank **likelihood**: high | medium | low per candidate
|
|
16
|
+
|
|
17
|
+
## Return
|
|
18
|
+
|
|
19
|
+
- Candidate commits with likelihood
|
|
20
|
+
- Files changed in window that match symptom scope
|
|
21
|
+
- Regression hypothesis (one paragraph max)
|
|
22
|
+
- Confidence: high | medium | low
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Agent: fix-regression-scope
|
|
2
|
+
|
|
3
|
+
**Readonly.** Do not edit files.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Estimate blast radius and related features that could break from a fix.
|
|
8
|
+
|
|
9
|
+
## Inputs
|
|
10
|
+
|
|
11
|
+
- Domain inventory constraints and `depends_on` from `aaac/dependencies.yaml`
|
|
12
|
+
- Suspect files from code-path agent
|
|
13
|
+
|
|
14
|
+
## Procedure
|
|
15
|
+
|
|
16
|
+
1. List **direct dependents** (imports, routes, types, RLS policies)
|
|
17
|
+
2. Cross-reference [dependency-analysis.md](./dependency-analysis.md) patterns
|
|
18
|
+
3. Tag risks: auth, migrations, ISR/revalidation, public API, design tokens
|
|
19
|
+
4. Set **blast_radius**: low | medium | high
|
|
20
|
+
|
|
21
|
+
## Return
|
|
22
|
+
|
|
23
|
+
- Affected domains and surfaces
|
|
24
|
+
- Risk tags
|
|
25
|
+
- blast_radius
|
|
26
|
+
- Features to spot-check after fix
|
|
27
|
+
- Confidence: high | medium | low
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Agent: fix-repro-verify
|
|
2
|
+
|
|
3
|
+
**Readonly** for investigation; may run dev server or tests to verify fix.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
After execute, confirm the original repro steps now pass and no obvious regression.
|
|
8
|
+
|
|
9
|
+
## Procedure
|
|
10
|
+
|
|
11
|
+
1. Re-run repro steps from Run artifact `investigation.repro_steps`
|
|
12
|
+
2. Run targeted tests from `fix-test-failures` recommendations
|
|
13
|
+
3. Spot-check 2–3 items from `fix-regression-scope` when blast_radius ≥ medium
|
|
14
|
+
4. Record **repro_status**: fixed | partial | not_fixed
|
|
15
|
+
|
|
16
|
+
## Return
|
|
17
|
+
|
|
18
|
+
- repro_status
|
|
19
|
+
- Steps executed and outcomes
|
|
20
|
+
- Regressions observed (if any)
|
|
21
|
+
- Confidence: high | medium | low
|
|
@@ -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.
|