@massa-ai/cursor-plugin 1.35.0 → 1.36.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 (37) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/skills/massa-ai/references/agent-orchestration.md +4 -0
  4. package/skills/massa-ai/references/artifact-persistence.md +46 -0
  5. package/skills/massa-ai/references/audit-report-io.md +50 -0
  6. package/skills/massa-ai/references/brownfield-mapping.md +22 -0
  7. package/skills/massa-ai/references/codebase-investigation.md +1 -1
  8. package/skills/massa-ai/references/discrimination-sensor.md +42 -0
  9. package/skills/massa-ai/references/implementation-delivery.md +8 -3
  10. package/skills/massa-ai/references/knowledge-verification-chain.md +25 -0
  11. package/skills/massa-ai/references/maestro/cloud.md +2 -0
  12. package/skills/massa-ai/references/maestro/fact-ledger.md +2 -0
  13. package/skills/massa-ai/references/maestro/patterns.md +7 -1
  14. package/skills/massa-ai/references/mobile-figma-matcher/core.md +13 -0
  15. package/skills/massa-ai/references/spec-driven/artifact-store.md +2 -32
  16. package/skills/massa-ai/references/spec-driven/design.md +1 -1
  17. package/skills/massa-ai/references/spec-driven/validate.md +9 -31
  18. package/skills/massa-ai/references/verification-ladder.md +16 -0
  19. package/skills/massa-ai/scripts/check_fix_closure.ts +335 -0
  20. package/skills/massa-ai/scripts/check_specs_delivered.ts +61 -15
  21. package/skills/massa-ai/scripts/validate_audit_report.ts +2 -1
  22. package/skills/massa-ai/workflows/architecture/architecture-fix.md +29 -19
  23. package/skills/massa-ai/workflows/bugs/bugs-fix.md +27 -16
  24. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +34 -21
  25. package/skills/massa-ai/workflows/debug.md +42 -15
  26. package/skills/massa-ai/workflows/exploration.md +1 -16
  27. package/skills/massa-ai/workflows/feature.md +24 -4
  28. package/skills/massa-ai/workflows/general.md +26 -4
  29. package/skills/massa-ai/workflows/implementation/implementation-fix.md +23 -16
  30. package/skills/massa-ai/workflows/maestro/maestro-fix.md +23 -4
  31. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +49 -16
  32. package/skills/massa-ai/workflows/refactor.md +32 -3
  33. package/skills/massa-ai/workflows/requirements/requirements-fix.md +29 -17
  34. package/skills/massa-ai/workflows/security/security-fix.md +28 -17
  35. package/skills/massa-ai/workflows/spec-driven.md +4 -21
  36. package/skills/massa-ai/workflows/tests/tests-fix.md +31 -17
  37. package/skills/massa-ai/references/spec-driven/brownfield-mapping.md +0 -16
@@ -3,7 +3,7 @@ name: security-fix
3
3
  description: "Executes fixes from a saved security audit report; not for findings-only security review or generic correctness fixes outside an exploitable path."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.1.0"
6
+ version: "1.2.0"
7
7
  ---
8
8
 
9
9
  ### Security Fix
@@ -12,7 +12,7 @@ Execute fixes from a security audit markdown report only.
12
12
 
13
13
  Load `references/project-context.md` (intake sweep) before the first substantive read.
14
14
 
15
- Before the first repository mutation, load `references/implementation-delivery.md` (delivery chain: worktree, atomic commits, PR, CI watch, merge gate) and `references/code-annotation.md` (doc blocks, rationale, test coverage). After two consecutive failed fixes on one symptom, stop editing and load `references/root-cause-scripts.md`.
15
+ Before the first repository mutation, load `references/implementation-delivery.md` (delivery chain: worktree, atomic commits, PR, CI watch, merge gate — its Stage 3 delivery-authorization scope covers one go-ahead through PR creation; force-push/deploy/merge stay separately gated) and `references/code-annotation.md` (doc blocks, rationale, test coverage). After two consecutive failed fixes on one symptom, stop editing and load `references/root-cause-scripts.md`.
16
16
 
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
@@ -22,11 +22,14 @@ Not for findings-only security review — route to `workflows/security/security-
22
22
  2. Load shared references:
23
23
  - `references/audit-report-io.md` before any code change
24
24
  - `references/lessons.md` to load confirmed project lessons
25
- - `references/codebase-investigation.md` before changing unfamiliar security boundaries
25
+ - `references/codebase-investigation.md` before changing unfamiliar security boundaries; that trigger also gates `.specs/project/onboarding/CONCERNS.md` — consult it before working the finding
26
26
  - `references/mobile-context.md` when the report target touches KMP, iOS, Android, native bridges, mobile permissions, secure storage, biometrics, deep links, push/background behavior, local persistence, offline queues, logs/crash privacy, or backend-mobile contracts
27
27
  - `references/verification-ladder.md` before non-trivial edits
28
28
  - `references/context-firewall.md` before inspecting large diffs, logs, generated reports, or broad search output
29
29
  - `references/agent-orchestration.md` only for large/high-risk findings, disjoint implementation slices, or independent verification
30
+ - `references/discrimination-sensor.md` before closing any SEC finding under the Mandatory Verification Fix Gate — its Mutation Target table names the guard just added as the security row
31
+ - `references/knowledge-verification-chain.md` when a guard, validation rule, crypto choice, or auth fix depends on an external library's or API's actual behavior
32
+ - `references/brownfield-mapping.md` (Minimum Bar only — `CONCERNS.md` and `TESTING.md`, Standard+ findings) when recall returns no hit for the security boundary and no gate command is derivable from the report's evidence
30
33
  3. `recall` -> load auth boundaries, tenant rules, validation conventions, secret-handling policies, accepted exceptions, prior incidents, and verification recipes for the report target.
31
34
  4. Select the security audit report with execution focus:
32
35
  - Establish the report selector, target focus, and optional finding selector before selecting a report. Target focus can be a trust boundary, route, module, flow, files/globs, branch comparison, commit range, symbol/class/function, or explicit whole-repo target.
@@ -60,7 +63,7 @@ Not for findings-only security review — route to `workflows/security/security-
60
63
  - Add or update negative tests for the exploit path when feasible.
61
64
  - Include positive tests for allowed behavior so the fix does not over-block legitimate use.
62
65
  - Do not weaken existing security assertions to make tests pass.
63
- 10. Use agent orchestration only when it improves signal. Dispatch per `references/agent-orchestration.md`:
66
+ 10. Use agent orchestration only when it improves signal — except the verifier dispatch below, which is unconditional for every SEC finding closed `fixed`, carved out under `references/agent-orchestration.md`'s Independent Verification Exception as the security-fix unconditional case (other fix families use the tier-gated one). Dispatch per `references/agent-orchestration.md`:
64
67
 
65
68
  > **Dispatch: `massa-ai-builder`** (role: `builder`) — charter `skills/agents/builder/SKILL.md`
66
69
  > - trigger: large/high-risk finding, disjoint implementation slice, or explicit subagent request
@@ -73,18 +76,6 @@ Not for findings-only security review — route to `workflows/security/security-
73
76
  > - memory: suggest-only; main agent persists reusable security patterns
74
77
  > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
75
78
 
76
- > **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
77
- > - trigger: independent verification of a high-risk security fix
78
- > - scope: the fixed finding's guard restoration, middleware order, redaction, and report claim closure
79
- > - permissions: read-only
80
- > - inputs: the finding, the applied fix, the verification suggestion, and validation assets
81
- > - sensors: deterministic command (negative tests, middleware-order inspection, redaction check) and report claim closure
82
- > - output: confirmed/disproven closure verdict with evidence
83
- > - firewall: raw test output/logs summarized
84
- > - memory: suggest-only; main agent persists reusable verification recipes
85
- > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
86
- - Main agent owns report parsing, prioritization, memory writes, final synthesis, and Evidence Gate.
87
-
88
79
  > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
89
80
  > - trigger: implementation complete, before the verification gate — never optional
90
81
  > - scope: the fix's diff surface and its task/AC context
@@ -97,19 +88,36 @@ Not for findings-only security review — route to `workflows/security/security-
97
88
  > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
98
89
  > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
99
90
 
91
+ > **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
92
+ > - trigger: every SEC finding closed `fixed` — never optional, at every tier (verification-ladder Independent Verification Mandate, security-fix exception)
93
+ > - scope: the fixed SEC finding's guard, exploit path, negative test, and report claim closure
94
+ > - permissions: read-only
95
+ > - inputs: the SEC finding, the applied guard, the verification suggestion, the exploit path, and validation assets
96
+ > - sensors: deterministic command (negative-test re-run, guard/middleware-order inspection, redaction or crypto check) and report claim closure; guard-mutation discrimination sensor per `references/discrimination-sensor.md` (invert the specific guard just added; the negative test must kill it)
97
+ > - output: confirmed/disproven SEC closure verdict with evidence, feeding the Fix Closure Report's Independent Verifier column
98
+ > - firewall: raw exploit transcripts and test/log output summarized
99
+ > - memory: suggest-only; main agent persists security verification outcomes
100
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes re-check of each fixed SEC row's guard and negative test, and record the skipped-delegation reason
101
+ > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
102
+ - Main agent owns report parsing, prioritization, memory writes, final synthesis, and Evidence Gate.
103
+
100
104
  11. Verify each completed finding:
101
105
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
102
106
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
103
107
  - Apply the Mandatory Verification Fix Gate from `references/verification-ladder.md`: run the report's Verification Suggestion or an equivalent deterministic command/artifact check for each selected finding or coherent group.
104
108
  - A finding cannot be marked `fixed` when a target-relevant command or artifact check exists but was not attempted; if verification cannot run, mark it `blocked`, `deferred`, or `skipped` with an allowed skipped-check reason.
105
109
  - Run the report's verification suggestion when available.
110
+ - At Standard+ size or high/critical severity, run the guard-mutation discrimination sensor per `references/discrimination-sensor.md`: invert the specific guard just added and confirm the negative test kills it; a surviving mutant marks the finding's Closure Matrix row `blocked` and records the `surviving_mutant` lessons signal even when the exploit-path test is green.
111
+ - The fix→re-verify cycle is capped per `references/verification-ladder.md`'s Bounded Fix→Re-verify Loop at 3 iterations; that counter is separate from the two-consecutive-failed-fixes breaker into `references/root-cause-scripts.md` named in this file's preamble, which fires inside a single edit iteration and neither consumes nor resets the loop count.
106
112
  - Run targeted tests for negative and positive paths, plus lint/type/build checks relevant to touched files.
107
113
  - Inspect logs/config/errors when the finding involves data exposure.
108
114
  - Record command/artifact, result, skipped reason or `none`, highest Verification Ladder level reached, validation assets protected, and residual risk.
109
115
  12. At completion, persist only durable knowledge:
110
116
  - Security boundary decisions, accepted exceptions, reusable exploit-path tests, or incident-prevention patterns after scoring with the Importance Calibration System.
117
+ - When step 2's unfamiliar-security-boundary trigger fired for this finding, append any newly discovered security hotspot to `.specs/project/onboarding/CONCERNS.md` — the same wiring that required consulting it before working the finding.
111
118
  - Use required tags: `project:<projectId>`, `session:<workflowSessionId>`, `workflow:security-fix`, `entity:<entity>`, and one `memory:<tier>` tag.
112
- 13. Complete the Evidence Gate from `references/evidence-gate.md`.
119
+ 13. Write the Fix Closure Report per `references/audit-report-io.md`'s Fix Closure Report Contract, at `audits/security/<YYYY-MM-DD security-fix-closure>.md`, sibling of the consumed audit report; then run `bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family security` before Propose and the Evidence Gate — a non-zero exit blocks both. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
120
+ 14. Complete the Evidence Gate from `references/evidence-gate.md`. Urgency does not expand delivery authorization: hotfix pressure never widens the Stage 3 one-go-ahead-through-PR-creation scope named in this file's preamble, and force-push, deploy, and merge stay separately gated regardless of severity.
113
121
 
114
122
  ## Examples
115
123
 
@@ -120,3 +128,6 @@ User asks: "Use security-fix to fix latest audit findings for user routes."
120
128
  3. Fix critical/high exploit paths first.
121
129
  4. Add negative tests for denied access, invalid input, or redacted output.
122
130
  5. Run deterministic tests and report residual security risk.
131
+
132
+ <!-- validator anchors: every SEC finding closed `fixed` — never optional, at every tier | guard-mutation discrimination sensor | Fix Closure Report Contract | security-fix-closure | consult it before working the finding | append any newly discovered security hotspot | Urgency does not expand delivery authorization | Bounded Fix→Re-verify Loop | graceful degradation preserved -->
133
+
@@ -136,7 +136,7 @@ Quick artifacts live under `.specs/quick/NNN-slug/` with a `TASK.md` (one-line i
136
136
  > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
137
137
 
138
138
  - The verification-agent re-derives coverage independently using evidence-or-zero and does not inherit the author's mental model.
139
- - The fix → re-verify loop is capped at 3 iterations before escalating to `Blocked`.
139
+ - The fix → re-verify loop is bounded by the Bounded Fix→Re-verify Loop rule in `references/verification-ladder.md` (cap reached → `Blocked`).
140
140
  - Distill lesson signals through `references/lessons.md` when validation produces grounded reusable failures.
141
141
  7. Before the delivery chain's Propose stage (PR creation), write and commit `.specs/project/STATE.md`, `.specs/HANDOFF.md`, and `.specs/project/FEATURES.json` on the branch — not merely "after meaningful progress" during Execute, but committed before `gh pr create`. **Deterministic backing (run it, do not eyeball it):** `bun skills/massa-ai/scripts/check_specs_delivered.ts <feature> [--root .]` — a non-zero exit blocks Propose (see `references/implementation-delivery.md` stage 3.5 and GATE-02). If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved). Record decisions, blockers, handoff, and completion evidence per `references/spec-driven/memory.md`'s write triggers.
142
142
  8. When the user splits planning and implementation across clean chats, resume from the canonical `.specs/` artifacts — `.specs/project/STATE.md`, `.specs/project/FEATURES.json`, `.specs/HANDOFF.md`, and the feature's phase files. This workflow owns the spec phase contracts on both sides of the split; there is no separate save/load procedure.
@@ -164,32 +164,15 @@ Quick artifacts live under `.specs/quick/NNN-slug/` with a `TASK.md` (one-line i
164
164
  - Validation command unavailable: record the missing command/tool in `validation.md` and mark `Blocked`.
165
165
  - Discrimination sensor cannot be made safely reversible: mark `Blocked` unless the verification-agent can prove equivalent discrimination with an existing deterministic mutation fixture.
166
166
  - Validation conflict: stop for user resolution when a validation asset conflicts with an approved specification.
167
- - Fix loop exceeds 3 iterations: stop with `Blocked`, preserve evidence, and ask for direction.
167
+ - Fix loop reaches the `references/verification-ladder.md` cap: stop with `Blocked`, preserve evidence, and ask for direction.
168
168
 
169
169
  ## Knowledge Verification Chain
170
170
 
171
- When researching, designing, or making any technical decision, follow this chain in strict order. Never skip steps.
172
-
173
- ```
174
- Step 1: Codebase → existing code, conventions, patterns already in use
175
- Step 2: Project docs (leads, not truth) → README, docs/, inline comments, .specs/project/STATE.md (Decisions) — verify against current source before relying
176
- Step 3: Context7 MCP → resolve library ID, then query for current API/patterns
177
- Step 4: Web search → official docs, reputable sources, community patterns
178
- Step 5: Flag as uncertain → "I'm not certain about X — here's my reasoning, but verify"
179
- ```
180
-
181
- - If a chain step's tool is unavailable (Context7 MCP not registered, no web
182
- access), record it as a skipped sensor with its reason and continue to the next
183
- step. An unavailable step is skipped, never silently treated as answered.
184
- - Never skip to Step 5 if Steps 1-4 are available.
185
- - Step 5 is always flagged uncertain — never presented as fact.
186
- - Never assume or fabricate. If no answer is found, say "I don't know" or "I couldn't find documentation for this". Uncertainty is always preferable to fabrication; invented APIs/patterns cause cascading failures across design → tasks → implementation.
171
+ When researching, designing, or making any technical decision, follow the 5-step chain in `references/knowledge-verification-chain.md` in strict order — codebase, project docs, Context7 MCP, web search, then flag-as-uncertain. Never skip steps, record an unavailable step as a skipped sensor with its reason, and never present Step 5 output as fact.
187
172
 
188
173
  ## Brownfield Onboarding — 7-Doc Codebase Mapping
189
174
 
190
- When the spec-driven work targets a codebase the agent has not yet mapped (brownfield, new repo, or cold project), derive the 7-doc codebase map from `references/spec-driven/brownfield-mapping.md` before Specify closes — not busywork, each doc feeds a downstream phase.
191
-
192
- Minimum bar: derive at least **`CONCERNS.md`** (risk surface — drives risk-domain escalation and validation focus) and **`TESTING.md`** (gate derivation — exact commands the Execute gate will run). If time or access is constrained, these two are non-negotiable; the other five are derived as the work needs them. Record the map under `.specs/features/<slug>/` (or the project onboarding dir) and confirm it against current source, not memory or external summaries.
175
+ When the spec-driven work targets a codebase the agent has not yet mapped (brownfield, new repo, or cold project), derive the 7-doc codebase map from `references/brownfield-mapping.md` before Specify closes — not busywork, each doc feeds a downstream phase. That reference's **Minimum Bar** (CONCERNS.md + TESTING.md non-negotiable) applies; record the map under `.specs/features/<slug>/` per its output-path rule.
193
176
 
194
177
  ## Commands
195
178
 
@@ -3,7 +3,7 @@ name: tests-fix
3
3
  description: "Executes fixes from a saved tests audit report; not for findings-only coverage review or generic test-writing work without an audit report."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.1.0"
6
+ version: "1.2.0"
7
7
  ---
8
8
 
9
9
  ### Tests Fix
@@ -12,7 +12,7 @@ Execute fixes from a tests audit markdown report only.
12
12
 
13
13
  Load `references/project-context.md` (intake sweep) before the first substantive read.
14
14
 
15
- Before the first repository mutation, load `references/implementation-delivery.md` (delivery chain: worktree, atomic commits, PR, CI watch, merge gate) and `references/code-annotation.md` (doc blocks, rationale, test coverage). After two consecutive failed fixes on one symptom, stop editing and load `references/root-cause-scripts.md`.
15
+ Before the first repository mutation, load `references/implementation-delivery.md` (delivery chain: worktree, atomic commits, PR, CI watch, merge gate — one go-ahead covers local commits through PR creation only, force-push/deploy/merge stay separately gated per `references/audit-report-io.md`'s Execution Report Input) and `references/code-annotation.md` (doc blocks, rationale, test coverage). After two consecutive failed fixes on one symptom, stop editing and load `references/root-cause-scripts.md`.
16
16
 
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
@@ -25,8 +25,11 @@ Not for findings-only test coverage, assertion quality, fixture health, flakines
25
25
  - `references/codebase-investigation.md` before changing unfamiliar tests or fixtures
26
26
  - `references/mobile-context.md` when the report target touches KMP, iOS, Android, native bridges, mobile lifecycle, offline sync, permissions, local persistence, UI snapshots/screenshots, or backend-mobile contracts
27
27
  - `references/verification-ladder.md` before non-trivial edits
28
+ - `references/discrimination-sensor.md` before closing a TST finding at Standard+/Spec-driven size or high/critical severity, to size the mutation-target sensor against the new or repaired test's subject code
29
+ - `references/knowledge-verification-chain.md` when the fix direction depends on an external test framework's or assertion library's current behavior rather than in-repo convention
28
30
  - `references/context-firewall.md` before inspecting large logs, snapshots, generated reports, or broad search output
29
31
  - `references/agent-orchestration.md` only for large/high-risk findings, disjoint implementation slices, or independent verification
32
+ - `references/brownfield-mapping.md` (Minimum Bar's `TESTING.md` only — the report's `Regression Risk` field already covers `CONCERNS.md`) when recall returns no hit for the target test suite/harness and no gate command is derivable from the report's evidence, for Standard+ findings
30
33
  3. `recall` -> load testing conventions, mock boundaries, test frameworks, prior flaky tests, known regressions, accepted exceptions, and reusable verification recipes for the report target.
31
34
  4. Select the tests audit report with execution focus:
32
35
  - Establish the report selector, target focus, and optional finding selector before selecting a report. Target focus can be a behavior, flow, module, test suite, files/globs, branch comparison, commit range, symbol/class/function, or explicit whole-repo target.
@@ -41,8 +44,9 @@ Not for findings-only test coverage, assertion quality, fixture health, flakines
41
44
  - If the user supplied finding IDs, extract only those IDs after validating they exist and match the current target focus.
42
45
  - Rank by regression risk, severity, dependency order, and determinism.
43
46
  6. Build a coverage execution map before editing:
44
- - Finding ID -> behavior under test, missing/weak assertion, fixture/mock boundary, deterministic harness, validation asset, expected failure before fix when possible, and verification command.
47
+ - Finding ID -> behavior under test, missing/weak assertion, fixture/mock boundary, deterministic harness, validation asset, expected failure before fix when possible, verification command, and discrimination sensor result.
45
48
  - Separate missing coverage, weak assertion, fixture drift, flakiness, skipped test, and missing deterministic sensor findings.
49
+ - Keep this map current through closure: filled in, it is the pre-edit draft of the Fix Closure Report's Closure Matrix, one row per finding.
46
50
  - For mobile findings, include KMP/shared vs platform-specific boundary, native bridge payload or backend-mobile contract, Android/iOS harness, device matrix or simulator/emulator assumptions, platform parity expectation, and skipped platform checks from `references/mobile-context.md`.
47
51
  7. Size each finding with `references/verification-ladder.md`:
48
52
  - Quick: local test addition, assertion strengthening, fixture field correction, or focused skipped-test restoration.
@@ -73,6 +77,18 @@ Not for findings-only test coverage, assertion quality, fixture health, flakines
73
77
  > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
74
78
  > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
75
79
 
80
+ > **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
81
+ > - trigger: mandatory per the verification-ladder's Independent Verification Mandate for any TST finding closed at Standard+/Spec-driven size or high/critical severity; at Quick size the subagent hop is skipped and the standalone fresh-eyes assertion re-check below runs instead
82
+ > - scope: the fixed TST finding's assertion strength, fixture/mock boundary, coverage-execution-map row, and report claim closure
83
+ > - permissions: read-only
84
+ > - inputs: the finding, the applied test change, the coverage execution map row, the verification command, and validation assets
85
+ > - sensors: deterministic command (focused test run, assertion inspection, fixture-not-weakened check) against the coverage execution map row; discrimination sensor per `references/discrimination-sensor.md` (mutate the new/repaired test's subject; the test must kill it)
86
+ > - output: confirmed/disproven TST closure verdict with assertion evidence
87
+ > - firewall: raw test output/logs summarized
88
+ > - memory: suggest-only; main agent persists tests-closure verification outcomes
89
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes re-check of each TST closure row's assertion evidence and record the skipped-delegation reason
90
+ > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
91
+
76
92
  10. Use strict harness sensors:
77
93
  - Never rely on AI subjective evaluation.
78
94
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
@@ -82,7 +98,10 @@ Not for findings-only test coverage, assertion quality, fixture health, flakines
82
98
  - Continue only when the execution harness returns a clean exit code, or report the exact skipped-check reason.
83
99
  - A finding cannot be marked `fixed` when a target-relevant command or artifact check exists but was not attempted; if verification cannot run, mark it `blocked`, `deferred`, or `skipped` with an allowed skipped-check reason.
84
100
  - Record command/artifact, result, skipped reason or `none`, highest Verification Ladder level reached, validation assets protected, and residual risk.
85
- 11. Use agent orchestration only when it improves signal. Dispatch per `references/agent-orchestration.md`:
101
+ - Sequence the TST proof in two passes, in order: first reproduce the coverage execution map's `expected failure before fix` row red (the pre-fix run proves the assertion can fail); only then, at Standard+/Spec-driven size or high/critical severity, run the discrimination sensor from `references/discrimination-sensor.md` as the post-fix kill-check against the new/repaired test's subject code — Quick focused-assertion findings are exempt from the sensor pass but never from the pre-fix red check.
102
+ - A surviving mutant means the TST claim is unproven: close that finding's row `blocked` rather than `fixed` and emit the `surviving_mutant` lessons signal via the recording command above.
103
+ - The fix→re-verify cycle is capped per `references/verification-ladder.md`'s Bounded Fix→Re-verify Loop (3 verification iterations, then `Blocked` with evidence preserved). That cap is a distinct counter from the "two consecutive failed fixes" breaker in the preamble above, which escalates a single stuck iteration to `references/root-cause-scripts.md` and neither consumes nor resets this cap.
104
+ 11. Use agent orchestration only when it improves signal — except the verification-agent dispatch above, which `references/agent-orchestration.md`'s Independent Verification Exception mandates for TST closures at the sizes/severities its trigger names, regardless of signal improvement. Dispatch per `references/agent-orchestration.md`:
86
105
 
87
106
  > **Dispatch: `massa-ai-builder`** (role: `builder`) — charter `skills/agents/builder/SKILL.md`
88
107
  > - trigger: large/high-risk finding, disjoint implementation slice, or explicit subagent request
@@ -93,23 +112,16 @@ Not for findings-only test coverage, assertion quality, fixture health, flakines
93
112
  > - output: implementation summary, test counts, commands run, deviations
94
113
  > - firewall: raw test output/logs summarized
95
114
  > - memory: suggest-only; main agent persists reusable testing patterns
96
- > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
97
-
98
- > **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
99
- > - trigger: independent verification of a high-risk test fix
100
- > - scope: the fixed finding's assertions, fixtures, and report claim closure
101
- > - permissions: read-only
102
- > - inputs: the finding, the applied fix, the verification suggestion, and validation assets
103
- > - sensors: deterministic command (focused test suite, assertion inspection, fixture-not-weakened check) and report claim closure
104
- > - output: confirmed/disproven closure verdict with evidence
105
- > - firewall: raw test output/logs summarized
106
- > - memory: suggest-only; main agent persists reusable verification recipes
107
115
  > - persona: optional — the active route's cataloged id only, never the persona prompt, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions; omit when no persona is routed
108
116
  - Main agent owns report parsing, prioritization, memory writes, final synthesis, and Evidence Gate.
109
- 12. At completion, persist only durable knowledge after scoring with the Importance Calibration System:
117
+ 12. Close out with the Fix Closure Report:
118
+ - The coverage execution map from step 6, now filled in through step 10's discrimination sensor result column, is the pre-edit draft of the Closure Matrix — carry its rows forward rather than re-deriving them.
119
+ - Write the final Fix Closure Report per `references/audit-report-io.md` (Fix Closure Report Contract) to `audits/tests/<YYYY-MM-DD tests-fix-closure>.md`, one Closure Matrix row per selected TST finding.
120
+ - Run `bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family tests` before Propose/Evidence Gate; a non-zero exit blocks Propose. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
121
+ 13. At completion, persist only durable knowledge after scoring with the Importance Calibration System:
110
122
  - Testing conventions, deterministic harness recipes, flaky-test root causes, accepted exceptions, or reusable edge-case coverage patterns.
111
123
  - Use required tags: `project:<projectId>`, `session:<workflowSessionId>`, `workflow:tests-fix`, `entity:<entity>`, and one `memory:<tier>` tag.
112
- 13. Complete the Evidence Gate from `references/evidence-gate.md`; do not mark tests complete without a clean deterministic exit code or explicit skipped-check reason.
124
+ 14. Complete the Evidence Gate from `references/evidence-gate.md`; do not mark tests complete without a clean deterministic exit code or explicit skipped-check reason.
113
125
 
114
126
  ## Examples
115
127
 
@@ -120,3 +132,5 @@ User asks: "Use tests-fix to fix latest audit findings for report scheduling."
120
132
  3. Map each finding to missing coverage, weak assertions, fixture drift, flakiness, or missing sensor work.
121
133
  4. Add or repair deterministic tests without weakening validation assets.
122
134
  5. Run focused tests and report broader skipped checks when needed.
135
+
136
+ <!-- validator anchors: references/discrimination-sensor.md | references/knowledge-verification-chain.md | references/brownfield-mapping.md (Minimum Bar's TESTING.md only) | Independent Verification Exception | mandatory per the verification-ladder's Independent Verification Mandate for any TST finding | discrimination sensor per references/discrimination-sensor.md (mutate the new/repaired test's subject; the test must kill it) | Sequence the TST proof in two passes | surviving_mutant lessons signal | Bounded Fix→Re-verify Loop | Fix Closure Report Contract | audits/tests/<YYYY-MM-DD tests-fix-closure>.md | bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family tests | graceful degradation preserved -->
@@ -1,16 +0,0 @@
1
- # Brownfield Onboarding — 7-Doc Codebase Mapping
2
-
3
- Use from `workflows/spec-driven.md` when the target codebase
4
- has not yet been mapped (brownfield, new repo, or cold project). The map is
5
- the shared factual ground for requirements, design, and task derivation;
6
- each doc feeds a downstream phase.
7
-
8
- | Doc | Derives | Feeds |
9
- | --- | --- | --- |
10
- | `STACK.md` | languages, runtimes, frameworks, key libraries | Design constraints, verification commands |
11
- | `ARCHITECTURE.md` | layers, modules, boundaries, data flow | Design, risk surface |
12
- | `CONVENTIONS.md` | naming, file layout, commit/test conventions | Tasks, Execute |
13
- | `STRUCTURE.md` | directory map, where new code goes | Tasks, file placement |
14
- | `TESTING.md` | test runner, how to run gates, coverage tooling | Gate Check Commands, verification recipe |
15
- | `INTEGRATIONS.md` | external services, APIs, contracts, auth | Discuss, risk escalation |
16
- | `CONCERNS.md` | known risks, tech debt, migration landmines, security/privacy hotspots | Risk-domain escalation, validation focus |