@massa-ai/cursor-plugin 1.55.0 → 1.57.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 (66) hide show
  1. package/.cursor-plugin/plugin.json +1 -1
  2. package/install.sh +9 -7
  3. package/package.json +1 -1
  4. package/skills/agents/architecture-specialist/SKILL.md +1 -1
  5. package/skills/agents/audit-specialist/SKILL.md +1 -1
  6. package/skills/agents/builder/SKILL.md +1 -1
  7. package/skills/agents/context-curator/SKILL.md +1 -1
  8. package/skills/agents/designer/SKILL.md +1 -1
  9. package/skills/agents/documentation-agent/SKILL.md +1 -1
  10. package/skills/agents/furps-analyst/SKILL.md +1 -1
  11. package/skills/agents/investigator/SKILL.md +1 -1
  12. package/skills/agents/judge/SKILL.md +1 -1
  13. package/skills/agents/meta-judge/SKILL.md +1 -1
  14. package/skills/agents/mobile-specialist/SKILL.md +1 -1
  15. package/skills/agents/navigator/SKILL.md +1 -1
  16. package/skills/agents/plan-critic/SKILL.md +1 -1
  17. package/skills/agents/planner/SKILL.md +1 -1
  18. package/skills/agents/requirements-analyst/SKILL.md +1 -1
  19. package/skills/agents/reviewer/SKILL.md +1 -1
  20. package/skills/agents/test-engineer/SKILL.md +1 -1
  21. package/skills/agents/verification-agent/SKILL.md +1 -1
  22. package/skills/bootstrap/SKILL.md +74 -0
  23. package/skills/massa-ai/SKILL.md +2 -1
  24. package/skills/massa-ai/references/agent-orchestration.md +41 -4
  25. package/skills/massa-ai/references/audit-scope.md +1 -1
  26. package/skills/massa-ai/references/code-annotation.md +16 -1
  27. package/skills/massa-ai/references/code-quality-lens.md +107 -0
  28. package/skills/massa-ai/references/code-reuse-scan.md +0 -1
  29. package/skills/massa-ai/references/implementation-delivery.md +6 -3
  30. package/skills/massa-ai/references/naming-standards.md +12 -7
  31. package/skills/massa-ai/references/skill-architect/authoring-principles.md +37 -0
  32. package/skills/massa-ai/references/verification-ladder.md +2 -0
  33. package/skills/massa-ai/scripts/check_commit.ts +4 -1
  34. package/skills/massa-ai/scripts/ensure_worktree.ts +311 -0
  35. package/skills/massa-ai/scripts/resolve_scope.ts +263 -0
  36. package/skills/massa-ai/scripts/size_change.ts +227 -0
  37. package/skills/massa-ai/workflows/architecture/architecture-audit.md +1 -15
  38. package/skills/massa-ai/workflows/architecture/architecture-fix.md +1 -8
  39. package/skills/massa-ai/workflows/bugs/bugs-audit.md +1 -13
  40. package/skills/massa-ai/workflows/bugs/bugs-fix.md +1 -9
  41. package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +3 -34
  42. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +3 -17
  43. package/skills/massa-ai/workflows/commit.md +6 -6
  44. package/skills/massa-ai/workflows/debug.md +2 -9
  45. package/skills/massa-ai/workflows/design.md +0 -6
  46. package/skills/massa-ai/workflows/exploration.md +0 -1
  47. package/skills/massa-ai/workflows/feature.md +2 -15
  48. package/skills/massa-ai/workflows/general.md +1 -16
  49. package/skills/massa-ai/workflows/implementation/implementation-audit.md +0 -1
  50. package/skills/massa-ai/workflows/implementation/implementation-fix.md +1 -15
  51. package/skills/massa-ai/workflows/judge-with-debate.md +0 -2
  52. package/skills/massa-ai/workflows/maestro/maestro-fix.md +1 -8
  53. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +0 -6
  54. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +1 -14
  55. package/skills/massa-ai/workflows/pr-review.md +0 -3
  56. package/skills/massa-ai/workflows/refactor.md +2 -9
  57. package/skills/massa-ai/workflows/refinement/furps-refinement.md +0 -1
  58. package/skills/massa-ai/workflows/requirements/requirements-audit.md +1 -13
  59. package/skills/massa-ai/workflows/requirements/requirements-fix.md +1 -8
  60. package/skills/massa-ai/workflows/security/security-audit.md +1 -13
  61. package/skills/massa-ai/workflows/security/security-fix.md +1 -9
  62. package/skills/massa-ai/workflows/skill-architect.md +7 -39
  63. package/skills/massa-ai/workflows/spec-driven.md +0 -11
  64. package/skills/massa-ai/workflows/tests/tests-audit.md +1 -13
  65. package/skills/massa-ai/workflows/tests/tests-fix.md +1 -8
  66. package/skills/massa-ai/workflows/to-prd.md +0 -1
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "massa-ai",
3
- "version": "1.55.0",
3
+ "version": "1.57.0",
4
4
  "description": "massa-ai — semantic code search, memory, and context compression for Cursor"
5
5
  }
package/install.sh CHANGED
@@ -397,7 +397,7 @@ install_bundled_skills() {
397
397
  # authoritative constant (D6/IPT-05) — not derived by scanning the bundle's
398
398
  # skills/ directory, which would install 49 on cursor (every workflow skill
399
399
  # ships as its own directory here).
400
- for name in massa-ai persona-router profile; do
400
+ for name in massa-ai persona-router profile bootstrap; do
401
401
  src="$SCRIPT_DIR/skills/$name"
402
402
  [[ -d "$src" ]] || continue
403
403
  dest="$HARNESS_SKILLS_DIR/$name"
@@ -426,7 +426,7 @@ if (typeof data.platforms !== "object" || data.platforms === null || Array.isArr
426
426
  }
427
427
  data.version = 2;
428
428
  const prev = data.platforms[host];
429
- data.platforms[host] = { root, skillsOwner: "plugin", skills: ["massa-ai", "persona-router", "profile"] };
429
+ data.platforms[host] = { root, skillsOwner: "plugin", skills: ["massa-ai", "persona-router", "profile", "bootstrap"] };
430
430
  // The whole-record replace must not drop fields a previous successful install
431
431
  // wrote (R2) — re-attach them. installRoute (T9) is installer-owned but
432
432
  // written by a LATER step of this same install (record_plugin_version), so it
@@ -472,7 +472,7 @@ NODE
472
472
  )"
473
473
  [[ "$raw_owner" == "plugin" ]] && {
474
474
  local name
475
- for name in massa-ai persona-router profile; do
475
+ for name in massa-ai persona-router profile bootstrap; do
476
476
  rm -rf "$HARNESS_SKILLS_DIR/$name"
477
477
  done
478
478
  rmdir "$HARNESS_SKILLS_DIR" 2>/dev/null || true
@@ -680,15 +680,17 @@ vecho " + .cursor-plugin/plugin.json"
680
680
 
681
681
  # Copy the host-command skills (each in a subdirectory: skills/<name>/SKILL.md),
682
682
  # quick + generated workflow commands alike. massa-ai/, persona-router/,
683
- # agents/, and profile/ are the PDO-06 harness bundle, not a Cursor command
684
- # skill — they are installed separately, into the shared harness skills
683
+ # agents/, profile/ and bootstrap/ are the PDO-06 harness bundle, not a Cursor
684
+ # command skill — they are installed separately, into the shared harness skills
685
685
  # directory (see "Skills bundling" below), not into this plugin-cache
686
686
  # skills/ tree. `profile` was missing from this exclusion pre-fix, which
687
- # leaked it into the command-skill cache mislabeled as `/profile`.
687
+ # leaked it into the command-skill cache mislabeled as `/profile`; `bootstrap`
688
+ # (T21) is the same class, and is excluded here in the same commit that
689
+ # teaches the generator to emit it, so it never has a release where it leaks.
688
690
  for src in "$SCRIPT_DIR/skills/"*/SKILL.md; do
689
691
  name="$(basename "$(dirname "$src")")"
690
692
  case "$name" in
691
- massa-ai|persona-router|agents|profile) continue ;;
693
+ massa-ai|persona-router|agents|profile|bootstrap) continue ;;
692
694
  esac
693
695
  mkdir -p "$PLUGIN_DIR/skills/$name"
694
696
  cp "$src" "$PLUGIN_DIR/skills/$name/SKILL.md"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/cursor-plugin",
3
- "version": "1.55.0",
3
+ "version": "1.57.0",
4
4
  "description": "massa-ai plugin for Cursor — semantic code search, memory, and context compression",
5
5
  "files": [
6
6
  "agents",
@@ -3,7 +3,7 @@ name: architecture-specialist
3
3
  description: Read-only architecture guidance agent. Evaluate architecture, suggest boundaries, recommend abstractions, evaluate trade-offs, and suggest modularization. Folds the existing domain-mapper, coupling-auditor, and deepening-architect roles into one specialist. Triggers when a workflow needs architectural guidance before or during design. Never implements or rewrites code.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: audit-specialist
3
3
  description: Configurable read-only audit agent. Execute specialized audits through six lenses — bugs, architecture, security, requirements, code-quality, performance — selected via the lens field in the capability packet. Triggers when a workflow needs a findings-only audit. Never modifies implementation.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: builder
3
3
  description: Write-permitted implementation agent. Implement approved plans by modifying source code, creating files, and updating existing code while following project conventions. Triggers when a workflow has an approved plan or task with a disjoint write set. Never redesigns architecture, performs reviews, or generates implementation plans.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: standard
9
9
  permission: write
@@ -3,7 +3,7 @@ name: context-curator
3
3
  description: Read-only context preparation agent. Decide which files to open, retrieve memories, use Synapse when appropriate, apply Context Firewall rules, and produce a concise Context Packet consumed by other agents. Triggers when a workflow needs the minimum high-quality context before dispatching a planner, builder, or reviewer. Never implements, reviews, or plans.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: designer
3
3
  description: Screen implementation and design-conformance agent. Verify and implement user-facing screens against their design source, reading Figma through MCP when a link or node id is supplied. Default read-only; writes only UI-layer files when explicitly scoped with a disjoint write set. Triggers whenever a task creates or modifies a screen. Owns screen-vs-design conformance only; no production logic outside the UI layer.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: standard
9
9
  permission: write
@@ -3,7 +3,7 @@ name: documentation-agent
3
3
  description: Engineering documentation agent. Generate README, ADR, RFC, changelog, KDoc, and architecture documentation. Default read-only; writes only doc files when explicitly scoped with a disjoint write set. Triggers when a workflow needs documentation artifacts. Never modifies implementation.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: light
9
9
  permission: write
@@ -3,7 +3,7 @@ name: furps-analyst
3
3
  description: Read-only FURPS+ dimension analyst. Analyze exactly one FURPS+ dimension (F, U, R, P, S, or X) of a PRD or ADR against its checklist section and return structured refinement findings. Triggers when the furps-refinement workflow fans out per-dimension analysis. Never analyzes other dimensions, never writes files, never mutates Atlassian issues.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: investigator
3
3
  description: Read-only codebase investigation agent. Locate implementations, trace execution flow, identify dependencies, estimate change impact, and answer engineering questions. Triggers when a workflow needs to understand existing code before planning or implementing. Never modifies code, never generates implementation, never performs reviews.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: judge
3
3
  description: Debate-panel evaluator for judge-with-debate. Score an artifact against the meta-judge's evaluation specification with quoted evidence, then defend or revise scores across up to 3 debate rounds until the panel reaches consensus. Writes only its own judge-N report file per dispatch. Never judges outside the specification, never revises without quoted evidence.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.2.0"
8
8
  model_tier: deep
9
9
  permission: write
@@ -3,7 +3,7 @@ name: meta-judge
3
3
  description: Read-only evaluation-specification author for judge-with-debate. Generate the tailored rubric, criteria, weights, and checklists that a panel of judge agents uses to evaluate an artifact through independent analysis and multi-round debate. Runs exactly once per evaluation. Never scores the artifact, never edits the specification after emission.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.1.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: mobile-specialist
3
3
  description: Conditional mobile expertise agent. Provide Android, Kotlin, Compose, KMP, Swift, iOS, Gradle, CocoaPods, performance, lifecycle, and offline-sync guidance. Invoked only when the workflow detects a mobile-related project. Read-only. Triggers on mobile detection signals; refuses non-mobile targets.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: navigator
3
3
  description: Code exploration specialist that leverages the massa-ai semantic index instead of brute-force file reads. Use when the user asks "where is X?", "how does Y work?", "who calls Z?", or for any question about an indexed codebase. Starts every investigation by consulting the massa-ai index (project map, definitions, references) before falling back to Read/Grep.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.1.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: plan-critic
3
3
  description: Read-only plan-challenge agent. Stress-test a constructed plan, surface the assumption most likely to fail, name the deterministic check that would falsify success, and return a bounded critique for the lite or full Plan Challenge gate. Triggers after a concrete plan exists. Never edits the plan, never implements, never expands scope.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: planner
3
3
  description: Read-only planning agent. Transform engineering requests into implementation plans by breaking work into steps, identifying dependencies and risks, suggesting execution order, and producing an implementation strategy. Triggers when a workflow needs a plan before implementation. Never implements or reviews code.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: requirements-analyst
3
3
  description: Read-only requirements analysis agent. Detect ambiguity, missing requirements, contradictions, implicit requirements, and uncovered scenarios before implementation. Triggers during the Specify phase when gray areas, persistence, external calls, auth, payments, concurrency, or state transitions affect behavior. Never implements.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: reviewer
3
3
  description: Read-only diff review agent. Analyze diffs to detect bugs, regressions, code smells, missing edge cases, and suggest improvements. Triggers after a builder completes a task and before the verification gate. Never implements, rewrites files, or plans features.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -3,7 +3,7 @@ name: test-engineer
3
3
  description: Testing strategy agent. Generate unit, integration, edge-case, negative-scenario, and acceptance-coverage test plans. Default read-only; writes only test files when explicitly scoped with a disjoint write set. Triggers when a workflow needs a test strategy or test plan. Focuses only on testing; no production code changes outside test files.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: standard
9
9
  permission: write
@@ -3,7 +3,7 @@ name: verification-agent
3
3
  description: Read-only verification agent. Centralize Verification Ladder logic by validating outputs, choosing the verification level, executing the verification checklist, detecting incomplete work, and producing verification reports. Triggers as the mandatory final gate before a task is claimed complete. Never modifies implementation.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  model_tier: deep
9
9
  permission: read-only
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: bootstrap
3
+ description: Inspect or toggle the massa-ai startup-contract rules (caveman, massa-ai-router, persona-router, dedupe-guardrails, plan-challenge, conversation-feedback, indexing-hygiene, english-code, code-comments) that the installed MASSA-AI.md delivers to this host. Use when the user asks which startup rules are active, asks to turn one on or off, or asks why a rule is or is not being applied. Do NOT use for editing the rule text itself (that is a massa-ai repository change, not a runtime toggle) and do NOT claim a toggle is live before the user restarts the host session.
4
+ license: MIT
5
+ metadata:
6
+ author: Luiz Massa
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # Bootstrap Rule Toggle Skill
11
+
12
+ ## Mission
13
+ Drive the one massa-ai bootstrap toggle engine through its CLI and relay the engine's own per-host report — never a second toggle path, never a hand-edited `MASSA-AI.md`.
14
+
15
+ ## When To Use
16
+ - The user asks which startup-contract rules are active, or what a rule does.
17
+ - The user asks to enable or disable one rule by id.
18
+ - The user asks to preview a toggle without applying it.
19
+ - The user asks why a rule appears not to be in force on this host.
20
+
21
+ ## How To Drive It
22
+ `massa-ai-config` is the only front for this surface. There is no `bootstrap_*` MCP tool, deliberately: the toggle has to keep working when the massa-ai MCP server is unreachable, because that is exactly the state a user is in after disabling `massa-ai-router` — the rule that loads the router which would otherwise drive the toggle. Never reach for an MCP call here, and never fall back to editing a rendered file by hand.
23
+
24
+ ```
25
+ massa-ai-config bootstrap list # every rule: id, current state, default, description
26
+ massa-ai-config bootstrap show # same output as list
27
+ massa-ai-config bootstrap enable <rule-id> [--dry-run]
28
+ massa-ai-config bootstrap disable <rule-id> [--dry-run]
29
+ ```
30
+
31
+ Run `bootstrap list` before any toggle, so the reported change is against a state that was read, not assumed. Default to `--dry-run` first when the user has not explicitly asked to apply the change immediately: a dry run persists nothing at all — not the preference either — and only previews the per-host delivery plan.
32
+
33
+ `--target <dir>` exists for scratch homes and requires `--yes`; it redirects only where the contract is *rendered*. The preference itself is always persisted to `~/.config/massa-ai/config.json`, so under a redirected target the CLI names both paths on stderr. Do not pass `--target` unless the user asked for a specific directory.
34
+
35
+ ## The Rule Ids
36
+ Exactly nine ids exist, and only these are accepted. There is no protected subset — every one of them can be switched both ways, including `massa-ai-router`.
37
+
38
+ - `caveman` — keep communication compressed while preserving technical accuracy. Default: enabled.
39
+ - `massa-ai-router` — load the massa-ai skill as the workflow router before substantive work. Default: enabled.
40
+ - `persona-router` — select one cataloged specialist persona after massa-ai context is available. Default: enabled.
41
+ - `dedupe-guardrails` — reuse already-loaded massa-ai context instead of bulk-loading workflows or references. Default: enabled.
42
+ - `plan-challenge` — run The Fool as a post-plan challenge gate per the configured policy. Default: enabled.
43
+ - `conversation-feedback` — emit chat-visible status updates for massa-ai workflow progress. Default: enabled.
44
+ - `indexing-hygiene` — ignore build output, dependency, and secret paths during indexing and context loading. Default: enabled.
45
+ - `english-code` — write generated code, identifiers, comments, and commit-facing artifacts in English regardless of conversational language. Default: enabled.
46
+ - `code-comments` — require API doc blocks and rationale comments on generated code. Default: **disabled**.
47
+
48
+ Never invent an id. An unrecognised id is refused before anything is read or written, and the error names the id and lists all nine — relay that list rather than guessing what the user meant.
49
+
50
+ Disabling `massa-ai-router` is allowed and is the user's call. Say plainly that it removes the router which reads the startup contract, and that the recovery is this same CLI (`massa-ai-config bootstrap enable massa-ai-router`), which is a binary and not a rule, so it stays reachable.
51
+
52
+ ## Relaying The Result
53
+ Always relay the per-host outcome and the restart notice verbatim in substance, not just "done". The report prints one line per host, each carrying its own status literal:
54
+
55
+ - `written` — the contract was written and this host loads it.
56
+ - `written-not-wired` — the contract was written, but **nothing on this host loads it**. Never collapse this into `written` and never report it as success: the command exits non-zero on it. Relay the reason as the engine states it — which artifact is missing, in which file — together with its remedy, `scripts/install-skills.sh --apply`, and say the toggle will not take effect on that host until the wiring is added.
57
+ - `skipped` — a byte-identical re-apply whose wiring is already present. Relay its reason; a bare "skipped" does not distinguish "already up to date" from any other no-op.
58
+ - `failed` — relay the reason that host failed for.
59
+
60
+ Three further lines carry meaning and must not be dropped:
61
+
62
+ - **No host installed.** When no host is recorded, the report says so and the command exits 0. That is "nothing to do", not "nothing happened" — say which it is.
63
+ - **Ignored persisted state.** A persisted entry that is not a known rule id with a boolean value is reported once and is never fatal. Relay the names.
64
+ - **Restart.** When at least one host was written in a non-dry-run pass, the report states that a host session restart is required. Say so explicitly, and never claim a toggle is already in force before that restart — hosts load the startup contract at session start; there is no live in-session reload.
65
+
66
+ On a dry run, say so and that no files changed.
67
+
68
+ ## Restrictions
69
+ - Never use an MCP tool for this surface; none exists. The CLI must keep working with the MCP server unreachable.
70
+ - Never invent, abbreviate, or pluralise a rule id; use only the nine ids above, exactly as the engine lists them.
71
+ - Never hand-edit a delivered `MASSA-AI.md`, a host's `AGENTS.md`, or `~/.config/massa-ai/config.json` to satisfy a toggle request — the engine owns those bytes, and a hand edit is overwritten by the next apply.
72
+ - Never edit the rule text itself to satisfy a toggle request; that is a massa-ai repository change owned by a different workflow.
73
+ - Never claim a toggle is live before the affected host's session restarts.
74
+ - Never report a `written-not-wired` host as switched.
@@ -3,7 +3,7 @@ name: massa-ai
3
3
  description: Default memory-backed workflow router for every coding, planning-before-coding, debugging, code review, refactoring, or implementation conversation. Always load it once per new coding session, select specialized workflows first, and use the general fallback otherwise. Handles massa-ai recall/search, durable memory, context compaction, handoff, audits, specs, ADR/RFC/TDD, and evidence gates. Do NOT use for generic non-coding chat or bulk-loading every workflow/reference.
4
4
  license: MIT
5
5
  metadata:
6
- author: S1LV4, luizgmassa
6
+ author: Luiz Massa
7
7
  version: "1.0.0"
8
8
  ---
9
9
 
@@ -297,6 +297,7 @@ Load only when a selected workflow asks for them:
297
297
  - `references/lessons.md`
298
298
  - `references/naming-standards.md`
299
299
  - `references/pr-task-fix.md`
300
+ - `references/code-quality-lens.md`
300
301
  - `references/architecture-lenses.md`
301
302
  - `references/architecture-domain-lens.md`
302
303
  - `references/architecture-coupling-lens.md`
@@ -137,8 +137,6 @@ dispatch.
137
137
 
138
138
  Before adding a new reusable role, load `references/subagent-design.md` and write a bounded role charter. For one-off tasks, use an existing role plus the prompt contract below instead of inventing a new role.
139
139
 
140
- ## Roles
141
-
142
140
  **The roster lives in one place: the Agent Table of `skills/AGENTS.md`**, which names
143
141
  every shipped specialist with its purpose, trigger, permission, and charter path. Do not
144
142
  restate it here. A second roster in this file is what let `judge` and `meta-judge` go
@@ -181,11 +179,50 @@ When dispatching a subagent, send a compact capability packet rather than a loos
181
179
  - `output`: the exact output contract
182
180
  - `firewall`: raw logs, diffs, snapshots, reports, or research that must be summarized
183
181
  - `memory`: whether the subagent may suggest memories and who persists them
184
- - `persona`: optional. The cataloged persona id in effect for the parent conversation, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions. Pass the id alone, never the persona prompt.
182
+ - `persona`: optional. The active route's cataloged persona id in effect for the parent conversation, passed as advisory framing only — it never overrides the agent's charter Restrictions, scope, or permissions. Pass the id alone, never the persona prompt. Omit the field when no persona is routed.
185
183
  - `next_use`: what the main agent will do with the result
186
184
  - `lens`: conditional — `audit-specialist` dispatches only. One of `bugs | architecture | security | requirements | code-quality | performance`.
187
185
 
188
- The named dispatch block that workflows embed (the quoted block whose header carries the prefixed agent name and role) is the block projection of this packet: `role` and `purpose` live in the block's header line, and `next_use` defaults to "the main agent synthesizes and continues the workflow" when absent. The remaining eight fields — `trigger, scope, permissions, inputs, sensors, output, firewall, memory` — appear as the block's body lines. The optional `persona` field appears there too.
186
+ The named dispatch block that workflows embed (the quoted block whose header carries the prefixed agent name and role) is the block projection of this packet: `role` and `purpose` live in the block's header line, and `next_use` defaults to "the main agent synthesizes and continues the workflow" when absent. The remaining eight fields — `trigger, scope, permissions, inputs, sensors, output, firewall, memory` — appear as the block's body lines, except where Role Defaults below already fix a field's value.
187
+
188
+ ### Role Defaults
189
+
190
+ A dispatch block carries only what varies. Every line below is that field's value
191
+ for **every** dispatch of the named role, supplied by this file rather than
192
+ restated per workflow. A block that restates one has forked the contract, which
193
+ is the failure these defaults exist to make impossible — the same field said
194
+ twice is the same field free to disagree.
195
+
196
+ Reading a workflow's dispatch block therefore means reading this section beside
197
+ it. That is the trade: the block stops being self-contained in exchange for
198
+ having exactly one place a shared value can be wrong.
199
+
200
+ **Every role, every dispatch**
201
+
202
+ - `persona` — as defined in the Capability Packet list above. It is never written
203
+ in a dispatch block; it applies to all of them.
204
+
205
+ **`massa-ai-reviewer`**
206
+
207
+ - `fallback`: if the subagent is unavailable, run a standalone fresh-eyes review against this output contract and record the skipped-delegation reason
208
+
209
+ **`massa-ai-verification-agent`**
210
+
211
+ - `permissions`: read-only
212
+
213
+ **`massa-ai-designer`** — its dispatch is mandatory-on-condition, so its trigger is
214
+ fixed here rather than per workflow; a block that reworded it would silently make
215
+ the dispatch advisory in that one file.
216
+
217
+ - `trigger`: the task creates or modifies a user-facing screen — mandatory once that condition holds, per the Screen Implementation Exception in `references/agent-orchestration.md`; it does not fire when no screen surface is touched
218
+ - `sensors`: Figma MCP read when a design source exists; per-element expected-vs-actual comparison; the UI module's own build/lint; the states a design under-specifies — empty, loading, error, long text, small and large sizes
219
+ - `inputs`: exact `projectId`, parent `workflowSessionId`, Figma links/node ids or screenshots when supplied, acceptance criteria, the repository's existing UI conventions and design tokens, recalled screen patterns
220
+ - `firewall`: summarized design-source evidence and `path:line` pointers only, never raw Figma node dumps or full file bodies
221
+ - `memory`: suggest-only; the main agent persists durable screen and design-token conventions
222
+
223
+ A designer block therefore carries only `scope`, `permissions` and `output` — the
224
+ three fields that genuinely differ between an audit that may not write and an
225
+ implementation workflow that may.
189
226
 
190
227
  ## Prompt Contract
191
228
 
@@ -4,7 +4,7 @@ Use from audit workflows, implementation audit, bug finder, mobile Figma, and ex
4
4
 
5
5
  ## Scope Packets
6
6
 
7
- Every audit scope must produce a compact scope packet before analysis:
7
+ Every audit scope must produce a compact scope packet before analysis. Resolve the mechanical half of it with `bun skills/massa-ai/scripts/resolve_scope.ts --scope modified|range|branch|files|whole`, which emits scope type, target focus, resolution method, base, head, resolved files, applied exclusions, and a freshness timestamp as JSON. It resolves files, not judgment: the ask-when-vague rule below and the per-lens evidence selection stay with the agent, and the script refuses rather than inventing a base when none can be resolved.
8
8
 
9
9
  ```text
10
10
  Scope Type: <modified files | explicit files/globs | commit range | branch comparison | codebase area | symbol/class/function | feature/flow | PR diff>
@@ -2,7 +2,9 @@
2
2
 
3
3
  Use in every implementation workflow, before writing or editing
4
4
  source. Defines the three things every created or updated unit of code owes
5
- the next reader: an API doc block, a rationale comment, and a test.
5
+ the next reader: an API doc block, a rationale comment, and a test. The first
6
+ two are gated by a bootstrap toggle; the test is not — read Toggle Scope below
7
+ before applying any of them.
6
8
 
7
9
  ## Principle
8
10
 
@@ -12,6 +14,19 @@ what does it do, why does it exist in this shape, and how do I prove it still
12
14
  works. Doc blocks answer the first, rationale comments the second, tests the
13
15
  third. None substitutes for another.
14
16
 
17
+ ## Toggle Scope
18
+
19
+ §1 (API Doc Block) and §2 (Rationale Comment) apply only while the
20
+ `code-comments` bootstrap rule is enabled, and `code-comments` defaults to
21
+ **off** — so on a fresh install neither section is in force, and generated code
22
+ carries no API doc blocks and no rationale comments.
23
+
24
+ §3 (Tests) sits outside that gate and applies unconditionally: no toggle state
25
+ weakens, narrows, or removes the test-coverage requirement.
26
+
27
+ Read the current state with `massa-ai-config bootstrap list`; the rendered
28
+ `MASSA-AI.md` startup contract is what states it for the running session.
29
+
15
30
  ## 1. API Doc Block
16
31
 
17
32
  Every **created or updated** public class, method, exported function, and public
@@ -0,0 +1,107 @@
1
+ # Code Quality Lens
2
+
3
+ Load from `workflows/code-quality/code-quality-audit.md` (detection) and
4
+ `workflows/code-quality/code-quality-fix.md` (repair). Both workflows used to
5
+ carry their own copy of these rules, in different words, which is how one copy
6
+ drifts into saying something the other does not.
7
+
8
+ This file owns the rules themselves. Each workflow owns only what is genuinely
9
+ its own: the audit owns static leads, severity, and the report contract; the fix
10
+ owns sizing, the refactoring map, and behavior preservation.
11
+
12
+ ## The Split Criterion
13
+
14
+ One criterion governs every "should this be split out?" question in this lens,
15
+ whether the answer becomes a finding or an edit:
16
+
17
+ **Split only when the result yields an externally-findable named unit (locatable
18
+ by search or grep from outside the file) or measurably reduces change risk;
19
+ never split on size or "more than one thing" alone.**
20
+
21
+ The negative half is the load-bearing half. "This function does more than one
22
+ thing" and "this file is long" are observations, not defects: an extraction that
23
+ produces a helper only its single caller can find has moved the code without
24
+ making anything easier to locate, change, or delete. Splitting on an accurate
25
+ description needing the word "and" is the specific rule this replaces, and it is
26
+ not a rule here.
27
+
28
+ Apply the same criterion, unchanged, when the question is inverted — whether to
29
+ inline rather than split.
30
+
31
+ ## File Shape
32
+
33
+ Flag multi-subject files (unrelated exported surfaces bundled together) and any
34
+ file over ~600 lines, regardless of subject count — it crowds out working
35
+ context for the rest of the task (see `references/coding-guidelines.md` "File
36
+ shape for agent readers"). Do NOT flag a single-subject file for line count
37
+ alone below that bound.
38
+
39
+ ## SOLID
40
+
41
+ Non-test source only.
42
+
43
+ | Principle | Flag when | Fix direction |
44
+ |---|---|---|
45
+ | Single Responsibility | a class or module bundles distinct concern groups — validation plus persistence, formatting plus dispatch — and separating them meets the Split Criterion above, never on concern-count or size alone | 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 |
46
+ | Open/Closed | a caller-side switch or if/else chain on a type tag means adding a variant requires modifying existing files | replace with polymorphism or a data map only when new variants are real |
47
+ | Liskov | a subtype throws where the base does not, ignores required methods, or narrows the base contract | preserve base contracts |
48
+ | Interface Segregation | an interface forces implementors to define unused methods | narrow fat interfaces |
49
+ | Dependency Inversion | a hardcoded `new ConcreteType()` sits inside a class body where abstraction or injection would be natural | inject dependencies when hardcoded concretes block testing or substitution |
50
+
51
+ ## Clean Code
52
+
53
+ Test and non-test source.
54
+
55
+ | Smell | Flag when | Fix direction |
56
+ |---|---|---|
57
+ | Magic values | a meaningful bare literal repeats — strings, timeouts, thresholds, event names | replace with named constants |
58
+ | Function does more than one thing | the Split Criterion above is met | 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 |
59
+ | Unqualified generic names | a name carries no domain or role qualification | name domain concepts precisely using `references/naming-standards.md` |
60
+ | What-comments | a comment restates the code | remove it; keep only why comments for constraints, workarounds, or non-obvious invariants |
61
+ | Half-finished surfaces | an exported TODO, stub, placeholder return, or "implement later" path | finish or delete it |
62
+ | Long parameter lists | more than 3-4 positional parameters | convert to an options object when it improves call-site clarity |
63
+
64
+ ## KISS, YAGNI, DRY
65
+
66
+ **KISS.** Flag abstractions, layers, indirection, or control flow that raise
67
+ cognitive load without clearly improving readability, correctness, or constraint
68
+ handling. Call out premature generalization, deep call chains, excessive
69
+ configuration, and clever patterns that obscure intent. Prefer straightforward,
70
+ explicit code a new reader can follow end-to-end: inline trivial abstractions,
71
+ collapse unnecessary layers, choose boring solutions unless complexity is
72
+ justified (real variability, hard constraints, or measured bottlenecks). When
73
+ weighing whether to split instead of inline, apply the Split Criterion above
74
+ unchanged — the direction of the question does not change the criterion.
75
+
76
+ **YAGNI.** Flag speculative features, extension points, and generic
77
+ infrastructure with no concrete caller, requirement, or near-term use. Call out
78
+ "just in case" hooks, over-parameterization, unused toggles, and frameworks
79
+ introduced ahead of need. Prefer implementing only what current use cases
80
+ demand, structured to evolve when real requirements appear. Defer generalization
81
+ until duplication or constraints force it, and remove dead or unused paths
82
+ aggressively.
83
+
84
+ **DRY.** Flag duplicated logic, data transformations, or domain rules repeated
85
+ without a strong reason (e.g., performance isolation or explicit decoupling).
86
+ Highlight copy-paste patterns, parallel conditionals, and repeated constants
87
+ that raise maintenance cost or inconsistency risk. Recommend consolidation into
88
+ a single source of truth when it improves clarity and reduces bugs, but avoid
89
+ over-abstraction that harms readability or adds indirection for trivial reuse.
90
+
91
+ **AI-slop surfaces.** Generic abstractions with no domain vocabulary,
92
+ fabricated-looking type names, unnecessary factories/builders, wrappers around
93
+ one call, comments that narrate obvious code, and broad configurability not
94
+ supported by current requirements. Remove them when current usage evidence does
95
+ not justify them.
96
+
97
+ ## Standing Rules
98
+
99
+ - Prefer delete, inline, or merge over a replacement abstraction whenever simpler
100
+ code preserves behavior.
101
+ - Require usage evidence before calling a surface unnecessary. When the evidence
102
+ is incomplete, mark the item `suspect` rather than reporting it as a defect.
103
+ - **Architecture boundary.** Do not report, recommend, or introduce ports,
104
+ adapters, bounded contexts, new service/module boundaries, or VSA-style folder
105
+ migration from this lens. Those need dependency-direction, strength, distance,
106
+ volatility, module-depth, or cross-domain ownership evidence this lens does not
107
+ gather — hand them to `workflows/architecture/architecture-audit.md`.
@@ -39,7 +39,6 @@ implementation code is planned or written:
39
39
  > - output: the reuse map (below), evidence-or-zero when nothing reusable is found
40
40
  > - firewall: summarized candidates and pointers only, never raw file dumps
41
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
42
 
44
43
  Dispatch one subagent per coherent target area; dispatch more than one only
45
44
  when the areas are independent enough to scope separately.
@@ -18,8 +18,8 @@ human chose to merge it".
18
18
 
19
19
  | # | Stage | Command | On failure |
20
20
  | --- | --- | --- | --- |
21
- | 0 | Preflight | `git rev-parse --is-inside-work-tree`; `command -v gh`; `gh auth status` | Record which capabilities are absent and select the degraded path below |
22
- | 1 | Isolate | `git fetch origin <base> && git worktree add -b <type>/<slug> <path> origin/<base>` | Branch name taken → suffix `-2`. Worktree path taken → reuse it only if its branch matches |
21
+ | 0 | Preflight | `bun skills/massa-ai/scripts/ensure_worktree.ts` runs this: `git rev-parse --is-inside-work-tree`; `command -v gh`; `gh auth status` | Record which capabilities are absent and select the degraded path below |
22
+ | 1 | Isolate | `bun skills/massa-ai/scripts/ensure_worktree.ts --branch <type>/<slug> [--base <base>] [--path <path>]`, which runs `git fetch origin <base> && git worktree add -b <type>/<slug> <path> origin/<base>` | Branch name taken → suffix `-2`. Worktree path taken → reuse it only if its branch matches. The script applies both rules and prints the resulting path + branch |
23
23
  | 1.5 | Summarize | present the pre-implementation change summary (see Stage 1.5) | Summary skipped → stop and present it before the first mutation; a mutation made without it is a protocol violation to report, not to hide |
24
24
  | 2 | Implement | one task → gate → `git commit` | Gate red → fix before committing. Never commit through a failing gate |
25
25
  | 3 | Push | `git push -u origin <type>/<slug>` | Rejected non-fast-forward → `git fetch` + rebase, never force-push a shared branch |
@@ -45,7 +45,10 @@ The only two legal skip reasons:
45
45
  2. The user explicitly declined isolation for this task.
46
46
 
47
47
  Record the skip reason verbatim in the completion report. Any other reason is a
48
- protocol violation, not a shortcut.
48
+ protocol violation, not a shortcut. `ensure_worktree.ts` emits exactly these two
49
+ strings and no third: it detects reason 1 from the tree, and takes reason 2 only
50
+ from an explicit `--skip-declined`, because a script cannot observe a user
51
+ declining anything.
49
52
 
50
53
  **Record the isolation evidence immediately after creation:** the worktree path
51
54
  and branch name go into the session status the moment Stage 1 completes, and
@@ -30,13 +30,18 @@ Code vocabulary is evidence, not truth. When business intent is inferred only fr
30
30
 
31
31
  ## Language
32
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.
33
+ This section is normative for **identifier** naming only, per AD-019's
34
+ one-normative-reference discipline. New or renamed identifiers, classes,
35
+ methods, screens, components, attributes, and implementation-facing artifact
36
+ names use English words. Convert any non-English source term to English before
37
+ implementing Portuguese is the primary case, but the rule covers any
38
+ non-English source language. Preserve existing public contracts, persisted
39
+ fields, and external names unless compatibility handling is explicitly in
40
+ scope, per the public-contract clause above.
41
+
42
+ Everything past an identifier is owned by the `english-code` bootstrap rule in
43
+ the rendered `MASSA-AI.md` startup contract. Consult that rule there rather
44
+ than this section; the wider contract is deliberately not restated here.
40
45
 
41
46
  ## Workflow Use
42
47