@massa-ai/claude-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 (180) hide show
  1. package/.claude-plugin/plugin.json +18 -0
  2. package/README.md +74 -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/commands/def.md +17 -0
  19. package/commands/find.md +19 -0
  20. package/commands/graph.md +16 -0
  21. package/commands/index.md +19 -0
  22. package/commands/map.md +24 -0
  23. package/commands/status.md +15 -0
  24. package/hooks/README.md +52 -0
  25. package/hooks/_pin.sh +64 -0
  26. package/hooks/_post.sh +77 -0
  27. package/hooks/hooks.json +54 -0
  28. package/hooks/massa-ai-hook.ts +298 -0
  29. package/hooks/post-tool-use.sh +4 -0
  30. package/hooks/pre-compact.sh +70 -0
  31. package/hooks/session-start.sh +5 -0
  32. package/hooks/stop.sh +4 -0
  33. package/hooks/user-prompt-submit.sh +4 -0
  34. package/install.sh +435 -0
  35. package/package.json +32 -0
  36. package/skills/agents/architecture-specialist/SKILL.md +69 -0
  37. package/skills/agents/audit-specialist/SKILL.md +85 -0
  38. package/skills/agents/builder/SKILL.md +71 -0
  39. package/skills/agents/context-curator/SKILL.md +71 -0
  40. package/skills/agents/documentation-agent/SKILL.md +69 -0
  41. package/skills/agents/furps-analyst/SKILL.md +74 -0
  42. package/skills/agents/investigator/SKILL.md +72 -0
  43. package/skills/agents/mobile-specialist/SKILL.md +86 -0
  44. package/skills/agents/navigator/SKILL.md +79 -0
  45. package/skills/agents/plan-critic/SKILL.md +93 -0
  46. package/skills/agents/planner/SKILL.md +69 -0
  47. package/skills/agents/requirements-analyst/SKILL.md +68 -0
  48. package/skills/agents/reviewer/SKILL.md +70 -0
  49. package/skills/agents/test-engineer/SKILL.md +70 -0
  50. package/skills/agents/verification-agent/SKILL.md +69 -0
  51. package/skills/massa-ai/SKILL.md +315 -0
  52. package/skills/massa-ai/personas/README.md +35 -0
  53. package/skills/massa-ai/personas/ai-native-nodejs-cli-architect.md +76 -0
  54. package/skills/massa-ai/personas/catalog.json +157 -0
  55. package/skills/massa-ai/personas/context-skill-harness-engineer-architect.md +74 -0
  56. package/skills/massa-ai/personas/product-manager.md +67 -0
  57. package/skills/massa-ai/personas/senior-mobile-engineer.md +74 -0
  58. package/skills/massa-ai/personas/senior-mobile-qa-automation-engineer.md +75 -0
  59. package/skills/massa-ai/references/adr-authoring.md +189 -0
  60. package/skills/massa-ai/references/agent-orchestration.md +221 -0
  61. package/skills/massa-ai/references/architecture-coupling-lens.md +239 -0
  62. package/skills/massa-ai/references/architecture-deepening-lens.md +136 -0
  63. package/skills/massa-ai/references/architecture-domain-lens.md +186 -0
  64. package/skills/massa-ai/references/architecture-lenses.md +108 -0
  65. package/skills/massa-ai/references/audit-report-io.md +459 -0
  66. package/skills/massa-ai/references/audit-scope.md +103 -0
  67. package/skills/massa-ai/references/code-annotation.md +111 -0
  68. package/skills/massa-ai/references/codebase-investigation.md +96 -0
  69. package/skills/massa-ai/references/context-firewall.md +62 -0
  70. package/skills/massa-ai/references/conversation-feedback.md +104 -0
  71. package/skills/massa-ai/references/debug-diagnosis-loop.md +140 -0
  72. package/skills/massa-ai/references/decision-engine.md +73 -0
  73. package/skills/massa-ai/references/evidence-gate.md +53 -0
  74. package/skills/massa-ai/references/furps/analyst-role.md +49 -0
  75. package/skills/massa-ai/references/furps/checklist.md +92 -0
  76. package/skills/massa-ai/references/furps/intake.md +104 -0
  77. package/skills/massa-ai/references/furps/report-contract.md +140 -0
  78. package/skills/massa-ai/references/hook-enforcement.md +137 -0
  79. package/skills/massa-ai/references/implementation-delivery.md +101 -0
  80. package/skills/massa-ai/references/installation.md +110 -0
  81. package/skills/massa-ai/references/lessons.md +119 -0
  82. package/skills/massa-ai/references/maestro/artifacts-reports.md +69 -0
  83. package/skills/massa-ai/references/maestro/cli-device.md +65 -0
  84. package/skills/massa-ai/references/maestro/cloud.md +67 -0
  85. package/skills/massa-ai/references/maestro/config-env-output.md +76 -0
  86. package/skills/massa-ai/references/maestro/fact-ledger.md +71 -0
  87. package/skills/massa-ai/references/maestro/js-scripting.md +70 -0
  88. package/skills/massa-ai/references/maestro/mcp.md +59 -0
  89. package/skills/massa-ai/references/maestro/patterns.md +96 -0
  90. package/skills/massa-ai/references/maestro/selectors.md +91 -0
  91. package/skills/massa-ai/references/maestro/workspace-execution.md +81 -0
  92. package/skills/massa-ai/references/maestro/yaml-commands.md +203 -0
  93. package/skills/massa-ai/references/maestro.md +47 -0
  94. package/skills/massa-ai/references/mcp-tools.md +296 -0
  95. package/skills/massa-ai/references/memory-policy.md +103 -0
  96. package/skills/massa-ai/references/mobile-context.md +113 -0
  97. package/skills/massa-ai/references/mobile-diagnosis.md +106 -0
  98. package/skills/massa-ai/references/mobile-figma-matcher/ATTRIBUTION.md +5 -0
  99. package/skills/massa-ai/references/mobile-figma-matcher/android-compose.md +13 -0
  100. package/skills/massa-ai/references/mobile-figma-matcher/android-views.md +13 -0
  101. package/skills/massa-ai/references/mobile-figma-matcher/core.md +117 -0
  102. package/skills/massa-ai/references/mobile-figma-matcher/ios-swiftui.md +12 -0
  103. package/skills/massa-ai/references/mobile-figma-matcher/ios-uikit.md +12 -0
  104. package/skills/massa-ai/references/mobile-figma-matcher/kmp-compose-multiplatform.md +14 -0
  105. package/skills/massa-ai/references/mobile-figma-matcher/repository-detection.md +77 -0
  106. package/skills/massa-ai/references/naming-standards.md +47 -0
  107. package/skills/massa-ai/references/pr-task-fix.md +80 -0
  108. package/skills/massa-ai/references/project-context.md +76 -0
  109. package/skills/massa-ai/references/rfc/ATTRIBUTION.md +5 -0
  110. package/skills/massa-ai/references/rfc/discovery-and-sizing.md +120 -0
  111. package/skills/massa-ai/references/rfc/document-contract.md +85 -0
  112. package/skills/massa-ai/references/rfc/quality-and-lifecycle.md +101 -0
  113. package/skills/massa-ai/references/root-cause-scripts.md +97 -0
  114. package/skills/massa-ai/references/spec-driven/artifact-store.md +98 -0
  115. package/skills/massa-ai/references/spec-driven/code-analysis.md +119 -0
  116. package/skills/massa-ai/references/spec-driven/coding-principles.md +80 -0
  117. package/skills/massa-ai/references/spec-driven/context-limits.md +64 -0
  118. package/skills/massa-ai/references/spec-driven/design.md +257 -0
  119. package/skills/massa-ai/references/spec-driven/discuss.md +182 -0
  120. package/skills/massa-ai/references/spec-driven/execute.md +471 -0
  121. package/skills/massa-ai/references/spec-driven/lessons.md +5 -0
  122. package/skills/massa-ai/references/spec-driven/memory.md +214 -0
  123. package/skills/massa-ai/references/spec-driven/specify.md +283 -0
  124. package/skills/massa-ai/references/spec-driven/sub-agents.md +151 -0
  125. package/skills/massa-ai/references/spec-driven/tasks.md +494 -0
  126. package/skills/massa-ai/references/spec-driven/validate.md +397 -0
  127. package/skills/massa-ai/references/subagent-design.md +132 -0
  128. package/skills/massa-ai/references/synapse-policy.md +160 -0
  129. package/skills/massa-ai/references/tdd/calibrated-examples.md +54 -0
  130. package/skills/massa-ai/references/tdd/discovery-and-sizing.md +83 -0
  131. package/skills/massa-ai/references/tdd/document-contract.md +136 -0
  132. package/skills/massa-ai/references/tdd/quality-and-lifecycle.md +83 -0
  133. package/skills/massa-ai/references/the-fool/cognitive-bias-inventory.md +103 -0
  134. package/skills/massa-ai/references/the-fool/dialectic-synthesis.md +170 -0
  135. package/skills/massa-ai/references/the-fool/evidence-audit.md +202 -0
  136. package/skills/massa-ai/references/the-fool/mode-selection-guide.md +113 -0
  137. package/skills/massa-ai/references/the-fool/pre-mortem-analysis.md +200 -0
  138. package/skills/massa-ai/references/the-fool/red-team-adversarial.md +206 -0
  139. package/skills/massa-ai/references/the-fool/socratic-questioning.md +153 -0
  140. package/skills/massa-ai/references/ticket/atlassian-fix.md +130 -0
  141. package/skills/massa-ai/references/ticket/intake-and-sources.md +65 -0
  142. package/skills/massa-ai/references/ticket/templates-and-quality.md +129 -0
  143. package/skills/massa-ai/references/verification-ladder.md +62 -0
  144. package/skills/massa-ai/scripts/lessons.py +590 -0
  145. package/skills/massa-ai/workflows/adr.md +33 -0
  146. package/skills/massa-ai/workflows/architecture/architecture-audit.md +125 -0
  147. package/skills/massa-ai/workflows/architecture/architecture-fix.md +110 -0
  148. package/skills/massa-ai/workflows/bugs/bugs-audit.md +113 -0
  149. package/skills/massa-ai/workflows/bugs/bugs-fix.md +97 -0
  150. package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +154 -0
  151. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +99 -0
  152. package/skills/massa-ai/workflows/commit.md +61 -0
  153. package/skills/massa-ai/workflows/debug.md +86 -0
  154. package/skills/massa-ai/workflows/design.md +54 -0
  155. package/skills/massa-ai/workflows/exploration.md +119 -0
  156. package/skills/massa-ai/workflows/feature.md +52 -0
  157. package/skills/massa-ai/workflows/general.md +46 -0
  158. package/skills/massa-ai/workflows/implementation/implementation-audit.md +87 -0
  159. package/skills/massa-ai/workflows/implementation/implementation-fix.md +90 -0
  160. package/skills/massa-ai/workflows/long-session.md +44 -0
  161. package/skills/massa-ai/workflows/maestro/maestro-audit.md +56 -0
  162. package/skills/massa-ai/workflows/maestro/maestro-fix.md +74 -0
  163. package/skills/massa-ai/workflows/maestro/maestro.md +68 -0
  164. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +68 -0
  165. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +74 -0
  166. package/skills/massa-ai/workflows/onboarding.md +23 -0
  167. package/skills/massa-ai/workflows/refactor.md +47 -0
  168. package/skills/massa-ai/workflows/refinement/furps-refinement.md +81 -0
  169. package/skills/massa-ai/workflows/requirements/requirements-audit.md +114 -0
  170. package/skills/massa-ai/workflows/requirements/requirements-fix.md +93 -0
  171. package/skills/massa-ai/workflows/rfc.md +55 -0
  172. package/skills/massa-ai/workflows/security/security-audit.md +113 -0
  173. package/skills/massa-ai/workflows/security/security-fix.md +97 -0
  174. package/skills/massa-ai/workflows/spec-driven.md +217 -0
  175. package/skills/massa-ai/workflows/tdd.md +71 -0
  176. package/skills/massa-ai/workflows/tests/tests-audit.md +114 -0
  177. package/skills/massa-ai/workflows/tests/tests-fix.md +96 -0
  178. package/skills/massa-ai/workflows/the-fool.md +82 -0
  179. package/skills/massa-ai/workflows/ticket.md +42 -0
  180. package/skills/persona-router/SKILL.md +158 -0
package/install.sh ADDED
@@ -0,0 +1,435 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # massa-ai Claude Code plugin installer
4
+ #
5
+ # Copies slash commands and the generated massa-ai subagents into the user's
6
+ # Claude Code config directory AND auto-writes the 5 massa-ai hook events
7
+ # into ~/.claude/settings.json (or ./.claude/settings.json) using an
8
+ # array-append merge that preserves existing user hooks. The hooks block uses
9
+ # Claude Code's nested matcher-group + hooks[] form, each owned entry marked
10
+ # with _massaAiOwned: true.
11
+ #
12
+ # MCP registration is delegated to scripts/install-agents.sh, the single writer
13
+ # of host MCP config; it merges the massa-ai entry alongside the hooks block.
14
+ #
15
+ # Idempotent: re-running is a no-op when owned hooks already present.
16
+ # Uninstall removes only ownership-marked hook entries + commands/agents,
17
+ # preserving user keys and user hooks.
18
+ #
19
+ # Usage:
20
+ # apps/claude-plugin/install.sh # install at user scope (~/.claude)
21
+ # apps/claude-plugin/install.sh --user # (same)
22
+ # apps/claude-plugin/install.sh --project # install at project scope (./.claude)
23
+ # apps/claude-plugin/install.sh --uninstall # remove owned hooks + commands/agents
24
+ # apps/claude-plugin/install.sh -h|--help # show this help
25
+
26
+ set -euo pipefail
27
+
28
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
29
+ REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
30
+ SCOPE="user"
31
+ UNINSTALL=0
32
+ DRY_RUN=0
33
+
34
+ for arg in "$@"; do
35
+ case "$arg" in
36
+ --user) SCOPE="user" ;;
37
+ --project) SCOPE="project" ;;
38
+ --uninstall) UNINSTALL=1 ;;
39
+ --quiet) MASSA_AI_VERBOSE=0 ;;
40
+ --verbose) MASSA_AI_VERBOSE=1 ;;
41
+ --dry-run) DRY_RUN=1; MASSA_AI_VERBOSE=1 ;;
42
+ -h|--help)
43
+ sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//'
44
+ exit 0
45
+ ;;
46
+ *) echo "Unknown flag: $arg" >&2; exit 2 ;;
47
+ esac
48
+ done
49
+
50
+ # Banner
51
+ source "$SCRIPT_DIR/../../scripts/banner.sh"
52
+ massa_ai_banner
53
+
54
+ if [[ "$SCOPE" == "project" ]]; then
55
+ TARGET="$(pwd)/.claude"
56
+ else
57
+ TARGET="$HOME/.claude"
58
+ fi
59
+ SETTINGS_JSON="$TARGET/settings.json"
60
+ # The shared binary lives in the repo (not copied) — settings.json references
61
+ # its absolute path so Claude Code can invoke `bun run <path> <subcommand>`.
62
+ HOOK_BIN="$SCRIPT_DIR/hooks/massa-ai-hook.ts"
63
+ # Double-fire guard input. The plugin now ships hooks/hooks.json, so a user who
64
+ # installed massa-ai through /plugin AND ran this script would ingest every
65
+ # lifecycle event twice. Claude Code records plugin installs at USER scope even
66
+ # for --project, so this resolves from $HOME, never from $SCOPE.
67
+ PLUGIN_REGISTRY="$HOME/.claude/plugins/installed_plugins.json"
68
+
69
+ # The 5 Claude Code events → binary subcommands. The matcher-group entry shape:
70
+ # { "hooks": [{ "type": "command", "command": "bun run \"<HOOK_BIN>\" <sub>" }],
71
+ # "_massaAiOwned": true }
72
+ # The merge appends one owned matcher-group entry per event array, preserving
73
+ # any pre-existing user matcher-group entries (F5 mitigation).
74
+ merge_settings_hooks() {
75
+ local file="$1"
76
+ local mode="$2" # "install" or "uninstall"
77
+ local ts
78
+ ts="$(date +%Y%m%d%H%M%S)"
79
+
80
+ local runner=""
81
+ if command -v node &>/dev/null; then
82
+ runner="node"
83
+ elif command -v bun &>/dev/null; then
84
+ runner="bun"
85
+ else
86
+ echo "Error: node or bun required to merge settings.json (JSON manipulation)" >&2
87
+ exit 3
88
+ fi
89
+
90
+ "$runner" - "$file" "$mode" "$ts" "$HOOK_BIN" "$PLUGIN_REGISTRY" <<'NODE'
91
+ const fs = require("fs");
92
+ const path = require("path");
93
+
94
+ const file = process.argv[2];
95
+ const mode = process.argv[3];
96
+ const ts = process.argv[4];
97
+ const hookBin = process.argv[5];
98
+ const pluginRegistry = process.argv[6];
99
+
100
+ const EVENTS = [
101
+ ["SessionStart", "session-start"],
102
+ ["UserPromptSubmit", "user-prompt-submit"],
103
+ ["PostToolUse", "post-tool-use"],
104
+ ["PreCompact", "pre-compact"],
105
+ ["Stop", "stop"],
106
+ ];
107
+
108
+ let cfg = {};
109
+ let existed = false;
110
+ try {
111
+ const raw = fs.readFileSync(file, "utf8");
112
+ if (raw.trim()) {
113
+ cfg = JSON.parse(raw);
114
+ existed = true;
115
+ }
116
+ } catch (e) {
117
+ if (e.code === "ENOENT") {
118
+ // no file — start empty
119
+ } else {
120
+ throw e;
121
+ }
122
+ }
123
+
124
+ function hasOwned(arr) {
125
+ return Array.isArray(arr) && arr.some((e) => e && e._massaAiOwned === true);
126
+ }
127
+
128
+ // Double-fire guard: true when massa-ai is already installed as a Claude Code
129
+ // plugin, in which case the plugin's own hooks/hooks.json is already wired and
130
+ // appending owned entries here would ingest every event twice.
131
+ //
132
+ // Fails OPEN in every uncertain case — a missing registry is the normal fresh
133
+ // install, and a malformed one must not block installation. That is deliberately
134
+ // unlike the read at the top of this script, which only tolerates ENOENT.
135
+ function pluginAlreadyInstalled() {
136
+ let raw;
137
+ try {
138
+ raw = fs.readFileSync(pluginRegistry, "utf8");
139
+ } catch (e) {
140
+ if (e.code !== "ENOENT") {
141
+ console.error(
142
+ ` ⚠ could not read ${pluginRegistry} (${e.code}) — wiring hooks anyway`,
143
+ );
144
+ }
145
+ return false;
146
+ }
147
+ try {
148
+ const plugins = JSON.parse(raw).plugins;
149
+ if (!plugins || typeof plugins !== "object") return false;
150
+ return Object.keys(plugins).some((k) => /^massa-ai@/.test(k));
151
+ } catch {
152
+ console.error(
153
+ ` ⚠ ${pluginRegistry} is not valid JSON — wiring hooks anyway`,
154
+ );
155
+ return false;
156
+ }
157
+ }
158
+
159
+ if (mode === "uninstall") {
160
+ const hooks = cfg.hooks;
161
+ if (hooks && typeof hooks === "object" && !Array.isArray(hooks)) {
162
+ for (const [evt] of EVENTS) {
163
+ if (Array.isArray(hooks[evt])) {
164
+ hooks[evt] = hooks[evt].filter((e) => !(e && e._massaAiOwned === true));
165
+ if (hooks[evt].length === 0) delete hooks[evt];
166
+ }
167
+ }
168
+ if (Object.keys(hooks).length === 0) delete cfg.hooks;
169
+ }
170
+ } else if (pluginAlreadyInstalled()) {
171
+ console.error(
172
+ " ↷ massa-ai is installed as a Claude Code plugin — skipping settings.json" +
173
+ " hooks (the plugin already provides them; wiring both would double-fire)",
174
+ );
175
+ process.exit(0);
176
+ } else {
177
+ // install: backup before first write if file existed
178
+ if (existed) {
179
+ const bak = `${file}.massa-ai.bak-${ts}`;
180
+ fs.copyFileSync(file, bak);
181
+ }
182
+ if (!cfg.hooks || typeof cfg.hooks !== "object" || Array.isArray(cfg.hooks)) {
183
+ cfg.hooks = {};
184
+ }
185
+ for (const [evt, sub] of EVENTS) {
186
+ if (!Array.isArray(cfg.hooks[evt])) cfg.hooks[evt] = [];
187
+ if (!hasOwned(cfg.hooks[evt])) {
188
+ cfg.hooks[evt].push({
189
+ hooks: [
190
+ {
191
+ type: "command",
192
+ command: `bun run "${hookBin}" ${sub}`,
193
+ },
194
+ ],
195
+ _massaAiOwned: true,
196
+ });
197
+ }
198
+ }
199
+ }
200
+
201
+ fs.mkdirSync(path.dirname(file), { recursive: true });
202
+ fs.writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
203
+ NODE
204
+ }
205
+
206
+ # ── Skills bundling (PDO-08, 09 / D3 two-writer ownership) ──────────────────
207
+ # scripts/install-skills.sh remains the single writer once it has already
208
+ # claimed this platform (skillsOwner: "repo" in the shared install-state.json).
209
+ # This plugin installs its bundled massa-ai/persona-router skills into the
210
+ # SAME harness skills directory (~/.claude/skills, not this plugin's cache)
211
+ # only when that has not happened, mirroring the MCP single-writer precedent
212
+ # (test-mcp-single-writer.sh). A repo checkout's own --apply always takes
213
+ # precedence over a prior plugin install — see install-skills.sh.
214
+ HARNESS_STATE_FILE="$HOME/.config/massa-ai/install-state.json"
215
+ HARNESS_SKILLS_DIR="$TARGET/skills"
216
+ HARNESS_HOST="claude"
217
+
218
+ harness_skills_owner() {
219
+ local runner="$1"
220
+ "$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" <<'NODE'
221
+ const fs = require("fs");
222
+ const [, , file, host] = process.argv;
223
+ try {
224
+ const data = JSON.parse(fs.readFileSync(file, "utf8"));
225
+ const rec = data && data.platforms && data.platforms[host];
226
+ process.stdout.write(rec && rec.skillsOwner === "repo" ? "repo" : "none");
227
+ } catch {
228
+ process.stdout.write("none");
229
+ }
230
+ NODE
231
+ }
232
+
233
+ install_bundled_skills() {
234
+ local runner=""
235
+ if command -v node &>/dev/null; then runner="node"
236
+ elif command -v bun &>/dev/null; then runner="bun"
237
+ else
238
+ echo " ⚠ node or bun required to install bundled skills — skipping" >&2
239
+ return 0
240
+ fi
241
+
242
+ if [[ "$(harness_skills_owner "$runner")" == "repo" ]]; then
243
+ vecho " ↷ skills already installed by scripts/install-skills.sh (repo-owned) — skipping bundled copy"
244
+ return 0
245
+ fi
246
+
247
+ local installed=0 name src dest
248
+ for name in massa-ai persona-router; do
249
+ src="$SCRIPT_DIR/skills/$name"
250
+ [[ -d "$src" ]] || continue
251
+ dest="$HARNESS_SKILLS_DIR/$name"
252
+ if [[ -e "$dest" && ! -d "$dest" ]]; then
253
+ echo " ⚠ $dest exists and is not a directory — skipping" >&2
254
+ continue
255
+ fi
256
+ mkdir -p "$HARNESS_SKILLS_DIR"
257
+ rm -rf "$dest"
258
+ cp -R "$src" "$dest"
259
+ installed=$((installed + 1))
260
+ done
261
+ vecho " + ${installed} harness skills installed to $HARNESS_SKILLS_DIR (plugin-owned)"
262
+
263
+ "$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" "$TARGET" <<'NODE'
264
+ const fs = require("fs");
265
+ const path = require("path");
266
+ const [, , file, host, root] = process.argv;
267
+ let data = { version: 2, platforms: {} };
268
+ try {
269
+ const existing = JSON.parse(fs.readFileSync(file, "utf8"));
270
+ if (existing && typeof existing === "object" && !Array.isArray(existing)) data = existing;
271
+ } catch { /* fresh */ }
272
+ if (typeof data.platforms !== "object" || data.platforms === null || Array.isArray(data.platforms)) {
273
+ data.platforms = {};
274
+ }
275
+ data.version = 2;
276
+ data.platforms[host] = { root, skillsOwner: "plugin", skills: ["massa-ai", "persona-router"] };
277
+ fs.mkdirSync(path.dirname(file), { recursive: true });
278
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
279
+ NODE
280
+ }
281
+
282
+ uninstall_bundled_skills() {
283
+ local runner=""
284
+ if command -v node &>/dev/null; then runner="node"
285
+ elif command -v bun &>/dev/null; then runner="bun"
286
+ else return 0
287
+ fi
288
+
289
+ # harness_skills_owner collapses to "repo" | "none"; uninstall only ever
290
+ # acts on an exact "plugin" record, so query the raw value directly.
291
+ local raw_owner
292
+ raw_owner="$("$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" <<'NODE'
293
+ const fs = require("fs");
294
+ const [, , file, host] = process.argv;
295
+ try {
296
+ const data = JSON.parse(fs.readFileSync(file, "utf8"));
297
+ const rec = data && data.platforms && data.platforms[host];
298
+ process.stdout.write(rec ? String(rec.skillsOwner) : "none");
299
+ } catch {
300
+ process.stdout.write("none");
301
+ }
302
+ NODE
303
+ )"
304
+ [[ "$raw_owner" == "plugin" ]] || return 0
305
+
306
+ local name
307
+ for name in massa-ai persona-router; do
308
+ rm -rf "$HARNESS_SKILLS_DIR/$name"
309
+ done
310
+ rmdir "$HARNESS_SKILLS_DIR" 2>/dev/null || true
311
+ echo " - removed plugin-owned harness skills from $HARNESS_SKILLS_DIR"
312
+
313
+ "$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" <<'NODE'
314
+ const fs = require("fs");
315
+ const [, , file, host] = process.argv;
316
+ try {
317
+ const data = JSON.parse(fs.readFileSync(file, "utf8"));
318
+ if (data && data.platforms && data.platforms[host] && data.platforms[host].skillsOwner === "plugin") {
319
+ delete data.platforms[host];
320
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
321
+ }
322
+ } catch { /* nothing to clean up */ }
323
+ NODE
324
+ }
325
+
326
+ # ── Uninstall ───────────────────────────────────────────────────────────────
327
+ if [[ "$UNINSTALL" -eq 1 ]]; then
328
+ echo "Uninstalling massa-ai Claude Code plugin (scope: $SCOPE)..."
329
+ uninstall_bundled_skills
330
+ # Remove owned hook entries (preserves user hooks + user keys)
331
+ if [[ -f "$SETTINGS_JSON" ]]; then
332
+ merge_settings_hooks "$SETTINGS_JSON" "uninstall"
333
+ echo " - removed massa-ai hook entries from $SETTINGS_JSON"
334
+ fi
335
+ # Remove owned command files
336
+ if [[ -d "$TARGET/commands" ]]; then
337
+ for src in "$SCRIPT_DIR/commands/"*.md; do
338
+ name="$(basename "$src" .md)"
339
+ rm -f "$TARGET/commands/massa-ai-${name}.md"
340
+ done
341
+ echo " - removed massa-ai-* commands from $TARGET/commands/"
342
+ fi
343
+ # Remove every massa-ai-owned subagent specialist. All of them are generated
344
+ # from skills/agents/*/SKILL.md, so the massa-ai- name prefix is the ownership
345
+ # marker; user agents without that prefix are untouched.
346
+ if [[ -d "$TARGET/agents" ]]; then
347
+ for src in "$TARGET/agents/"massa-ai-*.md; do
348
+ [[ -f "$src" ]] || continue
349
+ rm -f "$src"
350
+ done
351
+ echo " - removed massa-ai-* subagent specialists from $TARGET/agents/"
352
+ fi
353
+ echo ""
354
+ echo "Done. User hooks, keys, and non-massa-ai agents preserved."
355
+ exit 0
356
+ fi
357
+
358
+ # ── Install ──────────────────────────────────────────────────────────────────
359
+ vecho "Installing massa-ai Claude Code plugin to: $TARGET"
360
+ mkdir -p "$TARGET/commands" "$TARGET/agents"
361
+
362
+ # Count for summary
363
+ command_count=0
364
+ # Slash commands — prefix with 'massa-ai-' to avoid collisions with user commands
365
+ for src in "$SCRIPT_DIR/commands/"*.md; do
366
+ name="$(basename "$src" .md)"
367
+ dest="$TARGET/commands/massa-ai-${name}.md"
368
+ cp "$src" "$dest"
369
+ vecho " + /massa-ai-${name}"
370
+ command_count=$((command_count + 1))
371
+ done
372
+
373
+ # Subagent specialists (generated from skills/agents/*/SKILL.md, navigator
374
+ # included). The massa-ai- name prefix is the ownership marker used by uninstall.
375
+ specialist_count=0
376
+ for src in "$SCRIPT_DIR/agents/"massa-ai-*.md; do
377
+ [[ -f "$src" ]] || continue
378
+ name="$(basename "$src")"
379
+ cp "$src" "$TARGET/agents/$name"
380
+ vecho " + $name"
381
+ specialist_count=$((specialist_count + 1))
382
+ done
383
+ vecho " + ${specialist_count} subagent specialists (generated from skills/agents/*/SKILL.md)"
384
+
385
+ # Skills bundling (PDO-08, 09): install massa-ai/persona-router into the
386
+ # shared harness skills directory, unless scripts/install-skills.sh already
387
+ # owns it for this platform.
388
+ vecho ""
389
+ install_bundled_skills
390
+
391
+ # Merge hooks into settings.json (array-append, backup, idempotent)
392
+ vecho ""
393
+ vecho "Merging hooks into $SETTINGS_JSON..."
394
+ if [[ ! -f "$HOOK_BIN" ]]; then
395
+ echo " ⚠ Warning: hook binary not found at $HOOK_BIN" >&2
396
+ echo " Hooks will not fire until the binary is available." >&2
397
+ fi
398
+ merge_settings_hooks "$SETTINGS_JSON" "install"
399
+ vecho " + 5 massa-ai hook events wired (array-append, user hooks preserved)"
400
+
401
+ # ── MCP registration (delegated) ─────────────────────────────────────────────
402
+ # scripts/install-agents.sh is the single writer of host MCP config. It merges
403
+ # the massa-ai entry into ~/.claude/settings.json alongside the hooks block
404
+ # written above, at USER scope — a --project plugin install still registers MCP
405
+ # for the whole user.
406
+ vecho ""
407
+ vecho "Registering MCP server (user scope) via scripts/install-agents.sh..."
408
+ if [[ -f "$REPO_ROOT/scripts/install-agents.sh" ]]; then
409
+ # On success the delegated output is detail (usually "up to date"), so it is
410
+ # gated. On failure it is never gated: a silently-failed MCP registration is
411
+ # exactly the bug this change set exists to fix.
412
+ if agents_out="$(MASSA_AI_SUPPRESS_SPECIALIST_HINT=1 bash "$REPO_ROOT/scripts/install-agents.sh" --agent claude-code --yes 2>&1)"; then
413
+ vecho "$agents_out"
414
+ else
415
+ echo "$agents_out" >&2
416
+ echo " ⚠ MCP wiring failed — run: bash scripts/install-agents.sh --agent claude-code --yes" >&2
417
+ fi
418
+ else
419
+ echo " ⚠ scripts/install-agents.sh not found — register MCP with: bash scripts/install-agents.sh --agent claude-code --yes" >&2
420
+ fi
421
+
422
+ # Summary line in quiet mode
423
+ if [ "${MASSA_AI_VERBOSE:-0}" != "1" ]; then
424
+ ok "claude plugin installed (${command_count} commands, ${specialist_count} specialists, 5 hooks)"
425
+ else
426
+ vecho ""
427
+ vecho "Done. Restart Claude Code to pick up the new commands and hooks."
428
+ vecho ""
429
+ fi
430
+ vecho "Next steps:"
431
+ vecho " 1. Try: /massa-ai-status"
432
+ vecho " 2. Try: /massa-ai-map (on an indexed project)"
433
+ # ~/.claude.json, not ~/.claude/settings.json — Claude Code reads MCP
434
+ # definitions from the former; settings.json only holds approval controls.
435
+ vecho "💡 Hooks are wired by this plugin; MCP is registered in ~/.claude.json by scripts/install-agents.sh (single writer)."
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@massa-ai/claude-plugin",
3
+ "version": "1.6.0",
4
+ "description": "massa-ai plugin for Claude Code — semantic code search, durable memory, symbol graph, and context compression",
5
+ "files": [
6
+ "agents",
7
+ "commands",
8
+ "hooks",
9
+ "!hooks/__tests__",
10
+ "skills",
11
+ "install.sh",
12
+ "README.md",
13
+ ".claude-plugin/plugin.json"
14
+ ],
15
+ "author": "luizgmassa",
16
+ "keywords": [
17
+ "claude-code",
18
+ "plugin",
19
+ "massa-ai",
20
+ "semantic-search",
21
+ "code-search",
22
+ "memory",
23
+ "context-compression",
24
+ "ai",
25
+ "llm"
26
+ ],
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/luizgmassa/massa-ai"
31
+ }
32
+ }
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: architecture-specialist
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
+ license: MIT
5
+ metadata:
6
+ author: S1LV4, luizgmassa
7
+ version: "1.0.0"
8
+ model_hint: MiniMax M3
9
+ permission: read-only
10
+ ---
11
+
12
+ # Architecture Specialist Agent Skill
13
+
14
+ ## Mission
15
+ Provide architectural guidance by evaluating structure, suggesting boundaries, and weighing trade-offs.
16
+
17
+ ## Responsibilities
18
+ - Evaluate architecture (layering, boundaries, coupling, depth).
19
+ - Suggest module boundaries and seams.
20
+ - Recommend abstractions where duplication or volatility warrants them.
21
+ - Evaluate trade-offs between approaches.
22
+ - Suggest modularization for shallow or over-coupled modules.
23
+
24
+ ## Restrictions
25
+ - Never implement.
26
+ - Never rewrite code.
27
+ - Never spawn subagents and never load the `massa-ai` router; the dispatching workflow owns routing.
28
+
29
+ ## Inputs
30
+ - `scope`: the module, service, or area under evaluation.
31
+ - `inputs`: recalled facts, source pointers, existing architecture docs.
32
+ - `sensors`: static coupling/depth metrics when available.
33
+
34
+ ## Outputs
35
+ - Status: Complete | Partial | Blocked
36
+ - Scope: modules and boundaries evaluated
37
+ - Evidence: `path:line` pointers, coupling/depth metrics, source locations
38
+ - Findings: boundary suggestions, abstraction recommendations, trade-off analysis, modularization plan
39
+ - Risks and skipped checks
40
+ - Exact next step
41
+
42
+ ## Invocation
43
+ ### Use when
44
+ - A workflow needs architectural guidance before or during design.
45
+ - The work crosses module or service boundaries.
46
+ - The user asks for architecture evaluation, coupling analysis, or modularization.
47
+
48
+ ### Do not use when
49
+ - The work is a single-file fix with no architectural surface.
50
+ - The task needs a concrete implementation (route to builder).
51
+ - An audit-specific lens is needed (route to audit-specialist with `lens: architecture`).
52
+
53
+ ## massa-ai Integration
54
+ - Context Firewall: summarize source reads; return findings and metrics, not raw code.
55
+ - Verification Ladder: static (coupling, depth, boundary) checks; no behavioral changes.
56
+ - Massa-ai Memory: suggest durable architecture-decision memories only when a boundary or abstraction is recommended; main agent persists.
57
+ - Synapse: own ephemeral session when evaluation spans multiple modules with repeated searches.
58
+ - References: `references/architecture-lenses.md`, `references/architecture-domain-lens.md`, `references/architecture-coupling-lens.md`, `references/architecture-deepening-lens.md`.
59
+
60
+ ## Model Hint
61
+ MiniMax M3 (advisory). Fallback to the workflow's configured default model if unavailable.
62
+
63
+ ## Validation Sensors
64
+ - Every finding has a `path:line` or metric pointer.
65
+ - Trade-offs name at least two alternatives.
66
+ - Boundary suggestions reference concrete modules.
67
+
68
+ ## Memory Boundary
69
+ Suggest durable memories only when an architectural boundary or abstraction is recommended and accepted. The main agent persists. Do not persist one-off evaluation chatter.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: audit-specialist
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
+ license: MIT
5
+ metadata:
6
+ author: S1LV4, luizgmassa
7
+ version: "1.0.0"
8
+ model_hint: GLM-5.2
9
+ permission: read-only
10
+ ---
11
+
12
+ # Audit Specialist Agent Skill
13
+
14
+ ## Mission
15
+ Execute a specialized audit through one configurable lens and return findings-only output.
16
+
17
+ ## Responsibilities
18
+ - Execute the audit checklist for the selected lens.
19
+ - Tie every finding to a `path:line` source location.
20
+ - Rank findings by severity.
21
+ - Produce a findings report following the project audit-report format.
22
+
23
+ ## Restrictions
24
+ - Never modify implementation.
25
+ - One lens per dispatch; do not mix lenses in one run.
26
+ - Never spawn subagents and never load the `massa-ai` router; the dispatching workflow owns routing.
27
+
28
+ ## Lenses
29
+
30
+ The `lens` field in the capability packet selects the audit behavior:
31
+
32
+ | Lens | Focus | Per-lens references |
33
+ |---|---|---|
34
+ | `bugs` | Bug discovery: null paths, error handling, race conditions, logic errors | `workflows/bugs/bugs-audit.md` |
35
+ | `architecture` | DDD, boundaries, coupling, module depth, seams | `references/architecture-lenses.md`, `references/architecture-domain-lens.md`, `references/architecture-coupling-lens.md`, `references/architecture-deepening-lens.md` |
36
+ | `security` | Security, privacy, auth, validation, secret handling | `workflows/security/security-audit.md` |
37
+ | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
38
+ | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
39
+ | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
40
+
41
+ All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
42
+
43
+ ## Inputs
44
+ - `scope`: the target area, diff, or module to audit.
45
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
46
+ - `inputs`: recalled facts, existing audit reports, source pointers.
47
+ - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
48
+
49
+ ## Outputs
50
+ - Status: Complete | Partial | Blocked
51
+ - Scope: area audited + lens used
52
+ - Evidence: `path:line` pointers, static-check results, source locations
53
+ - Findings: ranked list (severity, location, problem, suggestion) in the project audit-report format
54
+ - Risks and skipped checks
55
+ - Exact next step
56
+
57
+ ## Invocation
58
+ ### Use when
59
+ - A workflow needs a findings-only audit of an implementation target.
60
+ - The user asks for a bug, architecture, security, requirements, code-quality, or performance audit.
61
+ - A high/critical finding needs independent verification.
62
+
63
+ ### Do not use when
64
+ - The task needs a fix (route to the matching `*-fix` workflow or builder).
65
+ - No concrete target exists to audit.
66
+ - The lens is ambiguous (ask the user to pick one).
67
+
68
+ ## massa-ai Integration
69
+ - Context Firewall: summarize the audit scope; return findings, not raw source dumps.
70
+ - Verification Ladder: static checks per lens; no behavioral changes (findings-only).
71
+ - Massa-ai Memory: suggest durable audit-pattern memories only when a lens reveals a recurring issue class; main agent persists.
72
+ - Synapse: own ephemeral session when the audit spans multiple modules with repeated searches.
73
+ - References: `references/audit-scope.md`, `references/audit-report-io.md`, plus the per-lens references above.
74
+
75
+ ## Model Hint
76
+ GLM-5.2 (advisory). Fallback to the workflow's configured default model if unavailable.
77
+
78
+ ## Validation Sensors
79
+ - Every finding has a `path:line` pointer.
80
+ - Findings follow the project audit-report format (`references/audit-report-io.md`).
81
+ - Severity is assigned per the lens rubric.
82
+ - No fix actions taken (findings-only).
83
+
84
+ ## Memory Boundary
85
+ Suggest durable memories only when a lens reveals a recurring issue class worth remembering. The main agent persists. Do not persist the audit report itself (it lives in `.specs/`).