@ludecker/aaac 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +60 -0
  2. package/package.json +38 -0
  3. package/src/cli.mjs +138 -0
  4. package/src/generators/generate-commands.mjs +165 -0
  5. package/src/generators/generate-graph-commands.mjs +63 -0
  6. package/src/generators/generate-graph.mjs +242 -0
  7. package/src/lib/copy.mjs +36 -0
  8. package/src/lib/install.mjs +76 -0
  9. package/src/lib/paths.mjs +54 -0
  10. package/templates/cursor/aaac/capabilities/registry.json +106 -0
  11. package/templates/cursor/aaac/contract-schema.md +66 -0
  12. package/templates/cursor/aaac/contracts/commands/create-module.yaml +28 -0
  13. package/templates/cursor/aaac/contracts/commands/fix-bug.yaml +32 -0
  14. package/templates/cursor/aaac/contracts/commands/update-module.yaml +28 -0
  15. package/templates/cursor/aaac/contracts/skills/impact-analysis.yaml +17 -0
  16. package/templates/cursor/aaac/contracts/skills/investigation-lite.yaml +17 -0
  17. package/templates/cursor/aaac/contracts/skills/investigation.yaml +17 -0
  18. package/templates/cursor/aaac/contracts/skills/validation.yaml +14 -0
  19. package/templates/cursor/aaac/dependencies.yaml +14 -0
  20. package/templates/cursor/aaac/dispatch.md +135 -0
  21. package/templates/cursor/aaac/fitness-functions.yaml +34 -0
  22. package/templates/cursor/aaac/governance/gates.json +39 -0
  23. package/templates/cursor/aaac/graph.project.yaml +161 -0
  24. package/templates/cursor/aaac/layers.md +93 -0
  25. package/templates/cursor/aaac/lifecycle/lifecycle.json +78 -0
  26. package/templates/cursor/aaac/lifecycle/phases.json +19 -0
  27. package/templates/cursor/aaac/ontology.json +219 -0
  28. package/templates/cursor/aaac/ontology.md +90 -0
  29. package/templates/cursor/aaac/project.config.json +3 -0
  30. package/templates/cursor/aaac/run/RUN.md +72 -0
  31. package/templates/cursor/aaac/run/schema.json +83 -0
  32. package/templates/cursor/aaac/state/checkpoints/README.md +20 -0
  33. package/templates/cursor/agents/boundary-review.md +11 -0
  34. package/templates/cursor/agents/check-capability-trace.md +18 -0
  35. package/templates/cursor/agents/dependency-analysis.md +11 -0
  36. package/templates/cursor/agents/discovery-boundaries.md +11 -0
  37. package/templates/cursor/agents/discovery-inventory.md +14 -0
  38. package/templates/cursor/agents/discovery-ssot.md +11 -0
  39. package/templates/cursor/agents/fallow-check-changed.md +9 -0
  40. package/templates/cursor/agents/impact-analysis.md +22 -0
  41. package/templates/cursor/agents/plan-layer-map.md +11 -0
  42. package/templates/cursor/agents/plan-state-machines.md +11 -0
  43. package/templates/cursor/agents/release-git.md +36 -0
  44. package/templates/cursor/agents/system-decomposition.md +11 -0
  45. package/templates/cursor/agents/unit-test-run.md +19 -0
  46. package/templates/cursor/policies/implementation.md +8 -0
  47. package/templates/cursor/policies/master-rules.md +7 -0
  48. package/templates/cursor/skills/shared/api/SKILL.md +26 -0
  49. package/templates/cursor/skills/shared/architecture/SKILL.md +25 -0
  50. package/templates/cursor/skills/shared/architecture/orchestrator/SKILL.md +21 -0
  51. package/templates/cursor/skills/shared/architecture/refactor-analysis.md +302 -0
  52. package/templates/cursor/skills/shared/check/SKILL.md +47 -0
  53. package/templates/cursor/skills/shared/component/SKILL.md +24 -0
  54. package/templates/cursor/skills/shared/dependency-graph/SKILL.md +38 -0
  55. package/templates/cursor/skills/shared/discovery/SKILL.md +29 -0
  56. package/templates/cursor/skills/shared/documentation/SKILL.md +21 -0
  57. package/templates/cursor/skills/shared/documentation/orchestrator/SKILL.md +26 -0
  58. package/templates/cursor/skills/shared/documentation/orchestrator/contract.yaml +20 -0
  59. package/templates/cursor/skills/shared/documentation/write-arch-doc.md +168 -0
  60. package/templates/cursor/skills/shared/domain/SKILL.md +24 -0
  61. package/templates/cursor/skills/shared/execution/SKILL.md +34 -0
  62. package/templates/cursor/skills/shared/fitness-functions/SKILL.md +42 -0
  63. package/templates/cursor/skills/shared/governance/implementation/SKILL.md +424 -0
  64. package/templates/cursor/skills/shared/impact-analysis/SKILL.md +44 -0
  65. package/templates/cursor/skills/shared/integration/SKILL.md +22 -0
  66. package/templates/cursor/skills/shared/investigation/SKILL.md +46 -0
  67. package/templates/cursor/skills/shared/investigation/orchestrator/SKILL.md +22 -0
  68. package/templates/cursor/skills/shared/investigation-lite/SKILL.md +38 -0
  69. package/templates/cursor/skills/shared/migration/SKILL.md +22 -0
  70. package/templates/cursor/skills/shared/model/SKILL.md +22 -0
  71. package/templates/cursor/skills/shared/module-authoring/SKILL.md +29 -0
  72. package/templates/cursor/skills/shared/module-authoring/authoring-template.md +9 -0
  73. package/templates/cursor/skills/shared/planning/SKILL.md +30 -0
  74. package/templates/cursor/skills/shared/platform-release/SKILL.md +46 -0
  75. package/templates/cursor/skills/shared/platform-release/orchestrator/SKILL.md +51 -0
  76. package/templates/cursor/skills/shared/platform-release/orchestrator/contract.yaml +29 -0
  77. package/templates/cursor/skills/shared/platform-release/ship-procedure.md +31 -0
  78. package/templates/cursor/skills/shared/remove/SKILL.md +28 -0
  79. package/templates/cursor/skills/shared/reporting/SKILL.md +43 -0
  80. package/templates/cursor/skills/shared/rollback/SKILL.md +46 -0
  81. package/templates/cursor/skills/shared/root-cause/SKILL.md +24 -0
  82. package/templates/cursor/skills/shared/run/SKILL.md +64 -0
  83. package/templates/cursor/skills/shared/schema/SKILL.md +24 -0
  84. package/templates/cursor/skills/shared/testing/SKILL.md +24 -0
  85. package/templates/cursor/skills/shared/testing/orchestrator/SKILL.md +22 -0
  86. package/templates/cursor/skills/shared/validation/SKILL.md +56 -0
  87. package/templates/cursor/skills/shared/verbs/_dispatch-utils.md +90 -0
  88. package/templates/cursor/skills/shared/verbs/_lifecycle.md +87 -0
  89. package/templates/cursor/skills/shared/verbs/_object-skills.md +60 -0
  90. package/templates/cursor/skills/shared/verbs/check/orchestrator/SKILL.md +22 -0
  91. package/templates/cursor/skills/shared/verbs/check/orchestrator/contract.yaml +24 -0
  92. package/templates/cursor/skills/shared/verbs/create/orchestrator/SKILL.md +39 -0
  93. package/templates/cursor/skills/shared/verbs/create/orchestrator/contract.yaml +34 -0
  94. package/templates/cursor/skills/shared/verbs/fix/orchestrator/SKILL.md +33 -0
  95. package/templates/cursor/skills/shared/verbs/fix/orchestrator/contract.yaml +38 -0
  96. package/templates/cursor/skills/shared/verbs/release/orchestrator/SKILL.md +29 -0
  97. package/templates/cursor/skills/shared/verbs/release/orchestrator/contract.yaml +25 -0
  98. package/templates/cursor/skills/shared/verbs/remove/orchestrator/SKILL.md +25 -0
  99. package/templates/cursor/skills/shared/verbs/remove/orchestrator/contract.yaml +32 -0
  100. package/templates/cursor/skills/shared/verbs/review/orchestrator/SKILL.md +24 -0
  101. package/templates/cursor/skills/shared/verbs/review/orchestrator/contract.yaml +25 -0
  102. package/templates/cursor/skills/shared/verbs/test/orchestrator/SKILL.md +24 -0
  103. package/templates/cursor/skills/shared/verbs/test/orchestrator/contract.yaml +25 -0
  104. package/templates/cursor/skills/shared/verbs/update/orchestrator/SKILL.md +34 -0
  105. package/templates/cursor/skills/shared/verbs/update/orchestrator/contract.yaml +34 -0
  106. package/templates/cursor/skills/shared/verification/SKILL.md +28 -0
  107. package/templates/cursor/skills/shared/workflow/SKILL.md +25 -0
  108. package/templates/docs/agentic_architecture.md +131 -0
  109. package/templates/docs/architecture.md +5 -0
  110. package/templates/docs/master_rules.md +5 -0
@@ -0,0 +1,36 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ export function copyDirRecursive(src, dest) {
5
+ fs.mkdirSync(dest, { recursive: true });
6
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
7
+ const srcPath = path.join(src, entry.name);
8
+ const destPath = path.join(dest, entry.name);
9
+ if (entry.isDirectory()) {
10
+ copyDirRecursive(srcPath, destPath);
11
+ } else {
12
+ fs.copyFileSync(srcPath, destPath);
13
+ }
14
+ }
15
+ }
16
+
17
+ export function substituteInTree(dir, replacements) {
18
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
19
+ const full = path.join(dir, entry.name);
20
+ if (entry.isDirectory()) {
21
+ substituteInTree(full, replacements);
22
+ continue;
23
+ }
24
+ if (!/\.(md|json|yaml|yml|mdc)$/i.test(entry.name)) continue;
25
+ let text = fs.readFileSync(full, "utf8");
26
+ let changed = false;
27
+ for (const [key, value] of Object.entries(replacements)) {
28
+ const token = `{{${key}}}`;
29
+ if (text.includes(token)) {
30
+ text = text.split(token).join(value);
31
+ changed = true;
32
+ }
33
+ }
34
+ if (changed) fs.writeFileSync(full, text);
35
+ }
36
+ }
@@ -0,0 +1,76 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { spawnSync } from "child_process";
4
+ import { copyDirRecursive, substituteInTree } from "./copy.mjs";
5
+ import {
6
+ ensureDir,
7
+ packageGeneratorsDir,
8
+ packageTemplatesDir,
9
+ } from "./paths.mjs";
10
+
11
+ export function runGenerators(cursorRoot) {
12
+ const generatorsDir = packageGeneratorsDir();
13
+ const graph = spawnSync(
14
+ process.execPath,
15
+ [path.join(generatorsDir, "generate-graph.mjs"), "--root", cursorRoot],
16
+ { stdio: "inherit" },
17
+ );
18
+ if (graph.status !== 0) {
19
+ throw new Error("generate-graph.mjs failed");
20
+ }
21
+ const commands = spawnSync(
22
+ process.execPath,
23
+ [path.join(generatorsDir, "generate-commands.mjs"), "--root", cursorRoot],
24
+ { stdio: "inherit" },
25
+ );
26
+ if (commands.status !== 0) {
27
+ throw new Error("generate-commands.mjs failed");
28
+ }
29
+ }
30
+
31
+ export function installAaac({
32
+ targetDir,
33
+ projectName,
34
+ docsRoot,
35
+ force = false,
36
+ }) {
37
+ const resolvedTarget = path.resolve(targetDir);
38
+ const cursorDest = path.join(resolvedTarget, ".cursor");
39
+ const aaacDest = path.join(cursorDest, "aaac");
40
+ const templates = packageTemplatesDir();
41
+
42
+ if (fs.existsSync(aaacDest) && !force) {
43
+ throw new Error(
44
+ `.cursor/aaac already exists at ${aaacDest}. Use --force to backup and replace.`,
45
+ );
46
+ }
47
+
48
+ if (fs.existsSync(cursorDest) && force) {
49
+ const backup = `${cursorDest}.aaac-backup-${Date.now()}`;
50
+ fs.renameSync(cursorDest, backup);
51
+ console.log(`Backed up existing .cursor to ${backup}`);
52
+ }
53
+
54
+ const cursorSrc = path.join(templates, "cursor");
55
+ copyDirRecursive(cursorSrc, cursorDest);
56
+ ensureDir(path.join(cursorDest, "commands"));
57
+ ensureDir(path.join(aaacDest, "state", "runs"));
58
+
59
+ const docsDest = path.join(resolvedTarget, docsRoot);
60
+ ensureDir(docsDest);
61
+ const docsSrc = path.join(templates, "docs");
62
+ for (const file of fs.readdirSync(docsSrc)) {
63
+ fs.copyFileSync(path.join(docsSrc, file), path.join(docsDest, file));
64
+ }
65
+
66
+ const replacements = {
67
+ PROJECT_NAME: projectName,
68
+ DOCS_ROOT: docsRoot.replace(/\/$/, ""),
69
+ };
70
+ substituteInTree(cursorDest, replacements);
71
+ substituteInTree(docsDest, replacements);
72
+
73
+ runGenerators(cursorDest);
74
+
75
+ return { cursorDest, docsDest };
76
+ }
@@ -0,0 +1,54 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+
5
+ const packageRoot = path.join(
6
+ path.dirname(fileURLToPath(import.meta.url)),
7
+ "..",
8
+ "..",
9
+ );
10
+
11
+ export function parseArgs(argv) {
12
+ const args = { root: null, yes: false, dir: null, force: false };
13
+ for (let i = 2; i < argv.length; i++) {
14
+ const arg = argv[i];
15
+ if (arg === "--root" && argv[i + 1]) {
16
+ args.root = argv[++i];
17
+ } else if (arg === "--dir" && argv[i + 1]) {
18
+ args.dir = argv[++i];
19
+ } else if (arg === "--yes" || arg === "-y") {
20
+ args.yes = true;
21
+ } else if (arg === "--force") {
22
+ args.force = true;
23
+ }
24
+ }
25
+ return args;
26
+ }
27
+
28
+ /** Resolve `.cursor` root (parent of `aaac/`). */
29
+ export function resolveCursorRoot(rootArg) {
30
+ if (rootArg) {
31
+ const resolved = path.resolve(rootArg);
32
+ if (path.basename(resolved) === "aaac") {
33
+ return path.dirname(resolved);
34
+ }
35
+ return resolved;
36
+ }
37
+ return path.resolve(process.cwd(), ".cursor");
38
+ }
39
+
40
+ export function aaacDir(cursorRoot) {
41
+ return path.join(cursorRoot, "aaac");
42
+ }
43
+
44
+ export function ensureDir(dir) {
45
+ fs.mkdirSync(dir, { recursive: true });
46
+ }
47
+
48
+ export function packageTemplatesDir() {
49
+ return path.join(packageRoot, "templates");
50
+ }
51
+
52
+ export function packageGeneratorsDir() {
53
+ return path.join(packageRoot, "src", "generators");
54
+ }
@@ -0,0 +1,106 @@
1
+ {
2
+ "version": 2,
3
+ "capabilities": {
4
+ "ui-design": {
5
+ "description": "Design tokens, component CSS, presentational UI",
6
+ "providers": [
7
+ { "id": "component", "type": "skill", "path": "skills/shared/component" }
8
+ ]
9
+ },
10
+ "ux-design": {
11
+ "description": "User flows, readability, navigation clarity",
12
+ "providers": [
13
+ { "id": "workflow", "type": "skill", "path": "skills/shared/workflow" }
14
+ ]
15
+ },
16
+ "api-design": {
17
+ "description": "Contracts and validation at boundaries",
18
+ "providers": [
19
+ { "id": "integration", "type": "skill", "path": "skills/shared/integration" }
20
+ ]
21
+ },
22
+ "database-design": {
23
+ "description": "Schema, migrations, persistence contracts",
24
+ "providers": [
25
+ { "id": "schema", "type": "skill", "path": "skills/shared/schema" },
26
+ { "id": "migration", "type": "skill", "path": "skills/shared/migration" }
27
+ ]
28
+ },
29
+ "security": {
30
+ "description": "Auth, secrets, access control — extend with project skills",
31
+ "providers": [
32
+ { "id": "architecture", "type": "skill", "path": "skills/shared/architecture" }
33
+ ]
34
+ },
35
+ "infrastructure": {
36
+ "description": "Deploy, hosting, environment",
37
+ "providers": [
38
+ { "id": "platform-release", "type": "skill", "path": "skills/shared/platform-release" }
39
+ ]
40
+ },
41
+ "layer-boundaries": {
42
+ "description": "SSOT, import direction, module layers",
43
+ "providers": [
44
+ { "id": "architecture", "type": "skill", "path": "skills/shared/architecture" }
45
+ ]
46
+ },
47
+ "component-model": {
48
+ "description": "Presentational UI components",
49
+ "providers": [
50
+ { "id": "component", "type": "skill", "path": "skills/shared/component" }
51
+ ]
52
+ },
53
+ "schema-model": {
54
+ "description": "Database schema contracts",
55
+ "providers": [
56
+ { "id": "schema", "type": "skill", "path": "skills/shared/schema" }
57
+ ]
58
+ },
59
+ "data-model": {
60
+ "description": "Entity and type shapes in code",
61
+ "providers": [
62
+ { "id": "model", "type": "skill", "path": "skills/shared/model" }
63
+ ]
64
+ },
65
+ "migration-model": {
66
+ "description": "Migration scripts and apply procedure",
67
+ "providers": [
68
+ { "id": "migration", "type": "skill", "path": "skills/shared/migration" }
69
+ ]
70
+ },
71
+ "workflow-model": {
72
+ "description": "Multi-step processes and state machines",
73
+ "providers": [
74
+ { "id": "workflow", "type": "skill", "path": "skills/shared/workflow" }
75
+ ]
76
+ },
77
+ "integration-model": {
78
+ "description": "API routes, webhooks, MCP adapters",
79
+ "providers": [
80
+ { "id": "integration", "type": "skill", "path": "skills/shared/integration" }
81
+ ]
82
+ },
83
+ "domain-model": {
84
+ "description": "Bounded context structure",
85
+ "providers": [
86
+ { "id": "domain", "type": "skill", "path": "skills/shared/domain" }
87
+ ]
88
+ },
89
+ "documentation": {
90
+ "description": "Architecture and runbook docs",
91
+ "providers": [
92
+ { "id": "documentation", "type": "skill", "path": "skills/shared/documentation" }
93
+ ]
94
+ },
95
+ "module-authoring": {
96
+ "description": "Bootstrap new domain modules",
97
+ "providers": [
98
+ { "id": "module-authoring", "type": "skill", "path": "skills/shared/module-authoring" }
99
+ ]
100
+ }
101
+ },
102
+ "resolution": {
103
+ "graph_skill_keys": "providers where type=skill → id maps to graph skills key",
104
+ "run_record": "all providers including type=mcp recorded on Run.capabilities_resolved and decisions"
105
+ }
106
+ }
@@ -0,0 +1,66 @@
1
+ # AAAC contract schema
2
+
3
+ Command vocabulary: [ontology.json](ontology.json).
4
+ Capability routing: [capabilities/registry.json](capabilities/registry.json).
5
+ Lifecycle phases: [lifecycle/lifecycle.json](lifecycle/lifecycle.json).
6
+
7
+ ## Layer placement
8
+
9
+ | Contract type | Location |
10
+ |---------------|----------|
11
+ | Command | `contracts/commands/<command>.yaml` |
12
+ | Skill / phase | `contracts/skills/<skill>.yaml` |
13
+ | Orchestrator plugin | `contract.yaml` beside orchestrator `SKILL.md` |
14
+
15
+ ## Command contract (required fields)
16
+
17
+ ```yaml
18
+ name: string
19
+ purpose: string
20
+ inputs:
21
+ domain: { required: boolean }
22
+ intent: { required: boolean }
23
+ outputs:
24
+ plan: { type: markdown, required: boolean }
25
+ report: { type: markdown, required: true }
26
+ lifecycle_verb: create | update | fix | …
27
+ success_criteria: []
28
+ failure_conditions: []
29
+ ```
30
+
31
+ ## Skill contract (required fields)
32
+
33
+ ```yaml
34
+ name: string
35
+ purpose: string
36
+ outputs:
37
+ <artifact>:
38
+ type: list | object | markdown | enum
39
+ required: boolean | required_when
40
+ readonly: boolean # when applicable
41
+ gate: boolean # when phase blocks execute
42
+ ```
43
+
44
+ Contracts prevent skills from drifting. Verification checks orchestrator `contract.yaml` **and** `contracts/skills/*.yaml` outputs.
45
+
46
+ ## Orchestrator plugin fields
47
+
48
+ See previous schema — `name`, `purpose`, `inputs`, `outputs`, `success_criteria`, `failure_conditions`, `dependencies`, `verification`.
49
+
50
+ ## Graph sections
51
+
52
+ | Section | Purpose |
53
+ |---------|---------|
54
+ | `object_capabilities` | Capability ids per object (ontology SSOT) |
55
+ | `object_skills` | Resolved providers from capability registry (generated) |
56
+ | `verb_work_phases` | Work phases from lifecycle.json (generated) |
57
+ | `verb_gate_stack` | Gate stack id per verb (generated) |
58
+ | `governance_gate_stacks` | From governance/gates.json (generated) |
59
+ | `verb_runtime` | Composed work + gates (generated) |
60
+ | `lifecycle` / `governance_gates` / `run` / `capabilities` | Layer SSOT paths |
61
+
62
+ ## Validation
63
+
64
+ - Every gate skill must have a contract in `contracts/skills/`
65
+ - Resolver commands (`update-module`, `fix-bug`, `create-feature`) must have command contracts
66
+ - Domain orchestrators must list `sync_inventory` in verification when `execute` runs
@@ -0,0 +1,28 @@
1
+ name: create-module
2
+ purpose: Create a new bounded module in a domain
3
+ inputs:
4
+ domain:
5
+ required: true
6
+ intent:
7
+ required: true
8
+ outputs:
9
+ plan:
10
+ type: markdown
11
+ required: true
12
+ implementation:
13
+ type: code_changes
14
+ required: true
15
+ verification:
16
+ type: markdown
17
+ required: true
18
+ report:
19
+ type: markdown
20
+ required: true
21
+ lifecycle_verb: create
22
+ success_criteria:
23
+ - validation confidence gates passed
24
+ - fitness security and layer_boundaries pass
25
+ - inventory synced when domain slug present
26
+ failure_conditions:
27
+ - confidence below threshold without user risk acceptance
28
+ - execute without rollback on protected object
@@ -0,0 +1,32 @@
1
+ name: fix-bug
2
+ purpose: Repair broken behavior in a domain
3
+ inputs:
4
+ domain:
5
+ required: false
6
+ intent:
7
+ required: true
8
+ outputs:
9
+ findings:
10
+ type: markdown
11
+ required: true
12
+ root_cause:
13
+ type: markdown
14
+ required: true
15
+ plan:
16
+ type: markdown
17
+ required: true
18
+ implementation:
19
+ type: code_changes
20
+ verification:
21
+ type: markdown
22
+ required: true
23
+ report:
24
+ type: markdown
25
+ required: true
26
+ lifecycle_verb: fix
27
+ success_criteria:
28
+ - deep investigation and root_cause before plan
29
+ - impact_analysis proceed yes or rollback defined
30
+ failure_conditions:
31
+ - root_cause confidence below 0.7
32
+ - symptom patch without root cause frame
@@ -0,0 +1,28 @@
1
+ name: update-module
2
+ purpose: Modify an existing domain module
3
+ inputs:
4
+ domain:
5
+ required: true
6
+ enum: [cms, ui, database]
7
+ intent:
8
+ required: true
9
+ outputs:
10
+ plan:
11
+ type: markdown
12
+ required: true
13
+ implementation:
14
+ type: code_changes
15
+ verification:
16
+ type: markdown
17
+ required: true
18
+ report:
19
+ type: markdown
20
+ required: true
21
+ lifecycle_verb: update
22
+ success_criteria:
23
+ - investigation_lite completed
24
+ - validation passed
25
+ - inventory Section 3 synced after execute
26
+ failure_conditions:
27
+ - skip investigation_lite
28
+ - execute without validate gate pass
@@ -0,0 +1,17 @@
1
+ name: impact-analysis
2
+ purpose: Pre-execute blast radius and risk analysis
3
+ outputs:
4
+ affected:
5
+ type: list
6
+ required: true
7
+ risk:
8
+ type: list
9
+ required: true
10
+ blast_radius:
11
+ type: enum
12
+ values: [low, medium, high]
13
+ required: true
14
+ proceed:
15
+ type: boolean
16
+ required: true
17
+ gate: true
@@ -0,0 +1,17 @@
1
+ name: investigation-lite
2
+ purpose: Lightweight pre-change investigation for create and update
3
+ outputs:
4
+ exists:
5
+ type: list
6
+ required: true
7
+ depends_on:
8
+ type: list
9
+ required: true
10
+ constraints:
11
+ type: list
12
+ required: true
13
+ confidence:
14
+ type: object
15
+ required: true
16
+ fields: [architecture, requirements, scope]
17
+ readonly: true
@@ -0,0 +1,17 @@
1
+ name: investigation
2
+ purpose: Deep investigation for fix paths and incidents
3
+ outputs:
4
+ findings:
5
+ type: list
6
+ required: true
7
+ risks:
8
+ type: list
9
+ required: true
10
+ recommendations:
11
+ type: list
12
+ required: true
13
+ confidence:
14
+ type: object
15
+ required: true
16
+ fields: [architecture, requirements, scope]
17
+ readonly: true
@@ -0,0 +1,14 @@
1
+ name: validation
2
+ purpose: Confidence gates before execute
3
+ outputs:
4
+ validation:
5
+ type: enum
6
+ values: [pass, fail]
7
+ required: true
8
+ scores:
9
+ type: object
10
+ required: true
11
+ clarification_questions:
12
+ type: list
13
+ required_when: validation fail
14
+ gate: true
@@ -0,0 +1,14 @@
1
+ # Domain dependency graph — populate when you add bounded contexts.
2
+ # SSOT for dependency-graph skill.
3
+
4
+ version: 1
5
+
6
+ domains: {}
7
+
8
+ objects: {}
9
+
10
+ risk_tags:
11
+ migrations: [migration, schema]
12
+ breaking_contracts: [integration, model, schema, migration]
13
+ auth: [integration, schema]
14
+ deployment: [app, integration]
@@ -0,0 +1,135 @@
1
+ # AAAC command dispatch (shared by all slash commands)
2
+
3
+ Agents running any AAAC command **must** follow this sequence.
4
+
5
+ **Path convention:** In [graph.yaml](graph.yaml), paths under `agents/`, `policies/`, `skills/`, and `domains/` are relative to **`.cursor/`**.
6
+
7
+ **Primary execution object:** Every command runs inside a **Run** — see [run/RUN.md](run/RUN.md) and [run/schema.json](run/schema.json).
8
+
9
+ ## 1. Parse input
10
+
11
+ From `$ARGUMENTS` and the user message:
12
+
13
+ | Slot | Rule |
14
+ |------|------|
15
+ | Command | Filename without `.md` (e.g. `update-module`) |
16
+ | Domain | See [ontology.md](ontology.md); optional for `review-incident` and `*-function` |
17
+ | Intent | Quoted string `"…"` or remainder after domain |
18
+ | Verb | First segment of command (e.g. `update-module` → verb `update`) |
19
+
20
+ If intent contains `Sync inventory only` (case-insensitive), orchestrator runs **sync_inventory** phase only (no execution).
21
+
22
+ **Resume:** If user references `run_{id}`, load `state/runs/{run_id}/run.json` and continue from `phase`.
23
+
24
+ **Aliases:** `commands.<name>.alias` → resolve canonical command (e.g. `update-api` → `update-integration`) and continue.
25
+
26
+ Legacy names (`module-update`, `architecture`, `swarm-check`, …) are aliases in [graph.yaml](graph.yaml).
27
+
28
+ ## 2. Load graph
29
+
30
+ Read [graph.yaml](graph.yaml) and [ontology.json](ontology.json).
31
+
32
+ - Reject unknown commands; suggest nearest alias if typo matches `command_aliases`
33
+ - Reject `invalid_pairs` with valid alternative (e.g. `release-module` → `release-app`)
34
+ - Resolve `commands.<name>` → orchestrator, `object`, `alias`, or `resolver` + slug map
35
+ - **Resolver fallback:** if slug missing from resolver `map`, use resolver `default` orchestrator and `default_object` when set
36
+ - **Object** comes from graph `object` field — load skills from `object_skills.<object>` and `object_skill_verbs.<object>.<verb>` per [verbs/_object-skills.md](../skills/shared/verbs/_object-skills.md)
37
+ - **Lifecycle (work):** [lifecycle/lifecycle.json](lifecycle/lifecycle.json) `verbs.*.work_phases`
38
+ - **Gates (approval):** [governance/gates.json](governance/gates.json) — composed into runtime per `verb_runtime` in graph
39
+ - **Maturity:** read `object_maturity.<object>` and apply `maturity_rules.<level>` (may require extra gate phases)
40
+ - **Capabilities:** resolve `object_capabilities.<object>` via [capabilities/registry.json](capabilities/registry.json) — record all providers (skill + mcp) on Run
41
+ - **Dependencies:** [dependencies.yaml](dependencies.yaml)
42
+ - **Fitness:** [fitness-functions.yaml](fitness-functions.yaml)
43
+ - **Contracts:** validate against [contracts/commands/](contracts/commands/) and [contracts/skills/](contracts/skills/)
44
+
45
+ ## 2.5 Create or resume Run
46
+
47
+ Before loading orchestrator:
48
+
49
+ 1. **Create** `state/runs/{run_id}/run.json` per [run/schema.json](run/schema.json)
50
+ 2. Set `pending` from `verb_runtime.<verb>` in graph (work + gates composed)
51
+ 3. Set `status: running`, first `phase`, `phase_kind: work`
52
+ 4. Record resolved orchestrator, object, domain, intent on Run
53
+
54
+ All state and observability live on the Run — **no** standalone execution-state or markdown logs.
55
+
56
+ ## 3. Load orchestrator
57
+
58
+ - Read `orchestrators.<id>.path` → `SKILL.md` + `contract.yaml` if present
59
+ - Read `inventory` when set on orchestrator
60
+ - Load every skill in `requires` (+ `optional` when fix/create modes need it)
61
+ - Load object skills from graph `object_skills` / `object_skill_verbs` for the command verb + object
62
+ - Load [.cursor/policies/](../policies/) — all skills inherit:
63
+ - [master-rules.md](../policies/master-rules.md)
64
+ - [implementation.md](../policies/implementation.md)
65
+ - [mcp-and-deploy.md](../policies/mcp-and-deploy.md)
66
+ - Read [verbs/_dispatch-utils.md](../skills/shared/verbs/_dispatch-utils.md) for inventory + investigation rules
67
+ - Read [run/SKILL.md](../skills/shared/run/SKILL.md) for Run update protocol
68
+
69
+ ## 4. Execute phases (Run-driven)
70
+
71
+ Run phases **in order** from Run `pending` (matches `verb_runtime`). Map phase id → skill via [lifecycle/phases.json](lifecycle/phases.json).
72
+
73
+ **After every phase** — update Run per [run/RUN.md](run/RUN.md):
74
+
75
+ - Append `log[]`, move phase to `completed`, write checkpoint, store artifacts
76
+ - Record routing and capability resolution in `decisions[]`
77
+ - Persist `run.json`
78
+
79
+ ### Work vs gate
80
+
81
+ | `phase_kind` | Phases | Purpose |
82
+ |--------------|--------|---------|
83
+ | `work` | discover … plan, execute … report | Do the work |
84
+ | `gate` | validate, impact_analysis, dependency_graph, fitness_functions, rollback | Approval / checkpoints |
85
+
86
+ Gates run after `plan`, before `execute` (or before `report` when verb has no execute).
87
+
88
+ ### Gate rules
89
+
90
+ | Gate | Skill |
91
+ |------|-------|
92
+ | **validate** | [validation/SKILL.md](../skills/shared/validation/SKILL.md) |
93
+ | **impact_analysis** | [impact-analysis/SKILL.md](../skills/shared/impact-analysis/SKILL.md) |
94
+ | **dependency_graph** | [dependency-graph/SKILL.md](../skills/shared/dependency-graph/SKILL.md) |
95
+ | **fitness_functions** | [fitness-functions/SKILL.md](../skills/shared/fitness-functions/SKILL.md) |
96
+ | **rollback** | [rollback/SKILL.md](../skills/shared/rollback/SKILL.md) when maturity or blast radius requires |
97
+
98
+ ### Human approval at gate boundaries
99
+
100
+ When a gate fails or confidence is below threshold:
101
+
102
+ ```yaml
103
+ status: blocked
104
+ awaiting_approval: true
105
+ blocked_reason: "<specific reason>"
106
+ ```
107
+
108
+ ```text
109
+ STOP — awaiting approval
110
+ Reason: {blocked_reason}
111
+ Run: {run_id}
112
+ ```
113
+
114
+ Do **not** proceed until user approves in chat. On approval: log decision, set `status: running`, `awaiting_approval: false`, retry gate or continue.
115
+
116
+ **Code changes:** [governance/implementation/SKILL.md](../skills/shared/governance/implementation/SKILL.md) is mandatory for `execute`.
117
+
118
+ **Investigation depth:**
119
+
120
+ | Verb | Investigation |
121
+ |------|----------------|
122
+ | create | [investigation-lite](../skills/shared/investigation-lite/SKILL.md) |
123
+ | update | [investigation-lite](../skills/shared/investigation-lite/SKILL.md) |
124
+ | fix | [investigation](../skills/shared/investigation/SKILL.md) → [root-cause](../skills/shared/root-cause/SKILL.md) |
125
+
126
+ ## 5. Report
127
+
128
+ [reporting/SKILL.md](../skills/shared/reporting/SKILL.md) — plain language first; include confidence, impact, fitness, rollback from Run artifacts. Set Run `status: completed`.
129
+
130
+ ## Regenerating
131
+
132
+ ```bash
133
+ node .cursor/aaac/generate-graph.mjs
134
+ node .cursor/aaac/generate-commands.mjs
135
+ ```