@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.
- package/.cursor-plugin/plugin.json +5 -0
- package/README.md +87 -0
- package/agents/massa-ai-architecture-specialist.md +65 -0
- package/agents/massa-ai-audit-specialist.md +81 -0
- package/agents/massa-ai-builder.md +67 -0
- package/agents/massa-ai-context-curator.md +67 -0
- package/agents/massa-ai-documentation-agent.md +65 -0
- package/agents/massa-ai-furps-analyst.md +71 -0
- package/agents/massa-ai-investigator.md +68 -0
- package/agents/massa-ai-mobile-specialist.md +82 -0
- package/agents/massa-ai-navigator.md +75 -0
- package/agents/massa-ai-plan-critic.md +90 -0
- package/agents/massa-ai-planner.md +65 -0
- package/agents/massa-ai-requirements-analyst.md +64 -0
- package/agents/massa-ai-reviewer.md +66 -0
- package/agents/massa-ai-test-engineer.md +66 -0
- package/agents/massa-ai-verification-agent.md +65 -0
- package/hooks/hooks.json +26 -0
- package/hooks/massa-ai-hook +298 -0
- package/install.sh +413 -0
- package/package.json +30 -0
- package/skills/agents/architecture-specialist/SKILL.md +69 -0
- package/skills/agents/audit-specialist/SKILL.md +85 -0
- package/skills/agents/builder/SKILL.md +71 -0
- package/skills/agents/context-curator/SKILL.md +71 -0
- package/skills/agents/documentation-agent/SKILL.md +69 -0
- package/skills/agents/furps-analyst/SKILL.md +74 -0
- package/skills/agents/investigator/SKILL.md +72 -0
- package/skills/agents/mobile-specialist/SKILL.md +86 -0
- package/skills/agents/navigator/SKILL.md +79 -0
- package/skills/agents/plan-critic/SKILL.md +93 -0
- package/skills/agents/planner/SKILL.md +69 -0
- package/skills/agents/requirements-analyst/SKILL.md +68 -0
- package/skills/agents/reviewer/SKILL.md +70 -0
- package/skills/agents/test-engineer/SKILL.md +70 -0
- package/skills/agents/verification-agent/SKILL.md +69 -0
- package/skills/def/SKILL.md +17 -0
- package/skills/find/SKILL.md +19 -0
- package/skills/graph/SKILL.md +16 -0
- package/skills/index/SKILL.md +19 -0
- package/skills/map/SKILL.md +24 -0
- package/skills/massa-ai/SKILL.md +315 -0
- package/skills/massa-ai/personas/README.md +35 -0
- package/skills/massa-ai/personas/ai-native-nodejs-cli-architect.md +76 -0
- package/skills/massa-ai/personas/catalog.json +157 -0
- package/skills/massa-ai/personas/context-skill-harness-engineer-architect.md +74 -0
- package/skills/massa-ai/personas/product-manager.md +67 -0
- package/skills/massa-ai/personas/senior-mobile-engineer.md +74 -0
- package/skills/massa-ai/personas/senior-mobile-qa-automation-engineer.md +75 -0
- package/skills/massa-ai/references/adr-authoring.md +189 -0
- package/skills/massa-ai/references/agent-orchestration.md +221 -0
- package/skills/massa-ai/references/architecture-coupling-lens.md +239 -0
- package/skills/massa-ai/references/architecture-deepening-lens.md +136 -0
- package/skills/massa-ai/references/architecture-domain-lens.md +186 -0
- package/skills/massa-ai/references/architecture-lenses.md +108 -0
- package/skills/massa-ai/references/audit-report-io.md +459 -0
- package/skills/massa-ai/references/audit-scope.md +103 -0
- package/skills/massa-ai/references/code-annotation.md +111 -0
- package/skills/massa-ai/references/codebase-investigation.md +96 -0
- package/skills/massa-ai/references/context-firewall.md +62 -0
- package/skills/massa-ai/references/conversation-feedback.md +104 -0
- package/skills/massa-ai/references/debug-diagnosis-loop.md +140 -0
- package/skills/massa-ai/references/decision-engine.md +73 -0
- package/skills/massa-ai/references/evidence-gate.md +53 -0
- package/skills/massa-ai/references/furps/analyst-role.md +49 -0
- package/skills/massa-ai/references/furps/checklist.md +92 -0
- package/skills/massa-ai/references/furps/intake.md +104 -0
- package/skills/massa-ai/references/furps/report-contract.md +140 -0
- package/skills/massa-ai/references/hook-enforcement.md +137 -0
- package/skills/massa-ai/references/implementation-delivery.md +101 -0
- package/skills/massa-ai/references/installation.md +110 -0
- package/skills/massa-ai/references/lessons.md +119 -0
- package/skills/massa-ai/references/maestro/artifacts-reports.md +69 -0
- package/skills/massa-ai/references/maestro/cli-device.md +65 -0
- package/skills/massa-ai/references/maestro/cloud.md +67 -0
- package/skills/massa-ai/references/maestro/config-env-output.md +76 -0
- package/skills/massa-ai/references/maestro/fact-ledger.md +71 -0
- package/skills/massa-ai/references/maestro/js-scripting.md +70 -0
- package/skills/massa-ai/references/maestro/mcp.md +59 -0
- package/skills/massa-ai/references/maestro/patterns.md +96 -0
- package/skills/massa-ai/references/maestro/selectors.md +91 -0
- package/skills/massa-ai/references/maestro/workspace-execution.md +81 -0
- package/skills/massa-ai/references/maestro/yaml-commands.md +203 -0
- package/skills/massa-ai/references/maestro.md +47 -0
- package/skills/massa-ai/references/mcp-tools.md +296 -0
- package/skills/massa-ai/references/memory-policy.md +103 -0
- package/skills/massa-ai/references/mobile-context.md +113 -0
- package/skills/massa-ai/references/mobile-diagnosis.md +106 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ATTRIBUTION.md +5 -0
- package/skills/massa-ai/references/mobile-figma-matcher/android-compose.md +13 -0
- package/skills/massa-ai/references/mobile-figma-matcher/android-views.md +13 -0
- package/skills/massa-ai/references/mobile-figma-matcher/core.md +117 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ios-swiftui.md +12 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ios-uikit.md +12 -0
- package/skills/massa-ai/references/mobile-figma-matcher/kmp-compose-multiplatform.md +14 -0
- package/skills/massa-ai/references/mobile-figma-matcher/repository-detection.md +77 -0
- package/skills/massa-ai/references/naming-standards.md +47 -0
- package/skills/massa-ai/references/pr-task-fix.md +80 -0
- package/skills/massa-ai/references/project-context.md +76 -0
- package/skills/massa-ai/references/rfc/ATTRIBUTION.md +5 -0
- package/skills/massa-ai/references/rfc/discovery-and-sizing.md +120 -0
- package/skills/massa-ai/references/rfc/document-contract.md +85 -0
- package/skills/massa-ai/references/rfc/quality-and-lifecycle.md +101 -0
- package/skills/massa-ai/references/root-cause-scripts.md +97 -0
- package/skills/massa-ai/references/spec-driven/artifact-store.md +98 -0
- package/skills/massa-ai/references/spec-driven/code-analysis.md +119 -0
- package/skills/massa-ai/references/spec-driven/coding-principles.md +80 -0
- package/skills/massa-ai/references/spec-driven/context-limits.md +64 -0
- package/skills/massa-ai/references/spec-driven/design.md +257 -0
- package/skills/massa-ai/references/spec-driven/discuss.md +182 -0
- package/skills/massa-ai/references/spec-driven/execute.md +471 -0
- package/skills/massa-ai/references/spec-driven/lessons.md +5 -0
- package/skills/massa-ai/references/spec-driven/memory.md +214 -0
- package/skills/massa-ai/references/spec-driven/specify.md +283 -0
- package/skills/massa-ai/references/spec-driven/sub-agents.md +151 -0
- package/skills/massa-ai/references/spec-driven/tasks.md +494 -0
- package/skills/massa-ai/references/spec-driven/validate.md +397 -0
- package/skills/massa-ai/references/subagent-design.md +132 -0
- package/skills/massa-ai/references/synapse-policy.md +160 -0
- package/skills/massa-ai/references/tdd/calibrated-examples.md +54 -0
- package/skills/massa-ai/references/tdd/discovery-and-sizing.md +83 -0
- package/skills/massa-ai/references/tdd/document-contract.md +136 -0
- package/skills/massa-ai/references/tdd/quality-and-lifecycle.md +83 -0
- package/skills/massa-ai/references/the-fool/cognitive-bias-inventory.md +103 -0
- package/skills/massa-ai/references/the-fool/dialectic-synthesis.md +170 -0
- package/skills/massa-ai/references/the-fool/evidence-audit.md +202 -0
- package/skills/massa-ai/references/the-fool/mode-selection-guide.md +113 -0
- package/skills/massa-ai/references/the-fool/pre-mortem-analysis.md +200 -0
- package/skills/massa-ai/references/the-fool/red-team-adversarial.md +206 -0
- package/skills/massa-ai/references/the-fool/socratic-questioning.md +153 -0
- package/skills/massa-ai/references/ticket/atlassian-fix.md +130 -0
- package/skills/massa-ai/references/ticket/intake-and-sources.md +65 -0
- package/skills/massa-ai/references/ticket/templates-and-quality.md +129 -0
- package/skills/massa-ai/references/verification-ladder.md +62 -0
- package/skills/massa-ai/scripts/lessons.py +590 -0
- package/skills/massa-ai/workflows/adr.md +33 -0
- package/skills/massa-ai/workflows/architecture/architecture-audit.md +125 -0
- package/skills/massa-ai/workflows/architecture/architecture-fix.md +110 -0
- package/skills/massa-ai/workflows/bugs/bugs-audit.md +113 -0
- package/skills/massa-ai/workflows/bugs/bugs-fix.md +97 -0
- package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +154 -0
- package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +99 -0
- package/skills/massa-ai/workflows/commit.md +61 -0
- package/skills/massa-ai/workflows/debug.md +86 -0
- package/skills/massa-ai/workflows/design.md +54 -0
- package/skills/massa-ai/workflows/exploration.md +119 -0
- package/skills/massa-ai/workflows/feature.md +52 -0
- package/skills/massa-ai/workflows/general.md +46 -0
- package/skills/massa-ai/workflows/implementation/implementation-audit.md +87 -0
- package/skills/massa-ai/workflows/implementation/implementation-fix.md +90 -0
- package/skills/massa-ai/workflows/long-session.md +44 -0
- package/skills/massa-ai/workflows/maestro/maestro-audit.md +56 -0
- package/skills/massa-ai/workflows/maestro/maestro-fix.md +74 -0
- package/skills/massa-ai/workflows/maestro/maestro.md +68 -0
- package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +68 -0
- package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +74 -0
- package/skills/massa-ai/workflows/onboarding.md +23 -0
- package/skills/massa-ai/workflows/refactor.md +47 -0
- package/skills/massa-ai/workflows/refinement/furps-refinement.md +81 -0
- package/skills/massa-ai/workflows/requirements/requirements-audit.md +114 -0
- package/skills/massa-ai/workflows/requirements/requirements-fix.md +93 -0
- package/skills/massa-ai/workflows/rfc.md +55 -0
- package/skills/massa-ai/workflows/security/security-audit.md +113 -0
- package/skills/massa-ai/workflows/security/security-fix.md +97 -0
- package/skills/massa-ai/workflows/spec-driven.md +217 -0
- package/skills/massa-ai/workflows/tdd.md +71 -0
- package/skills/massa-ai/workflows/tests/tests-audit.md +114 -0
- package/skills/massa-ai/workflows/tests/tests-fix.md +96 -0
- package/skills/massa-ai/workflows/the-fool.md +82 -0
- package/skills/massa-ai/workflows/ticket.md +42 -0
- package/skills/persona-router/SKILL.md +158 -0
- package/skills/status/SKILL.md +15 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Spec-Driven Memory And State
|
|
2
|
+
|
|
3
|
+
Use this reference when recording decisions, progress, blockers, handoff, or completion evidence for a spec-driven feature.
|
|
4
|
+
|
|
5
|
+
This memory layer is split across two artifacts with distinct lifecycles. Each has its own write triggers; writes are always section-scoped — never whole-file overwrites.
|
|
6
|
+
|
|
7
|
+
- `.specs/project/STATE.md` owns project-level **Decisions** (append-only) plus current objective, progress, blockers, verification evidence, changed files, and exact next step.
|
|
8
|
+
- `.specs/HANDOFF.md` owns the local **Handoff** snapshot (replace-on-pause).
|
|
9
|
+
- `.specs/project/FEATURES.json` owns the feature registry: `active_feature`, status, dependencies, and completion evidence.
|
|
10
|
+
- `.specs/features/<slug>/` owns approved feature artifacts.
|
|
11
|
+
- Use `references/spec-driven/artifact-store.md` for artifact read/write operations.
|
|
12
|
+
|
|
13
|
+
## STATE Precedence Chain
|
|
14
|
+
|
|
15
|
+
When sources conflict, resolve in this strict order — first match wins, lower sources never override higher:
|
|
16
|
+
|
|
17
|
+
1. **Fresh user instruction** — the live user's explicit direction for the current decision.
|
|
18
|
+
2. **Approved `.specs/` artifact** — the current `spec.md`/`design.md`/`tasks.md` approved for the active feature.
|
|
19
|
+
3. **STATE / HANDOFF** — `.specs/project/STATE.md` and `.specs/HANDOFF.md` position and decision logs.
|
|
20
|
+
4. **massa-ai memory** — durable cross-session recall; context until confirmed against current source.
|
|
21
|
+
|
|
22
|
+
massa-ai memory and external summaries are discovery, not authority. If a higher source is silent, the next source decides; if a lower source contradicts a higher one, the higher source wins and the lower one is corrected. Record the resolution in STATE so the chain stays auditable. `references/spec-driven/artifact-store.md` mirrors this chain for artifact reads.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Artifact State
|
|
27
|
+
|
|
28
|
+
- `.specs/project/FEATURES.json` owns feature registry, `active_feature`, status, dependencies, and completion evidence.
|
|
29
|
+
- `.specs/project/STATE.md` owns current objective, progress, blockers, verification evidence, changed files, exact next step, and project-level Decisions.
|
|
30
|
+
- `.specs/HANDOFF.md` owns local handoff state.
|
|
31
|
+
- `.specs/features/<slug>/` owns approved feature artifacts.
|
|
32
|
+
- Writes to `.specs/project/STATE.md` are section-scoped: update only the section needed for the current event instead of rewriting unrelated history.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Decision Log
|
|
37
|
+
|
|
38
|
+
Records **project-level** decisions only: conventions, patterns, constraints, or cross-cutting technology choices that future features must follow or supersede. Record `AD-NNN` entries in `.specs/project/STATE.md` only when they affect future work. Include decision, status, context, alternatives rejected, and evidence.
|
|
39
|
+
|
|
40
|
+
**Not project-level → stays in the feature's `design.md` Tech Decisions table.**
|
|
41
|
+
Heuristic: would a different feature need to know about this? If yes → project-level. If no → feature-local.
|
|
42
|
+
|
|
43
|
+
**Format** (one entry per decision):
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
### AD-001
|
|
47
|
+
- **Decision**: [what was decided — one sentence]
|
|
48
|
+
- **Reason**: [why this option was chosen]
|
|
49
|
+
- **Trade-off**: [what was given up]
|
|
50
|
+
- **Scope**: [which features / packages / layers this governs]
|
|
51
|
+
- **Date**: YYYY-MM-DD
|
|
52
|
+
- **Status**: active | superseded by AD-NNN
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Decision status values:
|
|
56
|
+
|
|
57
|
+
- `active`: current project standard.
|
|
58
|
+
- `superseded by AD-NNN`: replaced by a newer decision.
|
|
59
|
+
|
|
60
|
+
**Supersession rule:** when a new decision replaces an old one, append a new `AD-NNN` entry and update the old entry's `status` field to `superseded by AD-NNN`. Never delete old entries — the history is the audit trail.
|
|
61
|
+
|
|
62
|
+
### AD-NNN numbering
|
|
63
|
+
|
|
64
|
+
- Numbers are sequential, project-scoped, and permanent — never reused.
|
|
65
|
+
- The counter starts at `AD-001`. Check existing entries before assigning the next number.
|
|
66
|
+
- If `.specs/project/STATE.md` does not exist, the first decision is `AD-001`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Handoff
|
|
71
|
+
|
|
72
|
+
Captures mid-task / in-flight state so work can resume without re-reading the full task history. This is the sole position tracker; it complements `tasks.md` by recording state that `tasks.md` does not capture.
|
|
73
|
+
|
|
74
|
+
**File:** `.specs/HANDOFF.md` (replace-on-pause, ~500 tokens).
|
|
75
|
+
|
|
76
|
+
**Format:**
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
- **Feature**: [feature name / .specs path]
|
|
80
|
+
- **Phase / Task**: [e.g., Phase 2 / T4 — implement repository layer]
|
|
81
|
+
- **Completed**: [comma-separated task IDs or "none"]
|
|
82
|
+
- **In-progress** (file:line): [e.g., `src/billing/subscription.service.ts:88` — mid-write]
|
|
83
|
+
- **Next step**: [one sentence — exactly what to do next]
|
|
84
|
+
- **Blockers**: [none | description]
|
|
85
|
+
- **Uncommitted files**: [list or "none"]
|
|
86
|
+
- **Branch**: [git branch name]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Before pausing, update `.specs/project/STATE.md` and `.specs/HANDOFF.md` with:
|
|
90
|
+
|
|
91
|
+
- Current objective.
|
|
92
|
+
- Completed work.
|
|
93
|
+
- Pending work.
|
|
94
|
+
- Blockers and risks.
|
|
95
|
+
- Changed files.
|
|
96
|
+
- Verification evidence.
|
|
97
|
+
- Exact next step.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## File shape
|
|
102
|
+
|
|
103
|
+
`.specs/project/STATE.md`:
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
# STATE
|
|
107
|
+
|
|
108
|
+
## Decisions
|
|
109
|
+
|
|
110
|
+
[AD-NNN entries…]
|
|
111
|
+
|
|
112
|
+
## Blockers
|
|
113
|
+
|
|
114
|
+
- B-001: [blocker — what is blocked, why, unblock condition] (added YYYY-MM-DD)
|
|
115
|
+
|
|
116
|
+
## Deferred Ideas
|
|
117
|
+
|
|
118
|
+
- [idea / candidate scope] — deferred because [reason]; revisit when [trigger]
|
|
119
|
+
|
|
120
|
+
## Quick Tasks
|
|
121
|
+
|
|
122
|
+
| ID | Slug | Files | Status | Summary |
|
|
123
|
+
| --- | --- | --- | --- | --- |
|
|
124
|
+
| 001 | fix-typo-in-readme | 1 | done | README typo; gate green |
|
|
125
|
+
|
|
126
|
+
## Preferences
|
|
127
|
+
|
|
128
|
+
- model-guidance-shown: true | false
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Plus objective, progress, blockers, verification evidence, changed files, and next step sections per `references/spec-driven/artifact-store.md`.
|
|
132
|
+
|
|
133
|
+
**Structured section rules:**
|
|
134
|
+
|
|
135
|
+
- **Blockers** use stable `B-NNN` ids (project-scoped, sequential, permanent — like `AD-NNN`). Each entry names what is blocked, why, and the unblock condition. Clear the entry (mark resolved with date) when the blocker lifts; never delete — the history is the audit trail.
|
|
136
|
+
- **Deferred Ideas** are explicit parking: candidate work deliberately not taken now, with the revisit trigger. They are not blockers and not tasks — they prevent rediscovery loops.
|
|
137
|
+
- **Quick Tasks** table mirrors `.specs/quick/NNN-slug/` entries (see `references/spec-driven/artifact-store.md`). When 5+ quick tasks accumulate in one area, promote to a feature (Quick mode guardrails in `workflows/spec-driven.md`).
|
|
138
|
+
- **Preferences** tracks cross-cutting flags. `model-guidance-shown` records whether the per-session model-tier guidance note has already been delivered, so it is shown at most once per session.
|
|
139
|
+
|
|
140
|
+
`.specs/HANDOFF.md`:
|
|
141
|
+
|
|
142
|
+
```markdown
|
|
143
|
+
# HANDOFF
|
|
144
|
+
|
|
145
|
+
[latest snapshot…]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
If either file does not yet exist, create it with its section headers and an empty body.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Read / Write Triggers
|
|
153
|
+
|
|
154
|
+
| Trigger | Section | Operation |
|
|
155
|
+
| ------- | ------- | --------- |
|
|
156
|
+
| Design phase, Step 1 (Load Context) | `## Decisions` | **Read** — conform to active decisions or supersede |
|
|
157
|
+
| Design phase, Tech Decisions step | `## Decisions` | **Append** — only for project-level decisions |
|
|
158
|
+
| Pause work / end of session | `.specs/HANDOFF.md` | **Replace** — overwrite Handoff snapshot only |
|
|
159
|
+
| Resume work / start of session | `.specs/HANDOFF.md` | **Read** — load snapshot, propose next step |
|
|
160
|
+
| Resume work / start of session | `## Decisions` | **Read** — re-confirm active constraints before designing |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Section-scoped write rule (critical)
|
|
165
|
+
|
|
166
|
+
Two artifacts hold two distinct lifecycles. Writes MUST target their section only:
|
|
167
|
+
|
|
168
|
+
- **Design appends** to `## Decisions` in `.specs/project/STATE.md`. It MUST NOT touch `.specs/HANDOFF.md`.
|
|
169
|
+
- **Pause replaces** `.specs/HANDOFF.md`. It MUST NOT rewrite, reorder, or drop any entry in `## Decisions`.
|
|
170
|
+
|
|
171
|
+
The correct technique: locate the target section header, replace only the content between it and the next `##` header (or end of file). Never overwrite the full file.
|
|
172
|
+
|
|
173
|
+
Violating this rule causes one of two failures:
|
|
174
|
+
1. A pause write clobbers the decisions log → decisions are silently lost.
|
|
175
|
+
2. A design append touches the handoff snapshot → mid-task state is corrupted.
|
|
176
|
+
|
|
177
|
+
Both are silent data loss. The section-scoped write rule is the single correctness invariant of this memory layer.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Pause / Resume Procedure
|
|
182
|
+
|
|
183
|
+
### Pause
|
|
184
|
+
|
|
185
|
+
1. Locate the `## Handoff` content in `.specs/HANDOFF.md` (and the objective/progress/next-step sections in `.specs/project/STATE.md`).
|
|
186
|
+
2. Replace the Handoff body (everything between the header and the next `##` or EOF) with the current snapshot.
|
|
187
|
+
3. Do NOT modify anything above the Handoff section or touch `## Decisions`.
|
|
188
|
+
4. Commit or stash outstanding changes as appropriate.
|
|
189
|
+
|
|
190
|
+
### Resume
|
|
191
|
+
|
|
192
|
+
1. Read `.specs/project/STATE.md` and `.specs/HANDOFF.md` — both.
|
|
193
|
+
2. Re-confirm active decisions from `## Decisions` — nothing superseded since last session?
|
|
194
|
+
3. Read `.specs/HANDOFF.md` — identify feature, phase/task, next step, blockers, uncommitted files, branch.
|
|
195
|
+
4. Propose the next step to the user before writing any code.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Durable Memory
|
|
200
|
+
|
|
201
|
+
Use `remember` for durable cross-session decisions, rejected approaches, reusable verification recipes, repeated lessons, and high-signal gotchas after recall and importance scoring. Do not persist one-off command output, chat summaries, raw transcripts, raw logs, copied source, raw search output, raw subagent output, customer data, secrets, or already-captured facts.
|
|
202
|
+
|
|
203
|
+
Required massa-ai tags for durable memory:
|
|
204
|
+
|
|
205
|
+
- `project:<projectId>`
|
|
206
|
+
- `session:<workflowSessionId>`
|
|
207
|
+
- `workflow:spec-driven`
|
|
208
|
+
- `entity:<feature-or-domain>`
|
|
209
|
+
- one of `memory:working`, `memory:episodic`, `memory:semantic`, or `memory:procedural`
|
|
210
|
+
|
|
211
|
+
Current source and `.specs/` artifacts remain authoritative for implementation evidence; massa-ai durable memory is context until confirmed against current source.
|
|
212
|
+
|
|
213
|
+
Completion and handoff reports must state the memory outcome:
|
|
214
|
+
written, intentionally skipped with reason, duplicate skipped, forbidden payload skipped, or failed write with recovery note.
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# Spec-Driven Specify
|
|
2
|
+
|
|
3
|
+
Use this reference for the required Specify phase. **Goal**: Capture WHAT to build with testable, traceable requirements. The output is `.specs/features/<slug>/spec.md`.
|
|
4
|
+
|
|
5
|
+
If the feature has ambiguous gray areas (multiple valid approaches for user-facing behavior), the agent will automatically trigger the [discuss gray areas](discuss.md) process within this phase. For clear, well-defined features, it goes straight to the next phase.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
|
|
9
|
+
- First user request and any supplied requirement source.
|
|
10
|
+
- Current repository source and docs needed to understand scope.
|
|
11
|
+
- Existing `.specs/features/<slug>/` artifacts when resuming.
|
|
12
|
+
- `.specs/LESSONS.md` only when lessons are enabled by existing lesson artifacts.
|
|
13
|
+
|
|
14
|
+
## Required Sections
|
|
15
|
+
|
|
16
|
+
`spec.md` must include:
|
|
17
|
+
|
|
18
|
+
- Feature name and slug.
|
|
19
|
+
- Problem statement.
|
|
20
|
+
- Requirements table with stable requirement IDs such as `REQ-001`.
|
|
21
|
+
- Testable acceptance criteria linked to requirement IDs.
|
|
22
|
+
- Edge cases and failure modes.
|
|
23
|
+
- Explicit out-of-scope table.
|
|
24
|
+
- Open questions table.
|
|
25
|
+
- Accepted assumptions table.
|
|
26
|
+
- Verification approach.
|
|
27
|
+
- Discuss context summary when `references/spec-driven/discuss.md` was triggered.
|
|
28
|
+
- Artifact-store evidence: active artifact key, version, and checksum after write.
|
|
29
|
+
|
|
30
|
+
## Implicit-Requirement Dimensions
|
|
31
|
+
|
|
32
|
+
The canonical rubric for requirements that are easy to miss. Referenced by [discuss.md](discuss.md) — defined here, not duplicated.
|
|
33
|
+
|
|
34
|
+
| Dimension | What to cover |
|
|
35
|
+
| --------- | ------------- |
|
|
36
|
+
| Input validation & bounds | Limits, formats, sanitization |
|
|
37
|
+
| Failure / partial-failure states | Timeouts, partial saves, rollbacks |
|
|
38
|
+
| Idempotency / retry / duplicate handling | Safe retries, dedup keys |
|
|
39
|
+
| Auth boundaries & rate limits | Who can call what, throttle rules |
|
|
40
|
+
| Concurrency / ordering | Race conditions, ordering guarantees |
|
|
41
|
+
| Data lifecycle / expiry | TTL, archival, deletion |
|
|
42
|
+
| Observability | Logging, metrics, tracing hooks |
|
|
43
|
+
| External-dependency failure | Circuit breakers, fallbacks |
|
|
44
|
+
| State-transition integrity | Valid transitions, guards |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Implicit-Requirement Sweep
|
|
49
|
+
|
|
50
|
+
Before requirements close, check the dimensions above (and the prose list below) and either produce a requirement, accepted assumption, explicit out-of-scope row, or `N/A because <reason>` entry:
|
|
51
|
+
|
|
52
|
+
- Users, actors, permissions, and ownership.
|
|
53
|
+
- Inputs, outputs, payload fields, persisted records, emitted events, and returned objects.
|
|
54
|
+
- State transitions, concurrency, retries, idempotency, cancellation, and partial failure.
|
|
55
|
+
- Data migration, compatibility, privacy, auth, security, auditability, and irreversible behavior.
|
|
56
|
+
- Empty, loading, error, timeout, offline, unavailable dependency, and malformed-input states.
|
|
57
|
+
- Performance, observability, accessibility, localization, and platform-specific behavior when relevant.
|
|
58
|
+
- Testing and validation expectations, including which acceptance criteria require deterministic assertions.
|
|
59
|
+
|
|
60
|
+
The table is canonical; the prose is the applied sweep. **Large/Complex** work must cover every dimension above. **Medium** work resolves obvious ambiguities and records accepted assumptions for the rest. **Small** work can skip the sweep only when the skip reason is recorded and no dimension changes behavior or acceptance criteria.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Process
|
|
65
|
+
|
|
66
|
+
### 1. Clarify Requirements
|
|
67
|
+
|
|
68
|
+
**Load confirmed lessons first:** Before clarifying, load the project's confirmed lessons so past verification failures shape this spec instead of repeating. Run `python3 skills/massa-ai/scripts/lessons.py --root . list --status confirmed` (optionally `--scope [area]` or `--query [term]` for the area this feature touches) and apply what comes back as guidance. Load only `confirmed` — never `candidate` or `quarantined`. If no store exists yet or no code tool is available, skip silently. See [lessons.md](../lessons.md).
|
|
69
|
+
|
|
70
|
+
**Lightweight context scan first (Knowledge Verification Chain Step 1):** Before asking questions, briefly scan existing code, patterns, and neighboring features relevant to this feature. Prefer massa-ai tooling first (`list_projects`, `search`, `project_map`, `optimized_context`) before `ast-grep`/`rg`/`grep`, honoring freshness and source-precedence (current source overrides stale index/memory). Use what you find to ground your clarifying questions in reality — not to constrain the spec to current implementation. Keep it lightweight (stay within the <40k token budget; reuse the chain, no new machinery). The spec captures WHAT is needed, not only what exists.
|
|
71
|
+
|
|
72
|
+
You are a thinking partner, not an interviewer. Start open — let the user dump their mental model. Follow the energy: whatever they emphasize, dig into that.
|
|
73
|
+
|
|
74
|
+
Ask conversationally (not as a checklist):
|
|
75
|
+
|
|
76
|
+
- "What problem are you solving?"
|
|
77
|
+
- "Who is the user and what's their pain?"
|
|
78
|
+
- "What does success look like?"
|
|
79
|
+
|
|
80
|
+
If needed:
|
|
81
|
+
|
|
82
|
+
- "What are the constraints (time, tech, resources)?"
|
|
83
|
+
- "What is explicitly out of scope?"
|
|
84
|
+
|
|
85
|
+
**Challenge vagueness.** Never accept fuzzy answers. "Good" means what? "Users" means who? "Simple" means how? Make the abstract concrete: "Walk me through using this." "What does that actually look like?"
|
|
86
|
+
|
|
87
|
+
**Know when to stop — then run the dimensions sweep.** When you understand what they're building, why, who it's for, and what done looks like, run a closing **implicit-requirement dimensions sweep** before offering to proceed:
|
|
88
|
+
|
|
89
|
+
- **Large / Complex:** Cover every dimension above — each must resolve to a requirement OR an explicit `N/A because [reason]`. No blank entries allowed.
|
|
90
|
+
- **Medium:** Cover only dimensions obviously present for this feature's domain; collapse the rest to a single `remaining dimensions N/A for this scope`.
|
|
91
|
+
- **Small:** Skip the sweep entirely.
|
|
92
|
+
|
|
93
|
+
The `N/A because...` escape is mandatory — it prevents inventing requirements to fill the checklist. Bound the sweep to THIS feature's scope; never add requirements outside the feature boundary.
|
|
94
|
+
|
|
95
|
+
### 2. Capture User Stories with Priorities
|
|
96
|
+
|
|
97
|
+
**P1 = MVP** (must ship), **P2** (should have), **P3** (nice to have)
|
|
98
|
+
|
|
99
|
+
Each story MUST be **independently testable** — you can implement and demo just that story.
|
|
100
|
+
|
|
101
|
+
### 3. Write Acceptance Criteria
|
|
102
|
+
|
|
103
|
+
Use **WHEN/THEN/SHALL** format — it's precise and testable:
|
|
104
|
+
|
|
105
|
+
- WHEN [event/action] THEN [system] SHALL [response/behavior]
|
|
106
|
+
|
|
107
|
+
### 4. Requirement Closure Gate (before confirm)
|
|
108
|
+
|
|
109
|
+
Before Design, Tasks, or Execute — and before presenting the spec for confirmation — run the checks below. The spec is not presentable for confirmation until every item is resolved or assumption-logged. This is the guarantee that no requirement leaves the spec silently unclear.
|
|
110
|
+
|
|
111
|
+
**Scope-tiered:** Large/Complex = full gate; Medium = resolve obvious ambiguities, log the rest as assumptions; Small = skip entirely (consistent with skipping the sweep).
|
|
112
|
+
|
|
113
|
+
1. **List every open requirement question.** Enumerate every unresolved decision that surfaced during clarification.
|
|
114
|
+
|
|
115
|
+
2. **Resolve each question with the user** when it changes behavior, scope, data, security/privacy, compatibility, or acceptance criteria.
|
|
116
|
+
|
|
117
|
+
3. **Unambiguity + precision (hard).** Every AC must (a) have a single interpretation and (b) define a precise, spec-defined expected outcome. Any AC that fails either check: resolve with the user, split it, or log it as an explicit assumption with the chosen interpretation and rationale. No AC proceeds readable two ways or with an undefined outcome.
|
|
118
|
+
|
|
119
|
+
4. **Open-questions / assumptions closure.** Each question must be either (a) resolved with the user OR (b) recorded as an **assumption** (chosen default + rationale) in the spec's Assumptions & Open Questions section. If the user accepts a default, record it as an accepted assumption with the affected requirement IDs. Nothing proceeds unmarked.
|
|
120
|
+
|
|
121
|
+
5. **Declined gray areas become assumptions.** Any gray area the user declined to discuss or that went undiscussed is written to the spec's Assumptions & Open Questions section (agent's chosen default + rationale) — never silently dropped. Refused, deferred, or intentionally excluded areas go in the out-of-scope table. See [discuss.md](discuss.md).
|
|
122
|
+
|
|
123
|
+
6. **Continue only when** the Open Questions table is empty or every row has an accepted assumption.
|
|
124
|
+
|
|
125
|
+
Fix inline. This gate is bounded to THIS feature's stated dimensions and actual behavior — never to "anything imaginable." The Out of Scope table and anti-scope-creep rules remain the counterweights: the gate clarifies existing requirements, it never invents new ones.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Discuss Trigger
|
|
130
|
+
|
|
131
|
+
Load `references/spec-driven/discuss.md` during Specify when the request has gray areas that change behavior or acceptance criteria, especially persistence/state, external calls, auth, payments, concurrency, state transitions, compatibility, permissions, user-facing workflows, data loss, implicit requirements, or multiple plausible interpretations. Record the result in `.specs/features/<slug>/context.md` or a compact Discuss section in `spec.md`.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Sizing Signals
|
|
136
|
+
|
|
137
|
+
After requirements close, decide the remaining phases:
|
|
138
|
+
|
|
139
|
+
- Include **Design** when architecture, interfaces, data model, migration, security/privacy, public contract, reusable pattern decisions, or Large/Complex approach tradeoffs exist.
|
|
140
|
+
- Include **Tasks** when execution has more than 3 obvious linear steps or dependency/parallelism complexity.
|
|
141
|
+
- Record skipped phase reasons in `spec.md`, and reopen the phase if later evidence invalidates the skip.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Template: `.specs/features/<slug>/spec.md`
|
|
146
|
+
|
|
147
|
+
```markdown
|
|
148
|
+
# [Feature Name] Specification
|
|
149
|
+
|
|
150
|
+
## Problem Statement
|
|
151
|
+
|
|
152
|
+
[Describe the problem in 2-3 sentences. What pain point are we solving? Why now?]
|
|
153
|
+
|
|
154
|
+
## Goals
|
|
155
|
+
|
|
156
|
+
- [ ] [Primary goal with measurable outcome]
|
|
157
|
+
- [ ] [Secondary goal with measurable outcome]
|
|
158
|
+
|
|
159
|
+
## Out of Scope
|
|
160
|
+
|
|
161
|
+
Explicitly excluded. Documented to prevent scope creep.
|
|
162
|
+
|
|
163
|
+
| Feature | Reason |
|
|
164
|
+
| ----------- | -------------- |
|
|
165
|
+
| [Feature X] | [Why excluded] |
|
|
166
|
+
| [Feature Y] | [Why excluded] |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Assumptions & Open Questions
|
|
171
|
+
|
|
172
|
+
Every ambiguity is resolved or recorded here — nothing is left silently unclear.
|
|
173
|
+
|
|
174
|
+
| Assumption / decision | Chosen default | Rationale | Confirmed? |
|
|
175
|
+
| --------------------- | --------------- | --------- | ---------- |
|
|
176
|
+
| [ambiguity] | [what we'll do] | [why] | [y/n] |
|
|
177
|
+
|
|
178
|
+
**Open questions:** none — all resolved or logged above (required before the spec is confirmed).
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## User Stories
|
|
183
|
+
|
|
184
|
+
### P1: [Story Title] ⭐ MVP
|
|
185
|
+
|
|
186
|
+
**User Story**: As a [role], I want [capability] so that [benefit].
|
|
187
|
+
|
|
188
|
+
**Why P1**: [Why this is critical for MVP]
|
|
189
|
+
|
|
190
|
+
**Acceptance Criteria**:
|
|
191
|
+
|
|
192
|
+
1. WHEN [user action/event] THEN system SHALL [expected behavior]
|
|
193
|
+
2. WHEN [user action/event] THEN system SHALL [expected behavior]
|
|
194
|
+
3. WHEN [edge case] THEN system SHALL [graceful handling]
|
|
195
|
+
|
|
196
|
+
**Independent Test**: [How to verify this story works alone - e.g., "Can demo by doing X and seeing Y"]
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### P2: [Story Title]
|
|
201
|
+
|
|
202
|
+
**User Story**: As a [role], I want [capability] so that [benefit].
|
|
203
|
+
|
|
204
|
+
**Why P2**: [Why this isn't MVP but important]
|
|
205
|
+
|
|
206
|
+
**Acceptance Criteria**:
|
|
207
|
+
|
|
208
|
+
1. WHEN [event] THEN system SHALL [behavior]
|
|
209
|
+
2. WHEN [event] THEN system SHALL [behavior]
|
|
210
|
+
|
|
211
|
+
**Independent Test**: [How to verify]
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### P3: [Story Title]
|
|
216
|
+
|
|
217
|
+
**User Story**: As a [role], I want [capability] so that [benefit].
|
|
218
|
+
|
|
219
|
+
**Why P3**: [Why this is nice-to-have]
|
|
220
|
+
|
|
221
|
+
**Acceptance Criteria**:
|
|
222
|
+
|
|
223
|
+
1. WHEN [event] THEN system SHALL [behavior]
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Edge Cases
|
|
228
|
+
|
|
229
|
+
- WHEN [boundary condition] THEN system SHALL [behavior]
|
|
230
|
+
- WHEN [error scenario] THEN system SHALL [graceful handling]
|
|
231
|
+
- WHEN [unexpected input] THEN system SHALL [validation response]
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Requirement Traceability
|
|
236
|
+
|
|
237
|
+
Each requirement gets a unique ID for tracking across design, tasks, and validation.
|
|
238
|
+
|
|
239
|
+
| Requirement ID | Story | Phase | Status |
|
|
240
|
+
| -------------- | ----------- | ------ | ------- |
|
|
241
|
+
| [FEAT]-01 | P1: [Story] | Design | Pending |
|
|
242
|
+
| [FEAT]-02 | P1: [Story] | Design | Pending |
|
|
243
|
+
| [FEAT]-03 | P2: [Story] | - | Pending |
|
|
244
|
+
|
|
245
|
+
**ID format:** `[CATEGORY]-[NUMBER]` (e.g., `AUTH-01`, `CART-03`, `NOTIF-02`)
|
|
246
|
+
|
|
247
|
+
**Status values:** Pending → In Design → In Tasks → Implementing → Verified
|
|
248
|
+
|
|
249
|
+
**Coverage:** X total, Y mapped to tasks, Z unmapped ⚠️
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Success Criteria
|
|
254
|
+
|
|
255
|
+
How we know the feature is successful:
|
|
256
|
+
|
|
257
|
+
- [ ] [Measurable outcome - e.g., "User can complete X in < 2 minutes"]
|
|
258
|
+
- [ ] [Measurable outcome - e.g., "Zero errors in Y scenario"]
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Tips
|
|
264
|
+
|
|
265
|
+
- **P1 = Vertical Slice** — A complete, demo-able feature, not just backend or frontend
|
|
266
|
+
- **WHEN/THEN is code** — If you can't write it as a test, rewrite it
|
|
267
|
+
- **Requirement IDs are mandatory** — Every story maps to trackable IDs
|
|
268
|
+
- **Edge cases matter** — What breaks? What's empty? What's huge?
|
|
269
|
+
- **Out of Scope prevents creep** — If it's not here, it doesn't get built
|
|
270
|
+
- **Closure gate before confirm** — Three checks: unambiguity + precision, open-questions/assumptions closure, declined gray areas logged; scope-tiered; bounded to stated dimensions; never invents requirements
|
|
271
|
+
- **Confirm after the gate passes** — Present the spec for user confirmation only after the closure gate passes (no unresolved-and-unmarked items remain); user approves spec before moving to the discuss phase
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Done
|
|
276
|
+
|
|
277
|
+
Specify is done when every requirement has an ID, acceptance criteria are testable, edge cases are named, out-of-scope boundaries are explicit, implicit-requirement dimensions are resolved or marked `N/A because <reason>`, and the Requirement Closure Gate is satisfied.
|
|
278
|
+
|
|
279
|
+
## Massa-ai Integration
|
|
280
|
+
|
|
281
|
+
- **Code analysis:** Use massa-ai tools first (`list_projects`, `search`, `project_map`, `optimized_context`) before `ast-grep`/`rg`/`grep` for the lightweight context scan. Current source overrides a stale index or memory (source-precedence rule).
|
|
282
|
+
- **Memory:** Persist verified outcomes worth reusing with `remember`, tagging `project:<id>`, `session:<id>`, `workflow:spec-driven`, `entity:<slug>`, `memory:working|episodic|semantic|procedural`.
|
|
283
|
+
- **Validation:** Evidence-or-zero. Every confirmed lesson applied, requirement resolved, and assumption logged is checked against current source.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Sub-Agent Delegation
|
|
2
|
+
|
|
3
|
+
Use this reference during Execute when formal task planning packs into more than one task-budgeted batch (> ~8 tasks), when the user explicitly asks for delegation, or when final validation needs an independent verifier. Full mechanics for phase-batch workers and the Verifier sub-agent used during Execute.
|
|
4
|
+
|
|
5
|
+
## Phase-Batch Workers
|
|
6
|
+
|
|
7
|
+
**Two layers — keep them distinct:**
|
|
8
|
+
|
|
9
|
+
- **Phase** = the semantic / dependency unit (Foundation → Core → Integration), authored during Tasks. Indivisible.
|
|
10
|
+
- **Batch** = the execution / logistics unit — one or more *consecutive whole phases* assigned to a single worker.
|
|
11
|
+
|
|
12
|
+
Conflating the two (one worker per phase) is what fragments execution: a feature's dependency-layer count has nothing to do with the ideal per-worker workload. Batching by task budget separates the two concerns without breaking phases.
|
|
13
|
+
|
|
14
|
+
**Trigger:** Count total tasks across all phases. If the feature packs into **more than one batch** (> ~8 tasks), offer the user phase-batch sub-agents before starting Execute. If it fits a single batch (≤ ~8 tasks), execute inline in the main window — no sub-agents spawned.
|
|
15
|
+
|
|
16
|
+
**Batching algorithm (task budget ≈ 7 tasks/worker, phase-aligned):**
|
|
17
|
+
|
|
18
|
+
The benchmarked sweet spot is ~7 tasks of context per worker (~20 tasks → 3 workers). Pack whole phases into that budget:
|
|
19
|
+
|
|
20
|
+
1. Count total tasks `T`.
|
|
21
|
+
2. If `T ≤ ~8` → inline, no sub-agents.
|
|
22
|
+
3. Otherwise walk phases **in order**, accumulating whole phases into the current batch. When the batch's running task count reaches ~7 **and** phases remain, close the batch and start the next.
|
|
23
|
+
4. **Never split a phase** across workers — the cut only ever lands on a phase boundary. This preserves dependency ordering and keeps a phase's tasks + shared context in one worker.
|
|
24
|
+
5. If the final batch is a lone tail (1–2 tasks), fold it into the previous batch.
|
|
25
|
+
|
|
26
|
+
Result ≈ `ceil(T / 7)` workers, scaling linearly. Unevenness is absorbed by greedy packing — phases never need to divide evenly. Worked examples (20 tasks):
|
|
27
|
+
|
|
28
|
+
- Phases `[3,3,3,3,4,4]` → `{P1+P2=6, P3+P4=6, P5+P6=8}` = **3 workers**
|
|
29
|
+
- Phases `[8,2,2,8]` → `{P1=8, P2+P3=4, P4=8}` = **3 workers** (no even split needed)
|
|
30
|
+
- Phases `[5,5,5,5]` → `{P1+P2=10, P3+P4=10}` = **2 workers** (phases too coarse to hit 3 — see below)
|
|
31
|
+
|
|
32
|
+
**Coarse-phase caveat:** Because the cut lands only on phase boundaries, very coarse phases limit how finely you can pack. If a single phase alone exceeds ~1.5× the budget (~10+ tasks), that is a Tasks-authoring smell — split it into real sub-phases during Tasks (at a genuine dependency/cohesion boundary), never at dispatch time.
|
|
33
|
+
|
|
34
|
+
**Offer-then-confirm (never auto-spawn):**
|
|
35
|
+
|
|
36
|
+
> "This feature has [T] tasks across [N] phases. I can pack them into [K] sub-agents (~7 tasks each, whole phases per worker) — every worker runs its phases in order, reports a compact summary, and the orchestrator advances to the next batch. This keeps the main window lean without over-fragmenting. Want to proceed that way?"
|
|
37
|
+
|
|
38
|
+
The user must explicitly accept. If they decline (or if the feature fits one batch), execute inline.
|
|
39
|
+
|
|
40
|
+
**Execution model — one worker per task-budgeted batch, sequential:**
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Phases 1+2 (7 tasks) ──→ Batch Worker 1 ──→ compact summary ──→ orchestrator updates tasks.md
|
|
44
|
+
Phases 3+4 (6 tasks) ──→ Batch Worker 2 ──→ compact summary ──→ orchestrator updates tasks.md
|
|
45
|
+
Phase 5 (7 tasks) ──→ Batch Worker 3 ──→ compact summary ──→ orchestrator updates tasks.md
|
|
46
|
+
...
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Batches run strictly sequentially: a batch never starts until the previous batch's summary shows all its tasks complete.
|
|
50
|
+
|
|
51
|
+
**What a batch worker receives:**
|
|
52
|
+
|
|
53
|
+
- The task definitions for **every** phase in its batch (from `.specs/features/<slug>/tasks.md`)
|
|
54
|
+
- The Test Coverage Matrix and Gate Check Commands (from `.specs/features/<slug>/tasks.md`)
|
|
55
|
+
- `references/spec-driven/coding-principles.md`
|
|
56
|
+
- Relevant `spec.md`, `context.md`, and `design.md` sections for the feature (not all specs)
|
|
57
|
+
|
|
58
|
+
**What a batch worker does:**
|
|
59
|
+
|
|
60
|
+
Executes ALL tasks in its assigned batch **in order** — finishing every task in one phase before starting the next phase in the batch — following the `references/spec-driven/execute.md` cycle for each task (implement → gate → atomic commit). It does NOT spawn further sub-agents. After completing all tasks in the batch, the worker reports a **compact summary** to the orchestrator using the structured return contract:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Batch (phases [N]–[M]) return:
|
|
64
|
+
- Status: Complete | Blocked | Partial
|
|
65
|
+
- Tasks done: [list with commit hashes]
|
|
66
|
+
- Tests: [N passed, 0 failed]
|
|
67
|
+
- SPEC_DEVIATION: [none | <task-id>: <what diverged from spec/tasks.md and why>]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Return contract fields:**
|
|
71
|
+
|
|
72
|
+
- **Status** — `Complete` (all batch tasks done, gate green), `Blocked` (a task could not proceed; worker stopped), or `Partial` (some tasks done, remaining tasks deferred with reason). The orchestrator advances only on `Complete`.
|
|
73
|
+
- **SPEC_DEVIATION** — any divergence from the approved `spec.md`/`tasks.md`: a skipped test, a changed interface, an added dependency, an out-of-scope edit. `none` is the only silent value; every real deviation is named with its task id and reason so the orchestrator can decide accept/fix/escalate before the next batch.
|
|
74
|
+
|
|
75
|
+
No raw logs, no full test output — only the above fields keep the main context clean.
|
|
76
|
+
|
|
77
|
+
**No nesting:** Batch workers execute their tasks themselves. They never spawn sub-sub-agents. Execution is strictly sequential within and across batches — there is no intra-phase or intra-batch parallelism.
|
|
78
|
+
|
|
79
|
+
## Delegation Activity Table
|
|
80
|
+
|
|
81
|
+
The batching trigger above governs **when** batch workers are offered. This table governs **what** may be delegated at all. Delegation is activity-scoped, not blanket.
|
|
82
|
+
|
|
83
|
+
| Activity | Delegate? | Notes |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| Research / codebase investigation | Yes | Read-only gatherer; returns compact findings, never decisions |
|
|
86
|
+
| Implementation of an approved task | Yes (batch worker) | Task + gate already defined in `tasks.md`; worker executes the defined cycle |
|
|
87
|
+
| Planning (Specify / Design / Tasks authoring) | **Do not delegate** | Planning owns the contract; delegation fragments accountability |
|
|
88
|
+
| Task creation / task-list authoring | **Do not delegate** | The orchestrator owns `tasks.md` integrity and ordering |
|
|
89
|
+
| Validation (Verifier role) | **Do not delegate to a batch worker** | Use the dedicated Verifier sub-agent; author ≠ verifier is the gate's trust basis |
|
|
90
|
+
|
|
91
|
+
Delegated work returns through the compact summary contract above. Planning, task-creation, and validation never enter that return path — they stay with the orchestrator or the dedicated Verifier.
|
|
92
|
+
|
|
93
|
+
**The orchestrating agent's role during Execute:**
|
|
94
|
+
|
|
95
|
+
1. Count total tasks and pack phases into task-budgeted batches (~7 tasks each) — if that yields more than one batch, offer batch sub-agents and wait for the user to accept
|
|
96
|
+
2. Dispatch the next batch to a worker (or execute inline if not using sub-agents)
|
|
97
|
+
3. Receive the compact summary
|
|
98
|
+
4. Update `.specs/features/<slug>/tasks.md` with results
|
|
99
|
+
5. If all tasks in the summary show complete: dispatch the next batch
|
|
100
|
+
6. If a task failed: the worker has already stopped; decide fix/escalate before dispatching the next batch
|
|
101
|
+
|
|
102
|
+
**Failure handling:** If a task in a batch fails (gate does not pass, blocker hit), the worker stops and includes the failure in its summary. The next batch does not start until the current batch's summary shows all tasks complete. The orchestrator decides: fix and re-run, or escalate to the user.
|
|
103
|
+
|
|
104
|
+
**Context sizing signal:** If a batch's task list would likely push the worker's context beyond ~40k tokens, close the batch at an earlier phase boundary (fewer phases per worker). If a *single* phase alone would blow the budget, that phase is too coarse — split it during Tasks per the granularity guidance in `references/spec-driven/tasks.md`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Verifier Sub-Agent
|
|
109
|
+
|
|
110
|
+
**Always-on, never prompted — one per feature completion.** The Verifier is a separate role from the batch worker. It runs once — after the last task of the feature is committed — as an independent quality gate, dispatched automatically by the orchestrator. It is **not** gated behind the batching offer; it always runs. Do NOT ask the user whether to run validation; it is mandatory.
|
|
111
|
+
|
|
112
|
+
**Author ≠ verifier:** The agent (or batch worker) that wrote the code and tests is the author. The Verifier is a fresh sub-agent dispatched by the orchestrator after the final commit. It does not inherit the author's context, mental model, or assumptions. This separation is what makes the gate trustworthy.
|
|
113
|
+
|
|
114
|
+
**What the Verifier receives:**
|
|
115
|
+
|
|
116
|
+
- `spec.md` for the feature (ACs = source of truth)
|
|
117
|
+
- The git diff surface for the feature (scoped to the feature branch or commit range)
|
|
118
|
+
- The test files in scope
|
|
119
|
+
- `references/spec-driven/validate.md` as its operating checklist
|
|
120
|
+
|
|
121
|
+
**What the Verifier does (full process in `validate.md`):**
|
|
122
|
+
|
|
123
|
+
1. **Spec-anchored coverage check** — re-derives coverage evidence-or-zero: every AC traced to `file:line` + assertion expression. For each covered criterion, confirms the test's asserted value matches the **spec-defined expected outcome** (not just that an assertion exists). Where the spec does not define a precise outcome, flags a **spec-precision gap** rather than passing silently.
|
|
124
|
+
2. **Discrimination sensor** — injects a small behavior-level fault (flip a condition, change a return value, off-by-one, remove a required side effect) in a **scratch/throwaway state** (git stash or temp copy), runs the relevant tests, confirms they FAIL (kill the mutant), then discards the mutation. Tiered by risk: lightweight (1–3 mutations) for standard features; expanded (≥5 mutations or full mutation tooling) for P0/critical paths. Surviving mutants become fix tasks.
|
|
125
|
+
3. Applies the **payload/conjunction rule**: checks payload fields are asserted on value/state, not just that the call occurred.
|
|
126
|
+
4. **Writes the persisted report** to `.specs/features/<slug>/validation.md` — PASS/FAIL, per-AC evidence (`file:line` + assertion + spec outcome), sensor result (killed/survived per mutation), gate exit results, diff/commit range.
|
|
127
|
+
5. **Returns a compact verdict in chat** to the orchestrator.
|
|
128
|
+
6. Does **NOT** write, modify, or fix any code or tests — the real working tree is never mutated (sensor mutations run in scratch state only).
|
|
129
|
+
|
|
130
|
+
**What the Verifier reports back (compact chat format):**
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
## Validation: [feature name] — [PASS ✅ | FAIL ❌]
|
|
134
|
+
|
|
135
|
+
**Spec-anchored check**: [N/N ACs matched spec outcome | M spec-precision gaps flagged]
|
|
136
|
+
**Gate**: [X passed, 0 failed]
|
|
137
|
+
**Sensor**: [N mutations injected, N killed, N survived]
|
|
138
|
+
**Report**: `.specs/features/<slug>/validation.md`
|
|
139
|
+
|
|
140
|
+
**Ranked gaps** (if FAIL):
|
|
141
|
+
1. [Gap description] — [AC or criterion] — [file:line or "no evidence"]
|
|
142
|
+
2. ...
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Failure handling:** The orchestrator routes the ranked gaps to an implementer as fix tasks, then re-dispatches the Verifier. This fix→re-verify loop is bounded to a maximum of **3 iterations**. If gaps remain after 3 iterations, escalate to the user.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Standalone Fallback
|
|
150
|
+
|
|
151
|
+
When sub-agents are unavailable (a single agent executing the full feature), use the standalone fresh-eyes fallback: run `references/spec-driven/validate.md` as a standalone pass — clear implementation assumptions, re-read `spec.md` and the diff from scratch, apply evidence-or-zero, run the spec-anchored coverage check and discrimination sensor, write `.specs/features/<slug>/validation.md`, and report the PASS/FAIL verdict before marking the feature done.
|