@massa-ai/cursor-plugin 1.39.0 → 1.41.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 (29) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/skills/massa-ai/SKILL.md +3 -0
  4. package/skills/massa-ai/references/code-reuse-scan.md +76 -0
  5. package/skills/massa-ai/references/design-implementation.md +92 -0
  6. package/skills/massa-ai/references/figma-pre-analysis.md +11 -0
  7. package/skills/massa-ai/references/figma-wiring.md +115 -0
  8. package/skills/massa-ai/references/naming-standards.md +10 -0
  9. package/skills/massa-ai/references/spec-driven/design.md +6 -0
  10. package/skills/massa-ai/references/spec-driven/execute.md +2 -0
  11. package/skills/massa-ai/references/spec-driven/specify.md +8 -0
  12. package/skills/massa-ai/references/spec-driven/tasks.md +2 -0
  13. package/skills/massa-ai/scripts/validate_figma_wiring.ts +271 -0
  14. package/skills/massa-ai/workflows/architecture/architecture-fix.md +4 -1
  15. package/skills/massa-ai/workflows/bugs/bugs-fix.md +4 -1
  16. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +3 -1
  17. package/skills/massa-ai/workflows/debug.md +4 -1
  18. package/skills/massa-ai/workflows/design.md +7 -23
  19. package/skills/massa-ai/workflows/feature.md +4 -1
  20. package/skills/massa-ai/workflows/general.md +4 -2
  21. package/skills/massa-ai/workflows/implementation/implementation-fix.md +3 -1
  22. package/skills/massa-ai/workflows/maestro/maestro-fix.md +3 -1
  23. package/skills/massa-ai/workflows/maestro/maestro.md +3 -1
  24. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +4 -1
  25. package/skills/massa-ai/workflows/refactor.md +4 -1
  26. package/skills/massa-ai/workflows/requirements/requirements-fix.md +4 -1
  27. package/skills/massa-ai/workflows/security/security-fix.md +4 -1
  28. package/skills/massa-ai/workflows/spec-driven.md +5 -1
  29. package/skills/massa-ai/workflows/tests/tests-fix.md +4 -1
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "massa-ai",
3
- "version": "1.39.0",
3
+ "version": "1.41.0",
4
4
  "description": "massa-ai — semantic code search, memory, and context compression for Cursor"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/cursor-plugin",
3
- "version": "1.39.0",
3
+ "version": "1.41.0",
4
4
  "description": "massa-ai plugin for Cursor — semantic code search, memory, and context compression",
5
5
  "files": [
6
6
  "agents",
@@ -281,6 +281,7 @@ Load only when a selected workflow asks for them:
281
281
 
282
282
  - `references/agent-orchestration.md`
283
283
  - `references/subagent-design.md`
284
+ - `references/code-reuse-scan.md`
284
285
  - `references/adr-authoring.md`
285
286
  - `references/audit-scope.md`
286
287
  - `references/audit-report-io.md`
@@ -290,6 +291,8 @@ Load only when a selected workflow asks for them:
290
291
  - `references/mobile-context.md`
291
292
  - `references/mobile-diagnosis.md`
292
293
  - `references/figma-pre-analysis.md`
294
+ - `references/figma-wiring.md`
295
+ - `references/design-implementation.md`
293
296
  - `references/mobile-figma-matcher/`
294
297
  - `references/lessons.md`
295
298
  - `references/naming-standards.md`
@@ -0,0 +1,76 @@
1
+ # Code Reuse Scan
2
+
3
+ Load before planning or writing new implementation code in any of the 16
4
+ implementation workflows. The mandate is one uniform action line per
5
+ workflow; this file is its single normative copy.
6
+
7
+ ## Why
8
+
9
+ Duplicated components, helper methods, use cases, and repositories ship
10
+ undetected when an agent writes new code without first checking what already
11
+ exists. A scan run in a separate subagent, before the plan commits to new
12
+ code, catches reuse opportunities the main agent's own context would miss or
13
+ rationalize away.
14
+
15
+ ## Scan Targets
16
+
17
+ The scan covers existing:
18
+
19
+ - Components (UI or domain).
20
+ - Helper methods and utility functions.
21
+ - Classes and modules.
22
+ - Use cases and application services.
23
+ - Repositories and data-access adapters.
24
+ - Business logic already implementing the same or adjacent rule.
25
+ - Similar reusable elements evidenced by the codebase (validators, mappers,
26
+ formatters, fixtures, or comparable structural roles).
27
+
28
+ ## Dispatch
29
+
30
+ Run the scan in one or more separate read-only subagents before new
31
+ implementation code is planned or written:
32
+
33
+ > **Dispatch: `massa-ai-investigator`** (role: `investigator`) — charter `skills/agents/investigator/SKILL.md`
34
+ > - trigger: planning or writing new implementation code in any of the 16 implementation workflows — mandatory, not optional
35
+ > - scope: the target feature/module area — candidate existing components, helpers, classes, use cases, repositories, and business logic that could satisfy or overlap the new work
36
+ > - permissions: read-only
37
+ > - inputs: the task's acceptance criteria or requirement, recalled patterns, the closest entry point into the target area
38
+ > - sensors: progressive disclosure (project map → summary search → enriched search → symbol/file tools → optimized context → focused shell); per-candidate reuse-vs-new comparison
39
+ > - output: the reuse map (below), evidence-or-zero when nothing reusable is found
40
+ > - firewall: summarized candidates and pointers only, never raw file dumps
41
+ > - memory: suggest-only; main agent persists durable reuse findings
42
+ > - 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
43
+
44
+ Dispatch one subagent per coherent target area; dispatch more than one only
45
+ when the areas are independent enough to scope separately. The subagent
46
+ never spawns further subagents.
47
+
48
+ ## Reuse-Map Output Contract
49
+
50
+ The scan's output is a reuse map: one row per candidate element.
51
+
52
+ | Candidate element | Location | Decision |
53
+ | --- | --- | --- |
54
+ | name/role of the existing element | `path:line` or `path` pointer | `use` \| `extend` \| `new` |
55
+
56
+ - `use` — the existing element already satisfies the need; call/import it,
57
+ do not duplicate it.
58
+ - `extend` — the existing element is the right owner but needs a scoped
59
+ change; extend it instead of adding a parallel implementation.
60
+ - `new` — no existing element fits; new code is justified, and the map
61
+ records why the closest candidates were rejected.
62
+
63
+ **Evidence-or-zero:** if the scan finds no reusable elements, the reuse map
64
+ records that explicitly — an empty result is a row stating "no reusable
65
+ elements found for `<area>`", never an omitted section.
66
+
67
+ The reuse map is consumed before new code is planned or written. In
68
+ spec-driven, the map feeds Design and Tasks and is not re-run per task unless
69
+ a task introduces a new code area.
70
+
71
+ ## Inline Fallback
72
+
73
+ If subagent spawning is unavailable (forbidden, plugin missing, unknown agent
74
+ type), run the scan inline in the main agent against the same scan targets
75
+ and the same reuse-map output contract, and record the skipped-delegation
76
+ reason. Do not skip the scan because delegation is unavailable.
@@ -0,0 +1,92 @@
1
+ # Design-To-Code Implementation Direction
2
+
3
+ The single normative copy of the mobile UI implementation direction set:
4
+ Target Surface Packet, Figma Evidence / Screenshot Context Packet, the
5
+ Design-To-Code Mapping Matrix, coherent-slice implementation rules, and
6
+ per-slice verification/completion criteria.
7
+
8
+ Loaded by `workflows/design.md` for its direct route (behavior unchanged),
9
+ and by `spec-driven`/`feature` when Figma ingestion is enabled, so those
10
+ workflows absorb this direction set by reference instead of restating it.
11
+
12
+ ## Target Surface Packet
13
+
14
+ Build the immutable Target Surface Packet before loading stack guidance.
15
+ Classify each selected surface and load only its contracts:
16
+
17
+ - Android Views XML -> `references/mobile-figma-matcher/android-views.md`.
18
+ - Android Jetpack Compose -> `references/mobile-figma-matcher/android-compose.md`.
19
+ - iOS UIKit -> `references/mobile-figma-matcher/ios-uikit.md`.
20
+ - iOS SwiftUI -> `references/mobile-figma-matcher/ios-swiftui.md`.
21
+ - Shared KMP Compose Multiplatform -> `references/mobile-figma-matcher/kmp-compose-multiplatform.md`
22
+ plus native contracts only for selected native source sets, hosts,
23
+ wrappers, or runtime targets.
24
+
25
+ Non-mobile targets under Figma ingestion do not have a matcher contract to
26
+ classify against; proceed with the wiring recorded in `references/figma-wiring.md`
27
+ and a best-effort implementation contract, and record that class explicitly.
28
+
29
+ ## Figma Evidence / Screenshot Context Packet
30
+
31
+ Build the Figma Evidence Packet with metadata when needed, design context,
32
+ screenshot, variables, current Code Connect mappings, variants/states,
33
+ annotations, and asset inventory. For screenshot-only sources, build a
34
+ Screenshot Context Packet with provenance, target state, visible constraints,
35
+ uncertainty, and `Design Evidence Class: screenshot-context-only`; do not
36
+ infer exact Figma tokens, dimensions, variables, variants, or parity from
37
+ screenshots alone. Stop if neither structured Figma evidence nor supplied
38
+ screenshot context is available.
39
+
40
+ ## Design-To-Code Mapping Matrix
41
+
42
+ Resolve current components, tokens, resources, assets, source-set ownership,
43
+ platform adapters, requirements, and existing validation sensors. Create the
44
+ Design-To-Code Mapping Matrix and one comparison configuration per selected
45
+ runtime surface; screenshot-only rows use inferred visual intent, not
46
+ `Figma Value`.
47
+
48
+ ## Sizing And Verification Recipe
49
+
50
+ Size the work with the Verification Ladder. Route broad application work,
51
+ unresolved architecture, cross-feature design-system migration, or
52
+ implementation that won't fit one clean context window to `spec-driven`.
53
+
54
+ Establish the verification recipe before editing. Protect tests, snapshots,
55
+ screenshot baselines, fixtures, previews, accessibility identifiers, test
56
+ tags, and automation flows from weakening.
57
+
58
+ ## Coherent-Slice Implementation Rules
59
+
60
+ Implement coherent slices using the smallest correct ownership boundary:
61
+
62
+ - Reuse existing components and tokens only after resolving semantics,
63
+ states, accessibility, and values.
64
+ - Save required temporary Figma-served assets into the repository's existing
65
+ durable asset pipeline before referencing them.
66
+ - Keep shared KMP UI in common source sets only when ownership is genuinely
67
+ shared; keep platform UI and adapters explicit.
68
+ - Apply shared KMP root fixes before platform-local overrides when the cause
69
+ is shared.
70
+ - Preserve platform accessibility, safe areas/insets, localization, adaptive
71
+ behavior, and native conventions.
72
+
73
+ ## Per-Slice Verification
74
+
75
+ After each coherent slice, rebuild affected mapping/comparison rows and run
76
+ the cheapest deterministic sensors. When a shared KMP change affects Android
77
+ and iOS, verify both requested targets or mark the unavailable platform
78
+ `NOT EVALUATED`.
79
+
80
+ ## Completion Criteria
81
+
82
+ Refresh the Figma node, when available, and all selected target surfaces
83
+ before completion. Completion requires zero unresolved selected `MISMATCH`
84
+ rows for structured Figma evidence; `NOT EVALUATED` rows remain explicit
85
+ residual risk and prohibit complete parity claims. Screenshot-only
86
+ completion may claim implementation against supplied screenshot context,
87
+ never exact Figma parity.
88
+
89
+ ## Completion Report
90
+
91
+ Report changed files, final per-surface matrix, saved assets, strongest
92
+ verification level, skipped checks, and residual risk.
@@ -45,6 +45,12 @@ Its output is a compact packet:
45
45
  The main agent reviews the proposal, adjusts slice boundaries if project
46
46
  knowledge contradicts them, and records the final partition before Stage 2.
47
47
 
48
+ WHERE the parent workflow is `spec-driven` or `feature` with Figma ingestion
49
+ enabled, create one file per supplied Figma link under
50
+ `.specs/<type>/<slug>/figma/NN-<link-slug>.md` per the per-link file template
51
+ in `references/figma-wiring.md`, before Stage 2 begins. Audit, fix, and
52
+ `design` parent routes are unaffected by this pointer.
53
+
48
54
  ## Stage 2 — Sequential Retrieval (N subagents, one at a time)
49
55
 
50
56
  The main agent orchestrates the retrieval subagents **strictly sequentially —
@@ -61,6 +67,11 @@ Sequential dispatch is a hard rule, not a tuning choice: it respects Figma MCP
61
67
  session/rate limits, and it is what lets slice N+1 reuse what slice N learned.
62
68
  Retrieval subagents never spawn further subagents.
63
69
 
70
+ WHERE Figma ingestion is enabled per `references/figma-wiring.md`, populate
71
+ each completed slice's Number, Figma node id(s), Category, Explanation, and
72
+ Notes rows into its link's figma file wiring table as that slice's retrieval
73
+ completes.
74
+
64
75
  ## Fallback
65
76
 
66
77
  If subagent spawning is unavailable (forbidden, plugin missing, unknown agent
@@ -0,0 +1,115 @@
1
+ # Figma Node-Id Wiring
2
+
3
+ Load in `spec-driven` and `feature` only, lazily, WHERE Figma ingestion is
4
+ enabled — never for workflows without a Figma source. This file owns the
5
+ per-link figma file template, the wiring-table contract, the 13-category
6
+ table, category-tier rules, the unused-Number stop rule, and the Execute
7
+ retrieval protocol. It is the single normative copy; workflows point here,
8
+ they do not restate it.
9
+
10
+ ## Enablement
11
+
12
+ Figma ingestion is enabled when one or more Figma links or node IDs are
13
+ supplied for the work, on any platform. Mobile targets additionally keep the
14
+ existing `references/mobile-context.md` Design-Source Intake Gate and the
15
+ `references/mobile-figma-matcher/` implementation contracts. Non-mobile
16
+ targets proceed with wiring plus best-effort implementation contracts —
17
+ record that class explicitly rather than treating it as parity with the
18
+ mobile matcher contracts.
19
+
20
+ ## Relationship To Figma Pre-Analysis
21
+
22
+ `references/figma-pre-analysis.md` owns the two-stage retrieval protocol
23
+ (Stage 1 pre-analysis, Stage 2 sequential per-slice retrieval) and its hard
24
+ sequential-dispatch rule — never run Stage 2 subagents in parallel. This file
25
+ is where Stage 1's per-link file creation and Stage 2's table population
26
+ point; it does not restate the retrieval protocol itself.
27
+
28
+ ## Per-Link File Template
29
+
30
+ Stage 1 of `references/figma-pre-analysis.md` creates one file per supplied
31
+ Figma link under:
32
+
33
+ ```
34
+ .specs/<type>/<slug>/figma/NN-<link-slug>.md
35
+ ```
36
+
37
+ - `<type>` is the canonical artifact home for the parent work: `features` for
38
+ spec-driven and Standard+ feature work. Quick-tier work that receives
39
+ Figma links exits Quick tier — Figma ingestion is a design decision, and
40
+ Quick mode forbids design decisions.
41
+ - `NN` is the two-digit supply order (`01`, `02`, ...).
42
+ - `<link-slug>` is a short slug derived from the link or its screen/page name.
43
+
44
+ Each file's wiring table sits at the top. Stage 2 retrieval fills Number,
45
+ Figma node id(s), Category, Explanation, and Notes as it completes each
46
+ slice. Specify, Design, and Tasks passes fill the Spec(s)/Task(s)/Design(s)
47
+ ID columns as those artifacts wire each row.
48
+
49
+ ## Wiring-Table Contract
50
+
51
+ Every per-link figma file carries a table with exactly these columns, in
52
+ this order:
53
+
54
+ | Number | Figma node id(s) | Category | Spec(s) ID | Task(s) ID | Design(s) ID | Explanation | Notes |
55
+ | --- | --- | --- | --- | --- | --- | --- | --- |
56
+
57
+ - **Number** — the row's identifier within this file, referenced by spec,
58
+ task, and design items as `<link-slug>#<Number>`.
59
+ - **Figma node id(s)** — one or more node IDs the row covers.
60
+ - **Category** — exactly one of the 13 categories below.
61
+ - **Spec(s) ID / Task(s) ID / Design(s) ID** — the requirement, task, or
62
+ design-decision identifiers that wire this row; empty until an authoring
63
+ pass fills them.
64
+ - **Explanation** — what the node(s) represent and why they matter.
65
+ - **Notes** — ambiguity, assumptions, or follow-up needed.
66
+
67
+ ## The 13 Categories
68
+
69
+ Structure, Components, Tokens / Theming, Typography, Visual effects,
70
+ Behavior / Prototype, Flows, Content, Assets, States, Spatial, Semantics,
71
+ Mappings.
72
+
73
+ ## Category-Tier Rules
74
+
75
+ When spec, task, or design items are authored under Figma ingestion, each
76
+ item references its figma file plus Number:
77
+
78
+ - **Specs wire the high-level categories:** Structure, Behavior / Prototype,
79
+ Flows, and similar cross-cutting categories that describe requirements
80
+ rather than implementation detail.
81
+ - **Tasks and designs wire the remaining low-level categories** not covered
82
+ by specs: Components, Visual effects, Tokens / Theming, Typography,
83
+ Content, Assets, States, Spatial, Semantics, Mappings — each connected to
84
+ concrete codebase elements (classes, methods, variables, architecture,
85
+ strings, screens, states).
86
+
87
+ While creating or breaking down Tasks and Designs under Figma ingestion, run
88
+ the reuse scan per `references/code-reuse-scan.md` so wired implementation
89
+ work reuses existing code instead of duplicating it.
90
+
91
+ ## Unused-Number Stop Rule
92
+
93
+ The unused-Number check runs when the last included authoring phase closes
94
+ (Tasks when the plan includes Tasks, else Design, else Specify) and blocks
95
+ Execute until it passes. If any figma-file Number remains unwired to every
96
+ spec, task, and design item at that point, stop, report the unused Numbers
97
+ to the user, and ask for direction with alternatives and recommendations
98
+ before Execute proceeds. Do not silently drop or auto-wire an unused row.
99
+
100
+ **Deterministic backing (run it, do not eyeball it):** `bun skills/massa-ai/scripts/validate_figma_wiring.ts <slug> [--root .] [--type features|quick|debug|refactors]` parses every wiring table for the slug, always prints the parsed population (files scanned, rows parsed) beside the verdict, and exits non-zero when any Number row is unwired or when the figma directory exists but zero rows were parsed. If no code-execution tool is available, run the same checks by reading the artifact (graceful degradation preserved).
101
+
102
+ ## Execute Retrieval Protocol
103
+
104
+ When Execute implements a task with wired Figma node IDs, retrieve those
105
+ node IDs through Figma MCP (Model Context Protocol) and implement them per
106
+ the wiring recorded in the figma file, spec, task, and design entries — not
107
+ from memory of an earlier read. If Figma MCP is unavailable during Execute
108
+ for a wired task, stop that task and report the missing capability rather
109
+ than implementing from memory of the design.
110
+
111
+ ## Empty Or Unreadable Links
112
+
113
+ If a supplied Figma link yields zero readable nodes in Stage 1, record the
114
+ empty result in that link's figma file and surface it with the unused-Number
115
+ report rather than silently skipping the link.
@@ -28,6 +28,16 @@ Code vocabulary is evidence, not truth. When business intent is inferred only fr
28
28
  - When a rename is the fix, update all call sites, docs, tests, fixtures, snapshots, and generated examples that form the contract; do not weaken validation assets to hide drift.
29
29
  - Avoid fabricated domain terms. If no meaningful name is supported by evidence, choose the most precise technical role name and leave the domain uncertainty explicit in the plan, TDD, or audit.
30
30
 
31
+ ## Language
32
+
33
+ All new or renamed identifiers, classes, methods, screens, components,
34
+ attributes, and implementation-facing artifact names are written in English.
35
+ Convert any non-English source term to English before implementing —
36
+ Portuguese is the primary case, but the rule covers any non-English source
37
+ language. Preserve existing public contracts, persisted fields, and external
38
+ names unless compatibility handling is explicitly in scope, per the
39
+ public-contract clause above.
40
+
31
41
  ## Workflow Use
32
42
 
33
43
  - Feature, spec-driven execution, and implementation execution use this before writing or changing identifiers.
@@ -73,12 +73,18 @@ Overview of how components interact. Use mermaid diagrams when helpful.
73
73
 
74
74
  **CRITICAL**: What existing code can we leverage? This saves tokens and reduces errors.
75
75
 
76
+ Consume the reuse map produced per `references/code-reuse-scan.md` here — do not re-run the scan unless this design touches a code area the map did not cover.
77
+
78
+ WHERE Figma ingestion is enabled, fill this design's Design(s) ID column in the relevant `.specs/<type>/<slug>/figma/*.md` wiring table per `references/figma-wiring.md`, for the low-level categories (Components, Visual effects, Tokens / Theming, Typography, Content, Assets, States, Spatial, Semantics, Mappings) this design covers.
79
+
76
80
  Flag any concerns found here per step 1.5 into `## Risks & Concerns`.
77
81
 
78
82
  ### 4. Define Components and Interfaces
79
83
 
80
84
  Each component: Purpose, Location, Interfaces, Dependencies, What it reuses.
81
85
 
86
+ Apply the English-conversion rule from `references/naming-standards.md` to every component, interface, method, and data-model name before it is written into `design.md` — convert any non-English source term to English before it reaches this artifact.
87
+
82
88
  ### 5. Define Data Models
83
89
 
84
90
  If the feature involves data, define models before implementation.
@@ -81,6 +81,8 @@ Success: [how to verify]
81
81
 
82
82
  Load `references/naming-standards.md` before writing or changing identifiers; use meaningful domain or precise role names.
83
83
 
84
+ WHERE this task has wired Figma node IDs, retrieve them through Figma MCP and implement per `references/figma-wiring.md`'s Execute Retrieval Protocol before writing code — never from memory of an earlier read. Apply the English-conversion rule from `references/naming-standards.md` to every new or renamed identifier this task introduces.
85
+
84
86
  Ask the MCP and skill question when tool choice can change correctness or verification.
85
87
 
86
88
  ### 4. Write Tests (derived from spec, not from implementation)
@@ -157,6 +157,14 @@ After requirements close, decide the remaining phases:
157
157
 
158
158
  ---
159
159
 
160
+ ## Figma Wiring And English Naming
161
+
162
+ WHERE Figma ingestion is enabled for this feature, wire each authored spec item that maps to a high-level category (Structure, Behavior / Prototype, Flows) to its figma file + Number per `references/figma-wiring.md` before presenting the spec for confirmation.
163
+
164
+ Apply the English-conversion rule from `references/naming-standards.md` to every identifier, requirement name, and artifact-facing term before writing `spec.md` — convert any non-English source term before it reaches this artifact.
165
+
166
+ ---
167
+
160
168
  ## Template: `.specs/features/<slug>/spec.md`
161
169
 
162
170
  ```markdown
@@ -50,6 +50,8 @@ Use only when the TLC v3 flow includes Tasks. The output is the `.specs/features
50
50
 
51
51
  Read `.specs/features/<slug>/design.md` before creating tasks.
52
52
 
53
+ WHERE Figma ingestion is enabled, consume the reuse map from `references/code-reuse-scan.md` for the wired implementation work, and fill each task's Task(s) ID column in the relevant `.specs/<type>/<slug>/figma/*.md` wiring table per `references/figma-wiring.md`. Before presenting tasks (step 5 below), run that reference's unused-Number gate — stop and report any unwired Number to the user before Execute proceeds.
54
+
53
55
  ### 1.5. Generate the Test Coverage Matrix (ALWAYS)
54
56
 
55
57
  This step ALWAYS runs — there is no precondition. Decide which of two paths to take, then generate the two sections below.
@@ -0,0 +1,271 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * validate_figma_wiring.ts - deterministic backing for the Figma wiring
4
+ * unused-Number stop rule (FIGMA-07, design D11b).
5
+ *
6
+ * Parses every per-link figma file's wiring table under
7
+ * `.specs/<type>/<slug>/figma/*.md` for the given slug (`references/figma-wiring.md`
8
+ * owns the per-link file template and the 8-column table contract) and
9
+ * reports, for each Number row, whether it is wired to at least one
10
+ * Spec(s)/Task(s)/Design(s) ID. Bun builtins only, zero dependencies.
11
+ *
12
+ * ALWAYS prints the parsed population (files scanned + rows parsed) beside
13
+ * the verdict -- a bare pass/fail is not trustworthy on its own
14
+ * (spec-scripts-parse-strict-shapes lesson): a script that silently parses
15
+ * zero rows from a malformed table would otherwise report a vacuous pass.
16
+ *
17
+ * Usage:
18
+ * bun skills/massa-ai/scripts/validate_figma_wiring.ts <slug> [--root .] [--type features|quick|debug|refactors]
19
+ *
20
+ * What it checks:
21
+ * ERROR - the figma/ directory exists but zero wiring-table rows were
22
+ * parsed from it (loud failure, not a silent pass)
23
+ * ERROR - a Number row has Spec(s) ID, Task(s) ID, AND Design(s) ID all
24
+ * empty (unwired -- the unused-Number stop rule)
25
+ *
26
+ * A slug with no figma/ directory at all has nothing to check (Figma
27
+ * ingestion was never enabled for it) and exits 0 with a zero population.
28
+ *
29
+ * Exit codes: 0 pass (or nothing to check), 1 errors found, 2 usage error.
30
+ */
31
+
32
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
33
+ import { join, relative } from "node:path";
34
+
35
+ const VALID_TYPES = ["features", "quick", "debug", "refactors"] as const;
36
+ type ArtifactType = (typeof VALID_TYPES)[number];
37
+
38
+ /** One parsed data row from a wiring table. */
39
+ interface WiringRow {
40
+ number: string;
41
+ nodeIds: string;
42
+ category: string;
43
+ specIds: string;
44
+ taskIds: string;
45
+ designIds: string;
46
+ /** Path reported in output, relative to `--root`. */
47
+ file: string;
48
+ }
49
+
50
+ /**
51
+ * The wiring-table header row, per `references/figma-wiring.md`'s
52
+ * Wiring-Table Contract: exactly these 8 columns, in this order.
53
+ */
54
+ const HEADER_RE =
55
+ /^\|\s*Number\s*\|\s*Figma node id\(s\)\s*\|\s*Category\s*\|\s*Spec\(s\) ID\s*\|\s*Task\(s\) ID\s*\|\s*Design\(s\) ID\s*\|\s*Explanation\s*\|\s*Notes\s*\|\s*$/i;
56
+
57
+ function isFile(p: string): boolean {
58
+ return existsSync(p) && statSync(p).isFile();
59
+ }
60
+
61
+ function isDir(p: string): boolean {
62
+ return existsSync(p) && statSync(p).isDirectory();
63
+ }
64
+
65
+ /** Universal newline split. */
66
+ function splitLines(text: string): string[] {
67
+ return text.split(/\r\n|\r|\n/);
68
+ }
69
+
70
+ /** Splits one markdown table row into trimmed cells, dropping the outer-pipe edge cells. */
71
+ function splitRow(line: string): string[] {
72
+ const trimmed = line.trim();
73
+ const withoutEdges = trimmed.replace(/^\|/, "").replace(/\|$/, "");
74
+ return withoutEdges.split("|").map((c) => c.trim());
75
+ }
76
+
77
+ /** True when every cell of a row looks like a markdown table separator (`---`, `:--`, `--:`). */
78
+ function isSeparatorRow(cells: string[]): boolean {
79
+ return cells.length > 0 && cells.every((c) => /^:?-{2,}:?$/.test(c));
80
+ }
81
+
82
+ /** A cell counts as "wired" when it is non-empty and not a bare placeholder dash. */
83
+ function isWiredCell(cell: string): boolean {
84
+ return cell !== "" && cell !== "-" && cell !== "—" && cell !== "N/A";
85
+ }
86
+
87
+ /**
88
+ * Parses every wiring table found in one figma file's markdown content.
89
+ *
90
+ * A table is recognized by its header row matching the 8-column contract
91
+ * followed immediately by a markdown separator row; every subsequent
92
+ * pipe-prefixed line with at least 8 cells is a data row, until a
93
+ * non-pipe-prefixed line ends the table.
94
+ *
95
+ * @param content - Raw file text.
96
+ * @param fileLabel - Path recorded on each parsed row for reporting.
97
+ */
98
+ function parseWiringTables(content: string, fileLabel: string): WiringRow[] {
99
+ const lines = splitLines(content);
100
+ const rows: WiringRow[] = [];
101
+ for (let i = 0; i < lines.length; i++) {
102
+ if (!HEADER_RE.test(lines[i]!.trim())) continue;
103
+ const sepIdx = i + 1;
104
+ if (sepIdx >= lines.length || !isSeparatorRow(splitRow(lines[sepIdx]!))) continue;
105
+ let j = sepIdx + 1;
106
+ while (j < lines.length) {
107
+ const line = lines[j]!;
108
+ if (!line.trim().startsWith("|")) break;
109
+ const cells = splitRow(line);
110
+ if (cells.length < 8) break;
111
+ rows.push({
112
+ number: cells[0]!,
113
+ nodeIds: cells[1]!,
114
+ category: cells[2]!,
115
+ specIds: cells[3]!,
116
+ taskIds: cells[4]!,
117
+ designIds: cells[5]!,
118
+ file: fileLabel,
119
+ });
120
+ j++;
121
+ }
122
+ i = j - 1;
123
+ }
124
+ return rows;
125
+ }
126
+
127
+ function figmaDir(root: string, type: ArtifactType, slug: string): string {
128
+ return join(root, ".specs", type, slug, "figma");
129
+ }
130
+
131
+ function listFigmaFiles(dir: string): string[] {
132
+ if (!isDir(dir)) return [];
133
+ return readdirSync(dir)
134
+ .filter((f) => f.endsWith(".md") && isFile(join(dir, f)))
135
+ .sort()
136
+ .map((f) => join(dir, f));
137
+ }
138
+
139
+ interface CheckResult {
140
+ errors: string[];
141
+ dirPresent: boolean;
142
+ filesScanned: number;
143
+ rowsParsed: number;
144
+ unwired: WiringRow[];
145
+ }
146
+
147
+ function check(root: string, type: ArtifactType, slug: string): CheckResult {
148
+ const dir = figmaDir(root, type, slug);
149
+ const errors: string[] = [];
150
+ const dirPresent = isDir(dir);
151
+ const files = listFigmaFiles(dir);
152
+ let rowsParsed = 0;
153
+ const unwired: WiringRow[] = [];
154
+
155
+ for (const file of files) {
156
+ const content = readFileSync(file, "utf-8");
157
+ const label = relative(root, file);
158
+ const rows = parseWiringTables(content, label);
159
+ rowsParsed += rows.length;
160
+ for (const row of rows) {
161
+ if (!isWiredCell(row.specIds) && !isWiredCell(row.taskIds) && !isWiredCell(row.designIds)) {
162
+ unwired.push(row);
163
+ }
164
+ }
165
+ }
166
+
167
+ if (dirPresent && rowsParsed === 0) {
168
+ errors.push(
169
+ `figma/ directory exists at ${relative(root, dir)} but zero wiring-table rows were parsed -- check the table header matches the 8-column contract in references/figma-wiring.md`,
170
+ );
171
+ }
172
+ for (const row of unwired) {
173
+ errors.push(
174
+ `${row.file} #${row.number}: unwired -- Spec(s) ID, Task(s) ID, and Design(s) ID are all empty (category: ${row.category || "?"}, node id(s): ${row.nodeIds || "?"})`,
175
+ );
176
+ }
177
+
178
+ return { errors, dirPresent, filesScanned: files.length, rowsParsed, unwired };
179
+ }
180
+
181
+ const USAGE = "usage: validate_figma_wiring.ts [-h] [--root ROOT] [--type features|quick|debug|refactors] <slug>";
182
+ const HELP = `${USAGE}
183
+
184
+ Deterministic backing for the Figma wiring unused-Number stop rule (FIGMA-07).
185
+
186
+ positional arguments:
187
+ slug The feature/quick/debug/refactor slug whose figma/ directory to check
188
+
189
+ options:
190
+ -h, --help show this help message and exit
191
+ --root ROOT Project root that contains .specs/ (default: current dir)
192
+ --type TYPE Artifact type: features (default) | quick | debug | refactors`;
193
+
194
+ interface Args {
195
+ slug: string;
196
+ root: string;
197
+ type: ArtifactType;
198
+ }
199
+
200
+ function printUsageError(msg: string): void {
201
+ process.stderr.write(`${USAGE}\nvalidate_figma_wiring.ts: error: ${msg}\n`);
202
+ }
203
+
204
+ function parseArgs(argv: string[]): Args | null {
205
+ let root = ".";
206
+ let type: ArtifactType = "features";
207
+ const positionals: string[] = [];
208
+ for (let i = 0; i < argv.length; i++) {
209
+ const a = argv[i]!;
210
+ if (a === "--root") {
211
+ if (i + 1 >= argv.length) {
212
+ printUsageError("argument --root: expected one argument");
213
+ return null;
214
+ }
215
+ root = argv[++i]!;
216
+ } else if (a.startsWith("--root=")) {
217
+ root = a.slice("--root=".length);
218
+ } else if (a === "--type") {
219
+ if (i + 1 >= argv.length) {
220
+ printUsageError("argument --type: expected one argument");
221
+ return null;
222
+ }
223
+ const v = argv[++i]!;
224
+ if (!(VALID_TYPES as readonly string[]).includes(v)) {
225
+ printUsageError(`argument --type: invalid choice: '${v}' (choose from ${VALID_TYPES.map((t) => `'${t}'`).join(", ")})`);
226
+ return null;
227
+ }
228
+ type = v as ArtifactType;
229
+ } else if (a.startsWith("--type=")) {
230
+ const v = a.slice("--type=".length);
231
+ if (!(VALID_TYPES as readonly string[]).includes(v)) {
232
+ printUsageError(`argument --type: invalid choice: '${v}' (choose from ${VALID_TYPES.map((t) => `'${t}'`).join(", ")})`);
233
+ return null;
234
+ }
235
+ type = v as ArtifactType;
236
+ } else if (a === "-h" || a === "--help") {
237
+ console.log(HELP);
238
+ process.exit(0);
239
+ } else if (a.startsWith("-") && a !== "-") {
240
+ printUsageError(`unrecognized arguments: ${a}`);
241
+ return null;
242
+ } else {
243
+ positionals.push(a);
244
+ }
245
+ }
246
+ if (positionals.length === 0) {
247
+ printUsageError("the following arguments are required: slug");
248
+ return null;
249
+ }
250
+ if (positionals.length > 1) {
251
+ printUsageError(`unrecognized arguments: ${positionals.slice(1).join(" ")}`);
252
+ return null;
253
+ }
254
+ return { slug: positionals[0]!, root, type };
255
+ }
256
+
257
+ function main(argv: string[]): number {
258
+ const args = parseArgs(argv);
259
+ if (args === null) return 2;
260
+
261
+ const { errors, filesScanned, rowsParsed, unwired } = check(args.root, args.type, args.slug);
262
+ for (const e of errors) console.log(` ERROR ${e}`);
263
+ console.log(
264
+ `\nvalidate_figma_wiring: scanned ${filesScanned} file(s), parsed ${rowsParsed} row(s), ${unwired.length} unwired, ${errors.length} error(s) for slug "${args.slug}" (type: ${args.type})`,
265
+ );
266
+ return errors.length > 0 ? 1 : 0;
267
+ }
268
+
269
+ if (import.meta.main) {
270
+ process.exit(main(process.argv.slice(2)));
271
+ }
@@ -3,7 +3,7 @@ name: architecture-fix
3
3
  description: "Executes fixes from a saved architecture audit report; not for findings-only review or broad new design work with missing requirements."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Architecture Fix
@@ -17,10 +17,13 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  Not for findings-only architecture review — route to `workflows/architecture/architecture-audit.md`. Not for broad new design work with missing requirements — route to `workflows/spec-driven.md`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `architecture-fix-[entity]`
22
24
  2. Load shared references:
23
25
  - `references/audit-report-io.md` before any code change
26
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
24
27
  - `references/architecture-lenses.md`
25
28
  - `references/architecture-domain-lens.md` when executing domain or bounded-context findings
26
29
  - `references/architecture-coupling-lens.md` when executing dependency, contract, or coupling findings
@@ -3,7 +3,7 @@ name: bugs-fix
3
3
  description: "Executes fixes from a saved bugs audit report; not for findings-only discovery, single known issues without a report, or broad product changes."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Bugs Fix
@@ -17,10 +17,13 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  Not for findings-only bug discovery — route to `workflows/bugs/bugs-audit.md`. Not for one known broken behavior without an audit report — route to `workflows/debug.md`. Not for broad product/design changes — route to `workflows/spec-driven.md`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `bugs-fix-[entity]`
22
24
  2. Load shared references:
23
25
  - `references/audit-report-io.md` before any code or test change
26
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
24
27
  - `references/lessons.md` to load confirmed project lessons
25
28
  - `references/codebase-investigation.md` before changing unfamiliar bug paths
26
29
  - `references/verification-ladder.md` before non-trivial edits
@@ -3,7 +3,7 @@ name: code-quality-fix
3
3
  description: "Executes fixes from a saved code quality audit report; not for findings-only SOLID, Clean Code, KISS, YAGNI, DRY, or overengineering analysis."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Code Quality Fix
@@ -17,6 +17,8 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  Not for findings-only SOLID, Clean Code, KISS, YAGNI, DRY, maintainability, or overengineering analysis — route to `workflows/code-quality/code-quality-audit.md`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `code-quality-fix-[entity]`
22
24
  2. Load shared references:
@@ -3,7 +3,7 @@ name: debug
3
3
  description: "Use this workflow for evidence-backed root-cause diagnosis of broken behavior, failures, regressions, or crashes; route new capabilities to feature and broad redesign to spec-driven."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### 🔴 Debug
@@ -17,8 +17,11 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  1. Generate/reuse `workflowSessionId`: `debug-[entity]`
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
  2. Load shared references:
21
23
  - `references/codebase-investigation.md`
24
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
22
25
  - `references/debug-diagnosis-loop.md`
23
26
  - `references/mobile-diagnosis.md` when the bug target involves KMP, iOS, Android, native bridges, devices, simulators/emulators, or mobile lifecycle
24
27
  - `references/verification-ladder.md` before Quick/Standard/Spec-driven sizing or applying fixes
@@ -3,7 +3,7 @@ name: design
3
3
  description: "Implements or updates a concrete mobile UI from structured Figma evidence or screenshots when no saved audit report exists; route comparisons to mobile-figma-audit."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.1.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Design
@@ -17,32 +17,16 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  Not for Flutter, React Native, web UI, generic Figma exploration, variable-only queries, or MCP troubleshooting.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `design-[entity]`.
22
- 2. Load `references/mobile-figma-matcher/repository-detection.md`, `references/mobile-figma-matcher/core.md`, `references/mobile-context.md`, `references/codebase-investigation.md`, and `references/verification-ladder.md`. When Figma links or node IDs are provided, load `references/figma-pre-analysis.md` and run its two-stage sequential retrieval protocol before building the Figma Evidence Packet. Load `references/context-firewall.md` before large design/runtime artifacts and `references/synapse-policy.md` when repeated massa-ai searches are expected.
24
+ 2. Load `references/mobile-figma-matcher/repository-detection.md`, `references/mobile-figma-matcher/core.md`, `references/mobile-context.md`, `references/codebase-investigation.md`, `references/verification-ladder.md`, and `references/naming-standards.md` (before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names — English-conversion rule applies). When Figma links or node IDs are provided, load `references/figma-pre-analysis.md` and run its two-stage sequential retrieval protocol before building the Figma Evidence Packet. Load `references/context-firewall.md` before large design/runtime artifacts and `references/synapse-policy.md` when repeated massa-ai searches are expected.
23
25
  3. `recall` -> load current component conventions, design-system rules, approved platform/accessibility deviations, prior Figma mappings, asset pipelines, and reusable render recipes. Memory is context, not proof.
24
26
  4. Require a concrete feature/module target plus at least one design source: readable Figma node/selection or supplied screenshots. Resolve required visual and interactive states plus a requirements source for behavior not represented in the design source. Ask only when target ownership, runtime platforms, platform-frame mappings, or screenshot authority stay ambiguous after source inspection.
25
- 5. Build the immutable Target Surface Packet before loading stack guidance. Classify each selected surface and load only its contracts:
26
- - Android Views XML -> `references/mobile-figma-matcher/android-views.md`.
27
- - Android Jetpack Compose -> `references/mobile-figma-matcher/android-compose.md`.
28
- - iOS UIKit -> `references/mobile-figma-matcher/ios-uikit.md`.
29
- - iOS SwiftUI -> `references/mobile-figma-matcher/ios-swiftui.md`.
30
- - Shared KMP Compose Multiplatform -> `references/mobile-figma-matcher/kmp-compose-multiplatform.md` plus native contracts only for selected native source sets, hosts, wrappers, or runtime targets.
31
- 6. Build the Figma Evidence Packet with metadata when needed, design context, screenshot, variables, current Code Connect mappings, variants/states, annotations, and asset inventory. For screenshot-only sources, build a Screenshot Context Packet with provenance, target state, visible constraints, uncertainty, and `Design Evidence Class: screenshot-context-only`; do not infer exact Figma tokens, dimensions, variables, variants, or parity from screenshots alone. Stop if neither structured Figma evidence nor supplied screenshot context is available.
32
- 7. Resolve current components, tokens, resources, assets, source-set ownership, platform adapters, requirements, and existing validation sensors. Create the Design-To-Code Mapping Matrix and one comparison configuration per selected runtime surface; screenshot-only rows use inferred visual intent, not `Figma Value`.
33
- 8. Size the work with the Verification Ladder. Route broad application work, unresolved architecture, cross-feature design-system migration, or implementation that won't fit one clean context window to `spec-driven`.
34
- 9. Establish the verification recipe before editing. Protect tests, snapshots, screenshot baselines, fixtures, previews, accessibility identifiers, test tags, and automation flows from weakening.
35
- 10. Implement coherent slices using the smallest correct ownership boundary:
36
- - Reuse existing components and tokens only after resolving semantics, states, accessibility, and values.
37
- - Save required temporary Figma-served assets into the repository's existing durable asset pipeline before referencing them.
38
- - Keep shared KMP UI in common source sets only when ownership is genuinely shared; keep platform UI and adapters explicit.
39
- - Apply shared KMP root fixes before platform-local overrides when the cause is shared.
40
- - Preserve platform accessibility, safe areas/insets, localization, adaptive behavior, and native conventions.
41
- 11. After each coherent slice, rebuild affected mapping/comparison rows and run the cheapest deterministic sensors. When a shared KMP change affects Android and iOS, verify both requested targets or mark the unavailable platform `NOT EVALUATED`.
42
- 12. Refresh the Figma node, when available, and all selected target surfaces before completion. Completion requires zero unresolved selected `MISMATCH` rows for structured Figma evidence; `NOT EVALUATED` rows remain explicit residual risk and prohibit complete parity claims. Screenshot-only completion may claim implementation against supplied screenshot context, never exact Figma parity.
43
- 13. Report changed files, final per-surface matrix, saved assets, strongest verification level, skipped checks, and residual risk.
44
- 14. Persist only durable token/component mappings, approved deviations, source-set ownership rules, asset-pipeline rules, or reusable render recipes after Importance Calibration. Use `workflow:design` and required project/session/entity/memory tags.
45
- 15. Complete `references/evidence-gate.md`. Model visual judgment alone cannot satisfy completion.
27
+ 5. Follow `references/design-implementation.md` for the Target Surface Packet, the Figma Evidence / Screenshot Context Packet, the Design-To-Code Mapping Matrix, sizing and the verification recipe, coherent-slice implementation rules, per-slice verification, completion criteria, and the completion report — the single normative copy of this direction set, shared with `spec-driven`/`feature` under Figma ingestion.
28
+ 6. Persist only durable token/component mappings, approved deviations, source-set ownership rules, asset-pipeline rules, or reusable render recipes after Importance Calibration. Use `workflow:design` and required project/session/entity/memory tags.
29
+ 7. Complete `references/evidence-gate.md`. Model visual judgment alone cannot satisfy completion.
46
30
 
47
31
  ## Examples
48
32
 
@@ -3,7 +3,7 @@ name: feature
3
3
  description: "Use this workflow to add a new capability, screen, command, integration, or user-facing improvement with clear intent; route broken behavior to debug and broad work to spec-driven."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.4.0"
7
7
  ---
8
8
 
9
9
  ### 🟡 Feature
@@ -17,6 +17,8 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  1. Resolve/reuse `projectId` and `workflowSessionId` (`feature-[entity]`)
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
  2. `recall` → load prior decisions and patterns for this area
21
23
  - Use the default recall budget: `limit <= 3`, `minImportance >= 0.7`, and `types=["critical","decision","pattern"]` unless the feature needs broader memory discovery.
22
24
  - Recall is context only and must not load or reconstruct canonical artifact state.
@@ -30,6 +32,7 @@ Before the first repository mutation, load `references/implementation-delivery.m
30
32
  - `references/lessons.md` when `.specs/lessons.json` exists, to load confirmed project lessons before sizing
31
33
  - `references/knowledge-verification-chain.md` when the feature depends on an external library or API whose behavior is not already established from this codebase, running the 5-step chain (codebase → project docs → Context7 → web → flag-uncertain) before relying on that dependency's behavior
32
34
  - `references/brownfield-mapping.md` (Minimum Bar only — CONCERNS.md + TESTING.md) when the feature touches an area this codebase does not already document; the full onboarding need stays the existing route-to-`workflows/spec-driven.md` boundary stated above for broad, ambiguous, or cross-boundary work, not a new escalation here
35
+ - `references/figma-pre-analysis.md`, `references/figma-wiring.md`, and `references/design-implementation.md`, lazily, WHERE one or more Figma links or node IDs are supplied for this feature (any platform) — before PR-group decomposition in step 5
33
36
  4. For Android, iOS, KMP Compose Multiplatform UI, or work whose target matches the enumerated mobile-context trigger set (KMP, iOS, Android, native bridges, mobile lifecycle, offline/sync, permissions, push/background behavior, local persistence, or backend-mobile contracts), run the design-source intake gate from `references/mobile-context.md` (Design-Source Intake Gate) before implementation.
34
37
  5. Size the task before implementation:
35
38
  - Use the exact Quick, Standard, and Spec-driven thresholds in `references/verification-ladder.md`.
@@ -3,7 +3,7 @@ name: general
3
3
  description: "Final fallback workflow for coding, planning, review, or implementation work when no specialized massa-ai workflow is a better match."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### General Coding Workflow
@@ -17,6 +17,8 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  1. Resolve or reuse `projectId` and a stable `workflowSessionId`: `general-[entity]`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
  2. Run General fallback preflight before source work: name the specialized workflow considered, the exact rejected reason, and why fallback does not change verification, mutation behavior, or memory scope. Ask the user only when the rejected workflow would change those behaviors. One delivery authorization obtained here covers the fallback change's commits, push, and PR creation; force-push, deploy, or merge are separately gated (`references/implementation-delivery.md` Stage 3).
21
23
  3. Recall relevant durable context with `recall`. Treat recalled memory as a lead until current source confirms it. Confirm against current source before relying on it only when the change touches the enumerated risk-domain set: public API, data loss, auth/PII, migrations, or cross-service contracts. Otherwise trust recalled memory and cite it with a one-line source note. When recall returns no hit and the repository is otherwise unmapped on Standard+ fallback work, run the Minimum Bar sweep from `references/brownfield-mapping.md` first, writing only `CONCERNS.md` and `TESTING.md` into `.specs/project/onboarding/` before continuing.
22
24
  4. Create a Synapse session when planned related `search` calls >=2, following `references/synapse-policy.md`.
@@ -27,7 +29,7 @@ Before the first repository mutation, load `references/implementation-delivery.m
27
29
  - deepen into enriched search, symbols, or exact files only when needed
28
30
  - prefer `read_file` over native Read when symbol metadata + imports are useful (retrieval order per `references/mcp-tools.md`); use `symbol_snippet` for raw code snippets by file + line range
29
31
  - prefer current repository truth over stale or conflicting memories
30
- 6. Execute the requested work using existing repository conventions. Tie verification depth to the Verification Ladder tier table in `references/verification-ladder.md`: Quick (<=3 files and <=200 changed LOC) runs static + file-integrity checks; Standard (<=10 files or <=500 changed LOC) adds a named verification recipe and behavioral checks; Spec-driven (>10 files, >500 changed LOC) escalates to `workflows/spec-driven.md`. Do not invent new thresholds; load specialized references only when the task needs their exact contracts.
32
+ 6. Execute the requested work using existing repository conventions. Load `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies). Tie verification depth to the Verification Ladder tier table in `references/verification-ladder.md`: Quick (<=3 files and <=200 changed LOC) runs static + file-integrity checks; Standard (<=10 files or <=500 changed LOC) adds a named verification recipe and behavioral checks; Spec-driven (>10 files, >500 changed LOC) escalates to `workflows/spec-driven.md`. Do not invent new thresholds; load specialized references only when the task needs their exact contracts.
31
33
  - For analysis that benefits from running code (derived values, data inspection, bulk transforms), call `execute` with `language` and `code` or `batch_execute` with `commands`[] instead of loading raw data into context. Respect the local-dev-only trust model (no untrusted-client exposure).
32
34
  - When the chosen approach leans on an external library's or API's exact behavior, resolve it through the 5-step chain in `references/knowledge-verification-chain.md` (codebase, project docs, Context7, web, flag-uncertain) before committing to that approach — the trigger is the dependence itself, not the task's Quick/Standard/Spec-driven tier.
33
35
  7. Use `compress` only when accumulated source or conversation context is reducing execution quality; preserve decisions, constraints, current state, and next steps rather than raw history.
@@ -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.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Implementation Fix
@@ -17,6 +17,8 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
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`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `implementation-fix-[entity]`.
22
24
  2. Load shared references:
@@ -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.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Maestro Fix
@@ -17,6 +17,8 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
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.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `maestro-fix-[entity]`.
22
24
  2. Load shared references:
@@ -3,7 +3,7 @@ name: maestro
3
3
  description: "Implements new Maestro mobile E2E flows from Jira/Confluence, prompt text, attached scenario files, or inferred scenarios when no explicit source is supplied."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.1.0"
6
+ version: "1.2.0"
7
7
  ---
8
8
 
9
9
  ### Maestro
@@ -17,6 +17,8 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
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`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `maestro-[entity]`.
22
24
  2. Load shared references:
@@ -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.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Mobile Figma Fix
@@ -17,6 +17,8 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
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`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `mobile-figma-fix-[entity]`.
22
24
  2. Load shared references:
@@ -24,6 +26,7 @@ Do not execute from chat summaries, screenshots alone, remembered findings, or a
24
26
  - `references/mobile-figma-matcher/core.md` for Figma, assets, mapping, Maestro, matrix, and claim contracts.
25
27
  - `references/figma-pre-analysis.md` when the findings span multiple Figma links or nodes — run its two-stage sequential retrieval protocol for the re-read.
26
28
  - `references/lessons.md` to load confirmed project lessons
29
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
27
30
  - `references/mobile-context.md` for mobile boundary and verification guidance.
28
31
  - `references/audit-report-io.md` before any source or validation-asset edit.
29
32
  - `references/audit-scope.md` and `references/codebase-investigation.md` for freshness and current source.
@@ -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.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### 🔨 Refactor
@@ -17,10 +17,13 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  1. Resolve/reuse `workflowSessionId`: `refactor-[entity]`
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
  2. `recall` → load architectural decisions and coupling patterns for the area
21
23
  - 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`.
22
24
  3. Load shared references as needed:
23
25
  - `references/codebase-investigation.md` before changing unfamiliar code
26
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
24
27
  - `references/architecture-lenses.md` when the refactor is driven by coupling, seams, adapters, depth, leverage, or locality
25
28
  - `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
29
  - `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
@@ -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.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Requirements Fix
@@ -17,10 +17,13 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
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`.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `requirements-fix-[entity]`
22
24
  2. Load shared references:
23
25
  - `references/audit-report-io.md` before any code change
26
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
24
27
  - `references/lessons.md` to load confirmed project lessons
25
28
  - `references/codebase-investigation.md` before changing unfamiliar requirement flows
26
29
  - `references/verification-ladder.md` before non-trivial edits
@@ -3,7 +3,7 @@ name: security-fix
3
3
  description: "Executes fixes from a saved security audit report; not for findings-only security review or generic correctness fixes outside an exploitable path."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Security Fix
@@ -17,10 +17,13 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  Not for findings-only security review — route to `workflows/security/security-audit.md`. Not for generic correctness fixes unless the security report identifies the correctness issue as part of an exploitable path.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `security-fix-[entity]`
22
24
  2. Load shared references:
23
25
  - `references/audit-report-io.md` before any code change
26
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
24
27
  - `references/lessons.md` to load confirmed project lessons
25
28
  - `references/codebase-investigation.md` before changing unfamiliar security boundaries; that trigger also gates `.specs/project/onboarding/CONCERNS.md` — consult it before working the finding
26
29
  - `references/mobile-context.md` when the report target touches KMP, iOS, Android, native bridges, mobile permissions, secure storage, biometrics, deep links, push/background behavior, local persistence, offline queues, logs/crash privacy, or backend-mobile contracts
@@ -3,7 +3,7 @@ name: spec-driven
3
3
  description: "Use this workflow for explicit spec-driven requests and broad, ambiguous, migration-heavy, or cross-boundary delivery needing requirements-through-verification control."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.1.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Spec-Driven
@@ -88,6 +88,7 @@ Quick artifacts live under `.specs/quick/NNN-slug/` with a `TASK.md` (one-line i
88
88
  - Load `references/context-firewall.md` before broad source inspection, generated reports, external research, or verbose tool output.
89
89
  - Keep the loaded context budget under the `references/spec-driven/context-limits.md` target; summarize or narrow before loading bulky artifacts.
90
90
  - Use `references/spec-driven/code-analysis.md` when source inspection needs structural search or tool fallback.
91
+ - Load `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies).
91
92
  - Load current canonical artifacts from `.specs/` files: `.specs/project/FEATURES.json`, `.specs/project/STATE.md`, `.specs/HANDOFF.md`, existing `.specs/features/<slug>/` phase artifacts, lessons, and project source. Current repository source and approved `.specs/` artifacts override stale memory, old handoff notes, external summaries, debug exports, or unapproved generated plans.
92
93
  - `search` only counts as codebase evidence when it is fresh for the current repository path and commit/worktree state, or when the result is confirmed against source files read in this session.
93
94
  - Load confirmed project lessons through `references/lessons.md` when `.specs/lessons.json` exists:
@@ -96,7 +97,10 @@ Quick artifacts live under `.specs/quick/NNN-slug/` with a `TASK.md` (one-line i
96
97
  - Capture stable requirement IDs, testable acceptance criteria, edge cases, and explicit out-of-scope items.
97
98
  - Run `references/spec-driven/discuss.md` inside Specify when gray areas, implicit requirements, persistence/state, external calls, auth, payments, concurrency, or state transitions affect behavior.
98
99
  - For Android, iOS, or KMP Compose Multiplatform UI work, run the optional design-source intake gate from `references/mobile-context.md` (Design-Source Intake Gate).
100
+ - WHERE one or more Figma links or node IDs are supplied for this work (any platform), lazily load `references/figma-pre-analysis.md`, `references/figma-wiring.md`, and `references/design-implementation.md` before Design/Tasks close; mobile targets additionally keep the Design-Source Intake Gate above.
99
101
  - Apply the Requirement Closure Gate: every open requirement question is resolved with the user or recorded as an accepted assumption before execution begins.
102
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
103
+
100
104
  4. Decide whether `Design` is required. If yes, run `references/spec-driven/design.md`, including its deterministic validation before presenting `design.md` for confirmation; if no, record why the skip is valid. When Design is skipped and a design concern appears later, stop and create `design.md` before continuing.
101
105
  5. Decide whether `Tasks` is required. If yes, run `references/spec-driven/tasks.md`; if no, list the inline atomic execution steps before editing. If the inline list reveals more than 5 steps or complex dependencies, stop and create `tasks.md` — the Tasks phase was wrongly skipped (safety valve).
102
106
  6. Run `Execute` with `references/spec-driven/execute.md`.
@@ -3,7 +3,7 @@ name: tests-fix
3
3
  description: "Executes fixes from a saved tests audit report; not for findings-only coverage review or generic test-writing work without an audit report."
4
4
  license: MIT
5
5
  metadata:
6
- version: "1.2.0"
6
+ version: "1.3.0"
7
7
  ---
8
8
 
9
9
  ### Tests Fix
@@ -17,10 +17,13 @@ Before the first repository mutation, load `references/implementation-delivery.m
17
17
  **Isolation Gate — before the first file edit:** execute `references/implementation-delivery.md` Stage 0–1 now (fetch base, create the worktree + branch, work inside it) and record the worktree path + branch — or one of Stage 1's two legal skip reasons, verbatim — before any repository mutation.
18
18
 
19
19
  Not for findings-only test coverage, assertion quality, fixture health, flakiness, or regression-risk review — route to `workflows/tests/tests-audit.md`. Not for generic "write some tests" work without an audit report — route broad test planning through the relevant feature, debug, refactor, or spec-driven workflow.
20
+ **Reuse Scan — before writing new implementation code:** run the mandatory reuse scan per `references/code-reuse-scan.md` (separate read-only subagents; the reuse map's use/extend/new decisions are consumed before new code is planned or written) — or record its inline-fallback reason, verbatim.
21
+
20
22
 
21
23
  1. Resolve/reuse `workflowSessionId`: `tests-fix-[entity]`
22
24
  2. Load shared references:
23
25
  - `references/audit-report-io.md` before any code or test change
26
+ - `references/naming-standards.md` before introducing or renaming identifiers, screens, components, attributes, or implementation-facing names (English-conversion rule applies)
24
27
  - `references/lessons.md` to load confirmed project lessons
25
28
  - `references/codebase-investigation.md` before changing unfamiliar tests or fixtures
26
29
  - `references/mobile-context.md` when the report target touches KMP, iOS, Android, native bridges, mobile lifecycle, offline sync, permissions, local persistence, UI snapshots/screenshots, or backend-mobile contracts