@massa-ai/cursor-plugin 1.19.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/skills/agents/audit-specialist/SKILL.md +1 -1
  4. package/skills/agents/context-curator/SKILL.md +1 -1
  5. package/skills/agents/furps-analyst/SKILL.md +1 -1
  6. package/skills/agents/investigator/SKILL.md +1 -1
  7. package/skills/agents/mobile-specialist/SKILL.md +1 -1
  8. package/skills/agents/navigator/SKILL.md +1 -1
  9. package/skills/agents/requirements-analyst/SKILL.md +1 -1
  10. package/skills/agents/reviewer/SKILL.md +1 -1
  11. package/skills/agents/verification-agent/SKILL.md +1 -1
  12. package/skills/massa-ai/SKILL.md +10 -0
  13. package/skills/massa-ai/references/implementation-delivery.md +12 -1
  14. package/skills/massa-ai/references/spec-driven/coding-principles.md +16 -0
  15. package/skills/massa-ai/references/spec-driven/design.md +2 -2
  16. package/skills/massa-ai/references/spec-driven/discuss.md +35 -12
  17. package/skills/massa-ai/references/spec-driven/execute.md +41 -24
  18. package/skills/massa-ai/references/spec-driven/memory.md +12 -2
  19. package/skills/massa-ai/references/spec-driven/specify.md +30 -12
  20. package/skills/massa-ai/references/spec-driven/sub-agents.md +33 -6
  21. package/skills/massa-ai/references/spec-driven/tasks.md +8 -6
  22. package/skills/massa-ai/references/spec-driven/validate.md +15 -10
  23. package/skills/massa-ai/scripts/check_commit.py +128 -0
  24. package/skills/massa-ai/scripts/check_specs_delivered.py +137 -0
  25. package/skills/massa-ai/scripts/lessons.py +44 -4
  26. package/skills/massa-ai/scripts/validate_spec.py +272 -0
  27. package/skills/massa-ai/scripts/validate_state.py +183 -0
  28. package/skills/massa-ai/scripts/validate_tasks.py +302 -0
  29. package/skills/massa-ai/workflows/exploration.md +1 -1
  30. package/skills/massa-ai/workflows/spec-driven.md +5 -4
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "massa-ai",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "massa-ai — semantic code search, memory, and context compression for Cursor"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/cursor-plugin",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "massa-ai plugin for Cursor — semantic code search, memory, and context compression",
5
5
  "files": [
6
6
  "agents",
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: standard
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: light
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: standard
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: light
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: standard
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: light
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  tools: mcp-index
11
11
  ---
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: standard
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: standard
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: S1LV4, luizgmassa
7
7
  version: "1.0.0"
8
- model_tier: standard
8
+ model_tier: deep
9
9
  permission: read-only
10
10
  ---
11
11
 
@@ -62,6 +62,16 @@ Before reading any massa-ai file:
62
62
  to remove obsolete ones.
63
63
  - Emit concise user-facing status updates at meaningful workflow boundaries
64
64
  when the Conversation Feedback Policy is active.
65
+ - Verify, don't assume: every factual claim that drives a decision is
66
+ verified against current codebase/command evidence or confirmed with the
67
+ user. Documentation of any kind — README, docs/, inline comments, external
68
+ summaries, even `.specs/` prose — is a lead to verify against current
69
+ source, never a trustable source of truth by itself. Unverifiable claims
70
+ become explicit assumptions the user confirms or accepts.
71
+ - Ask when in doubt: when genuine doubt remains after looking it up —
72
+ requirement meaning, scope boundaries, destructive/irreversible choices,
73
+ contradictory evidence — ask the user rather than choose silently. Facts
74
+ are looked up; decisions are asked.
65
75
  - Complete Evidence Gate before claiming done.
66
76
 
67
77
  Use internal references only when needed:
@@ -22,7 +22,8 @@ human chose to merge it".
22
22
  | 1 | Isolate | `git fetch origin <base> && git worktree add -b <type>/<slug> <path> origin/<base>` | Branch name taken → suffix `-2`. Worktree path taken → reuse it only if its branch matches |
23
23
  | 2 | Implement | one task → gate → `git commit` | Gate red → fix before committing. Never commit through a failing gate |
24
24
  | 3 | Push | `git push -u origin <type>/<slug>` | Rejected non-fast-forward → `git fetch` + rebase, never force-push a shared branch |
25
- | 4 | Propose | `gh pr create --base <base> --title <t> --body <b>` | `gh` absent/unauthenticated → degraded path |
25
+ | 3.5 | Deliver specs | `python3 skills/massa-ai/scripts/check_specs_delivered.py <feature> [--root .]` | Non-zero → commit the missing `.specs/` updates (a `docs(specs):`-type commit is normal), push, re-run. Defensive fallback — should not fire when the close-out task already committed `.specs/` before the first push |
26
+ | 4 | Propose — precondition: Stage 3.5 (`check_specs_delivered.py`) green | `gh pr create --base <base> --title <t> --body <b>` | `gh` absent/unauthenticated → degraded path |
26
27
  | 5 | Watch | `gh pr checks --watch` | No checks configured → say so; do not claim CI passed |
27
28
  | 6 | Repair | fix on the branch, commit, return to stage 5 | Capped at 3 iterations, then stop as `Blocked` |
28
29
  | 7 | **Ask** | report the PR URL and the green check list, then **stop** | — |
@@ -69,6 +70,16 @@ that workflow. This reference owns only the cadence: **one atomic commit per
69
70
  completed task, after its gate passes.** Never batch tasks into one commit and
70
71
  never commit a task whose gate is red.
71
72
 
73
+ ### Stage 3 — push carries the feature's delivery authorization
74
+
75
+ One explicit delivery authorization per feature, obtained before implementation begins, covers task commits, the branch push, and `gh pr create` for that feature — a single approval, not a push-by-push confirmation. Force-push, deploy, production database changes, merges, and any other remote/externally-visible/destructive operation always require a separate explicit go-ahead, even after that authorization. Workflows that gate Execute behind a batch/delegation offer (e.g. `workflows/spec-driven.md`) obtain this authorization at that same moment.
76
+
77
+ ### Stage 3.5 — deliver specs before PR (defensive fallback)
78
+
79
+ Between Push and Propose, all feature `.specs/` artifacts (`spec/context/design/tasks/validation` as applicable), `.specs/project/STATE.md`, `.specs/HANDOFF.md`, and `.specs/project/FEATURES.json` must be updated and committed on the branch. **Deterministic backing (run it, do not eyeball it):** `python3 skills/massa-ai/scripts/check_specs_delivered.py <feature> [--root .]` — a non-zero exit blocks Propose. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
80
+
81
+ **Nominal path: this stage should never fire.** The feature's own close-out task (the last task before delivery — see `workflows/spec-driven.md` step 7) commits `.specs/` updates **before** the first push, so stage 3.5's remediation is a defensive fallback for the rare case something slipped through, not the normal place `.specs/` gets committed. On failure: commit the missing `.specs/` updates (a `docs(specs):`-type commit is normal), push, re-run this stage. No commits may land between the close-out commit and PR creation.
82
+
72
83
  ### Stage 4 — propose carries the phase key prefix
73
84
 
74
85
  The PR/MR is created with `gh pr create --base <base> --title <t> --body <b>`.
@@ -78,3 +78,19 @@ Artifact-store evidence: active artifact key, version, and checksum after write
78
78
 
79
79
  Ask: "Would senior engineer call this overcomplicated?"
80
80
  If yes → simplify before proceeding.
81
+
82
+ ---
83
+
84
+ ## Writing Voice (specs, ADRs, reports, commits, summaries)
85
+
86
+ The artifacts this skill produces should read like a decided engineer wrote them, not like generated boilerplate.
87
+
88
+ - **Lead with the verdict.** Validation reports and chat summaries open with PASS/FAIL and the one thing that matters, not a warm-up paragraph.
89
+ - **Decisions are definitive.** An ADR or a recorded decision states what you chose: "we will", not "we might" or "we should probably". If it still hedges, it is not a decision yet.
90
+ - **Cut filler and mechanical hedging.** Drop "it is worth noting", "as you can see", "in order to", and reflexive "may/might/could" on claims you are actually sure about. Reserve hedging for genuine uncertainty; using it everywhere signals nothing.
91
+ - **One idea per sentence; short sentences.** Prefer the plain verb over the nominalization ("evaluated", not "performed an evaluation of"). Keep subject-verb-object near the front.
92
+ - **Do not announce the phase.** Produce the artifact; do not narrate "I will now run Specify."
93
+ - **Avoid the em dash as a default connector.** A comma, colon, or two sentences usually read cleaner.
94
+ - **Writing in Portuguese:** keep sentences short; do not carry the long, multi-clause subordinate structure of Portuguese into the artifact. Plain and direct beats formal.
95
+
96
+ None of this means dumbing down the content — only the prose carrying it.
@@ -44,7 +44,7 @@ If the feature involves unfamiliar technology, patterns, or integrations, resear
44
44
  Follow the **Knowledge Verification Chain** (see SKILL.md) in strict order:
45
45
 
46
46
  ```
47
- Codebase → Project docs → Context7 MCP → Web search → Flag as uncertain
47
+ Codebase → Project docs (leads, not truth) → Context7 MCP → Web search → Flag as uncertain
48
48
  ```
49
49
 
50
50
  When verifying codebase claims, prefer the massa-ai tool chain FIRST — `list_projects`, `search`, `project_map`, `optimized_context` — before falling back to ast-grep / ripgrep / grep. Apply freshness and source-precedence rules: current source code overrides a stale index, and a stale index or durable memory never overrides current evidence. When uncertain about index freshness, read the live file directly.
@@ -110,7 +110,7 @@ When the design replaces an existing decision, never delete the old entry. Appen
110
110
  Use this order for technical claims:
111
111
 
112
112
  1. Current codebase.
113
- 2. Project docs and approved specs.
113
+ 2. Project docs and approved specs (leads, not truth) — verify against current source before relying.
114
114
  3. Context7 MCP or available local MCP source for current library behavior when relevant.
115
115
  4. Official documentation or primary source when current APIs or external services matter.
116
116
  5. Mark uncertainty explicitly when evidence is unavailable.
@@ -60,22 +60,42 @@ Present the feature boundary (from `spec.md`) and the gray areas to the user. Le
60
60
 
61
61
  Any gray area the user **declines** to discuss, or that goes undiscussed, is written to the spec's **Assumptions & Open Questions** section (agent's chosen default + rationale) — never silently dropped. This ensures the spec's closure gate can pass: every gray area is either resolved through discussion or recorded as a signed-off assumption.
62
62
 
63
- ### 3. Deep-Dive Each Area
63
+ ### 3. Choose discussion pace (once)
64
64
 
65
- For each selected area:
65
+ Before deep-diving, ask **one** pace question. Recommend **Guided** as the default. If the user skips, says "whatever", or "you choose", use Guided.
66
66
 
67
- 1. Ask 3-4 concrete questions with specific options (not vague categories)
68
- 2. After the questions, check: "More about [area], or move on?"
69
- 3. If more → ask 3-4 more, check again
70
- 4. After all areas → "Ready to create context?"
67
+ | Pace | When it fits | Cadence |
68
+ | ------------ | -------------------------------------------------- | ------------------------------------------------------------------------ |
69
+ | **Quick** | User wants speed; trusts defaults | Propose defaults per area (rationale included); user accepts / overrides |
70
+ | **Guided** | Default — balances depth and turn count | Adaptive elicitation (see below) |
71
+ | **Detailed** | High ambiguity; user wants Socratic control | Exactly one decision per turn, dependency order |
71
72
 
72
- **Question design:**
73
+ Honor mid-discussion switches immediately ("go faster", "slow down", "just decide") — change pace without restarting or re-asking settled decisions.
73
74
 
74
- - Options should be concrete ("Card layout" not "Option A")
75
- - Each answer should inform the next question
76
- - Include "You decide" as an option when reasonable — captures agent discretion
75
+ ### 4. Deep-Dive Each Area
77
76
 
78
- ### 4. Scope Guardrail (CRITICAL)
77
+ Shared rules for every pace:
78
+
79
+ 1. Options must be concrete ("Card layout" or "Table layout" — not "Option A" or "how should it look?").
80
+ 2. Lead with your recommended answer and one line of reasoning. You have read the codebase; the user should be able to accept or override in a word.
81
+ 3. Offer "You decide" when reasonable — it records agent discretion explicitly.
82
+ 4. Resolve anything discoverable from the code yourself (Knowledge Verification Chain); only put genuine product decisions to the user.
83
+ 5. When an area is settled: "More on [area], or move on?" After all areas: "Ready to create context?"
84
+
85
+ **Quick:** For each selected gray area, present the recommended decisions for that area in one turn (defaults + short rationale). Wait for accept / override. Do not drip-feed single questions unless the user challenges a default and opens a real fork.
86
+
87
+ **Guided:** Adaptive elicitation — questions are a decision tree to prune, not a checklist to finish.
88
+
89
+ 1. Classify upcoming decisions as **independent** vs **dependent**.
90
+ 2. Low-stakes / safe-to-default → state the assumption and invite correction (no blocking question).
91
+ 3. Independent product decisions → ask **at most 2** in the same turn, each with options + recommended default.
92
+ 4. Dependent decisions → ask **exactly one**, wait, then continue (the earlier answer should prune later questions).
93
+ 5. Never dump 3+ questions in one turn. Never ask what the code already answers.
94
+ 6. Stop the area as soon as enough is decided.
95
+
96
+ **Detailed:** Walk selected gray areas as a strict decision tree — one concrete question per turn, dependency order, wait for each answer before the next. Use when the user wants maximum control or the feature is highly ambiguous.
97
+
98
+ ### 5. Scope Guardrail (CRITICAL)
79
99
 
80
100
  The feature boundary from `spec.md` is **fixed**. Discussion clarifies HOW to implement, never WHETHER to add new capabilities.
81
101
 
@@ -84,7 +104,7 @@ The feature boundary from `spec.md` is **fixed**. Discussion clarifies HOW to im
84
104
 
85
105
  When user suggests scope creep: "That sounds like a separate feature. I'll note it in Deferred Ideas. Back to [current area]."
86
106
 
87
- ### 5. Write `context.md`
107
+ ### 6. Write `context.md`
88
108
 
89
109
  Write `.specs/features/<slug>/context.md` (see template below).
90
110
 
@@ -175,6 +195,9 @@ Discuss is done when every gray area is either resolved with the user, recorded
175
195
 
176
196
  ## Tips
177
197
 
198
+ - **Pace is a user choice; Guided is the default** — Quick for speed, Guided for balance, Detailed for Socratic depth; honor mid-discussion switches
199
+ - **Guided ≠ interrogation and ≠ form dump** — Assume-first when safe, ≤2 independent questions per turn, one-at-a-time only when answers depend on each other
200
+ - **Look it up, don't ask** — Resolve anything discoverable from the code yourself; ask only genuine product decisions
178
201
  - **Decisions, not vision** — "Card-based layout with subtle shadows" is a decision. "Should feel modern" is not.
179
202
  - **Scope is sacred** — Deferred Ideas captures scope creep without losing ideas
180
203
  - **User = visionary, Agent = builder** — Ask about how they imagine it, not about technical implementation
@@ -11,7 +11,7 @@ Use this reference for the required Execute phase. Implement ONE task at a time:
11
11
  - `.specs/features/<slug>/tasks.md` when Tasks was included, otherwise the inline atomic step list from `workflows/spec-driven.md`.
12
12
  - Current `.specs/project/STATE.md`.
13
13
  - `references/spec-driven/coding-principles.md`.
14
- - `references/spec-driven/sub-agents.md` when a formal task plan packs into more than one task-budgeted batch (> ~8 tasks), or final validation needs the standalone verifier fallback.
14
+ - `references/spec-driven/sub-agents.md` when a formal task plan has more than 3 tasks (the batch offer trigger — packing still uses ~7-task batches), or final validation needs the standalone verifier fallback.
15
15
 
16
16
  Artifact-store evidence: active artifact key, version, and checksum after write (see `references/spec-driven/artifact-store.md`).
17
17
 
@@ -35,7 +35,7 @@ Do not proceed without stating these explicitly.
35
35
 
36
36
  ### Before implementing: assess sub-agent delegation (MANDATORY — before the first task)
37
37
 
38
- Before implementing anything, if a formal `.specs/features/<slug>/tasks.md` with an Execution Plan exists, **count its total tasks** and pack the phases into task-budgeted batches (~7 tasks per worker, whole phases — see [sub-agents.md](sub-agents.md)). If that yields **more than one batch** (> ~8 tasks), you MUST present the sub-agent offer to the user and wait for their choice before starting Execute — do not silently proceed inline. If the feature fits a single batch (≤ ~8 tasks, or the user declines), execute inline. Skip this check only when you are already a batch worker executing a delegated batch (the orchestrator already made the delegation decision).
38
+ Before implementing anything, if a formal `.specs/features/<slug>/tasks.md` with an Execution Plan exists, **count its total tasks**. If the feature has **more than 3 tasks**, you MUST present the sub-agent offer to the user and wait for their choice before starting Execute — do not silently proceed inline. Packing itself still uses task-budgeted batches (~7 tasks per worker, whole phases — see [sub-agents.md](sub-agents.md)); a 4–8-task feature packs into a single batch and is still offered as one batch worker. If the feature has 3 or fewer tasks, or the user declines the offer, execute inline. Skip this check only when you are already a batch worker executing a delegated batch (the orchestrator already made the delegation decision).
39
39
 
40
40
  ### 0. List Atomic Steps (MANDATORY when Tasks phase was skipped)
41
41
 
@@ -222,11 +222,16 @@ After the gate check passes:
222
222
 
223
223
  **On any failure** → rewrite or remove the affected test(s), re-run the gate, then re-run this review.
224
224
 
225
- *Honest caveat:* This is an inspection-based review (model judgment), complementary to — not a replacement for — the deterministic gate. The gate confirms the test suite runs; the feature-level discrimination sensor (step 10) confirms the tests can detect regressions. This review confirms the suite is meaningful and bounded.
225
+ *Honest caveat:* This is an inspection-based review (model judgment), complementary to — not a replacement for — the deterministic gate. The gate confirms the test suite runs; the feature-level discrimination sensor (step 9) confirms the tests can detect regressions. This review confirms the suite is meaningful and bounded.
226
226
 
227
227
  Add the two mapping tables and a one-line adequacy verdict to the Execution Template's Post-Gate section.
228
228
 
229
- ### 7. Atomic Git Commit
229
+ ### 7. Status + Atomic Commit (same commit)
230
+
231
+ After the gate is green, close the task record **before** creating the commit, then commit code and status together. Never leave `tasks.md` still open after a successful task commit — a crash between those steps is how resume redoes finished work.
232
+
233
+ 1. Mark the task complete in `.specs/features/<slug>/tasks.md`. Update requirement traceability in `spec.md` if requirement IDs are used. Update logical feature artifact status and `.specs/project/STATE.md` with evidence and the exact next step.
234
+ 2. Create **one** atomic commit that includes the implementation, its tests, and those status/traceability updates.
230
235
 
231
236
  Each task gets its own commit immediately after verification. Never batch multiple tasks into one commit. Use one atomic commit per task when the environment and user permissions allow commits; otherwise record why the commit was skipped.
232
237
 
@@ -293,27 +298,20 @@ for reuse across multiple endpoints.
293
298
 
294
299
  - One task = one commit.
295
300
  - Description references what was DONE, not what was planned.
296
- - Include only files listed in the task — never sneak in "while I'm here" changes.
301
+ - Include only files listed in the task — plus the `tasks.md` / `spec.md` status updates for this task.
302
+ - Never sneak in "while I'm here" changes.
297
303
  - If tests are part of the task, include them in the same commit.
298
304
 
299
- ### 8. Scope Guardrail / Scope Control
300
-
301
- During implementation, you will notice things that could be improved, refactored, or added. **Do not act on them.** Instead:
302
-
303
- - If it's a bug: surface it to the user (or capture it as a separate task).
304
- - If it's an improvement: add it to the feature's `.specs/features/<slug>/context.md` under "Deferred Ideas" (or surface it to the user if there is no `context.md`).
305
- - If it's related to the current task: only include it if it is in the "Done when" criteria.
306
-
307
- **The heuristic:** "Is this in my task definition?" If no, don't touch it. "While I'm here" scope creep during implementation is the #1 quality killer.
305
+ **Deterministic backing (run it, do not eyeball it):** `python3 skills/massa-ai/scripts/check_commit.py --message "<your message>"` before committing. A non-zero exit means fix the format first — this makes the format rule enforceable instead of memory-dependent. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
308
306
 
309
- - Do not add requirements during Execute. New behavior goes back to Specify.
310
- - Do not make unapproved architecture or contract decisions. New decisions go back to Design.
311
- - Do not expand task scope to opportunistic refactors.
312
- - Keep changed files limited to the approved scope and validation.
307
+ **Optional git-level guard (git only, no agent dependency).** In a git repo the same check can run on every commit by wiring it as a `commit-msg` hook, so a malformed message is rejected regardless of who or what drives the commit:
313
308
 
314
- ### 9. Update Task Status
309
+ ```bash
310
+ # from the repo root, one time:
311
+ ln -sf skills/massa-ai/scripts/check_commit.py .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
312
+ ```
315
313
 
316
- Mark the task complete in `.specs/features/<slug>/tasks.md`. Update requirement traceability in `spec.md` if requirement IDs are used. Update logical feature artifact status and `.specs/project/STATE.md` with evidence and the exact next step.
314
+ This is a plain git hook, not tied to any editor or assistant. Skip it if the project manages hooks its own way (for example a pre-commit framework); the manual check above still applies.
317
315
 
318
316
  **Distill a confirmed lesson** when a task produced a reusable signal (an unexpected failure mode, a confirmed pattern, a corrected assumption):
319
317
 
@@ -328,7 +326,24 @@ python3 skills/massa-ai/scripts/lessons.py --root . add \
328
326
  python3 skills/massa-ai/scripts/lessons.py --root . list --status confirmed [--scope <relevant>]
329
327
  ```
330
328
 
331
- ### 10. Feature-Level Validation (after the LAST task — MANDATORY, always runs)
329
+ ### 8. Scope Guardrail / Scope Control
330
+
331
+ During implementation, you will notice things that could be improved, refactored, or added. **Do not act on them.** Instead:
332
+
333
+ - If it's a bug: surface it to the user (or capture it as a separate task).
334
+ - If it's an improvement: add it to the feature's `.specs/features/<slug>/context.md` under "Deferred Ideas" (or surface it to the user if there is no `context.md`).
335
+ - If it's related to the current task: only include it if it is in the "Done when" criteria.
336
+
337
+ **The heuristic:** "Is this in my task definition?" If no, don't touch it. "While I'm here" scope creep during implementation is the #1 quality killer.
338
+
339
+ - Do not add requirements during Execute. New behavior goes back to Specify.
340
+ - Do not make unapproved architecture or contract decisions. New decisions go back to Design.
341
+ - Do not expand task scope to opportunistic refactors.
342
+ - Keep changed files limited to the approved scope and validation.
343
+
344
+ **Blast radius (approval ≠ remote authority):** Approving Execute for this feature authorizes local implementation and local commits, and covers one delivery through PR creation — branch push and `gh pr create` — under one explicit go-ahead given at Execute start. Force-push, deploy, production database changes, merges, and any other remote/externally-visible/destructive operation always require a separate explicit go-ahead, even after that authorization.
345
+
346
+ ### 9. Feature-Level Validation (after the LAST task — MANDATORY, always runs)
332
347
 
333
348
  When the task you just completed is the **last task of the feature** (or of a priority group being delivered on its own, e.g. all P1 tasks), you MUST run feature-level validation before reporting the work as done. **This is not optional and is never prompted — it runs automatically.** Do not stop at the final task's commit.
334
349
 
@@ -336,7 +351,7 @@ When the task you just completed is the **last task of the feature** (or of a pr
336
351
 
337
352
  **Layering:**
338
353
  - Per-task adequacy self-check (steps 5–6): cheap, always runs, author does it, confirms each task in isolation.
339
- - Feature-level validation (step 10): one trustworthy independent gate at completion, always-on, Verifier sub-agent does it.
354
+ - Feature-level validation (step 9): one trustworthy independent gate at completion, always-on, Verifier sub-agent does it.
340
355
 
341
356
  **How to delegate to the Verifier:**
342
357
  Dispatch a fresh sub-agent following the **Verifier** role described in [sub-agents.md](sub-agents.md). Provide it with:
@@ -437,7 +452,7 @@ Then run `references/spec-driven/validate.md` as the final Execute gate. The ver
437
452
  **Status**: ✅ Complete | ❌ Blocked | ⚠️ Partial
438
453
  ```
439
454
 
440
- **After the LAST task:** dispatch the Verifier sub-agent (see step 10 and [sub-agents.md](sub-agents.md)) for independent feature-level validation, including the spec-anchored check and discrimination sensor. Validation always runs automatically — never prompted. Execute is not done until the Verifier reports PASS and the validation report is written.
455
+ **After the LAST task:** dispatch the Verifier sub-agent (see step 9 and [sub-agents.md](sub-agents.md)) for independent feature-level validation, including the spec-anchored check and discrimination sensor. Validation always runs automatically — never prompted. Execute is not done until the Verifier reports PASS and the validation report is written, confirmed deterministically by `python3 skills/massa-ai/scripts/validate_state.py <feature> [--root .]` (exit non-zero = not done); see [validate.md](validate.md). If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
441
456
 
442
457
  ---
443
458
 
@@ -447,11 +462,13 @@ Then run `references/spec-driven/validate.md` as the final Execute gate. The ver
447
462
  - **Tools matter** — Wrong MCP = wrong approach; ask the MCP and skill question when tool choice changes correctness or verification.
448
463
  - **Reuses save tokens** — Copy patterns, don't reinvent; reach for massa-ai tooling first to locate existing reuse.
449
464
  - **Check before commit** — Verify all criteria, then commit.
465
+ - **Status then commit, same commit** — Mark `tasks.md` complete before the atomic commit and include that update in it; a crash between the two steps is how resume redoes finished work.
450
466
  - **Stay surgical** — Touch only what's necessary.
451
467
  - **Commit per task** — Clean git history enables bisect and rollback.
452
468
  - **Never "while I'm here"** — Scope creep during implementation is the #1 quality killer.
469
+ - **Approval is local** — Push, deploy, and other remote/destructive ops need an explicit go-ahead beyond Execute's initial delivery authorization.
453
470
  - **Learn from mistakes** — If something goes wrong, distill a confirmed lesson and surface it so it informs the next task.
454
- - **Don't stop at the last commit** — Feature-level validation (step 10) is the final step of Execute, not optional.
471
+ - **Don't stop at the last commit** — Feature-level validation (step 9) is the final step of Execute, not optional.
455
472
 
456
473
  ---
457
474
 
@@ -191,8 +191,18 @@ Both are silent data loss. The section-scoped write rule is the single correctne
191
191
 
192
192
  1. Read `.specs/project/STATE.md` and `.specs/HANDOFF.md` — both.
193
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.
194
+ 3. Read `.specs/HANDOFF.md` — treat it as a **hypothesis** for feature, phase/task, next step, blockers, uncommitted files, branch — not as ground truth by itself.
195
+ 4. **Reconcile with git before editing anything:**
196
+ - Current branch vs Handoff `Branch`
197
+ - `git status --porcelain` (uncommitted / unexpected paths)
198
+ - Recent commits on the branch (messages and touched files)
199
+ - `tasks.md` completion marks and, when present, gate evidence / commit references
200
+ 5. **Resolve conflicts with evidence, not narrative:**
201
+ - A task with a green gate and an atomic commit already on the branch → do **not** redo it; mark it complete in `tasks.md` if the file still shows it open, then continue from the next incomplete task
202
+ - Partial unverified work in the working tree → preserve it, re-run the relevant gate, then finish the status+commit cycle
203
+ - Stale or missing Handoff → rebuild next-step from git + `tasks.md`, then propose that to the user
204
+ - Unexplained local changes you cannot map to the current task → STOP and ask; do not discard them
205
+ 6. Propose the reconciled next step to the user before writing any code.
196
206
 
197
207
  ---
198
208
 
@@ -82,6 +82,8 @@ If needed:
82
82
  - "What are the constraints (time, tech, resources)?"
83
83
  - "What is explicitly out of scope?"
84
84
 
85
+ **Facts you look up; decisions you ask.** Anything discoverable by reading the environment (the codebase, config, docs, existing conventions) you resolve yourself through the Knowledge Verification Chain — do not spend the user's attention asking for it. Reserve questions for genuine decisions that are the user's to make: scope, priorities, product behavior, trade-offs. A question you could have answered by reading the code erodes trust and wastes a turn.
86
+
85
87
  **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
88
 
87
89
  **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:
@@ -98,11 +100,22 @@ The `N/A because...` escape is mandatory — it prevents inventing requirements
98
100
 
99
101
  Each story MUST be **independently testable** — you can implement and demo just that story.
100
102
 
101
- ### 3. Write Acceptance Criteria
103
+ ### 3. Write Acceptance Criteria (EARS notation)
104
+
105
+ Write every acceptance criterion in **EARS** (Easy Approach to Requirements Syntax). Each criterion resolves to exactly one pattern, which keeps it unambiguous and directly testable. Choose the pattern that fits the requirement instead of forcing everything into a single shape:
106
+
107
+ | Pattern | Keyword | Template | Use for |
108
+ | ------- | ------- | -------- | ------- |
109
+ | Ubiquitous | (none) | The [system] SHALL [response] | Always-on invariants and constraints |
110
+ | Event-driven | WHEN | WHEN [trigger] THEN the [system] SHALL [response] | A response to a discrete trigger |
111
+ | State-driven | WHILE | WHILE [state] the [system] SHALL [response] | Behavior that holds during a state |
112
+ | Optional-feature | WHERE | WHERE [feature is present] the [system] SHALL [response] | Behavior gated behind an optional capability or flag |
113
+ | Unwanted-behavior | IF / THEN | IF [undesired condition] THEN the [system] SHALL [response] | Errors, failures, invalid input, timeouts |
114
+ | Complex | combination | WHILE [state], WHEN [trigger] the [system] SHALL [response] | Richer behavior combining the above |
102
115
 
103
- Use **WHEN/THEN/SHALL** format — it's precise and testable:
116
+ **Why patterns beat one shape:** failure states, state transitions, and optional behavior become first-class criteria instead of footnotes squeezed into WHEN/THEN. The patterns map onto the implicit-requirement dimensions above: state-transition integrity to State-driven; failure and external-dependency failure to Unwanted-behavior; feature flags to Optional-feature.
104
117
 
105
- - WHEN [event/action] THEN [system] SHALL [response/behavior]
118
+ **Rules:** one requirement per criterion (never bundle two behaviors); use concrete values (a specific status code, a specific message, a bound) rather than "quickly" or "gracefully"; every criterion contains a SHALL and is measurable. `python3 skills/massa-ai/scripts/validate_spec.py` flags any criterion without a SHALL and any that matches no recognized pattern.
106
119
 
107
120
  ### 4. Requirement Closure Gate (before confirm)
108
121
 
@@ -122,6 +135,8 @@ Before Design, Tasks, or Execute — and before presenting the spec for confirma
122
135
 
123
136
  6. **Continue only when** the Open Questions table is empty or every row has an accepted assumption.
124
137
 
138
+ 7. **Deterministic backing (run it, do not eyeball it):** `python3 skills/massa-ai/scripts/validate_spec.py <feature> [--root .]` checks that required sections exist, every AC is EARS-shaped (has a SHALL), no Assumptions row has an empty default or rationale, and requirement IDs are well-formed. A non-zero exit means fix before confirming — the script checks structure; the judgment calls (is the interpretation right, is the outcome precise) stay yours. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
139
+
125
140
  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
141
 
127
142
  ---
@@ -187,11 +202,12 @@ Every ambiguity is resolved or recorded here — nothing is left silently unclea
187
202
 
188
203
  **Why P1**: [Why this is critical for MVP]
189
204
 
190
- **Acceptance Criteria**:
205
+ **Acceptance Criteria** (each line is one EARS pattern):
191
206
 
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]
207
+ 1. WHEN [user action/event] THEN system SHALL [expected behavior] <!-- event-driven -->
208
+ 2. IF [invalid input / failure] THEN system SHALL [graceful handling] <!-- unwanted-behavior -->
209
+ 3. WHILE [state holds] system SHALL [behavior during that state] <!-- state-driven -->
210
+ 4. The system SHALL [always-on invariant] <!-- ubiquitous -->
195
211
 
196
212
  **Independent Test**: [How to verify this story works alone - e.g., "Can demo by doing X and seeing Y"]
197
213
 
@@ -226,9 +242,11 @@ Every ambiguity is resolved or recorded here — nothing is left silently unclea
226
242
 
227
243
  ## Edge Cases
228
244
 
245
+ Edge cases are usually unwanted-behavior (IF/THEN) or boundary (WHEN) criteria:
246
+
247
+ - IF [error scenario] THEN system SHALL [graceful handling]
248
+ - IF [unexpected input] THEN system SHALL [validation response]
229
249
  - 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
250
 
233
251
  ---
234
252
 
@@ -263,18 +281,18 @@ How we know the feature is successful:
263
281
  ## Tips
264
282
 
265
283
  - **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
284
+ - **EARS is code** — If you can't write a criterion as a test, rewrite it; pick the pattern (WHEN / WHILE / WHERE / IF / ubiquitous) that fits
267
285
  - **Requirement IDs are mandatory** — Every story maps to trackable IDs
268
286
  - **Edge cases matter** — What breaks? What's empty? What's huge?
269
287
  - **Out of Scope prevents creep** — If it's not here, it doesn't get built
270
288
  - **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
289
+ - **Confirm after the gate passes** — Present the spec for user confirmation only after the closure gate passes (no unresolved-and-unmarked items remain) and `validate_spec.py` exits clean; user approves spec before moving to the discuss phase
272
290
 
273
291
  ---
274
292
 
275
293
  ## Done
276
294
 
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.
295
+ Specify is done when every requirement has an ID, acceptance criteria are testable EARS statements, edge cases are named, out-of-scope boundaries are explicit, implicit-requirement dimensions are resolved or marked `N/A because <reason>`, the Requirement Closure Gate is satisfied, and `validate_spec.py` exits clean (or the no-code-execution-tool fallback was applied).
278
296
 
279
297
  ## Massa-ai Integration
280
298
 
@@ -1,6 +1,6 @@
1
1
  # Sub-Agent Delegation
2
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.
3
+ Use this reference during Execute when formal task planning has more than 3 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
4
 
5
5
  ## Phase-Batch Workers
6
6
 
@@ -11,15 +11,15 @@ Use this reference during Execute when formal task planning packs into more than
11
11
 
12
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
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.
14
+ **Trigger:** Count total tasks across all phases. If the feature has **more than 3 tasks**, offer the user phase-batch sub-agents before starting Execute — even when packing yields a single batch (a 4–8-task feature is offered as one batch worker). If the feature has 3 or fewer tasks, execute inline in the main window — no sub-agents spawned, no offer made.
15
15
 
16
16
  **Batching algorithm (task budget ≈ 7 tasks/worker, phase-aligned):**
17
17
 
18
18
  The benchmarked sweet spot is ~7 tasks of context per worker (~20 tasks → 3 workers). Pack whole phases into that budget:
19
19
 
20
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.
21
+ 2. If `T ≤ 3` → inline, no sub-agents, no offer.
22
+ 3. Otherwise (even for `T` as low as 4) offer sub-agents and 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
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
24
  5. If the final batch is a lone tail (1–2 tasks), fold it into the previous batch.
25
25
 
@@ -121,7 +121,7 @@ Delegated work returns through the compact summary contract above. Planning, tas
121
121
  **What the Verifier does (full process in `validate.md`):**
122
122
 
123
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.
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 an **isolated scratch** (temporary `git worktree` or temp file copies — never `git stash`), runs the relevant tests there, confirms they FAIL (kill the mutant), discards the scratch, and verifies the real worktree's `git status --porcelain` matches the pre-sensor baseline. 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
125
  3. Applies the **payload/conjunction rule**: checks payload fields are asserted on value/state, not just that the call occurred.
126
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
127
  5. **Returns a compact verdict in chat** to the orchestrator.
@@ -148,4 +148,31 @@ Delegated work returns through the compact summary contract above. Planning, tas
148
148
 
149
149
  ## Standalone Fallback
150
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.
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, and write `.specs/features/<slug>/validation.md`. **Deterministic backing (run it, do not eyeball it):** `python3 skills/massa-ai/scripts/validate_state.py <feature> [--root .]` confirms the report is a real PASS before the feature is marked done. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
152
+
153
+ ---
154
+
155
+ ## Model Tier per Role
156
+
157
+ **Applies only if the harness can assign a model per sub-agent.** If it cannot, ignore this section and run everything on the default model — the workflow is correct either way. The point is to spend high-reasoning capacity where ambiguity and consequence are high, and a faster tier where the work is mechanical, instead of paying top-tier cost uniformly.
158
+
159
+ massa-ai resolves the actual model per agent through `metadata.model_tier` (`light` / `standard` / `deep`) in each sub-agent's charter (`skills/agents/<name>/SKILL.md`), combined with the host and the active profile in `skills/model-profiles.json` (see `CLAUDE.md` § Agent-harness surface). This section maps role/work characteristics onto that mechanism — it is not a separate free-floating table.
160
+
161
+ Judge the tier by the work in front of the role, not by the role's title:
162
+
163
+ | Role / work | Characteristic | Suggested tier |
164
+ | ----------- | -------------- | -------------- |
165
+ | Design phase | High ambiguity, hard-to-reverse structural decisions | `deep` |
166
+ | Batch worker — core-domain or high-ambiguity phase | Non-obvious logic, tricky edge cases, novel integration | `deep` |
167
+ | Batch worker — mechanical phase | Entities, DTOs, config, wiring, straightforward CRUD against a settled pattern | `light` / `standard` |
168
+ | Verifier | Adversarial reasoning: designs mutations, re-derives coverage, judges outcome precision | `deep` (always — see below) |
169
+ | Specify / Tasks authoring | Structured but judgment-heavy | `standard` / `deep` |
170
+ | Read-only specialist (audit-specialist, context-curator, furps-analyst, investigator, mobile-specialist, navigator, requirements-analyst, reviewer) | No write access — findings, investigation, or review quality is the entire deliverable, with no implementation pass downstream to catch a missed nuance | `deep` (always — see below) |
171
+
172
+ **Rules of thumb:**
173
+
174
+ - When unsure, size up, not down. An under-powered worker on ambiguous logic produces gaps the Verifier then has to catch — more expensive than paying for reasoning once.
175
+ - **The Verifier always runs on the deepest tier** — per project rule, `skills/agents/verification-agent/SKILL.md` pins `metadata.model_tier: deep`, structurally, not just as advisory guidance here. A weak Verifier defeats the author ≠ verifier gate.
176
+ - **Read-only specialists always run on the deepest tier** — this generalizes the Verifier rule: every findings-only or investigation-only charter (`permission: read-only`) pins `metadata.model_tier: deep` structurally, because there is no later implementation pass to catch what a weaker read-only pass missed.
177
+ - Set the tier per batch, from that batch's phases. A feature can mix tiers across batches.
178
+ - Outside the Verifier's and read-only specialists' structural pins, this table is advisory metadata only — no gate, commit, or verification step depends on it.