@massa-ai/cursor-plugin 1.6.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 (172) hide show
  1. package/.cursor-plugin/plugin.json +5 -0
  2. package/README.md +87 -0
  3. package/agents/massa-ai-architecture-specialist.md +65 -0
  4. package/agents/massa-ai-audit-specialist.md +81 -0
  5. package/agents/massa-ai-builder.md +67 -0
  6. package/agents/massa-ai-context-curator.md +67 -0
  7. package/agents/massa-ai-documentation-agent.md +65 -0
  8. package/agents/massa-ai-furps-analyst.md +71 -0
  9. package/agents/massa-ai-investigator.md +68 -0
  10. package/agents/massa-ai-mobile-specialist.md +82 -0
  11. package/agents/massa-ai-navigator.md +75 -0
  12. package/agents/massa-ai-plan-critic.md +90 -0
  13. package/agents/massa-ai-planner.md +65 -0
  14. package/agents/massa-ai-requirements-analyst.md +64 -0
  15. package/agents/massa-ai-reviewer.md +66 -0
  16. package/agents/massa-ai-test-engineer.md +66 -0
  17. package/agents/massa-ai-verification-agent.md +65 -0
  18. package/hooks/hooks.json +26 -0
  19. package/hooks/massa-ai-hook +298 -0
  20. package/install.sh +413 -0
  21. package/package.json +30 -0
  22. package/skills/agents/architecture-specialist/SKILL.md +69 -0
  23. package/skills/agents/audit-specialist/SKILL.md +85 -0
  24. package/skills/agents/builder/SKILL.md +71 -0
  25. package/skills/agents/context-curator/SKILL.md +71 -0
  26. package/skills/agents/documentation-agent/SKILL.md +69 -0
  27. package/skills/agents/furps-analyst/SKILL.md +74 -0
  28. package/skills/agents/investigator/SKILL.md +72 -0
  29. package/skills/agents/mobile-specialist/SKILL.md +86 -0
  30. package/skills/agents/navigator/SKILL.md +79 -0
  31. package/skills/agents/plan-critic/SKILL.md +93 -0
  32. package/skills/agents/planner/SKILL.md +69 -0
  33. package/skills/agents/requirements-analyst/SKILL.md +68 -0
  34. package/skills/agents/reviewer/SKILL.md +70 -0
  35. package/skills/agents/test-engineer/SKILL.md +70 -0
  36. package/skills/agents/verification-agent/SKILL.md +69 -0
  37. package/skills/def/SKILL.md +17 -0
  38. package/skills/find/SKILL.md +19 -0
  39. package/skills/graph/SKILL.md +16 -0
  40. package/skills/index/SKILL.md +19 -0
  41. package/skills/map/SKILL.md +24 -0
  42. package/skills/massa-ai/SKILL.md +315 -0
  43. package/skills/massa-ai/personas/README.md +35 -0
  44. package/skills/massa-ai/personas/ai-native-nodejs-cli-architect.md +76 -0
  45. package/skills/massa-ai/personas/catalog.json +157 -0
  46. package/skills/massa-ai/personas/context-skill-harness-engineer-architect.md +74 -0
  47. package/skills/massa-ai/personas/product-manager.md +67 -0
  48. package/skills/massa-ai/personas/senior-mobile-engineer.md +74 -0
  49. package/skills/massa-ai/personas/senior-mobile-qa-automation-engineer.md +75 -0
  50. package/skills/massa-ai/references/adr-authoring.md +189 -0
  51. package/skills/massa-ai/references/agent-orchestration.md +221 -0
  52. package/skills/massa-ai/references/architecture-coupling-lens.md +239 -0
  53. package/skills/massa-ai/references/architecture-deepening-lens.md +136 -0
  54. package/skills/massa-ai/references/architecture-domain-lens.md +186 -0
  55. package/skills/massa-ai/references/architecture-lenses.md +108 -0
  56. package/skills/massa-ai/references/audit-report-io.md +459 -0
  57. package/skills/massa-ai/references/audit-scope.md +103 -0
  58. package/skills/massa-ai/references/code-annotation.md +111 -0
  59. package/skills/massa-ai/references/codebase-investigation.md +96 -0
  60. package/skills/massa-ai/references/context-firewall.md +62 -0
  61. package/skills/massa-ai/references/conversation-feedback.md +104 -0
  62. package/skills/massa-ai/references/debug-diagnosis-loop.md +140 -0
  63. package/skills/massa-ai/references/decision-engine.md +73 -0
  64. package/skills/massa-ai/references/evidence-gate.md +53 -0
  65. package/skills/massa-ai/references/furps/analyst-role.md +49 -0
  66. package/skills/massa-ai/references/furps/checklist.md +92 -0
  67. package/skills/massa-ai/references/furps/intake.md +104 -0
  68. package/skills/massa-ai/references/furps/report-contract.md +140 -0
  69. package/skills/massa-ai/references/hook-enforcement.md +137 -0
  70. package/skills/massa-ai/references/implementation-delivery.md +101 -0
  71. package/skills/massa-ai/references/installation.md +110 -0
  72. package/skills/massa-ai/references/lessons.md +119 -0
  73. package/skills/massa-ai/references/maestro/artifacts-reports.md +69 -0
  74. package/skills/massa-ai/references/maestro/cli-device.md +65 -0
  75. package/skills/massa-ai/references/maestro/cloud.md +67 -0
  76. package/skills/massa-ai/references/maestro/config-env-output.md +76 -0
  77. package/skills/massa-ai/references/maestro/fact-ledger.md +71 -0
  78. package/skills/massa-ai/references/maestro/js-scripting.md +70 -0
  79. package/skills/massa-ai/references/maestro/mcp.md +59 -0
  80. package/skills/massa-ai/references/maestro/patterns.md +96 -0
  81. package/skills/massa-ai/references/maestro/selectors.md +91 -0
  82. package/skills/massa-ai/references/maestro/workspace-execution.md +81 -0
  83. package/skills/massa-ai/references/maestro/yaml-commands.md +203 -0
  84. package/skills/massa-ai/references/maestro.md +47 -0
  85. package/skills/massa-ai/references/mcp-tools.md +296 -0
  86. package/skills/massa-ai/references/memory-policy.md +103 -0
  87. package/skills/massa-ai/references/mobile-context.md +113 -0
  88. package/skills/massa-ai/references/mobile-diagnosis.md +106 -0
  89. package/skills/massa-ai/references/mobile-figma-matcher/ATTRIBUTION.md +5 -0
  90. package/skills/massa-ai/references/mobile-figma-matcher/android-compose.md +13 -0
  91. package/skills/massa-ai/references/mobile-figma-matcher/android-views.md +13 -0
  92. package/skills/massa-ai/references/mobile-figma-matcher/core.md +117 -0
  93. package/skills/massa-ai/references/mobile-figma-matcher/ios-swiftui.md +12 -0
  94. package/skills/massa-ai/references/mobile-figma-matcher/ios-uikit.md +12 -0
  95. package/skills/massa-ai/references/mobile-figma-matcher/kmp-compose-multiplatform.md +14 -0
  96. package/skills/massa-ai/references/mobile-figma-matcher/repository-detection.md +77 -0
  97. package/skills/massa-ai/references/naming-standards.md +47 -0
  98. package/skills/massa-ai/references/pr-task-fix.md +80 -0
  99. package/skills/massa-ai/references/project-context.md +76 -0
  100. package/skills/massa-ai/references/rfc/ATTRIBUTION.md +5 -0
  101. package/skills/massa-ai/references/rfc/discovery-and-sizing.md +120 -0
  102. package/skills/massa-ai/references/rfc/document-contract.md +85 -0
  103. package/skills/massa-ai/references/rfc/quality-and-lifecycle.md +101 -0
  104. package/skills/massa-ai/references/root-cause-scripts.md +97 -0
  105. package/skills/massa-ai/references/spec-driven/artifact-store.md +98 -0
  106. package/skills/massa-ai/references/spec-driven/code-analysis.md +119 -0
  107. package/skills/massa-ai/references/spec-driven/coding-principles.md +80 -0
  108. package/skills/massa-ai/references/spec-driven/context-limits.md +64 -0
  109. package/skills/massa-ai/references/spec-driven/design.md +257 -0
  110. package/skills/massa-ai/references/spec-driven/discuss.md +182 -0
  111. package/skills/massa-ai/references/spec-driven/execute.md +471 -0
  112. package/skills/massa-ai/references/spec-driven/lessons.md +5 -0
  113. package/skills/massa-ai/references/spec-driven/memory.md +214 -0
  114. package/skills/massa-ai/references/spec-driven/specify.md +283 -0
  115. package/skills/massa-ai/references/spec-driven/sub-agents.md +151 -0
  116. package/skills/massa-ai/references/spec-driven/tasks.md +494 -0
  117. package/skills/massa-ai/references/spec-driven/validate.md +397 -0
  118. package/skills/massa-ai/references/subagent-design.md +132 -0
  119. package/skills/massa-ai/references/synapse-policy.md +160 -0
  120. package/skills/massa-ai/references/tdd/calibrated-examples.md +54 -0
  121. package/skills/massa-ai/references/tdd/discovery-and-sizing.md +83 -0
  122. package/skills/massa-ai/references/tdd/document-contract.md +136 -0
  123. package/skills/massa-ai/references/tdd/quality-and-lifecycle.md +83 -0
  124. package/skills/massa-ai/references/the-fool/cognitive-bias-inventory.md +103 -0
  125. package/skills/massa-ai/references/the-fool/dialectic-synthesis.md +170 -0
  126. package/skills/massa-ai/references/the-fool/evidence-audit.md +202 -0
  127. package/skills/massa-ai/references/the-fool/mode-selection-guide.md +113 -0
  128. package/skills/massa-ai/references/the-fool/pre-mortem-analysis.md +200 -0
  129. package/skills/massa-ai/references/the-fool/red-team-adversarial.md +206 -0
  130. package/skills/massa-ai/references/the-fool/socratic-questioning.md +153 -0
  131. package/skills/massa-ai/references/ticket/atlassian-fix.md +130 -0
  132. package/skills/massa-ai/references/ticket/intake-and-sources.md +65 -0
  133. package/skills/massa-ai/references/ticket/templates-and-quality.md +129 -0
  134. package/skills/massa-ai/references/verification-ladder.md +62 -0
  135. package/skills/massa-ai/scripts/lessons.py +590 -0
  136. package/skills/massa-ai/workflows/adr.md +33 -0
  137. package/skills/massa-ai/workflows/architecture/architecture-audit.md +125 -0
  138. package/skills/massa-ai/workflows/architecture/architecture-fix.md +110 -0
  139. package/skills/massa-ai/workflows/bugs/bugs-audit.md +113 -0
  140. package/skills/massa-ai/workflows/bugs/bugs-fix.md +97 -0
  141. package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +154 -0
  142. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +99 -0
  143. package/skills/massa-ai/workflows/commit.md +61 -0
  144. package/skills/massa-ai/workflows/debug.md +86 -0
  145. package/skills/massa-ai/workflows/design.md +54 -0
  146. package/skills/massa-ai/workflows/exploration.md +119 -0
  147. package/skills/massa-ai/workflows/feature.md +52 -0
  148. package/skills/massa-ai/workflows/general.md +46 -0
  149. package/skills/massa-ai/workflows/implementation/implementation-audit.md +87 -0
  150. package/skills/massa-ai/workflows/implementation/implementation-fix.md +90 -0
  151. package/skills/massa-ai/workflows/long-session.md +44 -0
  152. package/skills/massa-ai/workflows/maestro/maestro-audit.md +56 -0
  153. package/skills/massa-ai/workflows/maestro/maestro-fix.md +74 -0
  154. package/skills/massa-ai/workflows/maestro/maestro.md +68 -0
  155. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +68 -0
  156. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +74 -0
  157. package/skills/massa-ai/workflows/onboarding.md +23 -0
  158. package/skills/massa-ai/workflows/refactor.md +47 -0
  159. package/skills/massa-ai/workflows/refinement/furps-refinement.md +81 -0
  160. package/skills/massa-ai/workflows/requirements/requirements-audit.md +114 -0
  161. package/skills/massa-ai/workflows/requirements/requirements-fix.md +93 -0
  162. package/skills/massa-ai/workflows/rfc.md +55 -0
  163. package/skills/massa-ai/workflows/security/security-audit.md +113 -0
  164. package/skills/massa-ai/workflows/security/security-fix.md +97 -0
  165. package/skills/massa-ai/workflows/spec-driven.md +217 -0
  166. package/skills/massa-ai/workflows/tdd.md +71 -0
  167. package/skills/massa-ai/workflows/tests/tests-audit.md +114 -0
  168. package/skills/massa-ai/workflows/tests/tests-fix.md +96 -0
  169. package/skills/massa-ai/workflows/the-fool.md +82 -0
  170. package/skills/massa-ai/workflows/ticket.md +42 -0
  171. package/skills/persona-router/SKILL.md +158 -0
  172. package/skills/status/SKILL.md +15 -0
@@ -0,0 +1,494 @@
1
+ # Tasks
2
+
3
+ Use this reference only when the TLC v3 flow includes Tasks. The output is the `.specs/features/<slug>/tasks.md`.
4
+
5
+ **Goal**: Break into GRANULAR, ATOMIC tasks. Clear dependencies. Right tools. Sequential phase execution plan.
6
+
7
+ **Skip this phase when:** There are ≤3 obvious steps. In that case, tasks are implicit — go straight to Execute (`references/spec-driven/execute.md`) and list them inline in your implementation plan.
8
+
9
+ ## Include Tasks When
10
+
11
+ - Execution has more than 3 obvious linear steps.
12
+ - Work has dependencies, branch/join flow, migrations, rollout sequencing, or cross-module ordering.
13
+ - Verification needs staged setup, fixtures, or multiple commands.
14
+ - More than one contributor or agent could safely own disjoint slices.
15
+
16
+ ## Why Granular Tasks?
17
+
18
+ | Vague Task (BAD) | Granular Tasks (GOOD) |
19
+ | ---------------- | --------------------------------- |
20
+ | "Create form" | T1: Create email input component |
21
+ | | T2: Add email validation function |
22
+ | | T3: Create submit button |
23
+ | | T4: Add form state management |
24
+ | | T5: Connect form to API |
25
+ | "Implement auth" | T1: Create login form |
26
+ | | T2: Create register form |
27
+ | | T3: Add token storage utility |
28
+ | | T4: Create auth API service |
29
+ | | T5: Add route protection |
30
+
31
+ **Benefits of granular:**
32
+
33
+ - **Agents don't err** - Single focus, no ambiguity
34
+ - **Easy to test** - Each task = one verifiable outcome
35
+ - **Clean commits** - Each task = one atomic, revertable commit
36
+ - **Errors isolated** - One failure doesn't block everything
37
+
38
+ **Rule**: One task = ONE of these:
39
+
40
+ - One component
41
+ - One function
42
+ - One API endpoint
43
+ - One file change
44
+
45
+ ---
46
+
47
+ ## Process
48
+
49
+ ### 1. Review Design
50
+
51
+ Read `.specs/features/<slug>/design.md` before creating tasks.
52
+
53
+ ### 1.5. Generate the Test Coverage Matrix (ALWAYS)
54
+
55
+ This step ALWAYS runs — there is no precondition. Decide which of two paths to take, then generate the two sections below.
56
+
57
+ **Step 0 — Read project quality/testing guidelines (ALWAYS, before anything else).**
58
+
59
+ Before sampling tests or inferring anything, scan the project for documented quality and testing standards. Stack-agnostic sources to check (illustrative, not exhaustive):
60
+
61
+ - Agent/AI instructions: `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/**`, `.github/copilot-instructions.md`
62
+ - Contributor guides: `CONTRIBUTING.md`, `docs/` (testing, quality, or standards subdocs), README testing section
63
+ - Tool configuration: coverage thresholds in the test runner config (e.g., `jest.config.*`, `vitest.config.*`, `pytest.ini`, `.nycrc`, `Makefile` coverage targets, CI coverage gates)
64
+
65
+ **If guidelines are found:** the Coverage Expectation (see matrix below) conforms to them. Existing test samples fill gaps in style/location/framework only. Cite the specific files found in the matrix provenance note.
66
+
67
+ **If no guidelines are found:** apply the strong default — cover every spec AC and every listed edge case; domain/business logic maps 1:1 to spec ACs; routes/e2e cover happy + edge + error paths. This default may exceed the current repo's depth, which is intentional.
68
+
69
+ **Decision:**
70
+
71
+ - **Existing tests in the repo** → infer the matrix and gate commands by sampling the codebase.
72
+ - **No tests at all** → ask the user: "What test types will this project use (unit / integration / e2e / none)? What commands run them?"
73
+
74
+ **How to infer (path 1 — existing tests):**
75
+
76
+ 1. **Sample test files.** Locate 5–10 existing test files. Map each file's location relative to its source file to identify which code layers are exercised and at what level (unit, integration, e2e). Use these samples for style, location patterns, framework, and test type — and as a **floor** (never produce tests less thorough than existing ones for the same layer). Existing tests are NOT a ceiling on thoroughness; the thoroughness target comes from the spec ACs, listed edge cases, and guidelines (or strong default). The Coverage Expectation column captures the target per layer.
77
+ 2. **Discover commands from the repo.** Do NOT invent commands and do NOT assume an ecosystem. Read the project's own build/task manifests, test config, and CI workflows to extract the actual commands — for example: `package.json` / `project.json` (JS/TS), `Makefile`, `pyproject.toml` / `tox.ini` / `pytest` (Python), `Cargo.toml` (Rust), `go test` invocations (Go), `pom.xml` / `build.gradle` (Java/Kotlin), `Gemfile` / `Rakefile` (Ruby), `composer.json` (PHP), `.github/workflows` / `.gitlab-ci.yml`. The list is illustrative; detect what this repo actually uses.
78
+
79
+ **Output contract — render these two sections verbatim into `tasks.md`** (the exact headings downstream phases reference):
80
+
81
+ ---
82
+
83
+ ## Test Coverage Matrix
84
+
85
+ > Generated from codebase, project guidelines, and spec — confirm before Execute. Guidelines found: [list files, e.g. `AGENTS.md`, `jest.config.ts` — or "none — strong defaults applied"].
86
+
87
+ | Code Layer | Required Test Type | Coverage Expectation | Location Pattern | Run Command |
88
+ | ---------- | ------------------ | -------------------- | ---------------- | ----------- |
89
+ | [layer] | [unit/integration/e2e/none] | [depth target for this layer] | [glob or path pattern] | [command] |
90
+
91
+ **Coverage Expectation values** — set from guidelines first; use strong defaults when no guideline applies:
92
+
93
+ | Layer type | Strong default (no guideline) |
94
+ | ---------- | ----------------------------- |
95
+ | Domain / business-logic (service, use-case, domain model) | All branches; 1:1 to spec ACs; every listed edge case has a test |
96
+ | Route / controller / e2e / integration | All routes in scope: happy path + every listed edge case + error/failure paths |
97
+ | Repository / data-access | Key query paths + error handling; infer from existing repo tests |
98
+ | Entity / config / schema | none — build gate only |
99
+
100
+ These defaults may exceed the current repo's depth. That is intentional — they are a **target**, not a reflection of what already exists.
101
+
102
+ *Example (filled in):*
103
+
104
+ | Code Layer | Required Test Type | Coverage Expectation | Location Pattern | Run Command |
105
+ | ---------- | ------------------ | -------------------- | ---------------- | ----------- |
106
+ | Service | unit | All branches; 1:1 to spec ACs; all listed edge cases | `src/**/__test__/*.spec.ts` | `yarn test:unit` |
107
+ | Repository | integration | Key query paths + error paths | `src/**/__test__/*.e2e-spec.ts` | `yarn test:e2e` |
108
+ | Controller/Resolver | e2e | All routes: happy + edge + error | `src/**/__test__/*.e2e-spec.ts` | `yarn test:e2e` |
109
+ | Entity / Config | none | — (build gate only) | — | build gate only |
110
+
111
+ ## Gate Check Commands
112
+
113
+ > Generated from codebase — confirm before Execute.
114
+
115
+ | Gate Level | When to Use | Command |
116
+ | ---------- | ----------- | ------- |
117
+ | Quick | After tasks with unit tests only | [unit test command] |
118
+ | Full | After tasks with e2e/integration tests | [unit + e2e commands] |
119
+ | Build | After phase completion or config/entity-only tasks | [build + lint + all tests] |
120
+
121
+ ---
122
+
123
+ **Co-located tests:** Every task that creates or modifies a code layer with a required test type MUST include writing/updating those tests in the same task. Tests are NOT separate tasks. The tests must satisfy the layer's **Coverage Expectation** from the matrix — not merely exist.
124
+
125
+ | Task creates... | Done When must include... |
126
+ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
127
+ | Code layer with "unit" requirement | Unit tests written satisfying the layer's Coverage Expectation (e.g., 1:1 AC mapping for domain logic; all listed edge cases covered) + quick gate passes |
128
+ | Code layer with "e2e" requirement | E2E tests written satisfying the layer's Coverage Expectation (e.g., every route the task adds: happy path + edge + error paths) + full gate passes |
129
+ | Code layer with "integration" requirement | Integration tests written satisfying the layer's Coverage Expectation + full gate passes |
130
+ | Code layer with "none" requirement | Gate check at appropriate level |
131
+
132
+ ### 2. Break Into Atomic Tasks
133
+
134
+ **Task = ONE deliverable**. Examples:
135
+
136
+ - ✅ "Create UserService interface" (one file, one concept)
137
+ - ❌ "Implement user management" (too vague, multiple files)
138
+
139
+ ### 3. Define Dependencies
140
+
141
+ What MUST be done before this task can start?
142
+
143
+ ### 4. Create Execution Plan
144
+
145
+ Group tasks into ordered phases. Each phase depends on the ones before it; tasks execute sequentially within a phase.
146
+
147
+ **Size phases near the worker budget.** During Execute, phases are packed into task-budgeted batches (~7 tasks per sub-agent, whole phases — see `references/spec-driven/sub-agents.md`). Because a batch cut may only land on a phase boundary, a phase that is much larger than the budget forces an over-sized worker. Keep each phase from greatly exceeding the budget:
148
+
149
+ - If a phase would hold **more than ~10 tasks (≈1.5× the budget)**, split it into cohesive sub-phases at a genuine dependency/cohesion seam — not at an arbitrary task index.
150
+ - Only leave a phase over-sized when its tasks are one tight dependency chain that genuinely cannot be split. That is a legitimate (if fat) single-worker phase, not a smell.
151
+
152
+ This keeps phase boundaries meaningful while letting the packing hit its target worker count.
153
+
154
+ ### 5. Validate Before Presenting (MANDATORY)
155
+
156
+ Before showing tasks to the user, run ALL three pre-approval checks. These are NOT optional — they are gates. If any check fails, restructure the tasks and re-run until all pass.
157
+
158
+ **Check 1: Task Granularity** — verify each task is atomic (see Granularity Check section).
159
+
160
+ **Check 2: Diagram-Definition Cross-Check** — verify the execution diagram matches every task's `Depends on` field (see Diagram-Definition Cross-Check section). Build the cross-check table and include it in the output.
161
+
162
+ **Check 3: Test Co-location Validation** — verify every task's `Tests` field matches the **Test Coverage Matrix** generated above (see Test Co-location Validation section). Build the validation table and include it in the output.
163
+
164
+ **Output both tables with the tasks** so the user can see the validation results. Any ❌ means you MUST restructure before presenting — do not show failing tasks to the user and ask them to approve.
165
+
166
+ These three checks fold in the broader pre-approval gates that also apply: (1) **Requirement coverage** — every in-scope requirement appears in at least one task and in the Test Coverage Matrix; (2) **Dependency order** — each task can run after its dependencies without leaving the repository unbuildable; (3) **Gate commands** — each task has an exact validation command or explicit skipped reason; (4) **Scope discipline** — no task depends on hidden chat context, unapproved design decisions, or opportunistic refactors.
167
+
168
+ **Note on the generated matrix:** The two sections (`Test Coverage Matrix`, `Gate Check Commands`) are provisional — generated from codebase sampling or user input and included in this file for user confirmation as part of task approval. They become authoritative once the user approves the tasks.
169
+
170
+ ### 6. ASK About MCPs and Skills
171
+
172
+ **CRITICAL**: Before execution, ask the user:
173
+
174
+ > "For each task, which tools should I use?"
175
+ >
176
+ > **Available MCPs**: [list from project or user]
177
+ > **Available Skills**: [list from project or user]
178
+
179
+ ---
180
+
181
+ ## Template: `.specs/features/<slug>/tasks.md`
182
+
183
+ ```markdown
184
+ # [Feature] Tasks
185
+
186
+ ## Execution Protocol (MANDATORY -- do not skip)
187
+
188
+ Implement these tasks with the `massa-ai` skill: **activate it by name and follow its Execute flow and Critical Rules.** Do not search for skill files by filesystem path. The skill is the source of truth for the full flow (per-task cycle, sub-agent delegation, adequacy review, Verifier, discrimination sensor).
189
+
190
+ **If the skill cannot be activated, STOP and tell the user — do not proceed without it.**
191
+
192
+ ---
193
+
194
+ **Design**: `.specs/features/<slug>/design.md`
195
+ **Status**: Draft | Approved | In Progress | Done
196
+
197
+ ---
198
+
199
+ <!-- The two sections below are generated by step 1.5 of the Tasks process and filled in during task creation. Do not manually populate them — they are produced by the agent from codebase sampling. -->
200
+
201
+ ## Test Coverage Matrix
202
+
203
+ [Generated in step 1.5 — see process above]
204
+
205
+ ## Gate Check Commands
206
+
207
+ [Generated in step 1.5 — see process above]
208
+
209
+ ---
210
+
211
+ ## Execution Plan
212
+
213
+ Phases are ordered and run sequentially — each phase completes before the next begins, and tasks within a phase execute in order.
214
+
215
+ ### Phase 1: Foundation
216
+
217
+ Tasks that must be done first, in order.
218
+
219
+ T1 → T2 → T3
220
+
221
+ ### Phase 2: Core Implementation
222
+
223
+ Builds on the foundation.
224
+
225
+ T4 → T5 → T6 → T7
226
+
227
+ ### Phase 3: Integration
228
+
229
+ Bringing it all together.
230
+
231
+ T8 → T9
232
+
233
+ ---
234
+
235
+ ## Task Breakdown
236
+
237
+ ### T1: [Create X Interface]
238
+
239
+ **What**: [One sentence: exact deliverable]
240
+ **Where**: `src/path/to/file.ts`
241
+ **Depends on**: None
242
+ **Reuses**: `src/existing/BaseInterface.ts`
243
+ **Requirement**: [FEAT]-01
244
+
245
+ **Tools**:
246
+
247
+ - MCP: `filesystem` (or NONE)
248
+ - Skill: NONE
249
+
250
+ **Done when**:
251
+
252
+ - [ ] Interface defined with all methods from design
253
+ - [ ] Types exported correctly
254
+ - [ ] No TypeScript errors
255
+
256
+ **Tests**: [unit/e2e/integration/none — from coverage matrix]
257
+ **Gate**: [quick/full/build — from gate check commands]
258
+
259
+ ---
260
+
261
+ ### T2: [Implement Y Service]
262
+
263
+ **What**: [Exact deliverable]
264
+ **Where**: `src/services/YService.ts`
265
+ **Depends on**: T1
266
+ **Reuses**: `src/services/BaseService.ts` patterns
267
+
268
+ **Tools**:
269
+
270
+ - MCP: `filesystem`, `context7`
271
+ - Skill: NONE
272
+
273
+ **Done when**:
274
+
275
+ - [ ] Implements interface from T1
276
+ - [ ] Handles error cases from design
277
+ - [ ] Gate check passes: `[quick gate command from the Gate Check Commands above]`
278
+ - [ ] Test count: [N] tests pass (no silent deletions)
279
+
280
+ **Tests**: unit
281
+ **Gate**: quick
282
+
283
+ ---
284
+
285
+ ### T3: [Create Z Component]
286
+
287
+ **What**: [Exact deliverable]
288
+ **Where**: `src/components/ZComponent.tsx`
289
+ **Depends on**: T1
290
+ **Reuses**: `src/components/BaseComponent.tsx`
291
+
292
+ **Tools**:
293
+
294
+ - MCP: `filesystem`
295
+ - Skill: NONE
296
+
297
+ **Done when**:
298
+
299
+ - [ ] Component renders correctly
300
+ - [ ] Handles props from interface
301
+ - [ ] Follows existing component patterns
302
+ - [ ] Gate check passes: `[quick gate command from the Gate Check Commands above]`
303
+ - [ ] Test count: [N] tests pass (no silent deletions)
304
+
305
+ **Tests**: unit
306
+ **Gate**: quick
307
+
308
+ ---
309
+
310
+ ### T4: [Add A Feature to Y]
311
+
312
+ **What**: [Exact deliverable]
313
+ **Where**: `src/services/YService.ts` (modify)
314
+ **Depends on**: T2, T3
315
+ **Reuses**: Existing service patterns
316
+
317
+ **Tools**:
318
+
319
+ - MCP: `filesystem`, `github`
320
+ - Skill: `api-design`
321
+
322
+ **Done when**:
323
+
324
+ - [ ] Feature works per acceptance criteria
325
+ - [ ] Gate check passes: `[full gate command from the Gate Check Commands above]`
326
+ - [ ] Test count: [N] tests pass (no silent deletions)
327
+
328
+ **Tests**: integration
329
+ **Gate**: full
330
+
331
+ **Commit**: `feat([scope]): [description]`
332
+
333
+ ---
334
+
335
+ ## Phase Execution Map
336
+
337
+ Visual representation of task ordering. Phases run in sequence, and tasks within a phase run in order:
338
+
339
+ ```
340
+ Phase 1 → Phase 2 → Phase 3
341
+
342
+ Phase 1: T1 ──→ T2 ──→ T3
343
+ Phase 2: T4 ──→ T5 ──→ T6 ──→ T7
344
+ Phase 3: T8 ──→ T9
345
+ ```
346
+
347
+ Execution is strictly sequential — there is no intra-phase parallelism. A single agent (or batch worker) works one task at a time, in order.
348
+
349
+ **How phase-based execution works:**
350
+
351
+ At Execute, the agent counts total tasks and packs phases into **task-budgeted batches** (~7 tasks per worker, whole phases — the benchmarked sweet spot is ~20 tasks → ~3 workers). A **phase** is the semantic/dependency unit; a **batch** is one or more *consecutive whole phases* assigned to one worker. The cut only ever lands on a phase boundary — a phase is never split across workers. When packing yields more than one batch (> ~8 tasks), the agent offers to dispatch batch sub-agents. Batches run sequentially: each worker executes ALL its tasks in order, then reports a compact summary before the next batch starts. This right-sizes the worker count by workload instead of by phase count (one-per-phase is too fragmented; expensive and slow). See `references/spec-driven/sub-agents.md` for the full model — packing algorithm, offer-then-confirm, worker payload, compact summary contract, failure handling, and context sizing guidance.
352
+
353
+ When the whole feature fits a single batch (≤ ~8 tasks), execution happens inline in the main window with no sub-agents spawned.
354
+
355
+ **The orchestrating agent's role during Execute:**
356
+ 1. Count total tasks and pack phases into ~7-task batches — offer batch sub-agents if that yields more than one batch and the user accepts
357
+ 2. Dispatch the next batch (to a worker, or execute inline)
358
+ 3. Receive the compact batch summary
359
+ 4. Update tasks.md with results
360
+ 5. If the batch summary shows all tasks complete: proceed to the next batch
361
+ 6. If a task failed: decide fix/escalate before dispatching the next batch
362
+
363
+ ---
364
+
365
+ ## Task Granularity Check
366
+
367
+ Before approving tasks, verify they are granular enough:
368
+
369
+ | Task | Scope | Status |
370
+ | ------------------------------- | ------------- | ------------ |
371
+ | T1: Create email input | 1 component | ✅ Granular |
372
+ | T2: Add validation function | 1 function | ✅ Granular |
373
+ | T3: Create form with all fields | 5+ components | ❌ Split it! |
374
+ | T4: Connect to API | 1 function | ✅ Granular |
375
+
376
+ **Granularity check**:
377
+
378
+ - ✅ 1 component / 1 function / 1 endpoint = Good
379
+ - ⚠️ 2-3 related things in same file = OK if cohesive
380
+ - ❌ Multiple components or files = MUST split
381
+
382
+ ---
383
+
384
+ ## Diagram-Definition Cross-Check
385
+
386
+ Before approving tasks, verify the execution diagram is consistent with the task definitions. These are independent artifacts that can drift — the diagram is drawn for visual clarity while task bodies are written for precision. Both must agree.
387
+
388
+ For each task, check:
389
+
390
+ | Task | Depends On (task body) | Diagram Shows | Status |
391
+ | ---- | ---------------------- | ------------- | ------ |
392
+ | T[N] | [deps from body] | [deps from diagram arrows] | ✅ Match or ❌ Mismatch |
393
+
394
+ **Rules:**
395
+
396
+ - Every `Depends on` in a task body must have a corresponding arrow in the diagram.
397
+ - Every arrow in the diagram must correspond to a `Depends on` in the target task's body.
398
+ - A task must never depend on a task in a later phase — dependencies point backward or within the same phase only.
399
+
400
+ ---
401
+
402
+ ## Test Co-location Validation
403
+
404
+ Before approving tasks, verify EVERY task's `Tests` field is consistent with the **Test Coverage Matrix** generated above. This is a hard gate — tasks that fail this check MUST be fixed.
405
+
406
+ For each task, check: does the task create or modify a code layer that has a required test type in the coverage matrix? If yes, the task's `Tests` field MUST match.
407
+
408
+ | Task | Code Layer Created/Modified | Matrix Requires | Task Says | Status |
409
+ | ---- | --------------------------- | --------------- | --------- | ------ |
410
+ | T[N]: [name] | [layer from coverage matrix] | [test type] | [task's Tests field] | ✅ OK or ❌ VIOLATION |
411
+
412
+ **Rules:**
413
+
414
+ - "Tested in another task" is NOT a valid justification for `Tests: none`. That is test deferral — the exact anti-pattern this validation prevents.
415
+ - `Tests: none` is only valid when the coverage matrix says "none" for that code layer.
416
+ - If a task creates MULTIPLE code layers (e.g., service + controller), use the HIGHEST test type required by any of them.
417
+ - Any ❌ VIOLATION → restructure the task to include its required tests before proceeding.
418
+
419
+ **Resolving compilation dependencies:**
420
+
421
+ When a task creates code that can't be tested until a later task completes (e.g., a controller that needs module wiring before its e2e tests can run), do NOT defer the tests to a separate task. Instead, restructure:
422
+
423
+ 1. **Merge forward:** Move the untestable task's tests into the earliest task where they become runnable (e.g., the wiring task includes wiring + e2e tests for the controller it enables).
424
+ 2. **Merge backward:** Absorb the blocking dependency into the current task so it becomes self-testable (e.g., controller task includes its own module registration).
425
+
426
+ Pick whichever option keeps tasks atomic and cohesive. The goal: no task produces unverified code. If code can't be tested in the task that creates it, the task boundaries are wrong.
427
+
428
+ ---
429
+
430
+ ## Tips
431
+
432
+ - **Phases are ordered** — Each phase completes before the next; tasks run in order within a phase
433
+ - **Reuses = Token saver** — Always reference existing code
434
+ - **Tools per task** — MCPs and Skills prevent wrong approaches
435
+ - **Dependencies are gates** — Clear what blocks what
436
+ - **Done when = Testable** — If you can't verify it, rewrite it
437
+ - **Requirement ID = Traceable** — Every task traces back to a spec requirement
438
+ - **One commit per task** — Plan the commit message format in advance
439
+
440
+ ---
441
+
442
+ ## Task Verification Standards
443
+
444
+ Every task MUST follow the `Done when` + `Tests` + `Gate` fields defined in the **Task Breakdown** template above. Each `Done when` entry must be specific, testable (binary pass/fail), and reference the gate check command from the `Gate Check Commands` section. Include the expected test count to prevent silent deletions.
445
+ ```
446
+
447
+ ---
448
+
449
+ ## Required Task Shape
450
+
451
+ Each task must include:
452
+
453
+ - Task ID such as `TASK-001` (in addition to the short `T1`..`Tn` planning label).
454
+ - Requirement IDs covered.
455
+ - Scope and non-goals.
456
+ - Files or areas expected to change.
457
+ - Dependencies notes.
458
+ - Test Coverage Matrix entry covering the requirement IDs, expected assertion layer, and required edge/error cases.
459
+ - Gate Check Commands entry naming the deterministic quick/full/build command or artifact check.
460
+ - MCP and skill question: whether any available MCP, local skill, or project tool materially changes implementation or verification, with the selected answer or skipped reason.
461
+ - Test co-location validation: where tests should live according to existing repository conventions.
462
+ - Validation command or artifact check.
463
+ - Done criteria.
464
+ - Artifact-store evidence: active artifact key, version, and checksum after write.
465
+
466
+ When tasks introduce or rename implementation-facing identifiers, public contract fields, tests, fixtures, schemas, docs, or examples, load `references/naming-standards.md` and use meaningful domain or precise role names. Cross-reference `references/context-firewall.md` when tasks must keep chat context out of artifacts.
467
+
468
+ ## Always-Generated Planning Tables
469
+
470
+ When Tasks runs, always generate these sections before listing implementation tasks:
471
+
472
+ - `## Test Coverage Matrix`: every in-scope requirement maps to assertion layer, expected outcomes, edge/error cases, and evidence source. If the project has no tests for a requirement, record the gap and required artifact check instead of omitting the row.
473
+ - `## Project Testing Guidelines Scan`: inspect repository docs, existing tests, package scripts, harness commands, and neighboring files to identify test placement and conventions. (This is Step 0 of the generation process above.)
474
+ - `## Gate Check Commands`: name the exact quick, full, build, lint, type, validation, or artifact check commands expected for task approval and final validation.
475
+ - `## Test Co-location Validation`: for every task, show expected test/artifact location and the convention or file evidence used.
476
+
477
+ ## Massa-ai Integration
478
+
479
+ Before sampling tests manually, prefer massa-ai tooling to read the codebase:
480
+
481
+ 1. **Code analysis priority.** Run `list_projects`, then `project_map` and `search` / `optimized_context` to discover test files, test config, and layer structure BEFORE falling back to `ast-grep` / `rg` / `grep`. If the index is stale or missing, current source always overrides the index or a stored memory; reindex only when freshness blocks the decision.
482
+ 2. **Durable memory.** Tag confirmed planning artifacts with `remember` using `project:<id>`, `session:<id>`, `workflow:spec-driven`, `entity:<slug>`, and `memory:working|episodic|semantic|procedural`.
483
+ 3. **Validation: evidence-or-zero.** Every coverage claim and gate command must be confirmed against current source. No evidence → no claim.
484
+
485
+ ## Rules
486
+
487
+ - Keep tasks atomic enough to verify independently.
488
+ - Order tasks so earlier tasks leave the repository buildable and testable.
489
+ - Do not create tasks that require hidden chat context; every task must point to the spec/design evidence it needs.
490
+ - If a task reveals a missing requirement or design decision, stop and update the earlier artifact (`.specs/features/<slug>/spec.md` or `design.md`) before continuing.
491
+
492
+ ## Done
493
+
494
+ Tasks is done when every in-scope requirement maps to one or more executable tasks, dependencies are explicit, the Test Coverage Matrix and Gate Check Commands are present, project testing guideline scan and pre-approval checks are recorded, the three mandatory pre-approval tables (Granularity, Diagram-Definition Cross-Check, Test Co-location Validation) pass, and each task has deterministic validation with artifact-store evidence recorded.