@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,397 @@
|
|
|
1
|
+
# Spec-Driven Validate
|
|
2
|
+
|
|
3
|
+
Use this reference for the mandatory final Execute validation gate. This is not a separate phase — verification is part of every task's completion within Execute and runs automatically after the final task or inline step is complete.
|
|
4
|
+
|
|
5
|
+
<!-- validator anchors: reject shallow assertions | payload/conjunction rule | per-task test adequacy review summary | fix-loop iteration count | 3 verification iterations -->
|
|
6
|
+
|
|
7
|
+
**Goal**: Verify implementation meets spec AND coding principles.
|
|
8
|
+
|
|
9
|
+
## Three Levels of Verification
|
|
10
|
+
|
|
11
|
+
1. **Per-task verification (always, author self-check):** After implementing each task, verify its "Done when" criteria before committing. This is mandatory and automatic. The implementer runs it.
|
|
12
|
+
|
|
13
|
+
2. **Feature-level validation (independent Verifier sub-agent, always-on, never prompted):** After all tasks for a feature (or priority group) are done, validation runs automatically — the orchestrator dispatches a **fresh Verifier sub-agent** (see [references/spec-driven/sub-agents.md](sub-agents.md)). Do NOT ask the user whether to run it; it is the safety net, not an opt-in. User interaction is limited to interactive UAT (for user-facing features) and acting on a FAIL verdict ("fix these gaps now?"). The Verifier:
|
|
14
|
+
- Runs **read-only** over the real implementation and tests — mutations run in a scratch/throwaway state only (see Discrimination Sensor section), and must be reverted or discarded before verdict
|
|
15
|
+
- Scopes coverage to the feature's **git diff surface** (not the full repository)
|
|
16
|
+
- Re-derives coverage independently using **evidence-or-zero**: every AC must be traced to a `file:line` + assertion expression; a criterion with no `file:line` citation counts as NOT covered
|
|
17
|
+
- Runs the **spec-anchored outcome check** and the **discrimination sensor** (both described below)
|
|
18
|
+
- Writes `.specs/features/<slug>/validation.md` with the full evidence report
|
|
19
|
+
- Returns a compact verdict + ranked gap list to the orchestrator in chat
|
|
20
|
+
- Gaps become **fix tasks** routed back to an implementer; re-verification follows with a maximum of **3 fix→re-verify iterations** before escalating to the user
|
|
21
|
+
|
|
22
|
+
3. **Interactive UAT (for user-facing features only):** The feature has complex user-facing behavior where human judgment matters (UI flows, interaction patterns, visual design). For backend-only, harness-only, or infrastructure work, automated checks are sufficient — record `UAT: not applicable` with reason.
|
|
23
|
+
|
|
24
|
+
**Trigger for explicit validation:** "Validate", "verify work", "UAT", "test with me", "walk me through it"
|
|
25
|
+
|
|
26
|
+
## Independence Rule
|
|
27
|
+
|
|
28
|
+
Prefer a fresh read-only verifier agent or tool. The author must not verify their own work when independent verification tooling is available. When subagents are unavailable, run the standalone fresh-eyes fallback: re-read `spec.md`, changed files, tests, and diff from scratch before making a verdict.
|
|
29
|
+
|
|
30
|
+
The verifier is read-only against the real worktree. Discrimination sensor mutations run only in scratch state such as a temporary worktree, stash-protected copy, or temp file copy, and must be reverted or discarded before verdict.
|
|
31
|
+
|
|
32
|
+
## Inputs
|
|
33
|
+
|
|
34
|
+
- Approved `spec.md`.
|
|
35
|
+
- `context.md`, `design.md`, and `tasks.md` when present.
|
|
36
|
+
- Implementation diff and changed files.
|
|
37
|
+
- Execute evidence: commands, gate results, test counts, skipped checks, per-task test adequacy reviews, and accepted assumptions.
|
|
38
|
+
- Current tests, fixtures, snapshots, schemas, and validation assets.
|
|
39
|
+
- Artifact-store evidence: active artifact key, version, and checksum after write (where specify/tasks/design produced artifacts).
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Process
|
|
44
|
+
|
|
45
|
+
### 1. Check Completed Tasks
|
|
46
|
+
|
|
47
|
+
Go through `.specs/features/<slug>/tasks.md`:
|
|
48
|
+
|
|
49
|
+
- [ ] All tasks marked done?
|
|
50
|
+
- [ ] Any blocked or partial?
|
|
51
|
+
|
|
52
|
+
### 2. Spec-Anchored Acceptance Criteria Check
|
|
53
|
+
|
|
54
|
+
For each acceptance criterion in `.specs/features/<slug>/spec.md`, the Verifier re-derives the **spec-defined expected outcome** and confirms the test's actual assertion matches it:
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
### P1: [Story Title]
|
|
58
|
+
|
|
59
|
+
**Acceptance Criteria**:
|
|
60
|
+
|
|
61
|
+
| Criterion (WHEN X THEN Y) | Spec-defined outcome | `file:line` + assertion expression | Result |
|
|
62
|
+
| ------------------------- | -------------------- | ---------------------------------- | ------ |
|
|
63
|
+
| WHEN [X] THEN [Y] | [precise value/state from spec] | `path/to/test.ts:42` — `expect(result.field).toBe(expected)` | ✅ PASS / ❌ GAP / ⚠️ Spec-precision gap |
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Rules:**
|
|
67
|
+
|
|
68
|
+
- Where the spec defines a precise outcome (specific status code, field value, error message, state), the test assertion MUST target that exact outcome — not just that an assertion exists.
|
|
69
|
+
- Where the spec does NOT define a precise outcome, mark as **⚠️ Spec-precision gap** and flag it in the report. Do NOT silently pass a vague assertion.
|
|
70
|
+
- Evidence-or-zero: a criterion with no `file:line` citation counts as NOT covered.
|
|
71
|
+
|
|
72
|
+
### 3. Check Edge Cases
|
|
73
|
+
|
|
74
|
+
From `.specs/features/<slug>/spec.md` edge cases:
|
|
75
|
+
|
|
76
|
+
- [ ] [Edge case 1] handled correctly
|
|
77
|
+
- [ ] [Edge case 2] handled correctly
|
|
78
|
+
|
|
79
|
+
### 4. Run Build-Level Gate Check (MANDATORY)
|
|
80
|
+
|
|
81
|
+
Run the Build-level gate check from the **Gate Check Commands** section in tasks.md. This is NOT optional.
|
|
82
|
+
|
|
83
|
+
1. Run: `[Build gate command from the Gate Check Commands section in .specs/features/<slug>/tasks.md]`
|
|
84
|
+
2. Non-zero exit code = STOP. Do not proceed to Code Quality Check.
|
|
85
|
+
3. Record results:
|
|
86
|
+
- Total test count: [N]
|
|
87
|
+
- Passed: [N]
|
|
88
|
+
- Failed: [list]
|
|
89
|
+
- Skipped: [list — each skip must be justified]
|
|
90
|
+
|
|
91
|
+
**Test Integrity Check:**
|
|
92
|
+
|
|
93
|
+
- Compare current test count against the count before this feature was implemented
|
|
94
|
+
- If test count DECREASED: investigate why. Tests should only be deleted with explicit justification.
|
|
95
|
+
- If assertions were weakened (less specific than before): flag as potential regression
|
|
96
|
+
|
|
97
|
+
### 5. Discrimination Sensor (MANDATORY — always runs after gate check passes)
|
|
98
|
+
|
|
99
|
+
The sensor provides the empirical guarantee that the tests can actually detect regressions. It runs in a scratch/throwaway state — the real working tree is never modified.
|
|
100
|
+
|
|
101
|
+
**How it works:**
|
|
102
|
+
|
|
103
|
+
1. **Prepare a scratch state.** Use one of (choose the safest available for the environment):
|
|
104
|
+
- `git stash` the current state, apply a mutation, run tests, then `git stash pop`; OR
|
|
105
|
+
- A temporary worktree (`git worktree add`); OR
|
|
106
|
+
- A temp copy of the affected file(s).
|
|
107
|
+
2. **Inject a behavior-level fault** into the new code introduced by this feature. Choose a mutation proportional to the code's risk:
|
|
108
|
+
- Flip a boolean condition (`if (x)` → `if (!x)`, `>` → `>=`)
|
|
109
|
+
- Change a return value (return a wrong status code, wrong field, zero instead of a computed value)
|
|
110
|
+
- Off-by-one (shift a loop bound, change a slice index)
|
|
111
|
+
- Remove a required side effect (delete a method call that the spec requires)
|
|
112
|
+
3. **Run the tests** that cover the mutated code. Use the Quick or Full gate command from tasks.md.
|
|
113
|
+
4. **Confirm the mutant is killed** (tests FAIL). Then discard the mutation (restore the scratch state).
|
|
114
|
+
5. **If a mutant survives** (tests still pass after the fault), the tests are not discriminating for that behavior — add a fix task to strengthen the assertion.
|
|
115
|
+
|
|
116
|
+
**Tiering (proportional, not optional):**
|
|
117
|
+
|
|
118
|
+
| Context | Sensor depth |
|
|
119
|
+
| ------- | ------------ |
|
|
120
|
+
| Default (all features) | Lightweight fault-injection: 1–3 targeted behavior-level mutations per feature, focused on the highest-risk new code |
|
|
121
|
+
| P0 / critical paths (payment, auth, data integrity) | Full mutation run: use language-appropriate mutation tooling if available (e.g., Stryker, mutmut, cargo-mutants, pitest); otherwise increase the number of manual fault-injection mutations to ≥5 covering all branches |
|
|
122
|
+
|
|
123
|
+
**Stack-agnostic:** The sensor targets behavior-level semantics (what the code does), not a specific tool. Any language, any framework.
|
|
124
|
+
|
|
125
|
+
**Report:** Record killed/survived for each mutation attempt. Surviving mutants → create fix tasks before marking the feature done.
|
|
126
|
+
|
|
127
|
+
If a safe reversible mutant cannot be made, record why and mark `Blocked` unless equivalent existing mutation evidence proves discrimination.
|
|
128
|
+
|
|
129
|
+
### 6. Code Quality Check (MANDATORY)
|
|
130
|
+
|
|
131
|
+
For each changed file, verify against [references/spec-driven/coding-principles.md](coding-principles.md) and the [references/naming-standards.md](../naming-standards.md) conventions:
|
|
132
|
+
|
|
133
|
+
| Check | Pass? |
|
|
134
|
+
| ------------------------------------ | ----- |
|
|
135
|
+
| No features beyond what was asked | |
|
|
136
|
+
| No abstractions for single-use code | |
|
|
137
|
+
| No unnecessary "flexibility" added | |
|
|
138
|
+
| Only touched files required for task | |
|
|
139
|
+
| Didn't "improve" unrelated code | |
|
|
140
|
+
| Matches existing patterns/style | |
|
|
141
|
+
| Would senior engineer approve? | |
|
|
142
|
+
| Tests map to acceptance criteria and are non-shallow (spot-check one story) | |
|
|
143
|
+
| Spec-anchored outcome check: each test's asserted value matches the spec-defined outcome (or gap flagged) | |
|
|
144
|
+
| Per-layer Coverage Expectation met: domain logic has 1:1 AC mapping; routes/e2e cover happy + edge + error paths for every route in scope | |
|
|
145
|
+
| Every test in scope maps to a spec AC, listed edge case, or Done-when criterion (no unclaimed tests) | |
|
|
146
|
+
| Documented project quality/testing guidelines followed (cite guideline file, or "none — strong defaults applied") | |
|
|
147
|
+
|
|
148
|
+
❌ Any "No"? → Fix before marking complete.
|
|
149
|
+
|
|
150
|
+
### 7. Interactive UAT (if user-facing feature)
|
|
151
|
+
|
|
152
|
+
For each testable deliverable, present one test at a time:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
Test [N]: [Test Name]
|
|
156
|
+
|
|
157
|
+
Expected: [What should happen — specific and observable]
|
|
158
|
+
|
|
159
|
+
→ Does this work? Describe what you see.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Wait for user response:
|
|
163
|
+
|
|
164
|
+
| User says | Interpret as |
|
|
165
|
+
| ------------------------------ | ----------------------- |
|
|
166
|
+
| "yes", "pass", "works", "next" | ✅ Pass |
|
|
167
|
+
| "skip", "can't test", "n/a" | ⏭️ Skip |
|
|
168
|
+
| Anything else | ❌ Issue — log verbatim |
|
|
169
|
+
|
|
170
|
+
**Severity inference (never ask the user for severity):**
|
|
171
|
+
|
|
172
|
+
| User description contains | Inferred severity |
|
|
173
|
+
| --------------------------------------- | ----------------- |
|
|
174
|
+
| crash, error, exception, fails, broken | Blocker |
|
|
175
|
+
| doesn't work, wrong, missing, can't | Major |
|
|
176
|
+
| slow, weird, off, minor, small | Minor |
|
|
177
|
+
| color, font, spacing, alignment, visual | Cosmetic |
|
|
178
|
+
| (unclear) | Major (default) |
|
|
179
|
+
|
|
180
|
+
For mobile or UI features, follow the [references/mobile-context.md](../mobile-context.md) gate before driving an emulator/simulator. When instrumentation applies, prefer the Maestro MCP tooling (`list_devices` → `inspect_screen` → `run`) over manual steps.
|
|
181
|
+
|
|
182
|
+
### 8. Generate Fix Plans (if issues found)
|
|
183
|
+
|
|
184
|
+
For each issue found during UAT or from the Verifier:
|
|
185
|
+
|
|
186
|
+
1. **Diagnose** — Analyze the codebase to find root cause. Prefer massa-ai code-analysis tools first (search, optimized_context) for symbol and dependency location; fall back to ast-grep/rg/grep when the index is stale or unavailable. Current source overrides stale index/memory.
|
|
187
|
+
2. **Create fix task** — Write a task definition with:
|
|
188
|
+
- What: The specific fix
|
|
189
|
+
- Where: File paths
|
|
190
|
+
- Verify: How to prove the fix works
|
|
191
|
+
- Done when: Acceptance criteria for the fix
|
|
192
|
+
3. **Present fix plan** — Show all fix tasks to user for approval
|
|
193
|
+
|
|
194
|
+
Fix tasks follow the same format as regular tasks and can be executed with the implement phase (see [references/spec-driven/execute.md](execute.md)).
|
|
195
|
+
|
|
196
|
+
**Guardrail:** Maximum 3 diagnostic iterations per issue. If root cause isn't found after 3 attempts, flag for human investigation. The same 3-iteration bound applies to the Verifier's fix→re-verify cycle: if gaps persist after 3 rounds, escalate to the user rather than continuing to loop.
|
|
197
|
+
|
|
198
|
+
### 9. Write Validation Report File + Return Chat Summary (MANDATORY)
|
|
199
|
+
|
|
200
|
+
After all checks complete, the Verifier MUST:
|
|
201
|
+
|
|
202
|
+
1. **Write the persisted report** to `.specs/features/<slug>/validation.md` (see template below). This file is the evidence artifact — it survives the session and can be referenced by CI, reviewers, or future agents. Record in `.specs/project/STATE.md` (Decisions) that validation evidence is available at that path.
|
|
203
|
+
2. **Return a compact summary in chat** to the orchestrator (see Compact Chat Summary section below). The orchestrator surfaces it to the user and routes any ranked gaps to fix tasks.
|
|
204
|
+
|
|
205
|
+
### 10. Distill Lessons (MANDATORY when validation.md has signal)
|
|
206
|
+
|
|
207
|
+
This is the closing action of validation — not a separate phase. Immediately after the report is written, turn its grounded failures into reusable, project-local guidance by following [references/lessons.md](../lessons.md) and the stub at [references/spec-driven/lessons.md](lessons.md). In short: for each surviving mutant, spec-precision gap, failed/uncovered AC, or `// SPEC_DEVIATION`, record one terse general lesson via:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
python3 skills/massa-ai/scripts/lessons.py --root . add --feature <slug> --signal "<signal>" --source "<source>" --text "<lesson>" --scope "<scope>"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The script enforces grounding (mandatory `--source`) and owns all bookkeeping. A clean PASS with no signal → record nothing. Run the self-check: if there was signal but no lesson was recorded, say so in chat. See [references/lessons.md](../lessons.md) for the exact commands, phrasing rules, scope discipline, and the no-script fallback.
|
|
214
|
+
|
|
215
|
+
Persist durable memory for verified outcomes worth reusing via `remember` with tags `workflow:spec-driven`, `entity:<slug>`, and `memory:episodic|procedural` as appropriate.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Verdicts
|
|
220
|
+
|
|
221
|
+
- `Pass`: delivered behavior matches the spec, checks pass, UAT is passed or not applicable, and the discrimination sensor proves validation can fail for wrong behavior.
|
|
222
|
+
- `Needs Fix`: implementation diverges from the spec or validation is insufficient, and the fix path is clear.
|
|
223
|
+
- `Blocked`: verification cannot produce a trustworthy verdict because tooling, environment, safe mutation, requirements, UAT, or evidence is missing.
|
|
224
|
+
|
|
225
|
+
## Fix Loop
|
|
226
|
+
|
|
227
|
+
- Return `Needs Fix` findings to Execute as fix tasks.
|
|
228
|
+
- Cap the loop at 3 verification iterations.
|
|
229
|
+
- After 3 unsuccessful iterations, mark `Blocked` with remaining findings and exact next step.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Compact Chat Summary (returned in chat after validation)
|
|
234
|
+
|
|
235
|
+
The Verifier returns this block to the orchestrator after completing all checks:
|
|
236
|
+
|
|
237
|
+
```markdown
|
|
238
|
+
## Validation: [Feature] — [PASS ✅ | FAIL ❌]
|
|
239
|
+
|
|
240
|
+
**Spec-anchored check**: [N/N ACs matched spec outcome | M spec-precision gaps flagged]
|
|
241
|
+
**Gate**: [X passed, 0 failed]
|
|
242
|
+
**Sensor**: [N mutations injected, N killed, N survived]
|
|
243
|
+
**Report**: `.specs/features/<slug>/validation.md`
|
|
244
|
+
|
|
245
|
+
**Ranked gaps** (if FAIL):
|
|
246
|
+
1. [Gap description] — [AC or criterion] — [file:line or "no evidence"]
|
|
247
|
+
2. ...
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Validation Report Template (`.specs/features/<slug>/validation.md`)
|
|
253
|
+
|
|
254
|
+
```markdown
|
|
255
|
+
# [Feature] Validation
|
|
256
|
+
|
|
257
|
+
**Date**: [YYYY-MM-DD]
|
|
258
|
+
**Spec**: `.specs/features/<slug>/spec.md`
|
|
259
|
+
**Diff range**: [commit range or branch..HEAD]
|
|
260
|
+
**Verifier**: independent sub-agent (author ≠ verifier)
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Task Completion
|
|
265
|
+
|
|
266
|
+
| Task | Status | Notes |
|
|
267
|
+
| ---- | ---------- | ------- |
|
|
268
|
+
| T1 | ✅ Done | - |
|
|
269
|
+
| T2 | ✅ Done | - |
|
|
270
|
+
| T3 | ⚠️ Partial | [Issue] |
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Spec-Anchored Acceptance Criteria
|
|
275
|
+
|
|
276
|
+
| Criterion (WHEN X THEN Y) | Spec-defined outcome | `file:line` + assertion | Result |
|
|
277
|
+
| ------------------------- | -------------------- | ----------------------- | ------ |
|
|
278
|
+
| WHEN X THEN Y | [precise value/state from spec] | `path/to/test.ts:42` — `expect(result.field).toBe(expected)` | ✅ PASS |
|
|
279
|
+
| WHEN A THEN B | [expected value] | `path/to/test.ts:88` — `expect(res.status).toBe(400)` | ✅ PASS |
|
|
280
|
+
| WHEN C THEN D | not precisely defined in spec | — | ⚠️ Spec-precision gap |
|
|
281
|
+
|
|
282
|
+
**Status**: ✅ All ACs covered / ❌ Gaps present / ⚠️ Spec-precision gaps flagged
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Discrimination Sensor
|
|
287
|
+
|
|
288
|
+
| Mutation | File:line | Description | Killed? |
|
|
289
|
+
| -------- | --------- | ----------- | ------- |
|
|
290
|
+
| 1 | `src/service.ts:42` | Flipped condition `x > 0` → `x >= 0` | ✅ Killed |
|
|
291
|
+
| 2 | `src/service.ts:88` | Changed return value `status: 'active'` → `status: 'inactive'` | ✅ Killed |
|
|
292
|
+
| 3 | `src/handler.ts:15` | Removed side-effect call to `notify()` | ❌ Survived → fix task created |
|
|
293
|
+
|
|
294
|
+
**Sensor depth**: [lightweight / P0-full]
|
|
295
|
+
**Result**: [N/N killed] — [PASS ✅ | FAIL ❌]
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Interactive UAT Results (if performed)
|
|
300
|
+
|
|
301
|
+
| # | Test | Result | Details |
|
|
302
|
+
| --- | ----------- | -------- | ----------------------------------------------- |
|
|
303
|
+
| 1 | [Test name] | ✅ Pass | - |
|
|
304
|
+
| 2 | [Test name] | ❌ Issue | [Verbatim user response] — Severity: [inferred] |
|
|
305
|
+
| 3 | [Test name] | ⏭️ Skip | [Reason] |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Code Quality
|
|
310
|
+
|
|
311
|
+
| Principle | Status |
|
|
312
|
+
| ---------------- | ------ |
|
|
313
|
+
| Minimum code | ✅ |
|
|
314
|
+
| Surgical changes | ✅ |
|
|
315
|
+
| No scope creep | ✅ |
|
|
316
|
+
| Matches patterns | ✅ |
|
|
317
|
+
| Spec-anchored outcome check (asserted values match spec) | ✅ |
|
|
318
|
+
| Per-layer Coverage Expectation met (domain 1:1 ACs; routes happy+edge+error) | ✅ |
|
|
319
|
+
| Every test maps to a spec requirement — no unclaimed tests | ✅ |
|
|
320
|
+
| Documented guidelines followed: [file(s) or "none — strong defaults applied"] | ✅ |
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Edge Cases
|
|
325
|
+
|
|
326
|
+
- [x] Edge case 1: Handled correctly
|
|
327
|
+
- [ ] Edge case 2: NOT handled - needs fix
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Gate Check
|
|
332
|
+
|
|
333
|
+
- **Gate command**: [Build gate command from the Gate Check Commands section in tasks.md]
|
|
334
|
+
- **Result**: [X] passed, [Y] failed, [Z] skipped
|
|
335
|
+
- **Test count before feature**: [N]
|
|
336
|
+
- **Test count after feature**: [M]
|
|
337
|
+
- **Delta**: [+(M - N) new tests]
|
|
338
|
+
- **Skipped tests**: [list with justification for each]
|
|
339
|
+
- **Failures**: [list with details]
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Fix Plans (if issues found)
|
|
344
|
+
|
|
345
|
+
### Fix 1: [Issue description]
|
|
346
|
+
|
|
347
|
+
- **Root cause**: [What's actually wrong]
|
|
348
|
+
- **Fix task**: [Task definition]
|
|
349
|
+
- **Priority**: [Blocker/Major/Minor/Cosmetic]
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Requirement Traceability Update
|
|
354
|
+
|
|
355
|
+
Update `.specs/features/<slug>/spec.md` requirement statuses and reflect verified state in `.specs/project/FEATURES.json`:
|
|
356
|
+
|
|
357
|
+
| Requirement | Previous Status | New Status |
|
|
358
|
+
| ----------- | --------------- | ------------ |
|
|
359
|
+
| [FEAT]-01 | Implementing | ✅ Verified |
|
|
360
|
+
| [FEAT]-02 | Implementing | ❌ Needs Fix |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Summary
|
|
365
|
+
|
|
366
|
+
**Overall**: ✅ Ready | ⚠️ Issues | ❌ Not Ready
|
|
367
|
+
|
|
368
|
+
**Spec-anchored check**: [N/N ACs matched spec outcome | M spec-precision gaps]
|
|
369
|
+
**Sensor**: [N/N mutations killed]
|
|
370
|
+
**Gate**: [X passed]
|
|
371
|
+
|
|
372
|
+
**What works**: [List]
|
|
373
|
+
|
|
374
|
+
**Issues found**: [Issue 1: How to fix]
|
|
375
|
+
|
|
376
|
+
**Next steps**: [Action]
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Tips
|
|
382
|
+
|
|
383
|
+
- **Validation is never prompted** — it always runs after the last task; do not ask the user whether to run it
|
|
384
|
+
- **Spec-anchored, not just covered** — "there is an assertion" is not enough; the assertion must target the spec-defined outcome
|
|
385
|
+
- **Sensor in scratch only** — never mutate the real tree; stash/worktree/temp copy, run, discard
|
|
386
|
+
- **Surviving mutants are fix tasks** — do not mark the feature done if the sensor found weak tests
|
|
387
|
+
- **P1 first** — MVP must work before P2/P3
|
|
388
|
+
- **WHEN/THEN = Test** — Each criterion is a test case
|
|
389
|
+
- **Be specific** — "Doesn't work" isn't helpful
|
|
390
|
+
- **Recommend fixes** — Don't just report problems, create fix tasks
|
|
391
|
+
- **Quality check is mandatory** — Not optional
|
|
392
|
+
- **Infer severity** — Never ask the user "how bad is this?"
|
|
393
|
+
- **Max 3 diagnostic iterations** — Prevents infinite investigation loops
|
|
394
|
+
- **Update traceability** — Every verified requirement updates spec.md status and the FEATURES.json registry
|
|
395
|
+
- **Always write the report file** — `.specs/features/<slug>/validation.md` is the persisted evidence artifact
|
|
396
|
+
- **Distill after writing** — turn grounded failures into lessons via `python3 skills/massa-ai/scripts/lessons.py` ([references/lessons.md](../lessons.md)); clean PASS → no lesson
|
|
397
|
+
- **Independence first** — prefer a fresh read-only verifier; the author never verifies their own work when tooling allows
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Subagent Design
|
|
2
|
+
|
|
3
|
+
Use this reference only when designing or revising a reusable subagent role, adding a new role to `references/agent-orchestration.md`, or turning repeated delegated work into a stable role charter.
|
|
4
|
+
|
|
5
|
+
Do not load this reference for ordinary one-off delegation. For runtime delegation, use `references/agent-orchestration.md`.
|
|
6
|
+
|
|
7
|
+
## Principle
|
|
8
|
+
|
|
9
|
+
Subagents are execution units inside a harness, not independent workflow owners. In massa-ai:
|
|
10
|
+
|
|
11
|
+
- the main agent owns workflow routing, memory recall and persistence, user-facing synthesis, and the final Evidence Gate
|
|
12
|
+
- reusable subagents own one bounded capability with explicit context inputs, permission limits, deterministic sensors, and a compact output contract
|
|
13
|
+
- prompt quality matters, but completion gates and concrete evidence matter more
|
|
14
|
+
|
|
15
|
+
## Local Task vs Skill vs Subagent
|
|
16
|
+
|
|
17
|
+
Use this decision tree before creating or revising a reusable subagent:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
Is the work immediate, small, and tightly coupled to the main thread?
|
|
21
|
+
-> Keep it local.
|
|
22
|
+
|
|
23
|
+
Is the work reusable guidance that does not need isolated context?
|
|
24
|
+
-> Use or create a skill/reference.
|
|
25
|
+
|
|
26
|
+
Is the work a one-off bounded delegation with an existing role?
|
|
27
|
+
-> Use references/agent-orchestration.md with a task-specific prompt contract.
|
|
28
|
+
|
|
29
|
+
Is the work recurring, specialized, context-heavy, independently verifiable, and useful across workflows?
|
|
30
|
+
-> Design a reusable subagent role with this reference.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Prefer a skill/reference when the value is procedure or domain knowledge. Prefer a subagent when the value is isolated context, parallel work, or independent verification.
|
|
34
|
+
|
|
35
|
+
Reusable role threshold:
|
|
36
|
+
|
|
37
|
+
- Create or revise a reusable subagent role only when the work recurs across workflows, needs isolated context or independent verification, has deterministic sensors, and usually meets at least one dispatch trigger from `references/agent-orchestration.md`: explicit delegation request, >=2 independent slices, >10 files, high/critical findings, or context-firewall overflow.
|
|
38
|
+
- Do not create a role for one-off local tasks, overlapping write sets, unresolved user intent, or tasks that need full conversation history.
|
|
39
|
+
|
|
40
|
+
## Role Charter Template
|
|
41
|
+
|
|
42
|
+
Use this shape when adding a reusable role or writing a subagent definition. Keep the charter short enough that the main agent can pass it without dragging unrelated workflow history.
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## Role: [kebab-case-name]
|
|
46
|
+
|
|
47
|
+
Purpose: [one responsibility]
|
|
48
|
+
|
|
49
|
+
Trigger description:
|
|
50
|
+
- Use when [specific workflow condition or user phrase].
|
|
51
|
+
- Do not use when [local task, unresolved intent, overlapping role, or unsafe write scope].
|
|
52
|
+
|
|
53
|
+
Permissions:
|
|
54
|
+
- Default: read-only.
|
|
55
|
+
- Write access only when the task has a disjoint write set and concrete verification.
|
|
56
|
+
- Model: inherit by default; use a cheaper/faster model only for low-risk mechanical checks.
|
|
57
|
+
|
|
58
|
+
Context inputs:
|
|
59
|
+
- exact projectId
|
|
60
|
+
- exact parent `workflowSessionId` and child session tag; repeated-search roles
|
|
61
|
+
receive their own ephemeral Synapse session
|
|
62
|
+
- workflow name and role name
|
|
63
|
+
- scope and file/module ownership
|
|
64
|
+
- relevant recalled facts and source pointers
|
|
65
|
+
- exclusions and what to avoid redoing
|
|
66
|
+
- allowed tools and mutation level
|
|
67
|
+
- deterministic validation expected
|
|
68
|
+
- context-firewall limits
|
|
69
|
+
|
|
70
|
+
Process:
|
|
71
|
+
1. Confirm the scope and refusal conditions.
|
|
72
|
+
2. Inspect only the supplied scope plus minimal source needed to verify claims.
|
|
73
|
+
3. Run or recommend deterministic sensors when available.
|
|
74
|
+
4. Return compact findings, evidence, risks, and next step.
|
|
75
|
+
|
|
76
|
+
Output contract:
|
|
77
|
+
- Status: Complete, Partial, or Blocked
|
|
78
|
+
- Scope checked or files changed
|
|
79
|
+
- Evidence with commands, source locations, or artifacts
|
|
80
|
+
- Findings or implementation summary
|
|
81
|
+
- Risks and skipped checks
|
|
82
|
+
- Exact next step
|
|
83
|
+
|
|
84
|
+
Validation sensors:
|
|
85
|
+
- [tests, build, typecheck, lint, static search, artifact inspection, or source-location proof]
|
|
86
|
+
|
|
87
|
+
Memory boundary:
|
|
88
|
+
- Suggest durable memories only when useful.
|
|
89
|
+
- Do not persist broad project memory unless explicitly assigned by the main agent.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Capability Packet
|
|
93
|
+
|
|
94
|
+
When a workflow dispatches a reusable role, send a capability packet rather than a loose instruction. The packet should include:
|
|
95
|
+
|
|
96
|
+
- `role`: the role name from `agent-orchestration.md`
|
|
97
|
+
- `purpose`: one sentence tied to this workflow
|
|
98
|
+
- `trigger`: why delegation is justified now
|
|
99
|
+
- `scope`: exact files, modules, diff, report finding, or task IDs
|
|
100
|
+
- `permissions`: read-only or write with disjoint write set
|
|
101
|
+
- `inputs`: recalled facts, source pointers, task/report IDs, constraints, and exclusions
|
|
102
|
+
- `sensors`: commands or concrete checks expected
|
|
103
|
+
- `output`: the exact output contract
|
|
104
|
+
- `firewall`: raw logs, diffs, snapshots, or research that must be summarized
|
|
105
|
+
- `memory`: whether the subagent may suggest memory and who persists it
|
|
106
|
+
|
|
107
|
+
## Quality Checklist
|
|
108
|
+
|
|
109
|
+
Before adding or revising a reusable role:
|
|
110
|
+
|
|
111
|
+
- One responsibility; no generic "helper" roles.
|
|
112
|
+
- Trigger description names when to use it and when not to use it.
|
|
113
|
+
- Scope can be represented as a bounded capability packet.
|
|
114
|
+
- Read-only by default; write permissions require disjoint ownership and verification.
|
|
115
|
+
- Output contract includes evidence, skipped checks, risk, and exact next step.
|
|
116
|
+
- Success depends on deterministic sensors or concrete source evidence, not self-evaluation.
|
|
117
|
+
- Context-firewall rule is explicit for verbose logs, diffs, snapshots, generated reports, and research.
|
|
118
|
+
- Main agent remains responsible for synthesis, memory persistence, and final Evidence Gate.
|
|
119
|
+
- Role count stays small; add a role only when repeated work justifies the overhead.
|
|
120
|
+
|
|
121
|
+
## Anti-Patterns
|
|
122
|
+
|
|
123
|
+
- Vague descriptions such as "use for general tasks" or "help with code".
|
|
124
|
+
- Creating a subagent for a task that should be a local step or a skill.
|
|
125
|
+
- Letting a subagent decide user intent, workflow routing, or final acceptance.
|
|
126
|
+
- Broad write permissions without a disjoint write set.
|
|
127
|
+
- Parallel write agents sharing files or working tree state without isolation.
|
|
128
|
+
- Prompt-only success claims such as "be thorough" without sensors.
|
|
129
|
+
- Returning raw logs, diffs, screenshots, CSVs, or research dumps to the main context.
|
|
130
|
+
- Creating many narrow roles before repeated need is proven.
|
|
131
|
+
- Persisting one-off subagent chatter as durable memory.
|
|
132
|
+
- Missing lifecycle closure: no status, no skipped checks, no next step.
|