@massa-ai/cursor-plugin 1.6.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 (172) hide show
  1. package/.cursor-plugin/plugin.json +5 -0
  2. package/README.md +87 -0
  3. package/agents/massa-ai-architecture-specialist.md +65 -0
  4. package/agents/massa-ai-audit-specialist.md +81 -0
  5. package/agents/massa-ai-builder.md +67 -0
  6. package/agents/massa-ai-context-curator.md +67 -0
  7. package/agents/massa-ai-documentation-agent.md +65 -0
  8. package/agents/massa-ai-furps-analyst.md +71 -0
  9. package/agents/massa-ai-investigator.md +68 -0
  10. package/agents/massa-ai-mobile-specialist.md +82 -0
  11. package/agents/massa-ai-navigator.md +75 -0
  12. package/agents/massa-ai-plan-critic.md +90 -0
  13. package/agents/massa-ai-planner.md +65 -0
  14. package/agents/massa-ai-requirements-analyst.md +64 -0
  15. package/agents/massa-ai-reviewer.md +66 -0
  16. package/agents/massa-ai-test-engineer.md +66 -0
  17. package/agents/massa-ai-verification-agent.md +65 -0
  18. package/hooks/hooks.json +26 -0
  19. package/hooks/massa-ai-hook +298 -0
  20. package/install.sh +413 -0
  21. package/package.json +30 -0
  22. package/skills/agents/architecture-specialist/SKILL.md +69 -0
  23. package/skills/agents/audit-specialist/SKILL.md +85 -0
  24. package/skills/agents/builder/SKILL.md +71 -0
  25. package/skills/agents/context-curator/SKILL.md +71 -0
  26. package/skills/agents/documentation-agent/SKILL.md +69 -0
  27. package/skills/agents/furps-analyst/SKILL.md +74 -0
  28. package/skills/agents/investigator/SKILL.md +72 -0
  29. package/skills/agents/mobile-specialist/SKILL.md +86 -0
  30. package/skills/agents/navigator/SKILL.md +79 -0
  31. package/skills/agents/plan-critic/SKILL.md +93 -0
  32. package/skills/agents/planner/SKILL.md +69 -0
  33. package/skills/agents/requirements-analyst/SKILL.md +68 -0
  34. package/skills/agents/reviewer/SKILL.md +70 -0
  35. package/skills/agents/test-engineer/SKILL.md +70 -0
  36. package/skills/agents/verification-agent/SKILL.md +69 -0
  37. package/skills/def/SKILL.md +17 -0
  38. package/skills/find/SKILL.md +19 -0
  39. package/skills/graph/SKILL.md +16 -0
  40. package/skills/index/SKILL.md +19 -0
  41. package/skills/map/SKILL.md +24 -0
  42. package/skills/massa-ai/SKILL.md +315 -0
  43. package/skills/massa-ai/personas/README.md +35 -0
  44. package/skills/massa-ai/personas/ai-native-nodejs-cli-architect.md +76 -0
  45. package/skills/massa-ai/personas/catalog.json +157 -0
  46. package/skills/massa-ai/personas/context-skill-harness-engineer-architect.md +74 -0
  47. package/skills/massa-ai/personas/product-manager.md +67 -0
  48. package/skills/massa-ai/personas/senior-mobile-engineer.md +74 -0
  49. package/skills/massa-ai/personas/senior-mobile-qa-automation-engineer.md +75 -0
  50. package/skills/massa-ai/references/adr-authoring.md +189 -0
  51. package/skills/massa-ai/references/agent-orchestration.md +221 -0
  52. package/skills/massa-ai/references/architecture-coupling-lens.md +239 -0
  53. package/skills/massa-ai/references/architecture-deepening-lens.md +136 -0
  54. package/skills/massa-ai/references/architecture-domain-lens.md +186 -0
  55. package/skills/massa-ai/references/architecture-lenses.md +108 -0
  56. package/skills/massa-ai/references/audit-report-io.md +459 -0
  57. package/skills/massa-ai/references/audit-scope.md +103 -0
  58. package/skills/massa-ai/references/code-annotation.md +111 -0
  59. package/skills/massa-ai/references/codebase-investigation.md +96 -0
  60. package/skills/massa-ai/references/context-firewall.md +62 -0
  61. package/skills/massa-ai/references/conversation-feedback.md +104 -0
  62. package/skills/massa-ai/references/debug-diagnosis-loop.md +140 -0
  63. package/skills/massa-ai/references/decision-engine.md +73 -0
  64. package/skills/massa-ai/references/evidence-gate.md +53 -0
  65. package/skills/massa-ai/references/furps/analyst-role.md +49 -0
  66. package/skills/massa-ai/references/furps/checklist.md +92 -0
  67. package/skills/massa-ai/references/furps/intake.md +104 -0
  68. package/skills/massa-ai/references/furps/report-contract.md +140 -0
  69. package/skills/massa-ai/references/hook-enforcement.md +137 -0
  70. package/skills/massa-ai/references/implementation-delivery.md +101 -0
  71. package/skills/massa-ai/references/installation.md +110 -0
  72. package/skills/massa-ai/references/lessons.md +119 -0
  73. package/skills/massa-ai/references/maestro/artifacts-reports.md +69 -0
  74. package/skills/massa-ai/references/maestro/cli-device.md +65 -0
  75. package/skills/massa-ai/references/maestro/cloud.md +67 -0
  76. package/skills/massa-ai/references/maestro/config-env-output.md +76 -0
  77. package/skills/massa-ai/references/maestro/fact-ledger.md +71 -0
  78. package/skills/massa-ai/references/maestro/js-scripting.md +70 -0
  79. package/skills/massa-ai/references/maestro/mcp.md +59 -0
  80. package/skills/massa-ai/references/maestro/patterns.md +96 -0
  81. package/skills/massa-ai/references/maestro/selectors.md +91 -0
  82. package/skills/massa-ai/references/maestro/workspace-execution.md +81 -0
  83. package/skills/massa-ai/references/maestro/yaml-commands.md +203 -0
  84. package/skills/massa-ai/references/maestro.md +47 -0
  85. package/skills/massa-ai/references/mcp-tools.md +296 -0
  86. package/skills/massa-ai/references/memory-policy.md +103 -0
  87. package/skills/massa-ai/references/mobile-context.md +113 -0
  88. package/skills/massa-ai/references/mobile-diagnosis.md +106 -0
  89. package/skills/massa-ai/references/mobile-figma-matcher/ATTRIBUTION.md +5 -0
  90. package/skills/massa-ai/references/mobile-figma-matcher/android-compose.md +13 -0
  91. package/skills/massa-ai/references/mobile-figma-matcher/android-views.md +13 -0
  92. package/skills/massa-ai/references/mobile-figma-matcher/core.md +117 -0
  93. package/skills/massa-ai/references/mobile-figma-matcher/ios-swiftui.md +12 -0
  94. package/skills/massa-ai/references/mobile-figma-matcher/ios-uikit.md +12 -0
  95. package/skills/massa-ai/references/mobile-figma-matcher/kmp-compose-multiplatform.md +14 -0
  96. package/skills/massa-ai/references/mobile-figma-matcher/repository-detection.md +77 -0
  97. package/skills/massa-ai/references/naming-standards.md +47 -0
  98. package/skills/massa-ai/references/pr-task-fix.md +80 -0
  99. package/skills/massa-ai/references/project-context.md +76 -0
  100. package/skills/massa-ai/references/rfc/ATTRIBUTION.md +5 -0
  101. package/skills/massa-ai/references/rfc/discovery-and-sizing.md +120 -0
  102. package/skills/massa-ai/references/rfc/document-contract.md +85 -0
  103. package/skills/massa-ai/references/rfc/quality-and-lifecycle.md +101 -0
  104. package/skills/massa-ai/references/root-cause-scripts.md +97 -0
  105. package/skills/massa-ai/references/spec-driven/artifact-store.md +98 -0
  106. package/skills/massa-ai/references/spec-driven/code-analysis.md +119 -0
  107. package/skills/massa-ai/references/spec-driven/coding-principles.md +80 -0
  108. package/skills/massa-ai/references/spec-driven/context-limits.md +64 -0
  109. package/skills/massa-ai/references/spec-driven/design.md +257 -0
  110. package/skills/massa-ai/references/spec-driven/discuss.md +182 -0
  111. package/skills/massa-ai/references/spec-driven/execute.md +471 -0
  112. package/skills/massa-ai/references/spec-driven/lessons.md +5 -0
  113. package/skills/massa-ai/references/spec-driven/memory.md +214 -0
  114. package/skills/massa-ai/references/spec-driven/specify.md +283 -0
  115. package/skills/massa-ai/references/spec-driven/sub-agents.md +151 -0
  116. package/skills/massa-ai/references/spec-driven/tasks.md +494 -0
  117. package/skills/massa-ai/references/spec-driven/validate.md +397 -0
  118. package/skills/massa-ai/references/subagent-design.md +132 -0
  119. package/skills/massa-ai/references/synapse-policy.md +160 -0
  120. package/skills/massa-ai/references/tdd/calibrated-examples.md +54 -0
  121. package/skills/massa-ai/references/tdd/discovery-and-sizing.md +83 -0
  122. package/skills/massa-ai/references/tdd/document-contract.md +136 -0
  123. package/skills/massa-ai/references/tdd/quality-and-lifecycle.md +83 -0
  124. package/skills/massa-ai/references/the-fool/cognitive-bias-inventory.md +103 -0
  125. package/skills/massa-ai/references/the-fool/dialectic-synthesis.md +170 -0
  126. package/skills/massa-ai/references/the-fool/evidence-audit.md +202 -0
  127. package/skills/massa-ai/references/the-fool/mode-selection-guide.md +113 -0
  128. package/skills/massa-ai/references/the-fool/pre-mortem-analysis.md +200 -0
  129. package/skills/massa-ai/references/the-fool/red-team-adversarial.md +206 -0
  130. package/skills/massa-ai/references/the-fool/socratic-questioning.md +153 -0
  131. package/skills/massa-ai/references/ticket/atlassian-fix.md +130 -0
  132. package/skills/massa-ai/references/ticket/intake-and-sources.md +65 -0
  133. package/skills/massa-ai/references/ticket/templates-and-quality.md +129 -0
  134. package/skills/massa-ai/references/verification-ladder.md +62 -0
  135. package/skills/massa-ai/scripts/lessons.py +590 -0
  136. package/skills/massa-ai/workflows/adr.md +33 -0
  137. package/skills/massa-ai/workflows/architecture/architecture-audit.md +125 -0
  138. package/skills/massa-ai/workflows/architecture/architecture-fix.md +110 -0
  139. package/skills/massa-ai/workflows/bugs/bugs-audit.md +113 -0
  140. package/skills/massa-ai/workflows/bugs/bugs-fix.md +97 -0
  141. package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +154 -0
  142. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +99 -0
  143. package/skills/massa-ai/workflows/commit.md +61 -0
  144. package/skills/massa-ai/workflows/debug.md +86 -0
  145. package/skills/massa-ai/workflows/design.md +54 -0
  146. package/skills/massa-ai/workflows/exploration.md +119 -0
  147. package/skills/massa-ai/workflows/feature.md +52 -0
  148. package/skills/massa-ai/workflows/general.md +46 -0
  149. package/skills/massa-ai/workflows/implementation/implementation-audit.md +87 -0
  150. package/skills/massa-ai/workflows/implementation/implementation-fix.md +90 -0
  151. package/skills/massa-ai/workflows/long-session.md +44 -0
  152. package/skills/massa-ai/workflows/maestro/maestro-audit.md +56 -0
  153. package/skills/massa-ai/workflows/maestro/maestro-fix.md +74 -0
  154. package/skills/massa-ai/workflows/maestro/maestro.md +68 -0
  155. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +68 -0
  156. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +74 -0
  157. package/skills/massa-ai/workflows/onboarding.md +23 -0
  158. package/skills/massa-ai/workflows/refactor.md +47 -0
  159. package/skills/massa-ai/workflows/refinement/furps-refinement.md +81 -0
  160. package/skills/massa-ai/workflows/requirements/requirements-audit.md +114 -0
  161. package/skills/massa-ai/workflows/requirements/requirements-fix.md +93 -0
  162. package/skills/massa-ai/workflows/rfc.md +55 -0
  163. package/skills/massa-ai/workflows/security/security-audit.md +113 -0
  164. package/skills/massa-ai/workflows/security/security-fix.md +97 -0
  165. package/skills/massa-ai/workflows/spec-driven.md +217 -0
  166. package/skills/massa-ai/workflows/tdd.md +71 -0
  167. package/skills/massa-ai/workflows/tests/tests-audit.md +114 -0
  168. package/skills/massa-ai/workflows/tests/tests-fix.md +96 -0
  169. package/skills/massa-ai/workflows/the-fool.md +82 -0
  170. package/skills/massa-ai/workflows/ticket.md +42 -0
  171. package/skills/persona-router/SKILL.md +158 -0
  172. package/skills/status/SKILL.md +15 -0
@@ -0,0 +1,85 @@
1
+ # RFC Document Contract
2
+
3
+ Load this reference when drafting or revising an RFC. Preserve the full decision structure while tailoring detail to the RFC type and impact.
4
+
5
+ ## Section Contract
6
+
7
+ Every RFC contains **7 mandatory sections** and should contain the **4 recommended sections** when relevant.
8
+
9
+ ### Mandatory Sections
10
+
11
+ 1. **Header And Metadata**
12
+ - Title, `HIGH / MEDIUM / LOW` impact and justification, `NOT STARTED / IN PROGRESS / COMPLETE` status, Created, Last Updated, Due Date, and related resources.
13
+ - Full RACI: Driver, Approver or Approvers, Contributors, and Informed parties. Keep unknown required values as `TBD` rather than deleting fields.
14
+ 2. **Background**
15
+ - Current state, specific problem or opportunity, why now, evidence, and cost or consequence of inaction.
16
+ 3. **Assumptions**
17
+ - Table with assumption, owner, `High / Medium / Low` confidence, and invalidation trigger. Include at least one explicit assumption.
18
+ 4. **Decision Criteria**
19
+ - Define criteria before options. Separate non-negotiable must-haves from scored criteria.
20
+ - Use numeric `Weight (%)` values that sum to 100 across scored criteria. Explain scoring scale and disqualification rules.
21
+ 5. **Options Considered**
22
+ - At least two credible options. Explicitly evaluate the status quo and include it as "Do Nothing" unless it is impossible; explain any omission.
23
+ - For every option include description, how it works, honest pros and cons, dependencies, reversibility, `Estimated Cost`, effort, financial cost when applicable, and `HIGH / MEDIUM / LOW` risk.
24
+ - Generated estimates are required when exact estimates are unavailable. Label them as rough estimates, state assumptions, and use ranges where appropriate.
25
+ 6. **Action Items**
26
+ - Concrete post-decision actions with owner, due date, and status. Include review, communication, proof-of-concept, downstream TDD, or policy rollout actions when applicable.
27
+ 7. **Outcome**
28
+ - Keep a visible placeholder while the decision is open. After explicit human decision, record chosen/rejected/deferred outcome, date, decision-makers, rationale, key factors, conditions, and follow-up.
29
+
30
+ ### Recommended Sections
31
+
32
+ 8. **Relevant Data**: quantitative evidence, qualitative feedback, prior attempts, external research, and links.
33
+ 9. **Pros And Cons**: may live within each option, but each option must receive an honest assessment.
34
+ 10. **Estimated Cost**: summarize effort, money, operational load, migration cost, and opportunity cost across options.
35
+ 11. **Resources**: related Jira/Linear issues, Confluence pages, RFCs, ADRs, TDDs, dashboards, research, standards, and vendor documentation.
36
+
37
+ ## Option Comparison
38
+
39
+ After describing options, include a comparison matrix evaluating each option against the predeclared criteria. Use the numeric weights consistently and show enough scoring rationale that stakeholders can challenge the result. The recommendation must identify:
40
+
41
+ - which must-haves each option satisfies or fails
42
+ - weighted result or qualitative interpretation of the weighted criteria
43
+ - decisive trade-offs and sacrifices
44
+ - why the recommendation wins despite its disadvantages
45
+ - what evidence would change the recommendation
46
+
47
+ Do not manipulate criteria or weights after seeing which option wins without documenting the change and rerunning every option comparison.
48
+
49
+ ## Conditional Concerns
50
+
51
+ Add explicit subsections when the RFC type or impact triggers them:
52
+
53
+ | Trigger | Required concerns |
54
+ |---|---|
55
+ | Technical/architecture change | system impact, dependencies, compatibility, migration, security, observability, rollback or forward recovery |
56
+ | Process/workflow change | affected roles, training, adoption, pilot, enforcement, exceptions, feedback loop, process rollback |
57
+ | Product/feature change | user segments, value hypothesis, metrics, experiment or rollout, go/no-go criteria, support impact |
58
+ | Vendor/tool selection | evaluation method, pricing assumptions, contract terms, lock-in, data portability, support, exit plan |
59
+ | Policy/compliance change | authority, applicable obligations, enforcement, exceptions, audit evidence, review cadence |
60
+ | HIGH impact | broader stakeholder review, explicit risks, stronger evidence, implementation dependencies, decision deadline |
61
+
62
+ ## Required Metadata Shape
63
+
64
+ Use project conventions when present; otherwise start with this Markdown table:
65
+
66
+ ```markdown
67
+ # RFC: [Clear, Action-Oriented Title]
68
+
69
+ | Field | Value |
70
+ |---|---|
71
+ | **Impact** | HIGH / MEDIUM / LOW - [justification] |
72
+ | **Status** | NOT STARTED / IN PROGRESS / COMPLETE |
73
+ | **Driver** | @Name |
74
+ | **Approver(s)** | @Name1, @Name2 |
75
+ | **Contributors** | @Name3, @Name4 |
76
+ | **Informed** | @Team, @Stakeholder |
77
+ | **Due Date** | YYYY-MM-DD or TBD |
78
+ | **Resources** | Jira/Linear, Confluence, related RFC/ADR/TDD |
79
+ | **Created** | YYYY-MM-DD |
80
+ | **Last Updated** | YYYY-MM-DD |
81
+ ```
82
+
83
+ ## Detail Boundaries
84
+
85
+ An RFC decides whether and which direction to pursue. Include enough mechanism to compare feasibility, risk, compatibility, cost, and reversibility, but route settled implementation contracts and task sequencing to a TDD. Keep option descriptions concise and comparable rather than turning one preferred option into a complete design while leaving alternatives shallow.
@@ -0,0 +1,101 @@
1
+ # RFC Quality And Lifecycle
2
+
3
+ Load this reference before challenging, finalizing, saving, updating, or closing an RFC.
4
+
5
+ ## Quality Gate
6
+
7
+ Verify every item before finalization:
8
+
9
+ - Title is clear, action-oriented, and specific.
10
+ - Impact is `HIGH`, `MEDIUM`, or `LOW` with justification.
11
+ - Background states current state, problem or opportunity, why now, evidence, and cost of inaction.
12
+ - Full RACI identifies Driver, Approver or Approvers, Contributors, and Informed parties, using `TBD` only when the user cannot resolve a role.
13
+ - Assumptions include owner, confidence, and invalidation trigger.
14
+ - Decision criteria were defined before options, include must-haves, and use numeric weights summing to 100.
15
+ - At least two credible options are evaluated, with explicit status quo consideration.
16
+ - Every option has honest pros, cons, dependencies, reversibility, generated or supplied estimates, financial cost where applicable, and risk.
17
+ - Comparison uses the declared criteria rather than isolated sales arguments.
18
+ - Recommendation traces directly to criteria, evidence, and trade-offs.
19
+ - Action items identify concrete post-decision work.
20
+ - Outcome remains a placeholder until an explicit human decision exists.
21
+ - Technical, process, product, vendor, or policy concerns are included according to the classified RFC type.
22
+
23
+ If a blocking item fails, use `AskQuestion`, research the missing evidence, or keep the required field visibly unresolved. Do not silently weaken the document contract.
24
+
25
+ ## Anti-Patterns
26
+
27
+ ### Predetermined Conclusion Disguised As RFC
28
+
29
+ Reject a proposal where the preferred option receives detailed benefits while alternatives are caricatures. Steelman every credible option, include disconfirming evidence, and state what would change the recommendation.
30
+
31
+ ### Criteria Chosen After Options
32
+
33
+ Define and weight criteria first. If stakeholder feedback changes criteria or weights, record the revision and reevaluate every option.
34
+
35
+ ### Status Quo Treated As Free
36
+
37
+ Compare the cost, risk, and opportunity loss of inaction. "Do Nothing" may have low immediate effort and high long-term cost.
38
+
39
+ ### Hidden Assumptions Or False Precision
40
+
41
+ Expose assumptions with invalidation triggers. Generated estimates must be labeled, use ranges where useful, and state the capacity, pricing, volume, or complexity assumptions behind them.
42
+
43
+ ### Implementation Document Masquerading As RFC
44
+
45
+ Keep focus on whether and which direction should be selected. Route detailed implementation architecture and delivery planning to TDD after decision.
46
+
47
+ ## Plan Challenge Gate
48
+
49
+ Run the full configured Plan Challenge Gate after the draft exists. Challenge at least:
50
+
51
+ - strongest counterargument to the recommendation
52
+ - evidence quality and interested-party or vendor bias
53
+ - status quo, sunk cost, authority, confirmation, and planning biases
54
+ - criteria or weights that favor a predetermined answer
55
+ - weak generated estimates or missing cost categories
56
+ - assumption most likely to invalidate the recommendation
57
+ - reversibility, migration, adoption, security, compliance, and operational failure where relevant
58
+
59
+ Revise valid critical or high findings without deleting required RFC sections or stakeholder fields.
60
+
61
+ ## Lifecycle
62
+
63
+ Use the preserved states honestly:
64
+
65
+ - `NOT STARTED`: initial proposal shell or discovery has not produced a reviewable draft.
66
+ - `IN PROGRESS`: reviewable proposal exists, feedback is open, or required decision input remains unresolved.
67
+ - `COMPLETE`: an explicit human decision is recorded in Outcome as accepted, rejected, or deferred.
68
+
69
+ When updating an existing RFC:
70
+
71
+ 1. Read the current RFC and linked decisions.
72
+ 2. Identify new evidence, feedback, assumptions, criteria, weights, options, or cost changes.
73
+ 3. Preserve still-valid context and rejected-option rationale.
74
+ 4. Update Last Updated and status honestly.
75
+ 5. Record material changes so reviewers can identify what moved.
76
+ 6. Never overwrite an existing RFC unless the user explicitly requested an update or confirmed replacement.
77
+
78
+ ## Completion And Suggested Next Steps
79
+
80
+ After generating or updating the RFC, report title, impact, status, included sections, options compared, unresolved fields, and artifact path. Preserve these suggestions when relevant:
81
+
82
+ - Share with Contributors for feedback and Approvers for decision.
83
+ - Set or confirm a decision deadline and review meeting.
84
+ - Link or create related Jira or Linear work items.
85
+ - Create a follow-up TDD after the direction is approved.
86
+ - Publish or update the proposal in Confluence when the user wants shared publication.
87
+ - Update status to `IN PROGRESS` when review begins and `COMPLETE` only after the decision is recorded.
88
+
89
+ Do not claim a Jira/Linear link, Confluence publication, meeting, approval, or decision occurred unless the corresponding action or authoritative evidence exists.
90
+
91
+ ## Deterministic Checks
92
+
93
+ Before completion:
94
+
95
+ 1. Check Markdown structure, metadata, and local links.
96
+ 2. Confirm all 7 mandatory sections and relevant recommended sections exist.
97
+ 3. Confirm numeric criterion weights sum to 100 and each option appears in the comparison.
98
+ 4. Confirm the Outcome placeholder remains unresolved for open proposals.
99
+ 5. Run repository-specific documentation checks when available.
100
+ 6. Persist only the memory tier appropriate to current lifecycle state.
101
+ 7. Complete the shared Evidence Gate.
@@ -0,0 +1,97 @@
1
+ # Root-Cause Proof Scripts
2
+
3
+ Use this reference the moment an implementation or fix stops converging. It is a
4
+ circuit breaker, not a diagnosis method: it fires mid-implementation in any
5
+ workflow — `feature`, `debug`, `refactor`, `spec-driven`, any `*-fix` — including
6
+ the ones that never opened a reproduction loop.
7
+
8
+ `references/debug-diagnosis-loop.md` is where a `debug` investigation *starts*.
9
+ This file is where any implementation *stops guessing*.
10
+
11
+ ## Principle
12
+
13
+ An agent that has failed twice on the same symptom does not have a code-reading
14
+ problem. It has a data problem. Reading the same source a third time produces a
15
+ third theory with the same evidence base as the first two. The only way out is
16
+ to make the program tell you what it is actually doing.
17
+
18
+ ## Trigger
19
+
20
+ The circuit breaks when **any** of these holds:
21
+
22
+ 1. **Two consecutive failed fix attempts** against the same symptom. Attempt
23
+ three does not begin until a probe has run.
24
+ 2. A hypothesis already ruled out is being re-tested without new evidence.
25
+ 3. Three or more edits have been made to the same file without the symptom
26
+ changing.
27
+ 4. The explanation for the failure has changed twice while the observed failure
28
+ has not changed at all.
29
+
30
+ Two is the threshold, not three. The second failure is where the cost of a probe
31
+ first drops below the cost of another guess.
32
+
33
+ ## Forbidden Next Actions
34
+
35
+ Once the circuit breaks, these do **not** count as progress and must not be the
36
+ next action:
37
+
38
+ - Reading more source files, or re-reading a file already read this session.
39
+ - Reasoning about what the code "should" do.
40
+ - Another speculative edit "to see if it helps".
41
+ - Adding a defensive guard, try/catch, or null check that hides the symptom.
42
+ - Asking the user what is wrong before producing any observation.
43
+ - Rerunning the identical failing command with no added instrumentation.
44
+
45
+ ## Required Next Action — Build The Probe
46
+
47
+ Write and run an executable artifact that emits **real runtime data** from the
48
+ failing path. Acceptable forms, cheapest first:
49
+
50
+ | Form | Use when |
51
+ | --- | --- |
52
+ | A failing test at the suspected seam | The seam is reachable from the existing test harness |
53
+ | A standalone script (`bun`/`node`/`python`/shell) | The path needs setup the test harness does not provide |
54
+ | Instrumented run with structured logging at the divergence point | The failure only reproduces in the full system |
55
+ | A one-shot query against the real data store | The hypothesis is about persisted state, not control flow |
56
+ | Recorded request/response or device trace | The boundary is a network or platform call |
57
+
58
+ ### Probe contract
59
+
60
+ A probe is valid only if all of these hold:
61
+
62
+ 1. **Deterministic** — same input, same output, runnable twice with the same result.
63
+ 2. **Observational** — prints the *observed* value beside the *expected* value.
64
+ "It printed something" is not an observation; the comparison is.
65
+ 3. **Signalling** — exits non-zero (or fails) while the bug is present.
66
+ 4. **Narrow** — probes exactly one hypothesis. A probe that answers three
67
+ questions answers none of them cleanly.
68
+ 5. **Non-destructive** — never mutates production data or shared state. Scratch
69
+ paths, temp databases, and fixtures only.
70
+ 6. **Disposable or promoted** — either delete it when the bug is closed, or
71
+ promote it into a real regression test under
72
+ `references/code-annotation.md`. Do not leave orphan scripts in the tree.
73
+
74
+ Record the probe's output as evidence. The output — not the reasoning about it —
75
+ is what closes the hypothesis.
76
+
77
+ ## After The Probe
78
+
79
+ | Probe result | Next action |
80
+ | --- | --- |
81
+ | Confirms the hypothesis | Fix the divergence point the probe located, then rerun the probe to prove the fix |
82
+ | Refutes the hypothesis | Record it as ruled out with the observed data, and probe the next-ranked hypothesis |
83
+ | Inconclusive | Narrow the probe. An inconclusive probe was too broad, not the wrong idea |
84
+ | Cannot be built | Stop. Report `Blocked`, name the specific obstacle (no test seam, no access, no reproduction), and ask for direction. Do not resume guessing |
85
+
86
+ ## Escalation
87
+
88
+ If two probes both come back inconclusive, the problem is scoped wrong, not
89
+ understood wrong. Stop, report what the probes did observe, and re-scope with the
90
+ user before writing a third.
91
+
92
+ ## Delegation Note
93
+
94
+ A subagent dispatched to implement or fix inherits this contract. Its capability
95
+ packet states the trigger and the probe requirement, and its report must include
96
+ either "no circling" or the probe output that broke the loop. A subagent that
97
+ returns a third theory with no runtime data has not completed its task.
@@ -0,0 +1,98 @@
1
+ # Spec-Driven Artifact Store
2
+
3
+ Use this reference before any spec-driven workflow reads or writes feature registry, progress, handoff, phase artifacts, validation reports, or lessons. `.specs/` files are the canonical state layer for spec-driven logical artifacts.
4
+
5
+ ## Source Of Truth
6
+
7
+ - Canonical state lives in `.specs/` files tracked in the repository, not massa-ai records, semantic memories, or root aliases.
8
+ - Current repository source remains authoritative for implementation/code evidence.
9
+ - `search`, `recall`, and durable memories may discover context, decisions, or reusable patterns, but must never reconstruct canonical artifact state.
10
+ - If `.specs/` is unavailable or not writable, block spec-driven state mutation and record the blocker.
11
+
12
+ ## STATE Precedence Chain
13
+
14
+ Artifact reads resolve conflicts in this strict order (first match wins): fresh user instruction > approved `.specs/` artifact > STATE/HANDOFF > massa-ai memory. massa-ai memory and external summaries are discovery, not authority. Canonical ownership and full section rules live in `references/spec-driven/memory.md`; this store mirrors the chain so reads and writes stay consistent.
15
+
16
+ ## Logical Paths
17
+
18
+ Use these logical paths:
19
+
20
+ - `.specs/project/FEATURES.json` — feature registry, `active_feature`, status, dependencies
21
+ - `.specs/project/STATE.md` — current objective, progress, blockers, decisions, next step
22
+ - `.specs/HANDOFF.md` — session handoff state
23
+ - `.specs/features/<slug>/spec.md` — feature specification
24
+ - `.specs/features/<slug>/context.md` — feature context
25
+ - `.specs/features/<slug>/design.md` — feature design
26
+ - `.specs/features/<slug>/tasks.md` — feature tasks
27
+ - `.specs/features/<slug>/validation.md` — feature validation report
28
+ - `.specs/quick/NNN-slug/TASK.md` — quick-mode task (one-line intent + acceptance)
29
+ - `.specs/quick/NNN-slug/SUMMARY.md` — quick-mode result (files changed + gate evidence)
30
+ - `.specs/lessons.json` — machine-owned lesson state (managed by `lessons.py`)
31
+ - `.specs/LESSONS.md` — rendered lesson playbook (read-only, generated by `lessons.py`)
32
+
33
+ ## Quick Artifacts
34
+
35
+ Quick-mode tasks (Quick mode guardrails in `workflows/spec-driven.md`) live under `.specs/quick/NNN-slug/`. `NNN` is zero-padded and sequential per project; `slug` is the short kebab-case intent. Each quick task has exactly two files:
36
+
37
+ **`.specs/quick/NNN-slug/TASK.md`:**
38
+
39
+ ```markdown
40
+ # Quick NNN: <one-line intent>
41
+
42
+ ## Acceptance
43
+ - <single testable criterion — the gate the Execute step must pass>
44
+ ```
45
+
46
+ **`.specs/quick/NNN-slug/SUMMARY.md`:**
47
+
48
+ ```markdown
49
+ # Quick NNN: <one-line intent>
50
+
51
+ ## Result
52
+ - Status: Complete | Blocked | Partial
53
+ - Files changed: <list or "none">
54
+ - Gate: <command + pass/fail evidence>
55
+ - SPEC_DEVIATION: <none | what diverged and why>
56
+ ```
57
+
58
+ Quick tasks are also listed in the STATE.md Quick Tasks table (see `references/spec-driven/memory.md`). When 5+ quick tasks accumulate in one area, promote to a feature: move the work under `.specs/features/<slug>/` and record the promotion in STATE. Quick artifacts are canonical `.specs/` state — same precedence chain, same section-scoped write rules; they are not a second store.
59
+
60
+ ## Reading Artifacts
61
+
62
+ Load only what you need. Prefer metadata-only inspection before loading full content.
63
+
64
+ - **Feature registry status:** `cat .specs/project/FEATURES.json | python3 -c "import json,sys; d=json.load(sys.stdin); print('active:', d.get('active_feature')); [print(f['id'], f['status']) for f in d.get('features',[])]"`
65
+ - **Full feature registry:** `cat .specs/project/FEATURES.json`
66
+ - **Project state:** `cat .specs/project/STATE.md`
67
+ - **Handoff:** `cat .specs/HANDOFF.md`
68
+ - **Feature spec:** `cat .specs/features/<slug>/spec.md`
69
+ - **Confirmed lessons:** `python3 skills/massa-ai/scripts/lessons.py --root . list --status confirmed [--scope <relevant>]`
70
+
71
+ ## Writing Artifacts
72
+
73
+ Write artifacts directly to `.specs/` files. Use a here-doc or `printf` for Markdown, or `python3 -c` for JSON mutations.
74
+
75
+ - **Update state:** `printf '...' > .specs/project/STATE.md`
76
+ - **Update handoff:** `printf '...' > .specs/HANDOFF.md`
77
+ - **Write feature artifact:** `printf '...' > .specs/features/<slug>/design.md`
78
+ - **Update feature registry:** use `python3 -c` to read-modify-write `FEATURES.json`
79
+
80
+ Feature activate/complete flows update `.specs/project/FEATURES.json`, `.specs/project/STATE.md`, and `.specs/HANDOFF.md` through file writes.
81
+
82
+ ## Versioning
83
+
84
+ - Feature artifacts under `.specs/features/<slug>/` are versioned by design (one file per slug).
85
+ - `.specs/project/FEATURES.json` and `.specs/project/STATE.md` are append-only versioned by their git history.
86
+ - `lessons.json` versioning is managed automatically by `lessons.py`.
87
+ - When content must be superseded (e.g., a decision), update the existing file and rely on git history for the prior version.
88
+
89
+ ## Debug Exports
90
+
91
+ Exports under `.specs-exports/` are optional, untracked review aids. Use `cp -r .specs/ .specs-exports/` for human inspection. Exports are never runtime fallback, never canonical input, and never completion evidence.
92
+
93
+ ## Failure Handling
94
+
95
+ - `.specs/` directory missing or not writable: block spec-driven state mutation; do not fall back to memory or chat.
96
+ - Required artifact missing: create it on first write or block unless it is an approved initial creation.
97
+ - `lessons.py` unavailable: skip lessons loading/recording, record skipped reason in validation report.
98
+ .specs/ files
@@ -0,0 +1,119 @@
1
+ # Spec-Driven Code Analysis
2
+
3
+ Use this reference when Specify, Design, Tasks, Execute, or Validate needs source inspection or structural code search.
4
+
5
+ <!-- validator anchors: current repository source and approved .specs/ artifacts override stale memory -->
6
+
7
+ ## Tool Priority
8
+
9
+ Use graceful degradation, starting from massa-ai indexed tooling and falling back to structural, then text, search:
10
+
11
+ 1. `list_projects` (or equivalent index metadata) before indexed reads, to verify project ID, path, status, and freshness.
12
+ 2. `search` (or indexed symbol reads) when available and fresh for the current repository path and worktree state. Prefer `search_definitions`, `get_references`, or `optimized_context` for symbol- and reference-shaped queries.
13
+ 3. `sg` / ast-grep for structural pattern-based search when installed.
14
+ 4. `rg` (ripgrep) for fast context-aware text and file search.
15
+ 5. `grep` or direct file reads as the final, always-available fallback.
16
+
17
+ ## Freshness And Source Precedence
18
+
19
+ - Current repository source and approved `.specs/` artifacts override stale memory, old search results, external summaries, debug exports, and generated plans.
20
+ - `project_map`, `search`, and `optimized_context` are discovery evidence, not proof, until confirmed against source files read in this session or returned with current freshness evidence.
21
+ - If indexed results conflict with current files, or the index is stale, incomplete, missing the target path, or older than relevant local changes, trust current files and record the stale-index observation when it affects decisions.
22
+ - Use massa-ai durable memory for prior decisions, rejected approaches, reusable patterns, and verification recipes; do not use it as codebase evidence without current-source confirmation.
23
+
24
+ ## Rules
25
+
26
+ - Inspect current codebase and project docs before external docs.
27
+ - Prefer structural or symbol search for definitions, call sites, schemas, routes, test files, and public contract fields.
28
+ - Limit search scope to affected modules, source sets, tests, fixtures, schemas, and docs that define behavior.
29
+ - Record source evidence as files, symbols, line numbers, and commands in `design.md`, `tasks.md`, or `validation.md`.
30
+ - If a tool is unavailable, use the next fallback and state the skipped tool only when it affects confidence.
31
+
32
+ ## Detection
33
+
34
+ Check tool availability before use. Run the massa-ai tier first; only probe `sg` / `rg` when you are about to rely on them:
35
+
36
+ ```bash
37
+ # Check for ast-grep
38
+ if command -v sg >/dev/null 2>&1; then
39
+ # Use ast-grep for structural search
40
+ elif command -v rg >/dev/null 2>&1; then
41
+ # Fall back to ripgrep
42
+ else
43
+ # Use standard grep as final fallback
44
+ fi
45
+ ```
46
+
47
+ ## Usage Examples
48
+
49
+ **Finding function definitions:**
50
+
51
+ ```bash
52
+ # ast-grep (best - structural)
53
+ sg -p 'function $NAME($$$) { $$$ }'
54
+
55
+ # ripgrep (fallback - fast text)
56
+ rg '^function\s+\w+\(' --type-add 'source:*.[extension]' -t source
57
+
58
+ # grep (last resort - basic)
59
+ grep -r '^function ' --include="*.[extension]"
60
+ ```
61
+
62
+ **Finding imports/requires:**
63
+
64
+ ```bash
65
+ # ast-grep
66
+ sg -p 'import { $$$ } from "$MODULE"'
67
+
68
+ # ripgrep
69
+ rg '^import .* from' --type-add 'source:*.[extension]' -t source
70
+
71
+ # grep
72
+ grep -r '^import ' --include="*.[extension]"
73
+ ```
74
+
75
+ **Finding class/component definitions:**
76
+
77
+ ```bash
78
+ # ast-grep
79
+ sg -p 'class $NAME { $$$ }'
80
+
81
+ # ripgrep
82
+ rg '^(class|export class)\s+\w+' --type-add 'source:*.[extension]' -t source
83
+
84
+ # grep
85
+ grep -r '^class ' --include="*.[extension]"
86
+ ```
87
+
88
+ ## Search Scope
89
+
90
+ **Best practices:**
91
+
92
+ - Limit to source file extensions relevant to project
93
+ - Exclude directories: `node_modules`, `vendor`, `dist`, `build`, `.git`
94
+ - Focus on source directories: `src`, `lib`, `app`
95
+ - Use file type filters when available
96
+
97
+ **Performance tips:**
98
+
99
+ - Use specific patterns over broad searches
100
+ - Limit directory depth with `--max-depth` (ripgrep/grep)
101
+ - Cache results for repeated queries
102
+
103
+ ## Fallback Notice
104
+
105
+ If ast-grep is unavailable, display once per session:
106
+
107
+ ```
108
+ ⚠️ ast-grep not detected. Install for more precise structural code analysis.
109
+ https://ast-grep.github.io/guide/quick-start.html
110
+ ```
111
+
112
+ ## When To Use
113
+
114
+ - Finding usage patterns across the codebase
115
+ - Identifying code structure and organization
116
+ - Locating function/class/component definitions
117
+ - Analyzing import/dependency patterns
118
+ - Refactoring impact analysis
119
+ - Code navigation in unfamiliar codebases
@@ -0,0 +1,80 @@
1
+ # Spec-Driven Coding Principles
2
+
3
+ Use this reference before writing or changing implementation, tests, fixtures, validation assets, scripts, or docs during Execute.
4
+
5
+ Behavioral bias, not checklist. Read before every implementation.
6
+
7
+ ---
8
+
9
+ ## Pre-Implementation Statement
10
+
11
+ Before edits, state:
12
+
13
+ - Assumptions: accepted assumptions and remaining uncertainty.
14
+ - Files to touch: only files required for the current task or validation.
15
+ - Success criteria: deterministic command, artifact check, or validation report that proves the task.
16
+
17
+ Artifact-store evidence: active artifact key, version, and checksum after write (specify, tasks, design phases).
18
+
19
+ ---
20
+
21
+ ## Before Coding
22
+
23
+ - State assumptions explicitly. If uncertain, ask.
24
+ - Multiple interpretations exist? Present all—don't pick silently.
25
+ - Simpler approach exists? Say so. Push back when warranted.
26
+ - Something unclear? Stop. Name what's confusing. Ask.
27
+ - User's approach seems wrong? Disagree honestly. Don't be sycophantic.
28
+
29
+ ---
30
+
31
+ ## During Implementation
32
+
33
+ ### Simplicity
34
+
35
+ - No features beyond what was asked
36
+ - No abstractions for single-use code
37
+ - No "flexibility" or "configurability" not requested
38
+ - No error handling for impossible scenarios
39
+ - 200 lines that could be 50? Rewrite it.
40
+
41
+ ### Surgical Changes
42
+
43
+ - Don't "improve" adjacent code, comments, or formatting
44
+ - Don't refactor things that aren't broken
45
+ - Match existing style, even if you'd do differently
46
+ - Unrelated dead code noticed? Mention it—don't delete it
47
+ - Remove ONLY imports/variables/functions YOUR changes orphaned
48
+ - Don't remove pre-existing dead code unless asked
49
+
50
+ ### Test Integrity
51
+
52
+ - NEVER weaken an existing test assertion to make it pass
53
+ - NEVER delete a test to reduce failure count
54
+ - NEVER use the test framework's skip/disable/pending mechanism to bypass a failing test
55
+ - NEVER modify a task's tests afterward to make the implementation pass
56
+ - If a test is genuinely wrong, STOP and confirm with the user before changing it
57
+ - Tests are the spec — implementation conforms to tests, not the other way around
58
+
59
+ ### Goal-Driven
60
+
61
+ - Transform vague tasks into verifiable goals
62
+ - Multi-step work? State brief plan with verify checkpoints
63
+ - Every changed line must trace directly to user's request
64
+
65
+ ### Rules
66
+
67
+ - Implement the simplest complete change that satisfies the approved requirement.
68
+ - Touch only listed files unless a new requirement or design decision forces a return to Specify or Design.
69
+ - Match existing style and local helpers.
70
+ - Do not add speculative flexibility, broad refactors, or unrelated cleanup.
71
+ - Do not weaken tests, specs, fixtures, snapshots, schemas, or checks to make work pass.
72
+ - Derive tests from acceptance criteria and spec-defined outcomes, not from current implementation.
73
+ - Re-run the task gate after any code or validation-asset change.
74
+
75
+ ---
76
+
77
+ ## After Each Change
78
+
79
+ Ask: "Would senior engineer call this overcomplicated?"
80
+ If yes → simplify before proceeding.
@@ -0,0 +1,64 @@
1
+ # Spec-Driven Context Limits
2
+
3
+ Use this reference when planning context loading for a spec-driven feature or when `.specs/features/<slug>/` artifacts grow large enough to reduce implementation quality.
4
+
5
+ ## Targets
6
+
7
+ - Loaded working context target: under 40k tokens (20% of the window).
8
+ - Warning range: 40k to 60k tokens.
9
+ - Critical range: above 60k tokens.
10
+ - Reserve: 160k+ tokens for work, reasoning, and outputs.
11
+
12
+ ## Base Load Set
13
+
14
+ The deterministic starting context for a spec-driven task is a ~15k-token base set, loaded once before deeper artifacts:
15
+
16
+ - The selected workflow (`workflows/spec-driven.md`) — routing and phase contracts.
17
+ - `references/spec-driven/memory.md` and `references/spec-driven/artifact-store.md` — state layer + precedence.
18
+ - `.specs/project/STATE.md` and `.specs/HANDOFF.md` — current position and decisions.
19
+ - The active feature's `spec.md` (requirements + ACs) — the source of truth for the work.
20
+
21
+ Load additional phase references (`specify.md`, `design.md`, `tasks.md`, `execute.md`, `validate.md`) only when the active phase needs them, and unload/summarize when the phase closes. The base set keeps the starting footprint predictable; phase references are additive and bounded.
22
+
23
+ ## File Size Limits
24
+
25
+ | File | Max Tokens | ~Words | Warning At |
26
+ | ------------- | ---------- | ------ | ---------- |
27
+ | `spec.md` | 5,000 | 3,000 | 4,000 |
28
+ | `design.md` | 8,000 | 4,800 | 6,400 |
29
+ | `tasks.md` | 10,000 | 6,000 | 8,000 |
30
+
31
+ ## Artifact Budgets
32
+
33
+ | Artifact | Target |
34
+ | ---------- | ------------------- |
35
+ | `spec.md` | 5k tokens or less |
36
+ | `design.md`| 8k tokens or less |
37
+ | `tasks.md` | 10k tokens or less |
38
+
39
+ ## Context Zones
40
+
41
+ - 🟢 **Healthy** (<40k total): Silent.
42
+ - 🟡 **Moderate** (40-60k): Discrete footer note.
43
+ - 🔴 **Critical** (>60k): Active warning, suggest optimization.
44
+
45
+ ## Monitoring
46
+
47
+ Display context status in footer when loaded context exceeds 40k:
48
+
49
+ ```
50
+ 📊 Context: 52k tokens (moderate)
51
+ - tasks.md: 11k (ok)
52
+ - design.md: 6k (ok)
53
+ - Total: 52k / 200k (26%)
54
+ ```
55
+
56
+ ## Rules
57
+
58
+ - Load one active feature's `.specs/features/<slug>/` artifacts at a time.
59
+ - Never load multiple feature specs or architecture docs simultaneously — cross-feature loading invites stale-requirement bleed and blows the context budget. If a second feature's context is needed, summarize the first, persist position to `.specs/HANDOFF.md`, then load the next feature alone.
60
+ - Prefer summaries, targeted sections, and file ranges over full broad dumps.
61
+ - Use `references/context-firewall.md` before raw logs, raw transcripts, raw search output, generated reports, screenshots, large diffs, subagent output, or external research.
62
+ - Report context pressure as a compact status or `.specs/HANDOFF.md` field when loaded context approaches warning or critical range; do not paste raw context dumps to explain pressure.
63
+ - If context exceeds the warning range, compact artifact summaries before adding more source.
64
+ - If context exceeds the critical range, stop and produce a restartable handoff (`.specs/HANDOFF.md`) before continuing.