@massa-ai/cursor-plugin 1.34.0 → 1.35.1
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 +1 -1
- package/package.json +1 -1
- package/skills/massa-ai/references/agent-orchestration.md +4 -0
- package/skills/massa-ai/references/artifact-persistence.md +46 -0
- package/skills/massa-ai/references/audit-report-io.md +50 -0
- package/skills/massa-ai/references/brownfield-mapping.md +22 -0
- package/skills/massa-ai/references/codebase-investigation.md +1 -1
- package/skills/massa-ai/references/discrimination-sensor.md +42 -0
- package/skills/massa-ai/references/implementation-delivery.md +17 -3
- package/skills/massa-ai/references/knowledge-verification-chain.md +25 -0
- package/skills/massa-ai/references/maestro/cloud.md +2 -0
- package/skills/massa-ai/references/maestro/fact-ledger.md +2 -0
- package/skills/massa-ai/references/maestro/patterns.md +7 -1
- package/skills/massa-ai/references/mobile-figma-matcher/core.md +13 -0
- package/skills/massa-ai/references/spec-driven/artifact-store.md +2 -32
- package/skills/massa-ai/references/spec-driven/design.md +1 -1
- package/skills/massa-ai/references/spec-driven/validate.md +9 -31
- package/skills/massa-ai/references/verification-ladder.md +16 -0
- package/skills/massa-ai/scripts/check_fix_closure.ts +335 -0
- package/skills/massa-ai/scripts/check_specs_delivered.ts +61 -15
- package/skills/massa-ai/scripts/validate_audit_report.ts +2 -1
- package/skills/massa-ai/workflows/architecture/architecture-fix.md +31 -19
- package/skills/massa-ai/workflows/bugs/bugs-fix.md +29 -16
- package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +36 -21
- package/skills/massa-ai/workflows/debug.md +44 -15
- package/skills/massa-ai/workflows/design.md +2 -0
- package/skills/massa-ai/workflows/exploration.md +1 -16
- package/skills/massa-ai/workflows/feature.md +26 -4
- package/skills/massa-ai/workflows/general.md +28 -4
- package/skills/massa-ai/workflows/implementation/implementation-fix.md +25 -16
- package/skills/massa-ai/workflows/maestro/maestro-fix.md +25 -4
- package/skills/massa-ai/workflows/maestro/maestro.md +2 -0
- package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +51 -16
- package/skills/massa-ai/workflows/refactor.md +34 -3
- package/skills/massa-ai/workflows/requirements/requirements-fix.md +31 -17
- package/skills/massa-ai/workflows/security/security-fix.md +30 -17
- package/skills/massa-ai/workflows/spec-driven.md +6 -21
- package/skills/massa-ai/workflows/tests/tests-fix.md +33 -17
- package/skills/massa-ai/references/spec-driven/brownfield-mapping.md +0 -16
|
@@ -3,7 +3,7 @@ name: implementation-fix
|
|
|
3
3
|
description: "Executes confirmed findings from a saved implementation audit report; the saved audits/implementation report is the source of truth, not chat summaries."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.2.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
### Implementation Fix
|
|
@@ -12,7 +12,9 @@ Execute confirmed findings from a saved implementation audit markdown report onl
|
|
|
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 spans through PR creation only, not force-push, deploy, or merge) 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
|
+
|
|
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.
|
|
16
18
|
|
|
17
19
|
Do not execute from chat summaries, inline review comments, remembered findings, or old PR audit reports. The saved `audits/implementation/<YYYY-MM-DD implementation-audit.md>` report is the source of truth. Route fresh findings work to `workflows/implementation/implementation-audit.md`.
|
|
18
20
|
|
|
@@ -25,7 +27,10 @@ Do not execute from chat summaries, inline review comments, remembered findings,
|
|
|
25
27
|
- `references/verification-ladder.md` before non-trivial edits.
|
|
26
28
|
- `references/naming-standards.md` before introducing, renaming, or preserving identifiers as part of a finding fix.
|
|
27
29
|
- `references/context-firewall.md` before large diffs, logs, snapshots, reports, or broad searches.
|
|
28
|
-
- `references/
|
|
30
|
+
- `references/discrimination-sensor.md` before closing any finding at the tiers the verification-ladder's Independent Verification Mandate names.
|
|
31
|
+
- `references/knowledge-verification-chain.md` when a finding's fix depends on external library/API behavior not already verified this session.
|
|
32
|
+
- `references/brownfield-mapping.md` (Minimum Bar only) for Standard+ findings when recall returns no hit for the target and no gate command is derivable from the report's evidence.
|
|
33
|
+
- `references/agent-orchestration.md` for high-risk findings or disjoint implementation slices; the mandated verification-agent dispatch below is carved out of this trigger by agent-orchestration's Independent Verification Exception and always attempts dispatch at its own tier gate.
|
|
29
34
|
3. `recall` -> load prior implementation audit decisions, known regressions, architecture/security boundaries, accepted exceptions, testing conventions, and reusable verification recipes for the target.
|
|
30
35
|
4. Select the report with an explicit execution focus:
|
|
31
36
|
- Establish report selector, target focus, and optional source-qualified finding IDs before selecting a report.
|
|
@@ -64,17 +69,6 @@ Do not execute from chat summaries, inline review comments, remembered findings,
|
|
|
64
69
|
> - output: implementation summary, commands run, test counts, deviations
|
|
65
70
|
> - firewall: raw diffs/logs summarized
|
|
66
71
|
> - memory: suggest-only; main agent persists reusable patterns
|
|
67
|
-
> - 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
|
|
68
|
-
|
|
69
|
-
> **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
|
|
70
|
-
> - trigger: high-risk, security, public-contract, or multi-file fix
|
|
71
|
-
> - scope: the fixed finding's behavior, contracts, tests, and report claim closure
|
|
72
|
-
> - permissions: read-only
|
|
73
|
-
> - inputs: the finding, the applied fix, the verification suggestion, and validation assets
|
|
74
|
-
> - sensors: deterministic command per lens (tests, import checks, security checks) and report claim closure
|
|
75
|
-
> - output: confirmed/disproven closure verdict with evidence
|
|
76
|
-
> - firewall: raw test output/logs summarized
|
|
77
|
-
> - memory: suggest-only; main agent persists reusable verification recipes
|
|
78
72
|
> - 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
|
|
79
73
|
|
|
80
74
|
Never run parallel writers against shared files or contracts.
|
|
@@ -91,8 +85,20 @@ Do not execute from chat summaries, inline review comments, remembered findings,
|
|
|
91
85
|
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
|
|
92
86
|
> - 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
|
|
93
87
|
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
> **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
|
|
89
|
+
> - trigger: an `Area/PREFIX-N` finding's closure meets the verification-ladder's Independent Verification Mandate tier gate — Standard+/Spec-driven size or any high/critical-severity finding
|
|
90
|
+
> - scope: the closed `Area/PREFIX-N` finding's fix diff, its source-lens claim, and the validation assets the fix touches
|
|
91
|
+
> - permissions: read-only
|
|
92
|
+
> - inputs: the source-qualified finding ID, the applied fix diff, the report's Verification Suggestion, and the pending closure-matrix row
|
|
93
|
+
> - sensors: the deterministic command/artifact named in the closure row for that lens; discrimination sensor per `references/discrimination-sensor.md` (the code under the closed finding's claim)
|
|
94
|
+
> - output: confirmed/disproven closure verdict per `Area/PREFIX-N` row, ladder level reached, residual risk
|
|
95
|
+
> - firewall: raw test/build output and diffs summarized to verdict plus evidence pointers
|
|
96
|
+
> - memory: suggest-only; main agent persists implementation-closure verification outcomes
|
|
97
|
+
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes re-check of each closed Area/PREFIX-N row against this output contract and record the skipped-delegation reason
|
|
98
|
+
> - 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
|
+
|
|
100
|
+
11. Verify each completed finding with the Mandatory Verification Fix Gate from `references/verification-ladder.md`: run the report's Verification Suggestion or an equivalent deterministic command/artifact check, then run focused tests, build, lint, type, static, or runtime checks relevant to the source lens. At the tiers the ladder's Independent Verification Mandate names, also run the Discrimination Sensor (`references/discrimination-sensor.md`) against the code under the closed finding's claim; a surviving mutant marks that closure row `blocked` (not `fixed`) and emits the `surviving_mutant` lessons signal. Reinspect tests, fixtures, snapshots, types, specs, public contracts, and touched identifiers so validation assets were not weakened and names follow `references/naming-standards.md`. 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. The fix→re-verify cycle is capped at the ladder's 3-iteration limit per finding — distinct from the preamble's two-consecutive-failed-fixes breaker above, which fires on edit attempts inside a single iteration and routes to `references/root-cause-scripts.md` rather than closing a finding `blocked`.
|
|
101
|
+
12. Persist the closure evidence as the Fix Closure Report defined in `references/audit-report-io.md` (Fix Closure Report Contract), at `audits/implementation/<YYYY-MM-DD implementation-fix-closure>.md`, one row per selected finding keyed by its source-qualified `Area/PREFIX-N` ID: status (`fixed`, `deferred`, `blocked`, `skipped`), changed files, command/artifact, result, skipped reason or `none`, discrimination sensor verdict, independent verifier verdict, highest Verification Ladder level reached, validation assets protected, residual risk, and exact next step for deferred or blocked findings. Run `bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family implementation` before Propose/Evidence Gate; a non-zero exit blocks closure. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
|
|
96
102
|
13. If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
|
|
97
103
|
`bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
|
|
98
104
|
14. Persist only reusable root-cause patterns, approved remediation exceptions, durable architecture/security/requirements decisions, or project-specific verification recipes after Importance Calibration. Use `workflow:implementation-fix` and required project/session/entity/memory tags.
|
|
@@ -111,3 +117,6 @@ User asks: "Fix Security/SEC-2 from audits/implementation/2026-06-15 implementat
|
|
|
111
117
|
1. Read the exact report and validate `Security/SEC-2` against current source.
|
|
112
118
|
2. Apply security-fix methods only to that finding.
|
|
113
119
|
3. Preserve all other findings for later execution.
|
|
120
|
+
|
|
121
|
+
<!-- validator anchors: "Fix Closure Report defined in `references/audit-report-io.md`", "audits/implementation/<YYYY-MM-DD implementation-fix-closure>.md", "bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family implementation", "discrimination sensor per `references/discrimination-sensor.md`", "surviving_mutant` lessons signal", "graceful degradation preserved", "Independent Verification Exception", "brownfield-mapping.md` (Minimum Bar only)" -->
|
|
122
|
+
|
|
@@ -3,7 +3,7 @@ name: maestro-fix
|
|
|
3
3
|
description: "Child-only workflow to fix confirmed MST-prefixed findings from a saved Maestro audit report or an explicit maestro-audit handoff."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.2.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
### Maestro Fix
|
|
@@ -12,7 +12,9 @@ Child-only workflow: fix confirmed `MST-*` findings from a saved Maestro audit r
|
|
|
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) and `references/code-annotation.md` (doc blocks, rationale, test coverage) — one user go-ahead carries this fix through PR creation only, force-push, deploy, and merge stay separately gated, and Maestro Cloud execution/upload is gated again, separately, per `references/maestro/cloud.md`. After two consecutive failed fixes on one symptom, stop editing and load `references/root-cause-scripts.md`.
|
|
16
|
+
|
|
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.
|
|
16
18
|
|
|
17
19
|
Reject direct use without a saved `audits/maestro/<YYYY-MM-DD maestro-audit.md>` report or a parent audit handoff that includes the same required metadata. Do not execute from chat summaries, remembered findings, inline comments, or unsaved model analysis. The saved report or parent handoff is the source of truth.
|
|
18
20
|
|
|
@@ -23,9 +25,11 @@ Reject direct use without a saved `audits/maestro/<YYYY-MM-DD maestro-audit.md>`
|
|
|
23
25
|
- `references/maestro/cli-device.md` before CLI checks, device/platform readiness, local sharding, or executable runs.
|
|
24
26
|
- `references/maestro/artifacts-reports.md` before report/artifact/debug-output, screenshot, video, recording, or AI report claims.
|
|
25
27
|
- `references/maestro/patterns.md` before applying flow, setup/teardown, fixture, validation asset, or skipped-check rules.
|
|
28
|
+
- `references/discrimination-sensor.md` before closing any finding `fixed` — the Maestro instantiation is `references/maestro/patterns.md` § Discrimination Sensor (Flow Mutation), a scratch-copy selector/assertion perturbation.
|
|
29
|
+
- `references/brownfield-mapping.md` (Minimum Bar only — `CONCERNS.md` and `TESTING.md`) when recall returns no hit for the target flow/workspace and no gate command is derivable from the report's evidence, for Standard+ findings.
|
|
26
30
|
- `references/maestro/yaml-commands.md` before changing unfamiliar command syntax.
|
|
27
31
|
- `references/maestro/selectors.md` before changing selector strategy.
|
|
28
|
-
- `references/maestro/workspace-execution.md` before changing config, tags, execution order, sharding, or CI command shape.
|
|
32
|
+
- `references/maestro/workspace-execution.md` before changing config, tags, execution order, sharding, or CI command shape, or on the first fix touching an unmapped Maestro workspace.
|
|
29
33
|
- `references/maestro/config-env-output.md` before changing env, properties, report-output flags, or artifact directories.
|
|
30
34
|
- `references/maestro/js-scripting.md` before changing JavaScript helpers or logs.
|
|
31
35
|
- `references/maestro/cloud.md` only when saved finding scopes Cloud execution or Cloud artifact evidence.
|
|
@@ -63,6 +67,18 @@ Reject direct use without a saved `audits/maestro/<YYYY-MM-DD maestro-audit.md>`
|
|
|
63
67
|
- Keep setup/teardown explicit, idempotent, and isolated.
|
|
64
68
|
- Protect existing flows, subflows, fixtures, snapshots, baselines, report consumers, and CI commands unless the audit finding explicitly scopes them.
|
|
65
69
|
|
|
70
|
+
> **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
|
|
71
|
+
> - trigger: mandatory at Standard+/Spec-driven finding size or high/critical severity per the Independent Verification Mandate in `references/verification-ladder.md`; at Quick size, device runs are expensive, so skip the dispatch and instead run the standalone fresh-eyes self-check named in the fallback line
|
|
72
|
+
> - scope: the fixed flow/subflow/fixture's `MST-*` claim closure — selector/assertion changes, stable-flow design compliance, and the JUnit report/artifact evidence for the run
|
|
73
|
+
> - permissions: read-only
|
|
74
|
+
> - inputs: the `MST-*` finding, the applied flow/fixture diff, the report's Verification Suggestion, the JUnit report path, the artifact directory, and device/platform
|
|
75
|
+
> - sensors: the report's Verification Suggestion or equivalent `maestro test` run; flow-mutation discrimination sensor per `references/maestro/patterns.md` (single lightweight selector/assertion perturbation)
|
|
76
|
+
> - output: confirmed/disproven closure verdict for the `MST-*` row, with JUnit/artifact evidence cited
|
|
77
|
+
> - firewall: JUnit XML, logs, screenshots, and recordings summarized, never dumped raw
|
|
78
|
+
> - memory: suggest-only; main agent persists maestro-closure verification outcomes
|
|
79
|
+
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes re-check of the MST closure rows and on-disk JUnit/artifact evidence, and record the skipped-delegation reason
|
|
80
|
+
> - 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
|
|
81
|
+
|
|
66
82
|
> **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
|
|
67
83
|
> - trigger: implementation complete, before the verification gate — never optional
|
|
68
84
|
> - scope: the fix's diff surface and its task/AC context
|
|
@@ -82,7 +98,9 @@ Reject direct use without a saved `audits/maestro/<YYYY-MM-DD maestro-audit.md>`
|
|
|
82
98
|
- Prefer repository-specific Maestro commands; otherwise run `maestro test --format junit --output <report.xml> --test-output-dir <artifact-dir> <flow-or-directory>`.
|
|
83
99
|
- A finding cannot be marked `fixed` when a target-relevant command or artifact check exists but was not attempted.
|
|
84
100
|
- If verification cannot run, mark it `blocked`, `deferred`, or `skipped` with an allowed skipped-check reason.
|
|
85
|
-
|
|
101
|
+
- At the tier gate that mandated the verifier dispatch above, also run the Discrimination Sensor from `references/verification-ladder.md` via the flow-mutation sensor in `references/maestro/patterns.md`; a surviving mutant on the fixed flow's selector/assertion means the finding's closure row is `blocked`, and record the `surviving_mutant` lessons signal.
|
|
102
|
+
- Cap the fix→re-verify cycle at 3 iterations per `MST-*` finding per `references/verification-ladder.md`'s Bounded Fix→Re-verify Loop; after 3, stop with a `blocked` closure row and ask for direction. This is a verification-cycle counter, distinct from the two-consecutive-failed-fixes edit breaker above that routes to `references/root-cause-scripts.md` — neither resets or consumes the other.
|
|
103
|
+
10. Persist the closure matrix as the Fix Closure Report per `references/audit-report-io.md`'s Fix Closure Report Contract, at `audits/maestro/<YYYY-MM-DD maestro-fix-closure>.md`: the standard Closure Matrix columns (`MST-*` ID, status, changed files, command/artifact, result, skipped reason, Discrimination Sensor, Independent Verifier, ladder level, validation assets protected, residual risk, next step) plus the maestro extras `JUnit Report`, `Artifact Directory`, and `Device/Platform`, appended after the standard set. Before the Propose/Evidence Gate, run `bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family maestro`; a non-zero exit blocks closure. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
|
|
86
104
|
11. Persist only durable Maestro fix patterns, flake root causes, selector/test-ID policy, setup/teardown recipes, device matrix constraints, or reusable verification commands after Importance Calibration. Use `workflow:maestro-fix` and required memory tags.
|
|
87
105
|
12. Complete the Evidence Gate from `references/evidence-gate.md`.
|
|
88
106
|
|
|
@@ -93,3 +111,6 @@ User asks: "Fix MST-2 from audits/maestro/2026-06-29 maestro-audit.md."
|
|
|
93
111
|
1. Read and validate the saved report.
|
|
94
112
|
2. Reinspect current flow evidence and fix only the targeted Maestro flow/subflow/fixture surface.
|
|
95
113
|
3. Run the report's Verification Suggestion or equivalent Maestro command and report the closure matrix.
|
|
114
|
+
|
|
115
|
+
<!-- validator anchors: references/discrimination-sensor.md | Discrimination Sensor (Flow Mutation) | references/brownfield-mapping.md (Minimum Bar only) | first fix touching an unmapped Maestro workspace | Independent Verification Mandate | Bounded Fix→Re-verify Loop | surviving_mutant lessons signal | Fix Closure Report Contract | audits/maestro/<YYYY-MM-DD maestro-fix-closure>.md | check_fix_closure.ts --family maestro | graceful degradation preserved -->
|
|
116
|
+
|
|
@@ -14,6 +14,8 @@ Load `references/project-context.md` (intake sweep) before the first substantive
|
|
|
14
14
|
|
|
15
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`.
|
|
16
16
|
|
|
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
|
+
|
|
17
19
|
Not for findings-only review of existing flows — route to `workflows/maestro/maestro-audit.md`. Not to execute saved audit findings — route to `workflows/maestro/maestro-fix.md`. Not for app bug fixes or product behavior changes — route to `workflows/debug.md`, `workflows/feature.md`, or `workflows/requirements/requirements-audit.md`.
|
|
18
20
|
|
|
19
21
|
1. Resolve/reuse `workflowSessionId`: `maestro-[entity]`.
|
|
@@ -3,7 +3,7 @@ name: mobile-figma-fix
|
|
|
3
3
|
description: "Fixes confirmed MFM-prefixed findings from a saved mobile Figma audit report; the saved audit report is the source of truth, not screenshots or chat summaries."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.2.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
### Mobile Figma Fix
|
|
@@ -12,7 +12,9 @@ Fix confirmed `MFM-*` findings from a saved mobile Figma audit 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 delivery go-ahead spans through PR creation only, with force-push, deploy, and merge separately gated per that reference's Stage 3/7) 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
|
+
|
|
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.
|
|
16
18
|
|
|
17
19
|
Do not execute from chat summaries, screenshots alone, remembered findings, or an unsaved comparison table. The saved `audits/mobile-figma/<YYYY-MM-DD mobile-figma-audit>.md` report is the source of truth. Route fresh comparison work to `mobile-figma-audit`.
|
|
18
20
|
|
|
@@ -27,6 +29,10 @@ Do not execute from chat summaries, screenshots alone, remembered findings, or a
|
|
|
27
29
|
- `references/audit-scope.md` and `references/codebase-investigation.md` for freshness and current source.
|
|
28
30
|
- `references/verification-ladder.md` before edits.
|
|
29
31
|
- `references/context-firewall.md` before large design/runtime artifacts.
|
|
32
|
+
- `references/agent-orchestration.md` for the tier-gated builder/verification-agent dispatch in the fix loop below.
|
|
33
|
+
- `references/discrimination-sensor.md` before closing any finding under the Mandatory Verification Fix Gate — the mobile-Figma token/value instantiation lives in `references/mobile-figma-matcher/core.md`'s Discrimination Sensor for Visual Parity section.
|
|
34
|
+
- `references/knowledge-verification-chain.md` when a selected finding's fix direction depends on platform-API or external-library technique rather than the Figma-defined value.
|
|
35
|
+
- `references/brownfield-mapping.md` (Minimum Bar only — the gate-command packet, `TESTING.md`-equivalent) when recall returns no hit for the target surface/module and no gate command is derivable from the report's evidence, for Standard+ findings; the report's Verification/Test Fidelity Checklist already carries the risk surface, so `CONCERNS.md` is satisfied-by-citation from that checklist rather than derived fresh.
|
|
30
36
|
3. `recall` -> load current design-system rules, accepted deviations, prior component mappings, source-set boundaries, accessibility constraints, asset-pipeline rules, and render recipes for the target.
|
|
31
37
|
4. Select a report and target focus:
|
|
32
38
|
- Prefer an exact report path plus optional `MFM-*` IDs.
|
|
@@ -49,6 +55,18 @@ Do not execute from chat summaries, screenshots alone, remembered findings, or a
|
|
|
49
55
|
- Keep XML/Compose, UIKit/SwiftUI, and KMP/native interoperability explicit. Do not duplicate one visual rule across layers when an established shared source owns it.
|
|
50
56
|
- Do not weaken screenshot tests, previews, fixtures, assertions, test tags, resource IDs, content descriptions, or Maestro selectors to hide a mismatch.
|
|
51
57
|
- Modify tracked Maestro flows only when the selected finding explicitly identifies the flow as incorrect or missing and the user-approved scope includes that change.
|
|
58
|
+
9. Dispatch per `references/agent-orchestration.md`; the verification-agent block below is tier-gated mandatory, not merely discretionary — carved out of ordinary delegation gating by that reference's Independent Verification Exception:
|
|
59
|
+
|
|
60
|
+
> **Dispatch: `massa-ai-builder`** (role: `builder`) — charter `skills/agents/builder/SKILL.md`
|
|
61
|
+
> - trigger: a selected `MFM-*` finding spans a disjoint surface or shared-root slice, or an explicit subagent request
|
|
62
|
+
> - scope: one `MFM-*` finding, or a coherent surface group sharing one KMP root cause, with a disjoint write set
|
|
63
|
+
> - permissions: write (disjoint write set, per-surface or per-module ownership)
|
|
64
|
+
> - inputs: the finding's Surface ID, Figma value, resolved token/resource/asset chain, current implementation value, and simplest fix direction
|
|
65
|
+
> - sensors: the remediation matrix's assigned runtime sensor and optional Maestro packet for the surface
|
|
66
|
+
> - output: implementation summary, changed files, commands run, per-surface render evidence
|
|
67
|
+
> - firewall: raw diffs and screenshots summarized
|
|
68
|
+
> - memory: suggest-only; main agent persists reusable token/mapping patterns
|
|
69
|
+
> - 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
|
|
52
70
|
|
|
53
71
|
> **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
|
|
54
72
|
> - trigger: implementation complete, before the verification gate — never optional
|
|
@@ -62,20 +80,35 @@ Do not execute from chat summaries, screenshots alone, remembered findings, or a
|
|
|
62
80
|
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
|
|
63
81
|
> - 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
|
|
64
82
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
> **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
|
|
84
|
+
> - trigger: mandatory at Standard+/Spec-driven size or high/critical severity per the Independent Verification Mandate in `references/verification-ladder.md`; a Quick-tier finding runs the fallback fresh-eyes self-check below instead
|
|
85
|
+
> - scope: the fixed `MFM-*` finding's surface, resolved token/value, comparison-matrix row, and closure claim
|
|
86
|
+
> - permissions: read-only
|
|
87
|
+
> - inputs: the finding, the applied fix, the comparison-matrix row, the render sensor used, and validation assets
|
|
88
|
+
> - sensors: the token/value mutation sensor per `references/mobile-figma-matcher/core.md`'s Discrimination Sensor for Visual Parity section, plus the surface's existing render/snapshot/instrumentation check
|
|
89
|
+
> - output: confirmed/disproven closure verdict with evidence, mutation killed/survived result
|
|
90
|
+
> - firewall: raw screenshots and renders summarized
|
|
91
|
+
> - memory: suggest-only; main agent persists reusable verification recipes
|
|
92
|
+
> - fallback: at Quick tier, or when the subagent is unavailable, run a standalone fresh-eyes re-check of the MFM closure rows and record the skipped-delegation reason in closure evidence
|
|
93
|
+
> - 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
|
|
94
|
+
|
|
95
|
+
10. Verify after each coherent finding group:
|
|
96
|
+
- If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
|
|
97
|
+
`bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
|
|
98
|
+
- 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 `MFM-*` finding or coherent group.
|
|
99
|
+
- A finding cannot be marked `fixed` when a target-relevant command, render sensor, comparison artifact, or Maestro reproduction exists but was not attempted; if verification cannot run, mark it `blocked`, `deferred`, or `skipped` with an allowed skipped-check reason.
|
|
100
|
+
- Re-resolve every affected comparison row, not only the previous mismatch.
|
|
101
|
+
- Run focused static checks and existing preview/screenshot/instrumentation sensors.
|
|
102
|
+
- Re-evaluate every affected surface, including surfaces changed indirectly by a shared KMP fix.
|
|
103
|
+
- When Maestro evidence was used in audit and remains available, reproduce each recorded device/configuration/content state and rerun the same flow or navigation steps; capture equivalent hierarchy and screenshots.
|
|
104
|
+
- If Maestro becomes unavailable, record the regression gap instead of claiming equivalent runtime verification.
|
|
105
|
+
- Run the token/value mutation sensor from `references/mobile-figma-matcher/core.md`'s Discrimination Sensor for Visual Parity section for every critical/high-severity finding and every shared-KMP-root row; a surviving mutant marks that row's closure status `blocked` and records the `surviving_mutant` lessons signal.
|
|
106
|
+
- Cap the fix→re-verify cycle at 3 iterations per `MFM-*` finding per `references/verification-ladder.md`'s Bounded Fix→Re-verify Loop; after 3, stop with a `blocked` closure row and ask for direction. This is a verification-cycle counter, distinct from the two-consecutive-failed-fixes edit breaker in the preamble above that routes to `references/root-cause-scripts.md` — neither resets nor consumes the other.
|
|
107
|
+
11. Rebuild the final comparison matrix using fresh Figma and per-surface implementation evidence. Completion requires zero unresolved selected mismatches; all newly `NOT EVALUATED` rows remain residual risk. A passing Maestro flow does not change an unmatched visual row to `MATCH`.
|
|
108
|
+
12. Produce a closure matrix with `MFM-*` ID, surface ID, status (`fixed`, `deferred`, `blocked`, `skipped`), changed files, final Figma/implementation values, command/artifact, result, skipped reason or `none`, highest Verification Ladder level reached, validation assets protected, static evidence, per-platform render evidence, optional Maestro evidence, and residual risk.
|
|
109
|
+
13. Write the Fix Closure Report per `references/audit-report-io.md`'s Fix Closure Report Contract at `audits/mobile-figma/<YYYY-MM-DD mobile-figma-fix-closure>.md`, sibling of the consumed audit report — the standard Closure Matrix columns, appending the mobile-figma extras (`JUnit Report`, `Artifact Directory`, `Device/Platform`) whenever Maestro or instrumentation runtime evidence backs a row. Run `bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family mobile-figma` before Propose or the Evidence Gate; a non-zero exit blocks closure. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
|
|
110
|
+
14. Persist only durable token mappings, source-set ownership rules, approved constraint deviations, component reuse rules, asset-pipeline rules, or reusable verification recipes after Importance Calibration. Use `workflow:mobile-figma-fix` and required tags.
|
|
111
|
+
15. Complete `references/evidence-gate.md` and report the highest Verification Ladder level reached.
|
|
79
112
|
|
|
80
113
|
## Examples
|
|
81
114
|
|
|
@@ -94,3 +127,5 @@ User asks: "Fix the shared KMP spacing finding and its iOS host mismatch."
|
|
|
94
127
|
|
|
95
128
|
1. Re-detect the common Compose and iOS host surfaces, load KMP plus the matching UIKit or SwiftUI contract, and verify the report schema/freshness.
|
|
96
129
|
2. Apply the shared fix first, then the host-specific fix only if the mismatch remains; rebuild Android/iOS rows affected by the shared change.
|
|
130
|
+
|
|
131
|
+
<!-- validator anchors: Independent Verification Exception | surviving_mutant | Bounded Fix→Re-verify Loop | Fix Closure Report Contract | gate-command packet | satisfied-by-citation | graceful degradation preserved | Discrimination Sensor for Visual Parity -->
|
|
@@ -3,7 +3,7 @@ name: refactor
|
|
|
3
3
|
description: "Behavior-preserving structural cleanup, simplification, decoupling, and testability workflow; route broken behavior to debug and broad boundary redesign to architecture-audit or spec-driven."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.2.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
### 🔨 Refactor
|
|
@@ -14,12 +14,16 @@ Load `references/project-context.md` (intake sweep) before the first substantive
|
|
|
14
14
|
|
|
15
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`.
|
|
16
16
|
|
|
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
|
+
|
|
17
19
|
1. Resolve/reuse `workflowSessionId`: `refactor-[entity]`
|
|
18
20
|
2. `recall` → load architectural decisions and coupling patterns for the area
|
|
21
|
+
- Canonical artifact home: Standard+ refactors write to `.specs/refactors/<slug>/` (`CHARACTERIZATION.md` required; `PLAN.md` and `SENSOR.md` optional); Quick-sized refactors reuse `.specs/quick/NNN-slug/` verbatim. If the target directory is unwritable, block the write per `references/artifact-persistence.md`.
|
|
19
22
|
3. Load shared references as needed:
|
|
20
23
|
- `references/codebase-investigation.md` before changing unfamiliar code
|
|
21
24
|
- `references/architecture-lenses.md` when the refactor is driven by coupling, seams, adapters, depth, leverage, or locality
|
|
22
25
|
- `references/architecture-deepening-lens.md` and its Interface Design Method when a refactor candidate has two or more viable interface shapes (Design It Twice before choosing)
|
|
26
|
+
- `references/knowledge-verification-chain.md` when Design It Twice or an architecture-lens library-pattern investigation depends on external library/API behavior not already verified in this session
|
|
23
27
|
- `references/mobile-context.md` when the refactor touches KMP, iOS, Android, native bridges, mobile lifecycle, offline sync, permissions, local persistence, or backend-mobile contracts
|
|
24
28
|
- `references/verification-ladder.md` before Quick/Standard/Spec-driven sizing or edits
|
|
25
29
|
- `references/context-firewall.md` when source inspection or tool output meets its threshold table (a single source/log/doc block >200 lines, >20 KB, or >50 search hits)
|
|
@@ -31,6 +35,9 @@ Before the first repository mutation, load `references/implementation-delivery.m
|
|
|
31
35
|
- For Standard refactors or Quick refactors over 3 files/200 LOC, load `references/pr-task-fix.md`, run its ADR/TDD input gate, decompose work into Small-first independently buildable PR groups, and keep Medium groups only when splitting would break build, tests, UI, or review coherence.
|
|
32
36
|
5. Follow the shared retrieval order from `references/codebase-investigation.md`
|
|
33
37
|
to find related code and usages. Call `impact_analysis` with `project`, `projectPath`, and `scope` to assess the centrality-ranked blast radius of the structural change before editing. `impact_analysis` only counts as evidence when the index is fresh for the current repository path and commit/worktree state; fall back to `search`/`get_references` and record reduced retrieval confidence when the index is stale or unavailable. An empty diff returns an empty impact set (not an error).
|
|
38
|
+
|
|
39
|
+
**Brownfield Minimum Bar:** when this codebase's `.specs/project/onboarding/` mapping does not already cover the refactor's blast radius, derive the Minimum Bar from `references/brownfield-mapping.md` before establishing current behavior — `TESTING.md` feeds step 6's characterization commands directly, and `CONCERNS.md` drives the PR-group boundaries in step 9 and the discrimination sensor's P0 tiering. Record both under `.specs/project/onboarding/`.
|
|
40
|
+
|
|
34
41
|
6. Establish current behavior before moving code: tests, exact manual command transcripts, static checks, or artifact inspection
|
|
35
42
|
7. For mobile refactors, characterize current bridge/API/platform behavior before moving code:
|
|
36
43
|
- shared vs platform-specific boundary
|
|
@@ -44,12 +51,14 @@ Before the first repository mutation, load `references/implementation-delivery.m
|
|
|
44
51
|
- Verify changes do not break existing behavior using the verification recipe
|
|
45
52
|
9. Execute by PR group when `references/pr-task-fix.md` applies:
|
|
46
53
|
- Order non-breaking groups by Data, Domain, then Presentation/Navigation, mapping those labels to repository boundaries when needed.
|
|
47
|
-
- Validate each group with the characterization and verification recipe before committing.
|
|
54
|
+
- Validate each group with the characterization and verification recipe before committing, then run the discrimination sensor from `references/discrimination-sensor.md`: mutate the *moved* code (never new code) in scratch and confirm the characterization tests kill it. A surviving mutant becomes a fix task that strengthens the characterization test before that group is marked verified. Tier the group P0 when the moved code touches payment, auth, data-integrity, or public-contract surfaces.
|
|
48
55
|
- Invoke `workflows/commit.md` for each verified group; do not duplicate commit staging, message, audit-exclusion, or Jira-prefix rules in this workflow.
|
|
49
56
|
- When every group has a confirmed Jira key, follow the optional stacked branch flow in `references/pr-task-fix.md` (Jira-Key Stacked Branches).
|
|
57
|
+
- Every PR group from this refactor shares one Stage 3 delivery authorization (`references/implementation-delivery.md`) — one go-ahead covers every group's commits, pushes, and PR creation.
|
|
58
|
+
- Before PR creation, run `bun skills/massa-ai/scripts/check_specs_delivered.ts <slug> --kind refactor` (`--kind quick` for Quick-sized work) — a non-zero exit blocks Propose. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
|
|
50
59
|
10. Include file-integrity checks when tests, specs, benchmarks, fixtures, or snapshots are validation assets. If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
|
|
51
60
|
`bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
|
|
52
|
-
11. Use `references/agent-orchestration.md`
|
|
61
|
+
11. Use `references/agent-orchestration.md` for isolated implementation slices; the verification-agent dispatch below is not discretionary at Standard+ sizing or PR-group execution — that reference's Independent Verification Exception makes it a standing requirement, not a per-task judgment call.
|
|
53
62
|
12. At completion, persist (run the scoring rubric from `references/decision-engine.md`):
|
|
54
63
|
- Refactored architectural decisions via `remember` as scored `decision` memories
|
|
55
64
|
- Identified and decoupled anti-patterns via `remember` as scored `pattern` memories
|
|
@@ -66,4 +75,26 @@ Before the first repository mutation, load `references/implementation-delivery.m
|
|
|
66
75
|
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
|
|
67
76
|
> - 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
|
|
68
77
|
|
|
78
|
+
> **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
|
|
79
|
+
> - trigger: Standard+ refactor sizing or any PR-group execution per the Independent Verification Mandate in `references/verification-ladder.md` — mandatory once reviewer fix items are resolved; Quick-sized refactors dispatch only when validation assets were touched, otherwise run the fresh-eyes fallback below and record the skip reason
|
|
80
|
+
> - scope: the moved/transformed code across this refactor's PR groups and the characterization tests that must protect it
|
|
81
|
+
> - permissions: read-only
|
|
82
|
+
> - inputs: the characterization baseline from step 6 (and step 7 for mobile refactors), the diff of moved code per PR group, and the PR-group map from step 9
|
|
83
|
+
> - sensors: confirm the characterization tests still pass against the moved code's preserved behavior; discrimination sensor per `references/discrimination-sensor.md` (mutate the moved code — never new code — in scratch, one PR group at a time; characterization tests must kill each mutant)
|
|
84
|
+
> - output: a preserved/regressed verdict per PR group and any surviving-mutant findings, written to `.specs/refactors/<slug>/SENSOR.md`
|
|
85
|
+
> - firewall: summarized per-group findings only, never raw diff dumps
|
|
86
|
+
> - memory: suggest-only; main agent persists refactor verification outcomes
|
|
87
|
+
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes re-check of the characterization evidence per PR group and record the skipped-delegation reason
|
|
88
|
+
> - 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
|
|
89
|
+
|
|
90
|
+
- The fix→re-verify cycle for a PR group is capped by the Bounded Fix→Re-verify Loop's 3-iteration limit in `references/verification-ladder.md` (cap reached → `Blocked`); that is distinct from the two-consecutive-failed-fix edit-attempt breaker in `references/root-cause-scripts.md`, which fires on repeated failed edits against one symptom while moving code and neither consumes nor resets the verify-cycle count.
|
|
91
|
+
|
|
69
92
|
13. Complete the Evidence Gate from `references/evidence-gate.md`
|
|
93
|
+
|
|
94
|
+
## Failure Handling
|
|
95
|
+
|
|
96
|
+
- `.specs/refactors/<slug>/` unwritable: block the write per `references/artifact-persistence.md`; do not fall back to memory or chat as the record of characterization evidence.
|
|
97
|
+
- Discrimination sensor mutation not safely reversible: mark the claim `Blocked` unless equivalent existing deterministic mutation evidence already proves the characterization tests discriminate for that moved code.
|
|
98
|
+
|
|
99
|
+
<!-- validator anchors: massa-ai-verification-agent dispatch block; Independent Verification Mandate; Independent Verification Exception; discrimination sensor mutate the moved code; characterization tests must kill it; P0 payment/auth/data-integrity/public-contract; .specs/refactors/<slug>/CHARACTERIZATION.md; .specs/refactors/<slug>/SENSOR.md; check_specs_delivered.ts --kind refactor; check_specs_delivered.ts --kind quick; graceful degradation preserved; Stage 3 delivery authorization; Bounded Fix→Re-verify Loop; two-consecutive-failed-fix edit-attempt breaker; Brownfield Minimum Bar; knowledge-verification-chain.md -->
|
|
100
|
+
|
|
@@ -3,7 +3,7 @@ name: requirements-fix
|
|
|
3
3
|
description: "Executes fixes from a saved requirements audit report; not for findings-only review or broad feature design when acceptance criteria are missing."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.2.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
### Requirements Fix
|
|
@@ -12,7 +12,9 @@ Execute fixes from a requirements 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; note its authorization spans one go-ahead through PR creation only — force-push, deploy, and 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
|
+
|
|
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.
|
|
16
18
|
|
|
17
19
|
Not for findings-only requirements review — route to `workflows/requirements/requirements-audit.md`. Not for broad feature design when acceptance criteria are missing — route to `workflows/spec-driven.md`.
|
|
18
20
|
|
|
@@ -24,6 +26,9 @@ Not for findings-only requirements review — route to `workflows/requirements/r
|
|
|
24
26
|
- `references/verification-ladder.md` before non-trivial edits
|
|
25
27
|
- `references/context-firewall.md` before inspecting large specs, diffs, generated reports, or broad search output
|
|
26
28
|
- `references/agent-orchestration.md` only for large/high-risk findings, disjoint implementation slices, or independent verification
|
|
29
|
+
- `references/discrimination-sensor.md` before closing any Standard+/Spec-driven-sized or high/critical-severity REQ finding, to size the mutation sensor against the code that now satisfies the Requirement Source
|
|
30
|
+
- `references/knowledge-verification-chain.md` when the fix direction leans on an external library's or API's documented behavior — for this family the cited Requirement Source doubles as the chain's Step 0 anchor for what was required, per its Family Instantiations
|
|
31
|
+
- `references/brownfield-mapping.md` (Minimum Bar only, Standard+ REQ findings) when step 3's recall turns up no hit for the target and no gate command can be derived from the report's evidence
|
|
27
32
|
3. `recall` -> load product decisions, accepted scope constraints, public contracts, compatibility rules, requirement interpretations, and verification recipes for the report target.
|
|
28
33
|
4. Select the requirements audit report with execution focus:
|
|
29
34
|
- Establish the report selector, target focus, requirements source, and optional finding selector before selecting a report. Target focus can be a flow, feature, public contract, module, files/globs, branch comparison, commit range, symbol/class/function, or explicit whole-repo target.
|
|
@@ -38,8 +43,9 @@ Not for findings-only requirements review — route to `workflows/requirements/r
|
|
|
38
43
|
- If the user supplied finding IDs, extract only those IDs after validating they exist and match the current target focus and requirements source.
|
|
39
44
|
- Rank by mandatory requirement severity, dependency order, user-visible impact, compatibility risk, and testability.
|
|
40
45
|
6. Build a traceability matrix before editing:
|
|
41
|
-
- Requirement ID/source -> audit finding ID -> current implementation evidence -> desired behavior -> files likely affected -> tests/docs needed -> verification command.
|
|
46
|
+
- Requirement ID/source -> audit finding ID -> current implementation evidence -> desired behavior -> files likely affected -> tests/docs needed -> verification command -> Linked .specs/ Requirement ID (when `.specs/` exists).
|
|
42
47
|
- Mark each item as missing requirement, contradicted requirement, out-of-scope behavior, compatibility break, docs mismatch, or test/docs gap.
|
|
48
|
+
- That last column is the join key step 13 uses to mirror closure status back into the originating spec.
|
|
43
49
|
7. Size each finding with `references/verification-ladder.md`:
|
|
44
50
|
- Quick: local behavior correction, docs wording fix, config default correction, or focused test alignment.
|
|
45
51
|
- Standard: multi-file behavior change, public API compatibility fix, UI/API contract update, or meaningful test impact; define verification recipe first.
|
|
@@ -53,8 +59,9 @@ Not for findings-only requirements review — route to `workflows/requirements/r
|
|
|
53
59
|
9. Guard scope:
|
|
54
60
|
- Do not reinterpret requirements beyond the report and cited source.
|
|
55
61
|
- Preserve non-goals and explicit constraints.
|
|
62
|
+
- `references/knowledge-verification-chain.md`'s Step 5 settles technical facts only (library/API behavior), never product intent; a product decision gap still stops here regardless of how the chain resolved.
|
|
56
63
|
- If a finding exposes a product decision gap, stop and ask rather than inventing policy.
|
|
57
|
-
10. Use agent orchestration only when it improves signal. Dispatch per `references/agent-orchestration.md`:
|
|
64
|
+
10. Use agent orchestration only when it improves signal, with one carve-out: the verification-agent dispatch below is mandatory at its tier gate rather than discretionary, per `references/agent-orchestration.md`'s Independent Verification Exception. Dispatch per `references/agent-orchestration.md`:
|
|
58
65
|
|
|
59
66
|
> **Dispatch: `massa-ai-builder`** (role: `builder`) — charter `skills/agents/builder/SKILL.md`
|
|
60
67
|
> - trigger: large/high-risk finding, disjoint implementation slice, or explicit subagent request
|
|
@@ -67,18 +74,6 @@ Not for findings-only requirements review — route to `workflows/requirements/r
|
|
|
67
74
|
> - memory: suggest-only; main agent persists reusable requirements patterns
|
|
68
75
|
> - 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
|
|
69
76
|
|
|
70
|
-
> **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
|
|
71
|
-
> - trigger: independent verification of a high-risk requirements fix
|
|
72
|
-
> - scope: the fixed finding's requirement alignment, test coverage, and report claim closure
|
|
73
|
-
> - permissions: read-only
|
|
74
|
-
> - inputs: the finding, the applied fix, the verification suggestion, and validation assets
|
|
75
|
-
> - sensors: deterministic command (requirements-trace check, test coverage, doc/spec alignment) and report claim closure
|
|
76
|
-
> - output: confirmed/disproven closure verdict with evidence
|
|
77
|
-
> - firewall: raw test output/logs summarized
|
|
78
|
-
> - memory: suggest-only; main agent persists reusable verification recipes
|
|
79
|
-
> - 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
|
|
80
|
-
- Main agent owns report parsing, traceability matrix, memory writes, final synthesis, and Evidence Gate.
|
|
81
|
-
|
|
82
77
|
> **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
|
|
83
78
|
> - trigger: implementation complete, before the verification gate — never optional
|
|
84
79
|
> - scope: the fix's diff surface and its task/AC context
|
|
@@ -91,10 +86,26 @@ Not for findings-only requirements review — route to `workflows/requirements/r
|
|
|
91
86
|
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
|
|
92
87
|
> - 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
|
|
93
88
|
|
|
89
|
+
> **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
|
|
90
|
+
> - trigger: mandatory at Standard+/Spec-driven REQ-fix size or high/critical requirement severity, per the Independent Verification Mandate tier gate in `references/verification-ladder.md`'s Mandatory Verification Fix Gate; a Quick-tier REQ finding takes the fallback below instead
|
|
91
|
+
> - scope: the closed REQ row's Requirement Source alignment, acceptance evidence, and report claim closure
|
|
92
|
+
> - permissions: read-only
|
|
93
|
+
> - inputs: the finding, its Requirement Source and Requirement ID or Quote, the applied fix, the verification suggestion, and validation assets
|
|
94
|
+
> - sensors: deterministic command (requirements-trace check, acceptance tests, doc/spec alignment) and report claim closure; discrimination sensor per `references/discrimination-sensor.md` (the code that now satisfies the Requirement Source)
|
|
95
|
+
> - output: confirmed/disproven closure verdict against the Requirement Source, feeding the Fix Closure Report's Independent Verifier column
|
|
96
|
+
> - firewall: raw test output/logs summarized
|
|
97
|
+
> - memory: suggest-only; main agent persists requirements verification outcomes
|
|
98
|
+
> - fallback: if the subagent is unavailable, run a standalone fresh-eyes re-check of each REQ closure row against its Requirement Source and record the skipped-delegation reason
|
|
99
|
+
> - 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
|
|
100
|
+
- Main agent owns report parsing, traceability matrix, memory writes, final synthesis, and Evidence Gate.
|
|
101
|
+
|
|
94
102
|
11. Verify each completed finding:
|
|
95
103
|
- If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
|
|
96
104
|
`bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
|
|
97
105
|
- 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.
|
|
106
|
+
- Dispatch the verification-agent block above once a REQ finding reaches Standard+/Spec-driven size or high/critical severity; a Quick-tier finding instead runs the listed fallback self-check — the tier gate decides the hop, never the check itself.
|
|
107
|
+
- A surviving mutant on the discrimination sensor blocks the row: mark the finding's Closure Matrix status `blocked` and log a `surviving_mutant` signal through `references/lessons.md`.
|
|
108
|
+
- `references/verification-ladder.md`'s Bounded Fix→Re-verify Loop caps re-verify cycles per REQ finding at 3; exhausting it also lands `blocked`. That is a distinct counter from this file's own two-consecutive-failed-fixes breaker above, which trips inside one edit iteration rather than across re-verify cycles.
|
|
98
109
|
- 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.
|
|
99
110
|
- Run the report's verification suggestion when available.
|
|
100
111
|
- Run acceptance tests, targeted unit/integration tests, docs checks, type/build checks, or manual artifact inspection relevant to the requirement.
|
|
@@ -103,7 +114,8 @@ Not for findings-only requirements review — route to `workflows/requirements/r
|
|
|
103
114
|
12. At completion, persist only durable knowledge:
|
|
104
115
|
- Accepted requirement interpretations, scope constraints, compatibility rules, or reusable acceptance-test recipes after scoring with the Importance Calibration System.
|
|
105
116
|
- Use required tags: `project:<projectId>`, `session:<workflowSessionId>`, `workflow:requirements-fix`, `entity:<entity>`, and one `memory:<tier>` tag.
|
|
106
|
-
13.
|
|
117
|
+
13. Write the Fix Closure Report per `references/audit-report-io.md`'s Fix Closure Report Contract, at `audits/requirements/<YYYY-MM-DD requirements-fix-closure>.md`, carrying the family's appended `Linked .specs/ Requirement ID` column; when `.specs/` exists, mirror each closed REQ row into its originating `.specs/features/<slug>/spec.md` requirement-status table — the same join `references/spec-driven/validate.md`'s Requirement Traceability Update performs from the verification side. Then run `bun skills/massa-ai/scripts/check_fix_closure.ts <closure.md> --family requirements` 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).
|
|
118
|
+
14. Complete the Evidence Gate from `references/evidence-gate.md`.
|
|
107
119
|
|
|
108
120
|
## Examples
|
|
109
121
|
|
|
@@ -114,3 +126,5 @@ User asks: "Use requirements-fix to fix latest audit for checkout flow."
|
|
|
114
126
|
3. Build a requirement traceability matrix.
|
|
115
127
|
4. Fix mandatory gaps and contradictions before lower-severity docs/test issues.
|
|
116
128
|
5. Verify against the cited requirement source.
|
|
129
|
+
|
|
130
|
+
<!-- validator anchors: Linked .specs/ Requirement ID | Independent Verification Exception | audits/requirements/<YYYY-MM-DD requirements-fix-closure>.md | check_fix_closure.ts <closure.md> --family requirements | surviving_mutant | Bounded Fix→Re-verify Loop | Requirement Traceability Update | graceful degradation preserved -->
|