@bonesofspring/ai-rules 0.2.12 → 0.2.13

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 (163) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +114 -0
  4. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +64 -5
  5. package/presets/claude/go/agents/build-verifier.md +9 -2
  6. package/presets/claude/go/agents/code-reviewer.md +8 -1
  7. package/presets/claude/go/agents/feature-developer.md +8 -1
  8. package/presets/claude/go/agents/task-analyst.md +8 -1
  9. package/presets/claude/go/agents/task-router.md +33 -5
  10. package/presets/claude/go/commands/task.md +8 -6
  11. package/presets/claude/go/hooks/chain-team-phases.sh +195 -53
  12. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +30 -5
  13. package/presets/claude/go/team/README.md +13 -2
  14. package/presets/claude/ios-swift/agents/build-verifier.md +8 -1
  15. package/presets/claude/ios-swift/agents/code-reviewer.md +9 -14
  16. package/presets/claude/ios-swift/agents/feature-developer.md +8 -1
  17. package/presets/claude/ios-swift/agents/task-analyst.md +8 -1
  18. package/presets/claude/ios-swift/agents/task-router.md +31 -3
  19. package/presets/claude/ios-swift/commands/task.md +8 -6
  20. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +177 -54
  21. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +33 -2
  22. package/presets/claude/ios-swift/team/README.md +13 -2
  23. package/presets/claude/java/agents/build-verifier.md +8 -1
  24. package/presets/claude/java/agents/code-reviewer.md +8 -1
  25. package/presets/claude/java/agents/feature-developer.md +8 -1
  26. package/presets/claude/java/agents/task-analyst.md +8 -1
  27. package/presets/claude/java/agents/task-router.md +31 -3
  28. package/presets/claude/java/commands/task.md +8 -6
  29. package/presets/claude/java/hooks/chain-team-phases.sh +195 -53
  30. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +30 -5
  31. package/presets/claude/java/team/README.md +13 -2
  32. package/presets/claude/mcp-ts/agents/build-verifier.md +9 -2
  33. package/presets/claude/mcp-ts/agents/feature-developer.md +7 -1
  34. package/presets/claude/mcp-ts/agents/task-analyst.md +8 -1
  35. package/presets/claude/mcp-ts/agents/task-router.md +33 -5
  36. package/presets/claude/mcp-ts/commands/task.md +8 -6
  37. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +181 -39
  38. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +30 -5
  39. package/presets/claude/mcp-ts/team/README.md +13 -2
  40. package/presets/claude/next/agents/accessibility-reviewer.md +6 -12
  41. package/presets/claude/next/agents/api-contract-reviewer.md +6 -12
  42. package/presets/claude/next/agents/build-verifier.md +8 -12
  43. package/presets/claude/next/agents/ci-investigator.md +7 -13
  44. package/presets/claude/next/agents/code-reviewer.md +9 -14
  45. package/presets/claude/next/agents/debugger.md +6 -12
  46. package/presets/claude/next/agents/feature-developer.md +8 -1
  47. package/presets/claude/next/agents/migration-specialist.md +6 -12
  48. package/presets/claude/next/agents/performance-auditor.md +5 -11
  49. package/presets/claude/next/agents/qa-tester.md +6 -12
  50. package/presets/claude/next/agents/security-reviewer.md +6 -12
  51. package/presets/claude/next/agents/solution-architect.md +6 -12
  52. package/presets/claude/next/agents/task-analyst.md +10 -16
  53. package/presets/claude/next/agents/task-router.md +31 -3
  54. package/presets/claude/next/agents/tech-writer.md +6 -13
  55. package/presets/claude/next/agents/unit-test-generator.md +6 -10
  56. package/presets/claude/next/agents/unit-test-healer.md +6 -10
  57. package/presets/claude/next/agents/unit-test-planner.md +5 -11
  58. package/presets/claude/next/commands/task.md +8 -6
  59. package/presets/claude/next/hooks/chain-team-phases.sh +197 -54
  60. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +29 -4
  61. package/presets/claude/next/team/README.md +15 -3
  62. package/presets/claude/next/team/fixtures/artifact-manifest.example.json +61 -0
  63. package/presets/claude/next/team/fixtures/bugfix-standard.json +10 -0
  64. package/presets/claude/next/team/fixtures/feature-full.json +10 -0
  65. package/presets/claude/next/team/fixtures/feature-light.json +10 -0
  66. package/presets/claude/php-hexagonal/agents/build-verifier.md +9 -2
  67. package/presets/claude/php-hexagonal/agents/code-reviewer.md +8 -1
  68. package/presets/claude/php-hexagonal/agents/feature-developer.md +8 -1
  69. package/presets/claude/php-hexagonal/agents/task-analyst.md +8 -1
  70. package/presets/claude/php-hexagonal/agents/task-router.md +31 -3
  71. package/presets/claude/php-hexagonal/commands/task.md +8 -6
  72. package/presets/claude/php-hexagonal/hooks/README.md +1 -1
  73. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +195 -53
  74. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +30 -5
  75. package/presets/claude/php-hexagonal/team/README.md +13 -2
  76. package/presets/claude/php-laravel/agents/build-verifier.md +9 -2
  77. package/presets/claude/php-laravel/agents/code-reviewer.md +8 -1
  78. package/presets/claude/php-laravel/agents/feature-developer.md +8 -1
  79. package/presets/claude/php-laravel/agents/task-analyst.md +8 -1
  80. package/presets/claude/php-laravel/agents/task-router.md +31 -3
  81. package/presets/claude/php-laravel/commands/task.md +8 -6
  82. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +195 -53
  83. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +30 -5
  84. package/presets/claude/php-laravel/team/README.md +13 -2
  85. package/presets/cursor/go/agents/build-verifier.md +8 -1
  86. package/presets/cursor/go/agents/code-reviewer.md +8 -1
  87. package/presets/cursor/go/agents/feature-developer.md +8 -1
  88. package/presets/cursor/go/agents/task-analyst.md +8 -1
  89. package/presets/cursor/go/agents/task-router.md +31 -3
  90. package/presets/cursor/go/commands/task.md +8 -6
  91. package/presets/cursor/go/hooks/chain-team-phases.sh +195 -53
  92. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +30 -5
  93. package/presets/cursor/go/team/README.md +13 -2
  94. package/presets/cursor/ios-swift/agents/build-verifier.md +8 -1
  95. package/presets/cursor/ios-swift/agents/code-reviewer.md +9 -14
  96. package/presets/cursor/ios-swift/agents/feature-developer.md +8 -1
  97. package/presets/cursor/ios-swift/agents/task-analyst.md +8 -1
  98. package/presets/cursor/ios-swift/agents/task-router.md +31 -3
  99. package/presets/cursor/ios-swift/commands/task.md +8 -6
  100. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +195 -54
  101. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +23 -2
  102. package/presets/cursor/ios-swift/team/README.md +13 -2
  103. package/presets/cursor/java/agents/build-verifier.md +8 -1
  104. package/presets/cursor/java/agents/code-reviewer.md +8 -1
  105. package/presets/cursor/java/agents/feature-developer.md +8 -1
  106. package/presets/cursor/java/agents/task-analyst.md +8 -1
  107. package/presets/cursor/java/agents/task-router.md +31 -3
  108. package/presets/cursor/java/commands/task.md +8 -6
  109. package/presets/cursor/java/hooks/chain-team-phases.sh +195 -53
  110. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +30 -5
  111. package/presets/cursor/java/team/README.md +13 -2
  112. package/presets/cursor/mcp-ts/agents/build-verifier.md +8 -1
  113. package/presets/cursor/mcp-ts/agents/feature-developer.md +7 -1
  114. package/presets/cursor/mcp-ts/agents/task-analyst.md +8 -1
  115. package/presets/cursor/mcp-ts/agents/task-router.md +31 -3
  116. package/presets/cursor/mcp-ts/commands/task.md +8 -6
  117. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +181 -39
  118. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +30 -5
  119. package/presets/cursor/mcp-ts/team/README.md +13 -2
  120. package/presets/cursor/next/agents/accessibility-reviewer.md +7 -14
  121. package/presets/cursor/next/agents/api-contract-reviewer.md +7 -14
  122. package/presets/cursor/next/agents/build-verifier.md +8 -13
  123. package/presets/cursor/next/agents/ci-investigator.md +7 -14
  124. package/presets/cursor/next/agents/code-reviewer.md +9 -14
  125. package/presets/cursor/next/agents/debugger.md +6 -12
  126. package/presets/cursor/next/agents/feature-developer.md +8 -1
  127. package/presets/cursor/next/agents/migration-specialist.md +7 -14
  128. package/presets/cursor/next/agents/performance-auditor.md +6 -13
  129. package/presets/cursor/next/agents/qa-tester.md +6 -13
  130. package/presets/cursor/next/agents/security-reviewer.md +7 -14
  131. package/presets/cursor/next/agents/solution-architect.md +6 -12
  132. package/presets/cursor/next/agents/task-analyst.md +10 -16
  133. package/presets/cursor/next/agents/task-router.md +31 -3
  134. package/presets/cursor/next/agents/tech-writer.md +6 -13
  135. package/presets/cursor/next/agents/unit-test-generator.md +6 -11
  136. package/presets/cursor/next/agents/unit-test-healer.md +6 -11
  137. package/presets/cursor/next/agents/unit-test-planner.md +6 -13
  138. package/presets/cursor/next/commands/task.md +8 -6
  139. package/presets/cursor/next/hooks/chain-team-phases.sh +197 -54
  140. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +30 -5
  141. package/presets/cursor/next/team/README.md +16 -4
  142. package/presets/cursor/next/team/fixtures/artifact-manifest.example.json +61 -0
  143. package/presets/cursor/next/team/fixtures/bugfix-standard.json +10 -0
  144. package/presets/cursor/next/team/fixtures/feature-full.json +10 -0
  145. package/presets/cursor/next/team/fixtures/feature-light.json +10 -0
  146. package/presets/cursor/php-hexagonal/agents/build-verifier.md +8 -1
  147. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +8 -1
  148. package/presets/cursor/php-hexagonal/agents/feature-developer.md +8 -1
  149. package/presets/cursor/php-hexagonal/agents/task-analyst.md +8 -1
  150. package/presets/cursor/php-hexagonal/agents/task-router.md +31 -3
  151. package/presets/cursor/php-hexagonal/commands/task.md +8 -6
  152. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +195 -53
  153. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +30 -5
  154. package/presets/cursor/php-hexagonal/team/README.md +13 -2
  155. package/presets/cursor/php-laravel/agents/build-verifier.md +8 -1
  156. package/presets/cursor/php-laravel/agents/code-reviewer.md +8 -1
  157. package/presets/cursor/php-laravel/agents/feature-developer.md +8 -1
  158. package/presets/cursor/php-laravel/agents/task-analyst.md +8 -1
  159. package/presets/cursor/php-laravel/agents/task-router.md +31 -3
  160. package/presets/cursor/php-laravel/commands/task.md +8 -6
  161. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +195 -53
  162. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +30 -5
  163. package/presets/cursor/php-laravel/team/README.md +13 -2
@@ -41,7 +41,7 @@ When validating **preset packaging** changes (paths under `packages/ai-rules/pre
41
41
  7. **Embed drift (hard in `check:preset-structure`):** run `packages/ai-rules/scripts/check-shared-core-drift.sh` with `AI_RULES_DRIFT_FAIL=1` (bundled by the structure orchestrator). Lineage stems are excluded from body equality.
42
42
  8. **Dogfood (monorepo soft):** if root `.cursor/` is in the PR, prefer sync via `packages/ai-rules/scripts/sync-dogfood-cursor.sh`; mass deletion of tracked dogfood without migration doc → note as risk / FAIL for maintainers.
43
43
 
44
- 9. **Root AGENTS template:** each installable preset (`cursor|claude` × `next|ios-swift|go|java|mcp-ts|php-hexagonal`) must ship `REPO_AGENTS.md` when validating preset packaging → **FAIL** if missing.
44
+ 9. **Root AGENTS template:** each installable preset (`cursor|claude` × `next|ios-swift|go|java|mcp-ts|php-hexagonal|php-laravel`) must ship `REPO_AGENTS.md` when validating preset packaging → **FAIL** if missing.
45
45
  10. **Hooks cookbook:** default `hooks.json` must **not** reference `hooks/examples/` → **FAIL** if it does.
46
46
  11. **No react-performance on ios/go/java:** skill directory / required handoff must be absent under ios-swift, go, java, mcp-ts, php-hexagonal, and php-laravel → **FAIL** (leakage). Prefer `check:preset-leakage`.
47
47
  12. **Rule eval (WARN):** `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` should exist for maintainers; smoke optional. Hard fail only when the opt-in eval job runs — not part of default `check:preset-structure`.
@@ -78,18 +78,13 @@ PASS | FAIL
78
78
 
79
79
  ## On completion
80
80
 
81
- Update `status.json`:
81
+ Write the owned terminal receipt described under **Artifact contract**. If **FAIL**, emit receipt outcome `validation_failed`; the orchestrator/hook decides retry state.
82
82
 
83
- ```json
84
- {
85
- "slug": "<slug>",
86
- "currentAgent": "build-verifier",
87
- "phase": "executing",
88
- "state": "completed",
89
- "updatedAt": "<ISO8601>"
90
- }
91
- ```
83
+ Do not fix code — report only. Do not advance to code-reviewer until PASS.
92
84
 
93
- If **FAIL**, set `"state": "validation_failed"` (orchestrator/hook re-invokes `feature-developer` with this report).
85
+ ## Artifact contract
94
86
 
95
- Do not fix code report only. Do not advance to code-reviewer until PASS.
87
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition, implementation evidence, pipeline scope, and changed files.
88
+ - **Owned outputs:** `validation-report.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `validation`) and preserve all foreign entries.
89
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `validation_failed`. Bind it to the supplied `attemptId` when present.
90
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
@@ -44,24 +44,17 @@ Commands run and results.
44
44
 
45
45
  ## When to hand off
46
46
 
47
- - If the fix requires feature work beyond CI scope → document in `ci-report.md` and set `state: completed`; orchestrator may invoke `feature-developer`.
47
+ - If the fix requires feature work beyond CI scope → document in `ci-report.md` and emit owned receipt outcome `completed`; orchestrator/hook may invoke `feature-developer`.
48
48
  - If only investigation was requested → stop after report without code changes.
49
49
 
50
- ## On completion
50
+ ## Artifact contract
51
51
 
52
- Update `status.json`:
52
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition when present, failing check context, and prior validation/debug artifacts.
53
+ - **Owned outputs:** `ci-report.md` plus any minimal fix paths; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `ci`) and preserve all foreign entries.
54
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
55
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
53
56
 
54
- ```json
55
- {
56
- "slug": "<slug>",
57
- "currentAgent": "ci-investigator",
58
- "phase": "executing",
59
- "state": "completed",
60
- "updatedAt": "<ISO8601>"
61
- }
62
- ```
63
-
64
- Provide summary: failed check, root cause, files changed, validation commands run.
57
+ Provide summary: failed check, root cause, files changed, validation commands run. Keep `fixApplied: true/false` (and verdict) in `ci-report.md` / the owned receipt summary — do not encode them by mutating `status.json`.
65
58
 
66
59
  ## Anti-sycophancy discipline
67
60
 
@@ -5,7 +5,7 @@ readonly: false
5
5
  model: fast
6
6
  ---
7
7
 
8
- You are a senior code reviewer. You may write only review artifacts under `.cursor/team/**` and update task `status.json`; do not modify production code.
8
+ You are a senior code reviewer. You may write only review artifacts under `.cursor/team/**` and terminal receipts; do not modify production code.
9
9
 
10
10
  ## Inputs
11
11
 
@@ -47,22 +47,17 @@ APPROVE | APPROVE_WITH_NOTES | REQUEST_CHANGES
47
47
 
48
48
  ## On completion
49
49
 
50
- Update `status.json`:
51
-
52
- ```json
53
- {
54
- "slug": "<slug>",
55
- "currentAgent": "code-reviewer",
56
- "phase": "executing",
57
- "state": "completed",
58
- "updatedAt": "<ISO8601>"
59
- }
60
- ```
61
-
62
- If **REQUEST_CHANGES**, set `"state": "changes_requested"` (hook will re-invoke feature-developer).
50
+ Write the owned terminal receipt described under **Artifact contract**. If **REQUEST_CHANGES**, emit receipt outcome `changes_requested`; the hook decides retry state.
63
51
 
64
52
  Do not mix this output with retrospective facilitation — keep review and retro separate.
65
53
 
66
54
  ## Design guidance
67
55
 
68
56
  - Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
57
+
58
+ ## Artifact contract
59
+
60
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition, implementation, validation evidence, and the scoped git diff.
61
+ - **Owned outputs:** `review.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `review`) and preserve all foreign entries.
62
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `changes_requested`. Bind it to the supplied `attemptId` when present.
63
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
@@ -46,20 +46,14 @@ fixApplied: false
46
46
 
47
47
  5. If fix is trivial and clearly scoped, you **may** apply the minimal fix and set `fixApplied: true` in the report. Otherwise leave implementation to **feature-developer** with `fixApplied: false`.
48
48
 
49
- ## On completion
49
+ ## Artifact contract
50
50
 
51
- Update `status.json`:
51
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition when present, failing evidence, and related prior artifacts.
52
+ - **Owned outputs:** `debug-report.md` plus any minimal fix paths; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `debug`) and preserve all foreign entries.
53
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
54
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
52
55
 
53
- ```json
54
- {
55
- "slug": "<slug>",
56
- "currentAgent": "debugger",
57
- "state": "completed",
58
- "updatedAt": "<ISO8601>"
59
- }
60
- ```
61
-
62
- Handoff summary: root cause, recommended fix, files touched (if any).
56
+ Handoff summary: root cause, recommended fix, files touched (if any). Keep `fixApplied: true/false` in `debug-report.md` / the owned receipt — do not mutate `status.json` for that signal.
63
57
 
64
58
  Do not perform formal code review or write e2e plans — those are separate agents.
65
59
 
@@ -36,7 +36,7 @@ You are a senior frontend developer working in a Next.js monorepo with strict la
36
36
 
37
37
  ## On completion
38
38
 
39
- Update `status.json` (`currentAgent`: `feature-developer`, `state`: `completed`). Handoff: tasks done, files by layer, unit specs, validation result, gaps for build-verifier/reviewer.
39
+ Emit the owned implementation receipt with outcome `completed`. Handoff: tasks done, files by layer, unit specs, validation result, gaps for build-verifier/reviewer.
40
40
 
41
41
  Do not perform formal code review — that is the code-reviewer subagent's job.
42
42
 
@@ -51,3 +51,10 @@ Do not perform formal code review — that is the code-reviewer subagent's job.
51
51
  ## Anti-hallucination (Next / React / RTK)
52
52
 
53
53
  - When editing `app/**/*.{ts,tsx}`, load / follow rule `react-next-anti-hallucination`.
54
+
55
+ ## Artifact contract
56
+
57
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for `brief.md`, `decomposition.md`, current scope, and applicable prior findings.
58
+ - **Owned outputs:** `implementation.md` plus changed implementation/test paths; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `implementation`) and preserve all foreign entries.
59
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
60
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
@@ -54,21 +54,14 @@ Temporary adapters, feature flags, dual-write if needed.
54
54
  - Map every phase to concrete decomposition tasks for `feature-developer`.
55
55
  - Do not implement code — planning only.
56
56
 
57
- ## On completion
58
-
59
- Update `status.json`:
60
-
61
- ```json
62
- {
63
- "slug": "<slug>",
64
- "currentAgent": "migration-specialist",
65
- "phase": "executing",
66
- "state": "completed",
67
- "updatedAt": "<ISO8601>"
68
- }
69
- ```
57
+ ## Artifact contract
58
+
59
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition and stack/version context from the repo.
60
+ - **Owned outputs:** `migration-plan.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `migration-plan`) and preserve all foreign entries.
61
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
62
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
70
63
 
71
- Hand off: orchestrator runs human gate (if configured), then `feature-developer` executes phases from the plan.
64
+ Hand off: orchestrator/hook runs human gate (if configured), then `feature-developer` executes phases from the plan.
72
65
 
73
66
  ## Design guidance
74
67
 
@@ -51,19 +51,12 @@ Bundle chunks, Lighthouse hints, or measured timings.
51
51
  Ordered list for feature-developer if fixes are requested.
52
52
  ```
53
53
 
54
- ## On completion
55
-
56
- Update `status.json`:
57
-
58
- ```json
59
- {
60
- "slug": "<slug>",
61
- "currentAgent": "performance-auditor",
62
- "phase": "executing",
63
- "state": "completed",
64
- "updatedAt": "<ISO8601>"
65
- }
66
- ```
54
+ ## Artifact contract
55
+
56
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief when present and the scoped git diff / routes under audit.
57
+ - **Owned outputs:** `perf-report.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `perf-report`) and preserve all foreign entries.
58
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
59
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
67
60
 
68
61
  For standalone `perf-audit` intent, suggest `/technical-retro` or a follow-up `/task` to implement fixes.
69
62
 
@@ -36,19 +36,12 @@ When the task is mostly e2e, prefer invoking the dedicated `playwright-test-plan
36
36
  - Run relevant unit tests for changed modules.
37
37
  - Run affected e2e specs if feasible; report failures clearly.
38
38
 
39
- ## On completion
40
-
41
- Update `status.json`:
42
-
43
- ```json
44
- {
45
- "slug": "<slug>",
46
- "currentAgent": "qa-tester",
47
- "phase": "executing",
48
- "state": "completed",
49
- "updatedAt": "<ISO8601>"
50
- }
51
- ```
39
+ ## Artifact contract
40
+
41
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition, reviewer notes when present, and prior implementation/validation artifacts.
42
+ - **Owned outputs:** changed/added test paths (and any QA notes written under the slug dir); upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `qa-tester`) and preserve all foreign entries.
43
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
44
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
52
45
 
53
46
  Provide summary:
54
47
 
@@ -49,20 +49,13 @@ PASS | PASS_WITH_NOTES | FAIL
49
49
  |------|--------|-------|
50
50
  ```
51
51
 
52
- ## On completion
53
-
54
- Update `status.json`:
55
-
56
- ```json
57
- {
58
- "slug": "<slug>",
59
- "currentAgent": "security-reviewer",
60
- "phase": "executing",
61
- "state": "completed",
62
- "updatedAt": "<ISO8601>"
63
- }
64
- ```
52
+ ## Artifact contract
53
+
54
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition, prior `review.md` when present, and the scoped git diff.
55
+ - **Owned outputs:** `security-review.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `security-review`) and preserve all foreign entries.
56
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `changes_requested`. Bind it to the supplied `attemptId` when present.
57
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
65
58
 
66
- If **FAIL**, set `"state": "changes_requested"`.
59
+ If **FAIL**, emit receipt outcome `changes_requested`.
67
60
 
68
61
  Do not modify production code.
@@ -53,20 +53,14 @@ Write `.cursor/team/tasks/<slug>/architecture.md`:
53
53
  - Flag when decomposition should change — list suggested updates for analyst/developer.
54
54
  - Do **not** write production code or tests.
55
55
 
56
- ## On completion
56
+ ## Artifact contract
57
57
 
58
- Update `status.json`:
58
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition and applicable prior analysis artifacts.
59
+ - **Owned outputs:** `architecture.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `architecture`) and preserve all foreign entries.
60
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
61
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
59
62
 
60
- ```json
61
- {
62
- "slug": "<slug>",
63
- "currentAgent": "solution-architect",
64
- "state": "completed",
65
- "updatedAt": "<ISO8601>"
66
- }
67
- ```
68
-
69
- For `spike` intent with human gate after architect: set `"state": "awaiting_approval"` if design needs user sign-off.
63
+ For `spike` intent needing user sign-off: emit receipt outcome `completed` (or `blocked` if design cannot proceed) and state the approval need in the receipt summary — the orchestration runtime/hook owns human-gate lifecycle (`awaiting_approval`), not this agent.
70
64
 
71
65
  Handoff: summary of design decisions and recommended next steps for developer.
72
66
 
@@ -74,22 +74,9 @@ Create or update files under `.cursor/team/tasks/<slug>/`:
74
74
  - feature-delivery-workflow.mdc for layer order
75
75
  ```
76
76
 
77
- ### `status.json`
77
+ ### Runtime state
78
78
 
79
- ```json
80
- {
81
- "slug": "<slug>",
82
- "intent": "<from pipeline.json>",
83
- "pipelineIndex": 0,
84
- "currentAgent": "task-analyst",
85
- "phase": "executing",
86
- "state": "awaiting_approval",
87
- "awaitingHumanGate": true,
88
- "updatedAt": "<ISO8601>"
89
- }
90
- ```
91
-
92
- If `pipeline.json` has `humanGates` including `after:task-analyst`, set `awaitingHumanGate: true`.
79
+ The orchestration runtime/hook owns `status.json`; the analyst does not create or mutate lifecycle fields.
93
80
 
94
81
  Also write `.cursor/team/active-task.json`:
95
82
 
@@ -105,7 +92,7 @@ Use kebab-case from the task title (e.g. `order-history-date-filter`). Max 48 ch
105
92
 
106
93
  When DoR is reached and artifacts are saved:
107
94
 
108
- 1. Set `status.json` `"phase": "executing"`, `"state": "awaiting_approval"`.
95
+ 1. Emit the analysis receipt; the runtime applies the configured human gate.
109
96
  2. Summarize brief and task count for the user.
110
97
  3. **Stop** and ask the user to review artifacts. Tell them to run `/task-continue <slug>` after approval or reply with corrections.
111
98
 
@@ -114,3 +101,10 @@ Do not invoke the developer or any implementation subagent.
114
101
  ## Design guidance (optional)
115
102
 
116
103
  - Optional: Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit — only when decomposing refactor/architecture tasks (not default).
104
+
105
+ ## Artifact contract
106
+
107
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume `pipeline.json`, the manifest routing entry, user-approved decisions, and any authoritative architecture/approval entries.
108
+ - **Owned outputs:** `brief.md` and `decomposition.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `analysis`) and preserve all foreign entries.
109
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
110
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
@@ -56,6 +56,27 @@ Set optional top-level `"profile": "full" | "standard" | "light"` in `pipeline.j
56
56
 
57
57
  Fixtures: `.cursor/team/fixtures/` (feature-full, feature-light, bugfix-standard).
58
58
 
59
+ ## Routing decision rubric
60
+
61
+ Keep top-level `profile` and emit this top-level object in every new `pipeline.json`:
62
+
63
+ ```json
64
+ "routingDecision": {
65
+ "complexity": "low | moderate | high",
66
+ "riskFlags": [],
67
+ "routingReasons": ["Concrete request signal and its routing consequence."],
68
+ "estimatedWorkPackages": 1,
69
+ "openDecisionCount": 0
70
+ }
71
+ ```
72
+
73
+ - `low`: one bounded layer/file set, explicit AC, reversible, no risk flags/open decisions → `light` when verification policy permits.
74
+ - `moderate`: adjacent concerns or a regression/refactor with known boundaries → usually `standard`.
75
+ - `high`: cross-layer/public API, security, migration/destructive or concurrency/state risk, broad e2e surface, unclear AC, or multiple work packages → usually `full`.
76
+ - Use concrete flags: `public-contract`, `cross-layer`, `security-sensitive`, `migration`, `destructive`, `concurrency-state`, `external-dependency`, `unclear-acceptance-criteria`, `broad-test-surface`, `behavior-regression`.
77
+ - `routingReasons` must be non-empty and explain profile, gates, specialists, skips, or checkpoints; never write “standard by default.”
78
+ - `estimatedWorkPackages` is an integer ≥1; `openDecisionCount` is an integer ≥0. Do not lower complexity because implementation is familiar.
79
+
59
80
  ## Adjust steps (when context is clear)
60
81
 
61
82
  - Skip **task-analyst** if AC/scope fully specified → document in `skipped`.
@@ -96,7 +117,7 @@ Cursor mapping when orchestrator invokes Task: `cheap` → pass `model: "fast"`
96
117
 
97
118
  ## Output
98
119
 
99
- Write `.cursor/team/tasks/<slug>/pipeline.json` and initial `status.json` via the **Write** tool (creates parents; do not Shell-`mkdir`); set `.cursor/team/active-task.json` `{ "slug": "<slug>" }`. Minimal template — см. **`agents/README.md`**.
120
+ Write `.cursor/team/tasks/<slug>/pipeline.json` and initialize the routing entry in `artifact-manifest.json`; set `.cursor/team/active-task.json`. The orchestration runtime creates and owns `status.json`.
100
121
 
101
122
  ## Handoff to orchestrator
102
123
 
@@ -108,6 +129,13 @@ Write `.cursor/team/tasks/<slug>/pipeline.json` and initial `status.json` via th
108
129
 
109
130
  Do not invoke implementation agents yourself.
110
131
 
111
- ## Metrics initialization
132
+ ## Runtime initialization
133
+
134
+ Return the routing receipt to the orchestrator. The orchestration runtime/hook exclusively initializes and updates `status.json`, `metrics.json`, attempt identities, and gate lifecycle; the router does not write those shared runtime files.
135
+
136
+ ## Artifact contract
112
137
 
113
- Alongside `pipeline.json` and `status.json`, create `metrics.json` with `schemaVersion: 1`, immutable task dimensions, `task_started`, and a generated `runId`. Before the parent invokes each agent, append `attempt_started` and set `status.activeAttempts[attemptId]` with agent, step index, attempt number, and host-clock `startedAt`. For parallel work create one entry per agent; do not use `currentAgent` to identify their completion.
138
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume the user request and any existing authoritative task/decision entries.
139
+ - **Owned outputs:** `pipeline.json` and the routing manifest entry; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `routing`) and preserve all foreign entries.
140
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
141
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
@@ -43,19 +43,12 @@ Conventional commit / release note snippet.
43
43
  - Do not duplicate entire decomposition — summarize outcomes and how to use/extend.
44
44
  - May create or update files under `docs/**` when the task explicitly requests it; otherwise keep primary output in team artifacts.
45
45
 
46
- ## On completion
47
-
48
- Update `status.json`:
49
-
50
- ```json
51
- {
52
- "slug": "<slug>",
53
- "currentAgent": "tech-writer",
54
- "phase": "executing",
55
- "state": "completed",
56
- "updatedAt": "<ISO8601>"
57
- }
58
- ```
46
+ ## Artifact contract
47
+
48
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition and available architecture/migration/review artifacts.
49
+ - **Owned outputs:** `documentation.md` (and any explicitly requested docs paths); upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `documentation`) and preserve all foreign entries.
50
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
51
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
59
52
 
60
53
  Suggest `/technical-retro <slug>` when this is the final pipeline step.
61
54
 
@@ -26,17 +26,12 @@ You generate unit tests from project test plans.
26
26
 
27
27
  Run affected unit tests from `app/` when feasible. Report files changed, commands run, failures, and gaps.
28
28
 
29
- Update `status.json`:
30
-
31
- ```json
32
- {
33
- "slug": "<slug>",
34
- "currentAgent": "unit-test-generator",
35
- "phase": "executing",
36
- "state": "completed",
37
- "updatedAt": "<ISO8601>"
38
- }
39
- ```
29
+ ## Artifact contract
30
+
31
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for `unit-test-plan.md`, brief/decomposition when present, and target modules.
32
+ - **Owned outputs:** generated/updated `*.spec.ts` / `*.spec.tsx` paths; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `unit-test-generator`) and preserve all foreign entries.
33
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
34
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
40
35
 
41
36
  ## Design guidance
42
37
 
@@ -27,17 +27,12 @@ Use **`unit-testing` skill**, **`debug-investigation` skill**, and **`tests-unit
27
27
 
28
28
  Report root cause, files changed, validation result, and remaining risk.
29
29
 
30
- Update `status.json`:
31
-
32
- ```json
33
- {
34
- "slug": "<slug>",
35
- "currentAgent": "unit-test-healer",
36
- "phase": "executing",
37
- "state": "completed",
38
- "updatedAt": "<ISO8601>"
39
- }
40
- ```
30
+ ## Artifact contract
31
+
32
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for failing test evidence, `unit-test-plan.md` when present, and recent diff.
33
+ - **Owned outputs:** healed `*.spec.ts` / `*.spec.tsx` paths (and minimal production fixes only when evidenced); upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `unit-test-healer`) and preserve all foreign entries.
34
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
35
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
41
36
 
42
37
  ## Design guidance
43
38
 
@@ -47,19 +47,12 @@ Fixtures, mocks, test-store patterns to reuse.
47
47
 
48
48
  Test titles in the plan must follow Russian capitalization rules from `tests-unit.mdc`.
49
49
 
50
- ## On completion
51
-
52
- Update `status.json`:
53
-
54
- ```json
55
- {
56
- "slug": "<slug>",
57
- "currentAgent": "unit-test-planner",
58
- "phase": "executing",
59
- "state": "completed",
60
- "updatedAt": "<ISO8601>"
61
- }
62
- ```
50
+ ## Artifact contract
51
+
52
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition and target modules under `app/src/**`.
53
+ - **Owned outputs:** `unit-test-plan.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `unit-test-planner`) and preserve all foreign entries.
54
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
55
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
63
56
 
64
57
  Do not write `*.spec.ts` files — that is `unit-test-generator`'s job.
65
58
 
@@ -25,14 +25,16 @@ description: Route a natural-language task through the agent-team pipeline: task
25
25
 
26
26
  ## Алгоритм
27
27
 
28
- 1. **Slug** — kebab-case из описания (≤48 символов). Создай `.cursor/team/tasks/<slug>/` через **Write** (например сразу `status.json` или пустой placeholder) — **не** через Shell `mkdir` (песочница → `Operation not permitted`).
28
+ 1. **Slug** — kebab-case из описания (≤48 символов). Создай `.cursor/team/tasks/<slug>/` через **Write** (например placeholder `pipeline.json` или пустой marker) — runtime/hook владеет `status.json` — **не** через Shell `mkdir` (песочница → `Operation not permitted`).
29
29
  2. **Router** — вызови subagent **task-router** с описанием задачи и путём к slug.
30
30
  3. **План** — покажи пользователю таблицу из `pipeline.json`: intent, steps, skipped, humanGates.
31
31
  4. **Intent retro** — если `intent === "retro"`, выполни `/technical-retro` и **остановись**.
32
- 5. **Старт** — вызови subagent для `pipeline.steps[0].agent`:
33
- - передай slug, пути к артефактам, scope из step (если есть);
34
- - обнови `status.json`: `pipelineIndex: 0`, `currentAgent`, `state: in_progress`.
35
- 6. **Human gate** если после текущего шага есть gate в `humanGates` (`after:<agent>`), после завершения агента **остановись** и попроси `/task-continue <slug>` (или `/feature-continue <slug>`).
32
+ 5. **Старт** — после router:
33
+ - подтверди `pipeline.json` и `active-task.json`;
34
+ - **не** пиши lifecycle-поля `status.json` / `metrics.json` сам — их владеет orchestration runtime/hook (см. **agent-artifact-contracts**). Если `status.json` отсутствует, допустим только минимальный bootstrap (`slug`, `intent`, `pipelineIndex: 0`, `currentAgent: steps[0]`, `state: in_progress`) — **не** увеличивай `pipelineIndex` вручную;
35
+ - вызови subagent для `pipeline.steps[0].agent` (slug, пути к артефактам, scope).
36
+ 6. **После каждого агента** — дождись hook handoff / reconciliation terminal receipt → `status.state`; не запускай следующий шаг, пока `status.json` не отражает handoff (или пока нет `followup_message` от hook).
37
+ 7. **Human gate** — если после текущего шага есть gate в `humanGates` (`after:<agent>`), после завершения агента **остановись** и попроси `/task-continue <slug>` (или `/feature-continue <slug>`).
36
38
 
37
39
  ## Не делать
38
40
 
@@ -51,4 +53,4 @@ description: Route a natural-language task through the agent-team pipeline: task
51
53
 
52
54
  ## Metrics
53
55
 
54
- Initialize `metrics.json` before the first invocation with frozen task dimensions and `task_started`; add one `activeAttempts[attemptId]` entry plus `attempt_started` per scheduled agent. On `/task-continue`, append `human_gate_ended` (referencing the stored gate event) before activating the next attempt. Do not calculate durations in agents.
56
+ Runtime/hook owns `metrics.json` and `status.json` attempt ledgers. Before the first invocation ensure `task_started` and one `activeAttempts[attemptId]` + `attempt_started` exist (router/runtime bootstrap — parent must not invent parallel indices). On `/task-continue`, run the installed chain hook `end_human_gate` action (or wrapper) so `human_gate_ended` lands before the next attempt. Do not calculate durations in agents.