@massa-ai/cursor-plugin 1.31.0 → 1.32.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 (38) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/agent-profiles/balanced/massa-ai-audit-specialist.md +2 -1
  3. package/agent-profiles/balanced/massa-ai-test-engineer.md +2 -1
  4. package/agent-profiles/cheap/massa-ai-audit-specialist.md +2 -1
  5. package/agent-profiles/cheap/massa-ai-test-engineer.md +2 -1
  6. package/agent-profiles/heavy/massa-ai-audit-specialist.md +2 -1
  7. package/agent-profiles/heavy/massa-ai-test-engineer.md +2 -1
  8. package/agent-profiles/home/massa-ai-audit-specialist.md +2 -1
  9. package/agent-profiles/home/massa-ai-test-engineer.md +2 -1
  10. package/agent-profiles/work/massa-ai-audit-specialist.md +2 -1
  11. package/agent-profiles/work/massa-ai-test-engineer.md +2 -1
  12. package/agents/massa-ai-audit-specialist.md +2 -1
  13. package/agents/massa-ai-test-engineer.md +2 -1
  14. package/package.json +1 -1
  15. package/skills/agents/audit-specialist/SKILL.md +2 -1
  16. package/skills/agents/test-engineer/SKILL.md +2 -1
  17. package/skills/massa-ai/references/coding-guidelines.md +9 -0
  18. package/skills/massa-ai/references/implementation-delivery.md +1 -0
  19. package/skills/massa-ai/references/lessons.md +52 -0
  20. package/skills/massa-ai/references/spec-driven/validate.md +10 -0
  21. package/skills/massa-ai/scripts/lessons.ts +238 -2
  22. package/skills/massa-ai/workflows/architecture/architecture-fix.md +13 -0
  23. package/skills/massa-ai/workflows/bugs/bugs-fix.md +13 -0
  24. package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +4 -3
  25. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +16 -3
  26. package/skills/massa-ai/workflows/debug.md +13 -0
  27. package/skills/massa-ai/workflows/feature.md +18 -4
  28. package/skills/massa-ai/workflows/general.md +13 -0
  29. package/skills/massa-ai/workflows/implementation/implementation-fix.md +13 -0
  30. package/skills/massa-ai/workflows/maestro/maestro-fix.md +13 -0
  31. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +13 -0
  32. package/skills/massa-ai/workflows/pr-review.md +1 -1
  33. package/skills/massa-ai/workflows/refactor.md +14 -0
  34. package/skills/massa-ai/workflows/requirements/requirements-fix.md +13 -0
  35. package/skills/massa-ai/workflows/security/security-fix.md +13 -0
  36. package/skills/massa-ai/workflows/spec-driven.md +12 -0
  37. package/skills/massa-ai/workflows/tests/tests-audit.md +15 -1
  38. package/skills/massa-ai/workflows/tests/tests-fix.md +14 -0
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "massa-ai",
3
- "version": "1.31.0",
3
+ "version": "1.32.0",
4
4
  "description": "massa-ai — semantic code search, memory, and context compression for Cursor"
5
5
  }
@@ -33,12 +33,13 @@ The `lens` field in the capability packet selects the audit behavior:
33
33
  | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
34
34
  | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
35
35
  | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
36
+ | `tests` | Coverage, regression protection, assertion quality, variation | `workflows/tests/tests-audit.md` |
36
37
 
37
38
  All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
38
39
 
39
40
  ## Inputs
40
41
  - `scope`: the target area, diff, or module to audit.
41
- - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
42
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance | tests` (required).
42
43
  - `inputs`: recalled facts, existing audit reports, source pointers.
43
44
  - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
44
45
 
@@ -6,12 +6,13 @@ model: inherit
6
6
  # Test Engineer Agent Skill
7
7
 
8
8
  ## Mission
9
- Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria.
9
+ Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria, and that catches the five distinct error classes a test suite must cover: business-logic errors, code no test touched, hardcoded-example brittleness, built-the-wrong-thing, and drift over time.
10
10
 
11
11
  ## Responsibilities
12
12
  - Define unit test cases for core logic.
13
13
  - Define integration test cases for boundaries.
14
14
  - Identify edge cases and negative scenarios.
15
+ - Design variation/property-style test cases — vary inputs beyond the fixture example (bounds, parameter changes) — technique-level, library-neutral.
15
16
  - Produce a test plan aligned with acceptance criteria.
16
17
  - Ensure acceptance coverage maps to spec criteria.
17
18
 
@@ -33,12 +33,13 @@ The `lens` field in the capability packet selects the audit behavior:
33
33
  | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
34
34
  | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
35
35
  | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
36
+ | `tests` | Coverage, regression protection, assertion quality, variation | `workflows/tests/tests-audit.md` |
36
37
 
37
38
  All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
38
39
 
39
40
  ## Inputs
40
41
  - `scope`: the target area, diff, or module to audit.
41
- - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
42
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance | tests` (required).
42
43
  - `inputs`: recalled facts, existing audit reports, source pointers.
43
44
  - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
44
45
 
@@ -6,12 +6,13 @@ model: inherit
6
6
  # Test Engineer Agent Skill
7
7
 
8
8
  ## Mission
9
- Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria.
9
+ Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria, and that catches the five distinct error classes a test suite must cover: business-logic errors, code no test touched, hardcoded-example brittleness, built-the-wrong-thing, and drift over time.
10
10
 
11
11
  ## Responsibilities
12
12
  - Define unit test cases for core logic.
13
13
  - Define integration test cases for boundaries.
14
14
  - Identify edge cases and negative scenarios.
15
+ - Design variation/property-style test cases — vary inputs beyond the fixture example (bounds, parameter changes) — technique-level, library-neutral.
15
16
  - Produce a test plan aligned with acceptance criteria.
16
17
  - Ensure acceptance coverage maps to spec criteria.
17
18
 
@@ -33,12 +33,13 @@ The `lens` field in the capability packet selects the audit behavior:
33
33
  | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
34
34
  | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
35
35
  | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
36
+ | `tests` | Coverage, regression protection, assertion quality, variation | `workflows/tests/tests-audit.md` |
36
37
 
37
38
  All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
38
39
 
39
40
  ## Inputs
40
41
  - `scope`: the target area, diff, or module to audit.
41
- - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
42
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance | tests` (required).
42
43
  - `inputs`: recalled facts, existing audit reports, source pointers.
43
44
  - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
44
45
 
@@ -6,12 +6,13 @@ model: inherit
6
6
  # Test Engineer Agent Skill
7
7
 
8
8
  ## Mission
9
- Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria.
9
+ Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria, and that catches the five distinct error classes a test suite must cover: business-logic errors, code no test touched, hardcoded-example brittleness, built-the-wrong-thing, and drift over time.
10
10
 
11
11
  ## Responsibilities
12
12
  - Define unit test cases for core logic.
13
13
  - Define integration test cases for boundaries.
14
14
  - Identify edge cases and negative scenarios.
15
+ - Design variation/property-style test cases — vary inputs beyond the fixture example (bounds, parameter changes) — technique-level, library-neutral.
15
16
  - Produce a test plan aligned with acceptance criteria.
16
17
  - Ensure acceptance coverage maps to spec criteria.
17
18
 
@@ -33,12 +33,13 @@ The `lens` field in the capability packet selects the audit behavior:
33
33
  | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
34
34
  | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
35
35
  | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
36
+ | `tests` | Coverage, regression protection, assertion quality, variation | `workflows/tests/tests-audit.md` |
36
37
 
37
38
  All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
38
39
 
39
40
  ## Inputs
40
41
  - `scope`: the target area, diff, or module to audit.
41
- - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
42
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance | tests` (required).
42
43
  - `inputs`: recalled facts, existing audit reports, source pointers.
43
44
  - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
44
45
 
@@ -6,12 +6,13 @@ model: inherit
6
6
  # Test Engineer Agent Skill
7
7
 
8
8
  ## Mission
9
- Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria.
9
+ Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria, and that catches the five distinct error classes a test suite must cover: business-logic errors, code no test touched, hardcoded-example brittleness, built-the-wrong-thing, and drift over time.
10
10
 
11
11
  ## Responsibilities
12
12
  - Define unit test cases for core logic.
13
13
  - Define integration test cases for boundaries.
14
14
  - Identify edge cases and negative scenarios.
15
+ - Design variation/property-style test cases — vary inputs beyond the fixture example (bounds, parameter changes) — technique-level, library-neutral.
15
16
  - Produce a test plan aligned with acceptance criteria.
16
17
  - Ensure acceptance coverage maps to spec criteria.
17
18
 
@@ -33,12 +33,13 @@ The `lens` field in the capability packet selects the audit behavior:
33
33
  | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
34
34
  | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
35
35
  | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
36
+ | `tests` | Coverage, regression protection, assertion quality, variation | `workflows/tests/tests-audit.md` |
36
37
 
37
38
  All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
38
39
 
39
40
  ## Inputs
40
41
  - `scope`: the target area, diff, or module to audit.
41
- - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
42
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance | tests` (required).
42
43
  - `inputs`: recalled facts, existing audit reports, source pointers.
43
44
  - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
44
45
 
@@ -6,12 +6,13 @@ model: inherit
6
6
  # Test Engineer Agent Skill
7
7
 
8
8
  ## Mission
9
- Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria.
9
+ Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria, and that catches the five distinct error classes a test suite must cover: business-logic errors, code no test touched, hardcoded-example brittleness, built-the-wrong-thing, and drift over time.
10
10
 
11
11
  ## Responsibilities
12
12
  - Define unit test cases for core logic.
13
13
  - Define integration test cases for boundaries.
14
14
  - Identify edge cases and negative scenarios.
15
+ - Design variation/property-style test cases — vary inputs beyond the fixture example (bounds, parameter changes) — technique-level, library-neutral.
15
16
  - Produce a test plan aligned with acceptance criteria.
16
17
  - Ensure acceptance coverage maps to spec criteria.
17
18
 
@@ -33,12 +33,13 @@ The `lens` field in the capability packet selects the audit behavior:
33
33
  | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
34
34
  | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
35
35
  | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
36
+ | `tests` | Coverage, regression protection, assertion quality, variation | `workflows/tests/tests-audit.md` |
36
37
 
37
38
  All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
38
39
 
39
40
  ## Inputs
40
41
  - `scope`: the target area, diff, or module to audit.
41
- - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
42
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance | tests` (required).
42
43
  - `inputs`: recalled facts, existing audit reports, source pointers.
43
44
  - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
44
45
 
@@ -6,12 +6,13 @@ model: inherit
6
6
  # Test Engineer Agent Skill
7
7
 
8
8
  ## Mission
9
- Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria.
9
+ Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria, and that catches the five distinct error classes a test suite must cover: business-logic errors, code no test touched, hardcoded-example brittleness, built-the-wrong-thing, and drift over time.
10
10
 
11
11
  ## Responsibilities
12
12
  - Define unit test cases for core logic.
13
13
  - Define integration test cases for boundaries.
14
14
  - Identify edge cases and negative scenarios.
15
+ - Design variation/property-style test cases — vary inputs beyond the fixture example (bounds, parameter changes) — technique-level, library-neutral.
15
16
  - Produce a test plan aligned with acceptance criteria.
16
17
  - Ensure acceptance coverage maps to spec criteria.
17
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/cursor-plugin",
3
- "version": "1.31.0",
3
+ "version": "1.32.0",
4
4
  "description": "massa-ai plugin for Cursor — semantic code search, memory, and context compression",
5
5
  "files": [
6
6
  "agents",
@@ -38,12 +38,13 @@ The `lens` field in the capability packet selects the audit behavior:
38
38
  | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
39
39
  | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
40
40
  | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
41
+ | `tests` | Coverage, regression protection, assertion quality, variation | `workflows/tests/tests-audit.md` |
41
42
 
42
43
  All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
43
44
 
44
45
  ## Inputs
45
46
  - `scope`: the target area, diff, or module to audit.
46
- - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
47
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance | tests` (required).
47
48
  - `inputs`: recalled facts, existing audit reports, source pointers.
48
49
  - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
49
50
 
@@ -12,12 +12,13 @@ metadata:
12
12
  # Test Engineer Agent Skill
13
13
 
14
14
  ## Mission
15
- Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria.
15
+ Generate a testing strategy that covers unit, integration, edge cases, negative scenarios, and acceptance criteria, and that catches the five distinct error classes a test suite must cover: business-logic errors, code no test touched, hardcoded-example brittleness, built-the-wrong-thing, and drift over time.
16
16
 
17
17
  ## Responsibilities
18
18
  - Define unit test cases for core logic.
19
19
  - Define integration test cases for boundaries.
20
20
  - Identify edge cases and negative scenarios.
21
+ - Design variation/property-style test cases — vary inputs beyond the fixture example (bounds, parameter changes) — technique-level, library-neutral.
21
22
  - Produce a test plan aligned with acceptance criteria.
22
23
  - Ensure acceptance coverage maps to spec criteria.
23
24
 
@@ -65,3 +65,12 @@ For multi-step tasks, state a brief plan:
65
65
  ```
66
66
 
67
67
  Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
68
+
69
+ ## 5. File Shape for Agent Readers
70
+
71
+ **Read mechanics, not module depth.**
72
+
73
+ - A one-subject file up to ~500 lines is fine — a single agent read stays coherent, cheap in tokens, and a coding agent can hold the whole file in context with headroom for the rest of the task.
74
+ - A file over ~600 lines must be flagged for splitting — even one-subject, it crowds out the rest of the working context and pushes reads toward pagination.
75
+ - Splitting one subject across many files does not reduce read cost — it multiplies it: one subject spread over N files costs N reads, and each file boundary loses context (per-hop navigation cost).
76
+ - This guidance derives from agent read mechanics, not from module depth. Depth is a separate concept, and this section makes no depth claim: depth is NOT a lines-of-code ratio (`references/architecture-deepening-lens.md` Rejected Framings) — a deep module can be tiny and a shallow wrapper can be long. Do not phrase file-size guidance as a depth metric; it is scoped to single-agent read cost only.
@@ -111,6 +111,7 @@ report:
111
111
  - the PR URL,
112
112
  - the check names that passed,
113
113
  - what is still unverified (skipped jobs, absent checks),
114
+ - the change's category trust status (`bun skills/massa-ai/scripts/lessons.ts --root . trust status --category <kebab>`) as advisory reading-depth context — it never substitutes for the approval decision below,
114
115
 
115
116
  then stop and ask. If the user approves, merge with the repository's configured
116
117
  strategy and delete the branch. If the repository auto-releases on merge, say so
@@ -66,6 +66,58 @@ bun skills/massa-ai/scripts/lessons.ts --root . list --status confirmed [--scope
66
66
  | `quarantined` | A confirmed lesson penalized ≥`quarantine_threshold` times (failed when applied) |
67
67
  | **pruned** | A `candidate` that never recurred within `window_days` (default 45) |
68
68
 
69
+ ## Trust Ramp and Quality-Metric Trend (Advisory)
70
+
71
+ Two additional append-only record kinds accumulate in `.specs/lessons.json` beside
72
+ lessons: reviewer-feedback records (`data.reviews`) and quality-metric snapshots
73
+ (`data.metrics`). Both are derived state — `lessons.ts` computes streaks, trusted
74
+ flags, and trend verdicts at read time from the event log; there is no cached
75
+ `streak`/`trusted` flag anywhere in the store, so there is no invalidation step,
76
+ and demotion is emergent: a `major` record simply caps the trailing streak window
77
+ the next time the log is read.
78
+
79
+ ### Categories
80
+
81
+ A review category is a free-form kebab-case label supplied at record time (e.g.
82
+ `installer`, `admin-ui`) — the same convention as the existing `--scope` flag.
83
+ There is no fixed taxonomy; the label is whatever the recording agent or user
84
+ chooses.
85
+
86
+ ### Feedback levels
87
+
88
+ - `none` — no reviewer feedback; extends the category's streak.
89
+ - `minor` — a small correction; also extends the streak.
90
+ - `major` — resets the category's streak to 0 and demotes a trusted category
91
+ back to untrusted.
92
+
93
+ ### Trust threshold
94
+
95
+ `trust_threshold` (default 30) is the number of consecutive `none`/`minor`
96
+ records a category needs before `trust status` marks it `trusted`. The
97
+ comparison is `>=`: a streak sitting exactly at the threshold is trusted.
98
+
99
+ ### Advisory-only scope
100
+
101
+ Trust status governs reading depth only — how closely a human scrutinizes a
102
+ diff before approving it. It never governs, gates, or substitutes for per-PR
103
+ merge approval: `references/implementation-delivery.md`'s "Approval for one PR
104
+ does not carry to the next" clause is unaffected by any trust state.
105
+
106
+ ### Commands
107
+
108
+ ```bash
109
+ bun skills/massa-ai/scripts/lessons.ts --root . review add --category <kebab> --feedback none|minor|major --source <ref>
110
+ bun skills/massa-ai/scripts/lessons.ts --root . trust status [--category <kebab>]
111
+ bun skills/massa-ai/scripts/lessons.ts --root . metrics add --feature <slug> --result PASS|FAIL --fix-iterations <n> --surviving-mutants <n> --acs-total <n> --acs-covered <n>
112
+ bun skills/massa-ai/scripts/lessons.ts --root . metrics trend
113
+ ```
114
+
115
+ `trust status` with no `--category` lists every category with its streak,
116
+ total review count, and trusted state; an empty store reports
117
+ `(no review records)`, exit 0. `metrics trend` prints every snapshot
118
+ oldest-first followed by `trend: improving|stable|degrading`, or
119
+ `trend: insufficient data` when fewer than two snapshots exist — both exit 0.
120
+
69
121
  ## No-Script Fallback
70
122
 
71
123
  If `lessons.ts` is unavailable or cannot run, record `Lessons: skipped - script unavailable` in the validation report or evidence gate, keep the raw signal in the report, and do not hand-edit `lessons.json`. A future run with the script can import the validated signal.
@@ -218,6 +218,16 @@ The script enforces grounding (mandatory `--source`) and owns all bookkeeping. A
218
218
 
219
219
  Persist durable memory for verified outcomes worth reusing via `remember` with tags `workflow:spec-driven`, `entity:<slug>`, and `memory:episodic|procedural` as appropriate.
220
220
 
221
+ ### 11. Record Metric Snapshot (MANDATORY)
222
+
223
+ Immediately after validation completes, record this run's quality-metric snapshot so "is the harness improving or degrading" is answerable from data, not memory:
224
+
225
+ ```bash
226
+ bun skills/massa-ai/scripts/lessons.ts --root . metrics add --feature <slug> --result PASS|FAIL --fix-iterations <n> --surviving-mutants <n> --acs-total <n> --acs-covered <n>
227
+ ```
228
+
229
+ Derive the flags from this validation's own evidence: `--result` from the Verdict, `--acs-total`/`--acs-covered` from the Spec-Anchored Acceptance Criteria check, `--surviving-mutants` from the Discrimination Sensor's survived count, and `--fix-iterations` from the fix-loop iteration count used this run.
230
+
221
231
  ---
222
232
 
223
233
  ## Verdicts
@@ -23,6 +23,9 @@
23
23
  * export Export the lessons store as JSON (round-trips with import).
24
24
  * import Import lessons from JSON (merge by dedup key; best-effort massa-ai memory).
25
25
  * selftest Run stdlib regressions (normalization).
26
+ * review Append reviewer-feedback records and derive per-category trust streaks.
27
+ * trust Print derived per-category trust status (advisory only, AEH-03).
28
+ * metrics Append quality-metric snapshots and print the derived trend verdict (AEH-05).
26
29
  *
27
30
  * Exit codes: 0 ok, 2 usage/validation error (e.g. missing grounding).
28
31
  */
@@ -43,6 +46,7 @@ const SIGNALS: Record<string, string> = {
43
46
  const SIGNAL_KEYS_SORTED = Object.keys(SIGNALS).sort();
44
47
 
45
48
  const DEFAULTS = { promote_threshold: 2, window_days: 45, quarantine_threshold: 2 };
49
+ const RAMP_DEFAULTS = { trust_threshold: 30 };
46
50
 
47
51
  // massa-ai supported memory types (references/mcp-tools.md). `procedural` is a
48
52
  // TAG, never a type. Lessons are procedural knowledge -> type `pattern`.
@@ -69,6 +73,25 @@ interface Lesson {
69
73
  [key: string]: unknown;
70
74
  }
71
75
 
76
+ /** Reviewer-feedback event (AEH-03). Append-only; category is a free-form kebab-case label. */
77
+ interface ReviewRecord {
78
+ category: string;
79
+ feedback: "none" | "minor" | "major";
80
+ source: string;
81
+ recordedAt: string;
82
+ }
83
+
84
+ /** Per-validation quality-metric snapshot (AEH-05). Append-only. */
85
+ interface MetricSnapshot {
86
+ feature: string;
87
+ result: "PASS" | "FAIL";
88
+ fixLoopIterations: number;
89
+ survivingMutants: number;
90
+ acsTotal: number;
91
+ acsCovered: number;
92
+ recordedAt: string;
93
+ }
94
+
72
95
  interface Store {
73
96
  schema: number;
74
97
  promote_threshold: number;
@@ -76,6 +99,13 @@ interface Store {
76
99
  quarantine_threshold: number;
77
100
  next_id: number;
78
101
  lessons: Lesson[];
102
+ // Ramp-only fields (AEH-03/05) - absent on legacy stores, lazily backfilled by
103
+ // ensureRampFields() inside the new review/trust/metrics commands only, NEVER in
104
+ // load(), so every legacy command keeps reading/writing the store byte-identically
105
+ // to before this feature (pyts-golden protection).
106
+ trust_threshold?: number;
107
+ reviews?: ReviewRecord[];
108
+ metrics?: MetricSnapshot[];
79
109
  [key: string]: unknown;
80
110
  }
81
111
 
@@ -433,6 +463,60 @@ function find(data: Store, signal: string, text: string): Lesson | null {
433
463
  return null;
434
464
  }
435
465
 
466
+ // ---------------------------------------------------------------------------
467
+ // Trust ramp + metric-trend derivations (AEH-03, AEH-05)
468
+ //
469
+ // review/metrics records are append-only events; streak, trusted, and trend
470
+ // verdict are all derived at read time from the log (design Approach A) - no
471
+ // cached state, so demotion on a `major` record is emergent rather than a
472
+ // write-path invariant that needs its own tests.
473
+ // ---------------------------------------------------------------------------
474
+
475
+ /**
476
+ * Lazily backfills the ramp-only fields (`trust_threshold`, `reviews`, `metrics`)
477
+ * onto an in-memory store. Called ONLY from the new review/trust/metrics commands -
478
+ * NEVER from `load()` - so every legacy command keeps reading/writing the store
479
+ * byte-identically to before this feature (pyts-golden protection).
480
+ */
481
+ function ensureRampFields(data: Store): void {
482
+ pySetDefault(data as unknown as Record<string, unknown>, "trust_threshold", RAMP_DEFAULTS.trust_threshold);
483
+ pySetDefault(data as unknown as Record<string, unknown>, "reviews", []);
484
+ pySetDefault(data as unknown as Record<string, unknown>, "metrics", []);
485
+ }
486
+
487
+ /** Count of trailing none|minor records for `category`, scanning newest-first until a major. */
488
+ function categoryStreak(data: Store, category: string): number {
489
+ const records = (data.reviews ?? []).filter((r) => r.category === category);
490
+ let count = 0;
491
+ for (let i = records.length - 1; i >= 0; i--) {
492
+ if (records[i]!.feedback === "major") break;
493
+ count++;
494
+ }
495
+ return count;
496
+ }
497
+
498
+ function isTrusted(data: Store, category: string): boolean {
499
+ const threshold = data.trust_threshold ?? RAMP_DEFAULTS.trust_threshold;
500
+ return categoryStreak(data, category) >= threshold;
501
+ }
502
+
503
+ /** Scalar trend score for one snapshot - lower is better. FAIL*100 + mutants*10 + fixIters + uncoveredACs. */
504
+ function trendScore(s: MetricSnapshot): number {
505
+ return (s.result === "FAIL" ? 100 : 0) + s.survivingMutants * 10 + s.fixLoopIterations + (s.acsTotal - s.acsCovered);
506
+ }
507
+
508
+ /** Compares the last two snapshots' scores (lower = better). <2 snapshots -> "insufficient data". */
509
+ function trendVerdict(snapshots: MetricSnapshot[]): string {
510
+ if (snapshots.length < 2) return "insufficient data";
511
+ const last = snapshots[snapshots.length - 1]!;
512
+ const prev = snapshots[snapshots.length - 2]!;
513
+ const lastScore = trendScore(last);
514
+ const prevScore = trendScore(prev);
515
+ if (lastScore < prevScore) return "improving";
516
+ if (lastScore > prevScore) return "degrading";
517
+ return "stable";
518
+ }
519
+
436
520
  // ---------------------------------------------------------------------------
437
521
  // Commands
438
522
  // ---------------------------------------------------------------------------
@@ -737,6 +821,108 @@ function cmdStatus(root: string): number {
737
821
  return 0;
738
822
  }
739
823
 
824
+ interface ReviewAddArgs {
825
+ category: string;
826
+ feedback: string;
827
+ source: string;
828
+ project: string;
829
+ }
830
+
831
+ function cmdReviewAdd(root: string, args: ReviewAddArgs): number {
832
+ const category = (args.category || "").trim();
833
+ const source = (args.source || "").trim();
834
+ const data = load(root);
835
+ ensureRampFields(data);
836
+ const record: ReviewRecord = {
837
+ category,
838
+ feedback: args.feedback as ReviewRecord["feedback"],
839
+ source,
840
+ recordedAt: now(),
841
+ };
842
+ data.reviews!.push(record);
843
+ save(root, data);
844
+ const streak = categoryStreak(data, category);
845
+ console.log(`REVIEW ${category} (streak=${streak}, trusted=${isTrusted(data, category)})`);
846
+ return 0;
847
+ }
848
+
849
+ function cmdTrustStatus(root: string, categoryFilter: string): number {
850
+ const data = load(root);
851
+ ensureRampFields(data);
852
+ const reviews = data.reviews ?? [];
853
+ let categories = Array.from(new Set(reviews.map((r) => r.category)));
854
+ if (categoryFilter) {
855
+ categories = categories.filter((c) => c === categoryFilter);
856
+ }
857
+ categories.sort(pyStringCompare);
858
+ if (!categories.length) {
859
+ console.log("(no review records)");
860
+ return 0;
861
+ }
862
+ const threshold = data.trust_threshold ?? RAMP_DEFAULTS.trust_threshold;
863
+ for (const category of categories) {
864
+ const total = reviews.filter((r) => r.category === category).length;
865
+ const streak = categoryStreak(data, category);
866
+ const trusted = streak >= threshold;
867
+ console.log(`${category}: streak=${streak}/${threshold} total=${total} trusted=${trusted ? "yes" : "no"}`);
868
+ }
869
+ return 0;
870
+ }
871
+
872
+ /** Parses a required non-negative-integer flag value; prints an error naming `flagName` on failure. */
873
+ function parseNonNegativeInt(value: string, flagName: string): number | null {
874
+ const n = Number(value);
875
+ if (!Number.isFinite(n) || !Number.isInteger(n) || n < 0) {
876
+ console.error(`ERROR: ${flagName} must be a non-negative integer, got ${pyRepr(value)}`);
877
+ return null;
878
+ }
879
+ return n;
880
+ }
881
+
882
+ function cmdMetricsAdd(root: string, raw: Record<string, string>): number {
883
+ const feature = (raw.feature || "").trim();
884
+ const result = raw.result as MetricSnapshot["result"];
885
+ const fixLoopIterations = parseNonNegativeInt(raw["fix-iterations"]!, "--fix-iterations");
886
+ if (fixLoopIterations === null) return 2;
887
+ const survivingMutants = parseNonNegativeInt(raw["surviving-mutants"]!, "--surviving-mutants");
888
+ if (survivingMutants === null) return 2;
889
+ const acsTotal = parseNonNegativeInt(raw["acs-total"]!, "--acs-total");
890
+ if (acsTotal === null) return 2;
891
+ const acsCovered = parseNonNegativeInt(raw["acs-covered"]!, "--acs-covered");
892
+ if (acsCovered === null) return 2;
893
+
894
+ const data = load(root);
895
+ ensureRampFields(data);
896
+ const snapshot: MetricSnapshot = {
897
+ feature,
898
+ result,
899
+ fixLoopIterations,
900
+ survivingMutants,
901
+ acsTotal,
902
+ acsCovered,
903
+ recordedAt: now(),
904
+ };
905
+ data.metrics!.push(snapshot);
906
+ save(root, data);
907
+ console.log(
908
+ `METRICS ${feature} (result=${result}, survivingMutants=${survivingMutants}, fixIters=${fixLoopIterations}, acs=${acsCovered}/${acsTotal})`,
909
+ );
910
+ return 0;
911
+ }
912
+
913
+ function cmdMetricsTrend(root: string): number {
914
+ const data = load(root);
915
+ ensureRampFields(data);
916
+ const snapshots = data.metrics ?? [];
917
+ for (const s of snapshots) {
918
+ console.log(
919
+ `${s.feature} result=${s.result} fixIters=${s.fixLoopIterations} survivingMutants=${s.survivingMutants} acs=${s.acsCovered}/${s.acsTotal} recordedAt=${s.recordedAt}`,
920
+ );
921
+ }
922
+ console.log(`trend: ${trendVerdict(snapshots)}`);
923
+ return 0;
924
+ }
925
+
740
926
  // ---------------------------------------------------------------------------
741
927
  // CLI
742
928
  // ---------------------------------------------------------------------------
@@ -744,7 +930,9 @@ function cmdStatus(root: string): number {
744
930
  const PROG = "lessons.ts";
745
931
 
746
932
  function usageError(msg: string): void {
747
- process.stderr.write(`usage: ${PROG} [-h] [--root ROOT] {init,add,penalize,list,observe,export,import,prune,status,selftest} ...\n${PROG}: error: ${msg}\n`);
933
+ process.stderr.write(
934
+ `usage: ${PROG} [-h] [--root ROOT] {init,add,penalize,list,observe,export,import,prune,status,selftest,review,trust,metrics} ...\n${PROG}: error: ${msg}\n`,
935
+ );
748
936
  }
749
937
 
750
938
  interface FlagSpec {
@@ -894,9 +1082,57 @@ async function main(argv: string[]): Promise<number> {
894
1082
  case "selftest":
895
1083
  return selftestNorm();
896
1084
 
1085
+ case "review": {
1086
+ const sub = rest[0];
1087
+ if (sub === "add") {
1088
+ const parsed = parseFlags(rest.slice(1), [
1089
+ { name: "--category", required: true },
1090
+ { name: "--feedback", required: true, choices: ["none", "minor", "major"] },
1091
+ { name: "--source", required: true },
1092
+ { name: "--project", default: "" },
1093
+ ]);
1094
+ if (!parsed) return 2;
1095
+ return cmdReviewAdd(absRoot, parsed as unknown as ReviewAddArgs);
1096
+ }
1097
+ usageError(`argument cmd: invalid choice: ${pyRepr(sub ?? "")} (choose from 'add')`);
1098
+ return 2;
1099
+ }
1100
+
1101
+ case "trust": {
1102
+ const sub = rest[0];
1103
+ if (sub === "status") {
1104
+ const parsed = parseFlags(rest.slice(1), [{ name: "--category", default: "" }]);
1105
+ if (!parsed) return 2;
1106
+ return cmdTrustStatus(absRoot, parsed.category!);
1107
+ }
1108
+ usageError(`argument cmd: invalid choice: ${pyRepr(sub ?? "")} (choose from 'status')`);
1109
+ return 2;
1110
+ }
1111
+
1112
+ case "metrics": {
1113
+ const sub = rest[0];
1114
+ if (sub === "add") {
1115
+ const parsed = parseFlags(rest.slice(1), [
1116
+ { name: "--feature", required: true },
1117
+ { name: "--result", required: true, choices: ["PASS", "FAIL"] },
1118
+ { name: "--fix-iterations", required: true },
1119
+ { name: "--surviving-mutants", required: true },
1120
+ { name: "--acs-total", required: true },
1121
+ { name: "--acs-covered", required: true },
1122
+ ]);
1123
+ if (!parsed) return 2;
1124
+ return cmdMetricsAdd(absRoot, parsed);
1125
+ }
1126
+ if (sub === "trend") {
1127
+ return cmdMetricsTrend(absRoot);
1128
+ }
1129
+ usageError(`argument cmd: invalid choice: ${pyRepr(sub ?? "")} (choose from 'add', 'trend')`);
1130
+ return 2;
1131
+ }
1132
+
897
1133
  default:
898
1134
  usageError(
899
- `argument cmd: invalid choice: ${pyRepr(cmd)} (choose from 'init', 'add', 'penalize', 'list', 'observe', 'export', 'import', 'prune', 'status', 'selftest')`,
1135
+ `argument cmd: invalid choice: ${pyRepr(cmd)} (choose from 'init', 'add', 'penalize', 'list', 'observe', 'export', 'import', 'prune', 'status', 'selftest', 'review', 'trust', 'metrics')`,
900
1136
  );
901
1137
  return 2;
902
1138
  }
@@ -86,6 +86,19 @@ Not for findings-only architecture review — route to `workflows/architecture/a
86
86
  > - firewall: raw test output/logs summarized
87
87
  > - memory: suggest-only; main agent persists reusable verification recipes
88
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
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
91
+ > - trigger: implementation complete, before the verification gate — never optional
92
+ > - scope: the fix's diff surface and its task/AC context
93
+ > - permissions: read-only
94
+ > - inputs: diff, acceptance context, recalled code-quality conventions
95
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
96
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
97
+ > - firewall: summarized findings only, never raw diff dumps
98
+ > - memory: suggest-only; main agent persists
99
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
100
+ > - 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
101
+
89
102
  11. Verify each completed finding:
90
103
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
91
104
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
@@ -76,6 +76,19 @@ Not for findings-only bug discovery — route to `workflows/bugs/bugs-audit.md`.
76
76
  > - memory: suggest-only; main agent persists reusable verification recipes
77
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
78
78
  - Main agent owns report parsing, prioritization, memory writes, final synthesis, and Evidence Gate.
79
+
80
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
81
+ > - trigger: implementation complete, before the verification gate — never optional
82
+ > - scope: the fix's diff surface and its task/AC context
83
+ > - permissions: read-only
84
+ > - inputs: diff, acceptance context, recalled code-quality conventions
85
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
86
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
87
+ > - firewall: summarized findings only, never raw diff dumps
88
+ > - memory: suggest-only; main agent persists
89
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract 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
+
79
92
  10. Verify each completed finding:
80
93
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
81
94
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
@@ -76,6 +76,7 @@ Findings-only: do not edit code unless the user separately asks for fixes.
76
76
  - Magic values: repeated strings, event names, timeouts, numeric thresholds, status codes.
77
77
  - Generic names: `data`, `info`, `result`, `value`, `temp`, `manager`, `handler`, `helper` without useful qualification, using `references/naming-standards.md` to filter conventional short-scope or framework-required names.
78
78
  - Long parameter lists: more than 3-4 positional parameters.
79
+ - File shape: flag multi-subject files (unrelated exported surfaces bundled together) and any file over ~600 lines, regardless of subject count — it crowds out working context for the rest of the task (see `references/coding-guidelines.md` "File shape for agent readers"). Do NOT flag a single-subject file for line count alone below that bound.
79
80
  - Needlessly indirect code: pass-through wrappers, one-use abstractions, helper layers with no behavior, factories/builders that only hide one constructor call.
80
81
  - Speculative surfaces: unused options, future-oriented hooks, extension points with one implementation, exported APIs with no evidence of use.
81
82
  - Complexity without payoff: deep nesting, miniature state machines, or polymorphism where a direct branch or data map would preserve clarity.
@@ -84,20 +85,20 @@ Findings-only: do not edit code unless the user separately asks for fixes.
84
85
  9. Investigation pass:
85
86
  - Use summary/enriched search, symbol tools, and targeted file reads to inspect target modules, semantic hotspots, public classes, interfaces, functions, and exported API surface.
86
87
  - Apply SOLID checks to non-test source only:
87
- - Single Responsibility: flag classes/modules with distinct concern groups, such as validation plus persistence or formatting plus dispatch.
88
+ - Single Responsibility: flag classes/modules bundling distinct concern groups, such as validation plus persistence or formatting plus dispatch, only when separating them yields an externally-findable named unit (locatable by search or grep from outside the file) or measurably reduces change risk — never on concern-count or size alone.
88
89
  - Open/Closed: flag caller-side switches or if/else chains on type tags where adding a variant requires modifying existing files.
89
90
  - Liskov: flag subtypes that throw where the base does not, ignore required methods, or narrow the base contract.
90
91
  - Interface Segregation: flag interfaces that force implementors to define unused methods.
91
92
  - Dependency Inversion: flag hardcoded `new ConcreteType()` inside class bodies where abstraction or injection would be natural.
92
93
  - Apply Clean Code checks to test and non-test source:
93
94
  - Magic values: meaningful bare literals should be named constants, especially repeated strings, timeouts, thresholds, and event names.
94
- - Function does more than one thing: if accurate description needs "and", recommend splitting.
95
+ - Function does more than one thing: split only when the result yields an externally-findable named unit (locatable by search or grep from outside the file) or measurably reduces change risk; never split on size or "more than one thing" alone.
95
96
  - Unqualified generic names: flag vague names without domain or role qualification.
96
97
  - What-comments: flag comments that restate code; keep only why comments for constraints, workarounds, or non-obvious invariants.
97
98
  - Half-finished surfaces: flag exported TODOs, stubs, placeholder returns, and "implement later" code.
98
99
  - Long parameter lists: flag more than 3-4 positional parameters; suggest an options object.
99
100
  - Apply KISS/YAGNI/DRY checks:
100
- - KISS: flag abstractions, layers, indirection, or control flow that raise cognitive load without clearly improving readability, correctness, or constraint handling. Call out premature generalization, deep call chains, excessive configuration, and clever patterns that obscure intent. Prefer straightforward, explicit code a new reader can follow end-to-end: inline trivial abstractions, collapse unnecessary layers, choose boring solutions unless complexity is justified (real variability, hard constraints, or measured bottlenecks).
101
+ - KISS: flag abstractions, layers, indirection, or control flow that raise cognitive load without clearly improving readability, correctness, or constraint handling. Call out premature generalization, deep call chains, excessive configuration, and clever patterns that obscure intent. Prefer straightforward, explicit code a new reader can follow end-to-end: inline trivial abstractions, collapse unnecessary layers, choose boring solutions unless complexity is justified (real variability, hard constraints, or measured bottlenecks). When weighing whether to split instead of inline, apply the same discoverability-or-change-risk criterion used for the split lead above.
101
102
  - YAGNI: flag speculative features, extension points, and generic infrastructure with no concrete caller, requirement, or near-term use. Call out "just in case" hooks, over-parameterization, unused toggles, and frameworks introduced ahead of need. Prefer implementing only what current use cases demand, structured to evolve when real requirements appear. Defer generalization until duplication or constraints force it, and remove dead or unused paths aggressively.
102
103
  - DRY: flag duplicated logic, data transformations, or domain rules repeated without a strong reason (e.g., performance isolation or explicit decoupling). Highlight copy-paste patterns, parallel conditionals, and repeated constants that raise maintenance cost or inconsistency risk. Recommend consolidation into a single source of truth when it improves clarity and reduces bugs, but avoid over-abstraction that harms readability or adds indirection for trivial reuse.
103
104
  - Prefer delete, inline, or merge recommendations over replacement abstractions when simpler code preserves behavior.
@@ -48,9 +48,9 @@ Not for findings-only SOLID, Clean Code, KISS, YAGNI, DRY, maintainability, or o
48
48
  - Standard: multi-file consolidation, shared behavior cleanup, public helper contract change, or meaningful test impact; define characterization checks first.
49
49
  - Spec-driven: broad redesign, unclear behavior, cross-boundary migration, or user-visible behavior change; pause and route to `workflows/spec-driven.md` or ask for approval.
50
50
  8. Apply code quality fixing methods:
51
- - SOLID: separate mixed responsibilities only when the split reduces change risk; replace caller-side type switches with polymorphism or data maps only when new variants are real; preserve base contracts; narrow fat interfaces; inject dependencies when hardcoded concretes block testing or substitution.
52
- - Clean Code: name domain concepts precisely using `references/naming-standards.md`, replace repeated magic values with named constants, split functions that truly do multiple things, remove code-restating comments, finish or delete stubs, and convert long positional parameter lists to options objects when it improves call-site clarity.
53
- - KISS: inline shallow helpers, collapse needless layers, choose direct control flow over clever indirection, and remove configuration that hides rather than expresses behavior.
51
+ - SOLID: separate mixed responsibilities only when the split yields an externally-findable named unit (locatable by search or grep from outside the file) or reduces change risk; replace caller-side type switches with polymorphism or data maps only when new variants are real; preserve base contracts; narrow fat interfaces; inject dependencies when hardcoded concretes block testing or substitution.
52
+ - Clean Code: name domain concepts precisely using `references/naming-standards.md`, replace repeated magic values with named constants, split functions only when the result yields an externally-findable named unit (locatable by search or grep from outside the file) or measurably reduces change risk — never split on size or "more than one thing" alone — remove code-restating comments, finish or delete stubs, and convert long positional parameter lists to options objects when it improves call-site clarity.
53
+ - KISS: inline shallow helpers, collapse needless layers, choose direct control flow over clever indirection, and remove configuration that hides rather than expresses behavior. When choosing whether to split instead of inline, apply the same discoverability-or-change-risk criterion used for the Clean Code split direction above.
54
54
  - YAGNI: delete unused extension points, future hooks, unused options, one-implementation factories, and speculative public APIs when usage evidence is absent.
55
55
  - DRY: consolidate duplicated domain rules or transformations into one clear source of truth, but avoid abstractions that make trivial duplication harder to read.
56
56
  - AI-slop cleanup: remove generic wrappers, fabricated-looking abstractions, one-call factories, code-restating comments, and unused configurability when current usage evidence does not justify them.
@@ -83,6 +83,19 @@ Not for findings-only SOLID, Clean Code, KISS, YAGNI, DRY, maintainability, or o
83
83
  > - memory: suggest-only; main agent persists reusable verification recipes
84
84
  > - 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
85
85
  - Main agent owns report parsing, prioritization, memory writes, final synthesis, and Evidence Gate.
86
+
87
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
88
+ > - trigger: implementation complete, before the verification gate — never optional
89
+ > - scope: the fix's diff surface and its task/AC context
90
+ > - permissions: read-only
91
+ > - inputs: diff, acceptance context, recalled code-quality conventions
92
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
93
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
94
+ > - firewall: summarized findings only, never raw diff dumps
95
+ > - memory: suggest-only; main agent persists
96
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
97
+ > - 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
98
+
86
99
  11. Verify each completed finding:
87
100
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
88
101
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
@@ -57,6 +57,19 @@ Before the first repository mutation, load `references/implementation-delivery.m
57
57
  - file-integrity checks for validation assets such as tests, specs, benchmarks, fixtures, and snapshots
58
58
  12. Fix the divergence point closest to the root cause
59
59
  13. Add regression coverage at the correct seam, or document why no valid regression seam exists
60
+
61
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
62
+ > - trigger: implementation complete, before the verification gate — never optional
63
+ > - scope: the fix's diff surface and its task/AC context
64
+ > - permissions: read-only
65
+ > - inputs: diff, acceptance context, recalled code-quality conventions
66
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
67
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
68
+ > - firewall: summarized findings only, never raw diff dumps
69
+ > - memory: suggest-only; main agent persists
70
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
71
+ > - 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
72
+
60
73
  14. If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
61
74
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
62
75
  Rerun the original feedback loop, run the verification recipe, and remove temporary instrumentation unless intentionally retained as observability
@@ -39,15 +39,29 @@ Before the first repository mutation, load `references/implementation-delivery.m
39
39
  - Include a focused naming review when the feature introduces or renames identifiers. New names should use domain or precise role vocabulary, and public/persisted names should not change without explicit compatibility handling.
40
40
  9. For mobile features, capture the mobile context packet, choose shared vs platform-specific boundaries, state platform parity expectations, and include the cheapest relevant mobile verification sensor from `references/mobile-context.md`
41
41
  10. Use `references/agent-orchestration.md` only for isolated implementation slices or independent verification
42
- 11. Implement the feature by PR group when `references/pr-task-fix.md` applies:
42
+ 11. Capture 1-5 testable acceptance criteria in the conversation before implementation starts, or reference an existing spec artifact (e.g. `.specs/features/<slug>/spec.md`) when one already states them. These captured acceptance criteria are the anchor the verification step below checks outcomes against.
43
+ 12. Implement the feature by PR group when `references/pr-task-fix.md` applies:
43
44
  - Order non-breaking groups by Data, Domain, then Presentation/Navigation, mapping those labels to repository boundaries when needed.
44
45
  - Validate each group with the verification recipe before committing.
45
46
  - Invoke `workflows/commit.md` for each verified group; do not duplicate commit staging, message, audit-exclusion, or Jira-prefix rules in this workflow.
46
47
  - When every group has a confirmed Jira key, follow the optional stacked branch flow in `references/pr-task-fix.md` (Jira-Key Stacked Branches).
47
- 12. Run the verification recipe and report skipped checks explicitly. If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
48
+
49
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
50
+ > - trigger: implementation complete, before the verification gate — never optional
51
+ > - scope: the feature's diff surface and its task/AC context
52
+ > - permissions: read-only
53
+ > - inputs: diff, acceptance context, recalled code-quality conventions
54
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
55
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
56
+ > - firewall: summarized findings only, never raw diff dumps
57
+ > - memory: suggest-only; main agent persists
58
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
59
+ > - 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
60
+
61
+ 13. Run the verification recipe and check outcomes against the captured acceptance criteria from step 11, not only against a generic verification recipe; report skipped checks explicitly. If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
48
62
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
49
- 13. At completion, persist (run the scoring rubric from `references/decision-engine.md` for each):
63
+ 14. At completion, persist (run the scoring rubric from `references/decision-engine.md` for each):
50
64
  - Design decisions made via `remember` as scored `decision` memories
51
65
  - New patterns introduced via `remember` as scored `pattern` memories
52
66
  - Trade-offs accepted via `remember` as scored `conversation` memories
53
- 14. Complete the Evidence Gate from `references/evidence-gate.md`
67
+ 15. Complete the Evidence Gate from `references/evidence-gate.md`
@@ -34,6 +34,19 @@ Before the first repository mutation, load `references/implementation-delivery.m
34
34
  - if a recalled memory is stale or needs correction, call `memory_update` with `id` and the new `content` (re-embeds automatically); if a memory is obsolete, call `memory_delete` with `id` (hard-delete, severs graph edges)
35
35
  - for usage insights (search/cache patterns, recent activity), call `analytics` with `type` and `projectId`
36
36
  - skip transient details, raw logs, copied source, unverified hypotheses, and facts already captured in current non-stale memory
37
+
38
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
39
+ > - trigger: implementation complete, before the verification gate — never optional
40
+ > - scope: the change's diff surface and its task/AC context
41
+ > - permissions: read-only
42
+ > - inputs: diff, acceptance context, recalled code-quality conventions
43
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
44
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
45
+ > - firewall: summarized findings only, never raw diff dumps
46
+ > - memory: suggest-only; main agent persists
47
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
48
+ > - 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
49
+
37
50
  9. Complete the Evidence Gate from `references/evidence-gate.md` and report verification, changed artifacts, memory outcome, and residual risk.
38
51
 
39
52
  ## Failure Handling
@@ -78,6 +78,19 @@ Do not execute from chat summaries, inline review comments, remembered findings,
78
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
79
79
 
80
80
  Never run parallel writers against shared files or contracts.
81
+
82
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
83
+ > - trigger: implementation complete, before the verification gate — never optional
84
+ > - scope: the fix's diff surface and its task/AC context
85
+ > - permissions: read-only
86
+ > - inputs: diff, acceptance context, recalled code-quality conventions
87
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
88
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
89
+ > - firewall: summarized findings only, never raw diff dumps
90
+ > - memory: suggest-only; main agent persists
91
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
92
+ > - 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
+
81
94
  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. 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.
82
95
  12. Produce a closure matrix with finding ID, source lens, status (`fixed`, `deferred`, `blocked`, `skipped`), changed files, command/artifact, result, skipped reason or `none`, highest Verification Ladder level reached, validation assets protected, residual risk, and exact next step for deferred or blocked findings.
83
96
  13. If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
@@ -62,6 +62,19 @@ Reject direct use without a saved `audits/maestro/<YYYY-MM-DD maestro-audit.md>`
62
62
  - Replace brittle selectors with stable selectors, accessibility labels, or test IDs already present.
63
63
  - Keep setup/teardown explicit, idempotent, and isolated.
64
64
  - Protect existing flows, subflows, fixtures, snapshots, baselines, report consumers, and CI commands unless the audit finding explicitly scopes them.
65
+
66
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
67
+ > - trigger: implementation complete, before the verification gate — never optional
68
+ > - scope: the fix's diff surface and its task/AC context
69
+ > - permissions: read-only
70
+ > - inputs: diff, acceptance context, recalled code-quality conventions
71
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
72
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
73
+ > - firewall: summarized findings only, never raw diff dumps
74
+ > - memory: suggest-only; main agent persists
75
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
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
77
+
65
78
  9. Use strict harness sensors:
66
79
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
67
80
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
@@ -49,6 +49,19 @@ Do not execute from chat summaries, screenshots alone, remembered findings, or a
49
49
  - 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
50
  - Do not weaken screenshot tests, previews, fixtures, assertions, test tags, resource IDs, content descriptions, or Maestro selectors to hide a mismatch.
51
51
  - 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.
52
+
53
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
54
+ > - trigger: implementation complete, before the verification gate — never optional
55
+ > - scope: the fix's diff surface and its task/AC context
56
+ > - permissions: read-only
57
+ > - inputs: diff, acceptance context, recalled code-quality conventions
58
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
59
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
60
+ > - firewall: summarized findings only, never raw diff dumps
61
+ > - memory: suggest-only; main agent persists
62
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
63
+ > - 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
+
52
65
  9. Verify after each coherent finding group:
53
66
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
54
67
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
@@ -146,7 +146,7 @@ the severity labels, and the reply contract.
146
146
  | 2 | Requirements & DoD (Definition of Done) | `massa-ai-audit-specialist` | `lens: requirements` — score merged Track A + Track B criteria against the diff, evidence-or-zero: ✅ implemented (`path:line`) / 🟡 partial / ❌ missing; no source ⇒ report "requirements verification skipped" | `requirements` |
147
147
  | 3 | Architecture & conventions | `massa-ai-audit-specialist` | `lens: architecture` — extract every explicit rule from the profile's CONVENTIONS/REVIEW_SKILLS docs into a numbered matrix, grade each changed file PASS/VIOLATION/N/A; no docs ⇒ minimal generic boundary sweep, stated | `architecture` |
148
148
  | 4 | Performance | `massa-ai-audit-specialist` | `lens: performance` — only issues clearly visible in the diff: N+1 queries, unbounded fetches, per-row lazy I/O, sequential awaits of independent calls, loop-invariant recomputation, unbatched writes | `performance` |
149
- | 5 | Test coverage | `massa-ai-audit-specialist` | `lens: performance`, scope: test coverage (the charter's lens set has no `tests` lens; `tests-audit.md` precedent) — new/changed behavior with no test, wrong level (unit vs integration), placement/naming vs profile TEST row, missing negative case, assertions that exercise but never assert | `tests` |
149
+ | 5 | Test coverage | `massa-ai-audit-specialist` | `lens: tests` (dedicated lens: coverage, regression protection, assertion quality, variation `tests-audit.md` precedent) — new/changed behavior with no test, wrong level (unit vs integration), placement/naming vs profile TEST row, missing negative case, missing variation beyond the fixture example, assertions that exercise but never assert | `tests` |
150
150
  | 6 | Regression & hallucination | `massa-ai-reviewer` | diff review — unrelated deletions, references to symbols absent from the repo, wrong signature/arity, duplicated existing logic, weakened error handling or assertions, leftover TODO/stub, dead code | `regression` |
151
151
 
152
152
  Consolidation check (≥ 5 subagents): recorded in the feature design — rows 4 and 5
@@ -40,6 +40,7 @@ Before the first repository mutation, load `references/implementation-delivery.m
40
40
  8. Focus on pragmatic refactoring:
41
41
  - Identify over-abstracted code and propose Modular Monoliths
42
42
  - Reduce "abstraction cost" to make code more AI-navigable
43
+ - The primary payoff of extraction is extract-for-findability: create a named unit locatable by search or grep from outside the file — that is what makes code AI-navigable, not extraction volume alone
43
44
  - Verify changes do not break existing behavior using the verification recipe
44
45
  9. Execute by PR group when `references/pr-task-fix.md` applies:
45
46
  - Order non-breaking groups by Data, Domain, then Presentation/Navigation, mapping those labels to repository boundaries when needed.
@@ -52,4 +53,17 @@ Before the first repository mutation, load `references/implementation-delivery.m
52
53
  12. At completion, persist (run the scoring rubric from `references/decision-engine.md`):
53
54
  - Refactored architectural decisions via `remember` as scored `decision` memories
54
55
  - Identified and decoupled anti-patterns via `remember` as scored `pattern` memories
56
+
57
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
58
+ > - trigger: implementation complete, before the verification gate — never optional
59
+ > - scope: the change's diff surface and its task/AC context
60
+ > - permissions: read-only
61
+ > - inputs: diff, acceptance context, recalled code-quality conventions
62
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
63
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
64
+ > - firewall: summarized findings only, never raw diff dumps
65
+ > - memory: suggest-only; main agent persists
66
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
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
+
55
69
  13. Complete the Evidence Gate from `references/evidence-gate.md`
@@ -78,6 +78,19 @@ Not for findings-only requirements review — route to `workflows/requirements/r
78
78
  > - memory: suggest-only; main agent persists reusable verification recipes
79
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
80
  - Main agent owns report parsing, traceability matrix, memory writes, final synthesis, and Evidence Gate.
81
+
82
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
83
+ > - trigger: implementation complete, before the verification gate — never optional
84
+ > - scope: the fix's diff surface and its task/AC context
85
+ > - permissions: read-only
86
+ > - inputs: diff, acceptance context, recalled code-quality conventions
87
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
88
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
89
+ > - firewall: summarized findings only, never raw diff dumps
90
+ > - memory: suggest-only; main agent persists
91
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
92
+ > - 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
+
81
94
  11. Verify each completed finding:
82
95
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
83
96
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
@@ -82,6 +82,19 @@ Not for findings-only security review — route to `workflows/security/security-
82
82
  > - memory: suggest-only; main agent persists reusable verification recipes
83
83
  > - 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
84
84
  - Main agent owns report parsing, prioritization, memory writes, final synthesis, and Evidence Gate.
85
+
86
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
87
+ > - trigger: implementation complete, before the verification gate — never optional
88
+ > - scope: the fix's diff surface and its task/AC context
89
+ > - permissions: read-only
90
+ > - inputs: diff, acceptance context, recalled code-quality conventions
91
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
92
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
93
+ > - firewall: summarized findings only, never raw diff dumps
94
+ > - memory: suggest-only; main agent persists
95
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
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
+
85
98
  11. Verify each completed finding:
86
99
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`:
87
100
  `bun skills/massa-ai/scripts/lessons.ts --root . add --feature "<slug>" --signal "<signal>" --source "<ref>" --text "<one terse lesson>"`
@@ -110,6 +110,18 @@ Quick artifacts live under `.specs/quick/NNN-slug/` with a `TASK.md` (one-line i
110
110
  - Update logical feature artifacts in `.specs/features/<slug>/` and `.specs/project/STATE.md` after meaningful progress.
111
111
  - Finish Execute by running `references/spec-driven/validate.md`. Dispatch `verification-agent` (author ≠ verifier) per `references/agent-orchestration.md`; the verification-agent always runs automatically and writes `.specs/features/<slug>/validation.md`. Without subagents, run the standalone fresh-eyes fallback in `validate.md`.
112
112
 
113
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
114
+ > - trigger: implementation complete, before the verification gate — never optional
115
+ > - scope: the task's diff surface and its task/AC context
116
+ > - permissions: read-only
117
+ > - inputs: diff, acceptance context, recalled code-quality conventions
118
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
119
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
120
+ > - firewall: summarized findings only, never raw diff dumps
121
+ > - memory: suggest-only; main agent persists
122
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
123
+ > - 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
124
+
113
125
  > **Dispatch: `massa-ai-verification-agent`** (role: `verification-agent`) — charter `skills/agents/verification-agent/SKILL.md`
114
126
  > - trigger: spec-driven Execute final gate; author ≠ verifier independence required
115
127
  > - scope: the feature's git diff surface, test files, and spec ACs
@@ -16,6 +16,18 @@ Not to write, run, or fix test findings as the main task — route to `workflows
16
16
 
17
17
  Findings-only: do not edit code unless the user separately asks for fixes.
18
18
 
19
+ ### Gate / Error-Class Model
20
+
21
+ Five gates, five distinct error classes. A green gate elsewhere never substitutes for a missing one — each row below is a gap this audit checks for independently:
22
+
23
+ | Gate | Error class caught |
24
+ | --- | --- |
25
+ | Unit | Business-logic errors |
26
+ | Coverage | Code no test touched |
27
+ | Variation | Hardcoded-example brittleness |
28
+ | Acceptance-criteria mapping | Built-the-wrong-thing |
29
+ | Quality-metric trend | Drift over time |
30
+
19
31
  1. Resolve/reuse `workflowSessionId`: `test-audit-[entity]`
20
32
  2. Load shared references:
21
33
  - `references/codebase-investigation.md`
@@ -46,7 +58,7 @@ Findings-only: do not edit code unless the user separately asks for fixes.
46
58
  > - trigger: large scope, explicit parallel/subagent request, PR subagent invocation, or independent verification of high-impact finding
47
59
  > - scope: the tests audit target — test files, fixtures, harnesses, coverage
48
60
  > - permissions: read-only
49
- > - inputs: shared scope packet; `lens: performance` (test coverage is under the performance lens); recalled testing conventions, flaky tests, known regressions
61
+ > - inputs: shared scope packet; `lens: tests`; recalled testing conventions, flaky tests, known regressions
50
62
  > - sensors: map behavior to tests; check missing tests for new branches, error paths, async logic, migrations; fixture health, assertion quality, flakiness root-cause
51
63
  > - output: findings with missing/weak coverage type, location, evidence, regression risk, severity, simplest test direction, deterministic sensor, verification suggestion
52
64
  > - firewall: raw diffs/logs/search output summarized, not returned raw
@@ -54,6 +66,8 @@ Findings-only: do not edit code unless the user separately asks for fixes.
54
66
  > - 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
55
67
 
56
68
  - Map changed or targeted behavior to existing tests, fixtures, mocks, and deterministic harnesses.
69
+ - Variation check: flag tests exercising only the single fixture example where input bounds or parameters can vary — hardcoded-example brittleness the unit gate cannot see.
70
+ - Trend check: read `bun skills/massa-ai/scripts/lessons.ts --root . metrics trend` and report the direction (improving, stable, degrading) when two or more snapshots exist; report `insufficient data` otherwise.
57
71
  - Check missing tests for new branches, error paths, auth/validation/persistence changes, async or race-prone logic, migrations, public contracts, and recalled bug patterns.
58
72
  - For mobile scopes, check KMP shared and platform-specific `actual` tests, Android/iOS harnesses, native bridge payload coverage, permissions, lifecycle, offline sync, deep links, push/background flows, UI snapshots/screenshots, device-matrix assumptions, and platform parity claims from `references/mobile-context.md`.
59
73
  - Check weak assertions, tests that only assert implementation details, fixture drift, nondeterminism, hidden network/time/filesystem dependencies, skipped tests, and weakened snapshots.
@@ -52,11 +52,25 @@ Not for findings-only test coverage, assertion quality, fixture health, flakines
52
52
  - Fixture drift: repair fixtures/builders to match current contracts while keeping them minimal and explicit.
53
53
  - Flakiness: prove root cause first; control time, randomness, async scheduling, filesystem, network, and global state with deterministic seams.
54
54
  - Missing sensor: add or document the focused command needed to prove the regression cannot recur.
55
+ - Variation: add varied-input cases (bounds, parameter changes) that exercise the behavior beyond the fixture example — never add a second copy of the fixture example.
55
56
  - Mobile coverage: prefer KMP/shared tests before device loops when the behavior is shared; use Android/iOS harnesses, bridge contract tests, screenshot/snapshot checks, lifecycle or permission simulations, and parity validation when the report finding requires them.
56
57
  9. Guard validation assets:
57
58
  - Never weaken assertions only to make the suite pass.
58
59
  - Do not delete coverage, snapshots, fixtures, or benchmarks unless the audit report explicitly calls them obsolete and behavior remains protected elsewhere.
59
60
  - Prefer production-code changes only when required to expose a deterministic seam or fix a real bug found while writing the audited test.
61
+
62
+ > **Dispatch: `massa-ai-reviewer`** (role: `reviewer`) — charter `skills/agents/reviewer/SKILL.md`
63
+ > - trigger: implementation complete, before the verification gate — never optional
64
+ > - scope: the fix's diff surface and its task/AC context
65
+ > - permissions: read-only
66
+ > - inputs: diff, acceptance context, recalled code-quality conventions
67
+ > - sensors: bugs, regressions, missing edge cases, smells introduced by the diff
68
+ > - output: ranked findings, blocking vs advisory; blocking findings become fix items before verification runs
69
+ > - firewall: summarized findings only, never raw diff dumps
70
+ > - memory: suggest-only; main agent persists
71
+ > - fallback: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
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
73
+
60
74
  10. Use strict harness sensors:
61
75
  - Never rely on AI subjective evaluation.
62
76
  - If verification found a reusable signal (`ac_gap`, `surviving_mutant`, `spec_precision_gap`, `spec_deviation`, `gate_fail`), record it via `references/lessons.md`: