continuous-improvement 3.11.0 → 3.15.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 (76) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/CHANGELOG.md +65 -1
  3. package/QUICKSTART.md +1 -1
  4. package/README.md +39 -18
  5. package/SKILL.md +1 -1
  6. package/bin/check-skill-count.mjs +32 -1
  7. package/bin/check-test-imports-only.mjs +1 -1
  8. package/bin/check-tool-count.mjs +129 -0
  9. package/bin/generate-plugin-manifests.mjs +3 -1
  10. package/bin/harvest-friction.mjs +1 -1
  11. package/bin/install.mjs +77 -3
  12. package/bin/mcp-server.mjs +66 -9
  13. package/bin/plan-pack.mjs +77 -0
  14. package/bin/unified-cli.mjs +55 -410
  15. package/commands/harvest.md +1 -1
  16. package/commands/model-forward.md +13 -0
  17. package/commands/production-readiness-review.md +53 -0
  18. package/commands/ship.md +57 -0
  19. package/commands/superpowers.md +1 -1
  20. package/hooks/companion-preference.mjs +31 -19
  21. package/hooks/gateguard.mjs +59 -25
  22. package/hooks/hook-pack.mjs +110 -0
  23. package/hooks/recall-briefing.mjs +167 -0
  24. package/lib/gateguard-state.mjs +62 -13
  25. package/lib/goal-state.mjs +13 -9
  26. package/lib/hook-pack-gate.mjs +65 -0
  27. package/lib/install-targets.mjs +121 -0
  28. package/lib/plan-review-packet.mjs +96 -0
  29. package/lib/plugin-metadata.mjs +33 -7
  30. package/lib/recall-briefing.mjs +57 -0
  31. package/lib/recall-index.mjs +2 -2
  32. package/lib/skill-distill.mjs +141 -0
  33. package/llms.txt +2 -2
  34. package/package.json +6 -4
  35. package/plugins/beginner.json +3 -3
  36. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
  37. package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
  38. package/plugins/continuous-improvement/README.md +1 -1
  39. package/plugins/continuous-improvement/agents/README.md +3 -3
  40. package/plugins/continuous-improvement/bin/mcp-server.mjs +66 -9
  41. package/plugins/continuous-improvement/commands/harvest.md +1 -1
  42. package/plugins/continuous-improvement/commands/model-forward.md +13 -0
  43. package/plugins/continuous-improvement/commands/production-readiness-review.md +53 -0
  44. package/plugins/continuous-improvement/commands/ship.md +57 -0
  45. package/plugins/continuous-improvement/commands/superpowers.md +1 -1
  46. package/plugins/continuous-improvement/hooks/companion-preference.mjs +31 -19
  47. package/plugins/continuous-improvement/hooks/gateguard.mjs +59 -25
  48. package/plugins/continuous-improvement/hooks/hook-pack.mjs +110 -0
  49. package/plugins/continuous-improvement/hooks/hooks.json +16 -1
  50. package/plugins/continuous-improvement/hooks/recall-briefing.mjs +167 -0
  51. package/plugins/continuous-improvement/lib/gateguard-state.mjs +62 -13
  52. package/plugins/continuous-improvement/lib/goal-state.mjs +13 -9
  53. package/plugins/continuous-improvement/lib/hook-pack-gate.mjs +65 -0
  54. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +33 -7
  55. package/plugins/continuous-improvement/lib/recall-briefing.mjs +57 -0
  56. package/plugins/continuous-improvement/lib/recall-index.mjs +2 -2
  57. package/plugins/continuous-improvement/lib/skill-distill.mjs +141 -0
  58. package/plugins/continuous-improvement/skills/README.md +1 -1
  59. package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +1 -1
  60. package/plugins/continuous-improvement/skills/gateguard/SKILL.md +4 -4
  61. package/plugins/continuous-improvement/skills/goal-monitor/SKILL.md +1 -1
  62. package/plugins/continuous-improvement/skills/handoff/SKILL.md +0 -1
  63. package/plugins/continuous-improvement/skills/model-forward/SKILL.md +44 -0
  64. package/plugins/continuous-improvement/skills/superpowers/SKILL.md +1 -1
  65. package/plugins/expert.json +6 -2
  66. package/skills/README.md +4 -2
  67. package/skills/gateguard.md +4 -4
  68. package/skills/goal-monitor.md +1 -1
  69. package/skills/handoff.md +0 -1
  70. package/skills/model-forward.md +44 -0
  71. package/skills/superpowers.md +1 -1
  72. package/lib/compound-engineering.mjs +0 -831
  73. package/lib/pm-skills.mjs +0 -1274
  74. package/lib/unified-plugin.mjs +0 -924
  75. package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +0 -108
  76. package/skills/para-memory-files.md +0 -108
@@ -220,3 +220,144 @@ export function formatCandidates(candidates, limit = 10) {
220
220
  }
221
221
  return lines.join("\n");
222
222
  }
223
+ // ── Workflow-run → instinct bridge ───────────────────────────────────────────
224
+ // A native Workflow run (Opus 4.8 orchestration / ultracode) is recorded in the
225
+ // observation feed as a `tool: "Workflow"` row whose input_summary holds
226
+ // {"script":"..."} — truncated (~500 chars), but meta.name/description/phases sit
227
+ // at the head of the script and survive. The output_summary holds
228
+ // {"status","runId",...} with status "async_launched": the feed captures the
229
+ // LAUNCH, not the result. So a workflow's success is never read from the Workflow
230
+ // row itself — it is inferred from a following verify-exit-0 in the same feed.
231
+ //
232
+ // Unlike findCandidates (which needs a pattern recurring across >=2 sessions to
233
+ // reject coincidence), a Workflow script is an AUTHORED recipe: one verified run
234
+ // warrants a draft, so the session/occurrence thresholds do not apply here.
235
+ const WORKFLOW_TOOL = "Workflow";
236
+ // Pull meta.name / meta.description / meta.phases[].title out of a (possibly
237
+ // truncated) workflow script embedded as JSON in the observation input_summary.
238
+ // Fail-closed: returns null unless a name is recoverable — a recipe with no
239
+ // identity is never fabricated.
240
+ function parseWorkflowScript(inputSummary) {
241
+ if (!inputSummary)
242
+ return null;
243
+ let script = "";
244
+ try {
245
+ const parsed = JSON.parse(inputSummary);
246
+ if (typeof parsed.script === "string")
247
+ script = parsed.script;
248
+ }
249
+ catch {
250
+ // input_summary may itself be truncated mid-JSON; recover the script field loosely.
251
+ const m = inputSummary.match(/"script"\s*:\s*"((?:[^"\\]|\\.)*)/);
252
+ if (m) {
253
+ try {
254
+ script = JSON.parse(`"${m[1]}"`);
255
+ }
256
+ catch {
257
+ script = m[1].replace(/\\n/g, "\n").replace(/\\"/g, '"').replace(/\\'/g, "'");
258
+ }
259
+ }
260
+ }
261
+ if (!script)
262
+ return null;
263
+ // Scope name/description to the meta head (text before `phases:`) so a phase
264
+ // object's own description: is never mistaken for meta.description; scope phase
265
+ // titles to the phases array literal so inline agent/step title: fields are not
266
+ // captured. The capture classes exclude quotes and newlines, so a hostile
267
+ // name/description cannot inject lines into the draft YAML — serializeDraft emits
268
+ // trigger as a quoted scalar.
269
+ const phasesAt = script.search(/\bphases\s*:/);
270
+ const metaHead = phasesAt >= 0 ? script.slice(0, phasesAt) : script;
271
+ const name = (metaHead.match(/\bname\s*:\s*['"]([^'"\r\n]+)['"]/) ?? [])[1] ?? "";
272
+ if (!name)
273
+ return null; // fail closed: no recipe identity
274
+ const description = (metaHead.match(/\bdescription\s*:\s*['"]([^'"\r\n]+)['"]/) ?? [])[1] ?? "";
275
+ const phasesBlock = (script.match(/\bphases\s*:\s*\[([^\]]*)\]/) ?? [])[1] ?? "";
276
+ const phases = [];
277
+ const phaseRe = /\btitle\s*:\s*['"]([^'"\r\n]+)['"]/g;
278
+ let pm;
279
+ while ((pm = phaseRe.exec(phasesBlock)) !== null)
280
+ phases.push(pm[1]);
281
+ return { name, description, phases };
282
+ }
283
+ // A single verify-exit-0 Bash row: a verify/test/build command whose output is not
284
+ // failing. Mirrors classifyTrajectorySuccess's verify branch for one observation.
285
+ function isVerifySuccessRow(observation) {
286
+ if ((observation.tool ?? "") !== "Bash")
287
+ return false;
288
+ const input = (observation.input_summary ?? "").toString();
289
+ const output = (observation.output_summary ?? "").toString();
290
+ return VERIFY_CMD.test(input) && !FAILURE_MARKER.test(output) && (output === "" || SUCCESS_MARKER.test(output));
291
+ }
292
+ /**
293
+ * Detect the most recent completed-and-verified Workflow run in an observation
294
+ * list. Returns null (fail closed) unless: a `tool: "Workflow"` row carries a
295
+ * parseable script with a name, AND a verify-exit-0 row follows it in the feed.
296
+ * The trailing verify is the only success signal — the Workflow row records the
297
+ * launch, never the result.
298
+ */
299
+ export function workflowRunFromObservations(observations) {
300
+ let wfIndex = -1;
301
+ let meta = null;
302
+ for (let i = observations.length - 1; i >= 0; i -= 1) {
303
+ if ((observations[i].tool ?? "") !== WORKFLOW_TOOL)
304
+ continue;
305
+ const parsed = parseWorkflowScript((observations[i].input_summary ?? "").toString());
306
+ if (parsed) {
307
+ wfIndex = i;
308
+ meta = parsed;
309
+ break;
310
+ }
311
+ }
312
+ if (wfIndex === -1 || !meta)
313
+ return null;
314
+ const wfSession = (observations[wfIndex].session ?? "").toString();
315
+ // The verify that proves the run must follow the Workflow row in the SAME session.
316
+ // A verify from an unrelated later task (different session) does not count — the
317
+ // run is asynchronous, so an interleaved verify could otherwise falsely prove it.
318
+ let verifyCommand = "";
319
+ for (let i = wfIndex + 1; i < observations.length; i += 1) {
320
+ const row = observations[i];
321
+ if ((row.session ?? "").toString() !== wfSession)
322
+ continue;
323
+ if (isVerifySuccessRow(row)) {
324
+ verifyCommand = (row.input_summary ?? "").toString();
325
+ break;
326
+ }
327
+ }
328
+ if (!verifyCommand)
329
+ return null; // fail closed: no evidence the run's output landed
330
+ return { name: meta.name, description: meta.description, phases: meta.phases, verifyCommand };
331
+ }
332
+ /**
333
+ * Turn a verified Workflow run into a DRAFT instinct. The script's phase outline is
334
+ * a real skeleton (not a placeholder n-gram), but the human still edits the body
335
+ * before promoting. Reuses serializeDraft and the drafts/ ladder; the
336
+ * `draft-workflow-` id prefix marks the source and stays filesystem-safe.
337
+ */
338
+ export function draftFromWorkflowRun(run) {
339
+ // Cap the slug so a hostile/huge meta.name cannot produce a path that trips
340
+ // ENAMETOOLONG on write; strip a trailing hyphen left by the cut.
341
+ const slug = slugifyNgram([run.name]).slice(0, 120).replace(/-+$/, "") || "workflow";
342
+ const phaseLine = run.phases.length > 0 ? run.phases.join(" → ") : "(phases not captured)";
343
+ const lines = [
344
+ `When this situation recurs, the workflow "${run.name}" handled it end to end and its output passed verification.`,
345
+ "",
346
+ ];
347
+ if (run.description)
348
+ lines.push(`Intent: ${run.description}`);
349
+ lines.push(`Phases: ${phaseLine}`);
350
+ lines.push(`Verified by: ${run.verifyCommand}`);
351
+ lines.push("", "Replace this with the concrete steps, preconditions, and gotchas before promoting —", "the phase outline is the skeleton, not the full recipe.");
352
+ return {
353
+ id: `draft-workflow-${slug}`,
354
+ trigger: `Auto-detected from a verified workflow run: ${run.name}${run.description ? ` — ${run.description}` : ""}`,
355
+ body: lines.join("\n"),
356
+ confidence: DRAFT_CONFIDENCE,
357
+ domain: "workflow",
358
+ ngram: run.phases.length > 0 ? run.phases : [run.name],
359
+ occurrences: 1,
360
+ sessions: 1,
361
+ outcome: "workflow-verified",
362
+ };
363
+ }
package/llms.txt CHANGED
@@ -1,10 +1,10 @@
1
1
  # continuous-improvement
2
2
 
3
- > Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline 25 bundled skills, gating hooks, the Mulahazah auto-leveling instinct engine, and a GitHub Action transcript linter.
3
+ > The persistent-memory and runtime-discipline layer for Claude Code. It remembers the corrections you already gave, grounds every edit in real facts before it lands, and through the Mulahazah engine — turns each fix into a reusable instinct, so a lesson learned once is applied automatically next time with no re-teaching. Built on the 7 Laws of AI Agent Discipline (research, plan, verify, reflect, learn) and shipped as 25 bundled skills, instinct-aware hooks, an MCP toolset for recall and reflection, and a GitHub Action transcript linter that feeds real work history back into sharper instincts.
4
4
 
5
5
  ## What This Is
6
6
 
7
- A discipline framework for AI coding agents. It enforces seven laws — research, plan, execute one thing at a time, verify, reflect, iterate, learn — and builds behavioral instincts over time via the Mulahazah learning system, so the same correction does not have to be given twice.
7
+ The persistent-memory and discipline layer for AI coding agents. It carries the corrections Claude has already received from one session into the next, grounds each edit in real facts before it lands, and learns from every session so its competence compounds over time — research, plan, execute one thing at a time, verify, reflect, iterate, learn — building behavioral instincts via the Mulahazah learning system, so the same correction never has to be given twice and each run starts smarter than the last. Orchestration tools run a task; this is the layer that makes the lessons survive the run.
8
8
 
9
9
  ## Install
10
10
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.11.0",
4
- "description": "Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline 25 bundled skills, gating hooks, the Mulahazah auto-leveling instinct engine, and a GitHub Action transcript linter. Beginner: one /plugin install command. Expert: adds MCP tools and session hooks.",
3
+ "version": "3.15.0",
4
+ "description": "The persistent-memory and runtime-discipline layer for Claude Code. It remembers the corrections you already gave, grounds every edit in real facts before it lands, and through the Mulahazah engine — turns each fix into a reusable instinct, so a lesson learned once is applied automatically next time with no re-teaching. Built on the 7 Laws of AI Agent Discipline (research, plan, verify, reflect, learn) and shipped as 25 bundled skills, instinct-aware hooks, an MCP toolset for recall and reflection, and a GitHub Action transcript linter that feeds real work history back into sharper instincts. Beginner: one /plugin install command. Expert: adds MCP tools and session hooks.",
5
5
  "keywords": [
6
6
  "claude-code",
7
7
  "claude-code-skill",
@@ -29,7 +29,8 @@
29
29
  "bin": {
30
30
  "continuous-improvement": "bin/install.mjs",
31
31
  "ci-lint-transcript": "bin/lint-transcript.mjs",
32
- "ci": "bin/unified-cli.mjs"
32
+ "ci": "bin/unified-cli.mjs",
33
+ "ci-plan-pack": "bin/plan-pack.mjs"
33
34
  },
34
35
  "scripts": {
35
36
  "build": "tsc -p tsconfig.json && node bin/generate-plugin-manifests.mjs && node -e \"const fs=require('node:fs'); for (const f of fs.readdirSync('bin')) { if (f.endsWith('.mjs')) fs.chmodSync('bin/'+f, 0o755); } for (const f of fs.readdirSync('hooks')) { if (f.endsWith('.mjs')) fs.chmodSync('hooks/'+f, 0o755); } for (const f of fs.readdirSync('lib')) { if (f.endsWith('.mjs')) fs.chmodSync('lib/'+f, 0o755); } for (const f of fs.readdirSync('plugins/continuous-improvement/bin')) { if (f.endsWith('.mjs')) fs.chmodSync('plugins/continuous-improvement/bin/'+f, 0o755); } for (const f of fs.readdirSync('plugins/continuous-improvement/lib')) { if (f.endsWith('.mjs')) fs.chmodSync('plugins/continuous-improvement/lib/'+f, 0o755); } for (const f of fs.readdirSync('plugins/continuous-improvement/hooks')) { if (f.endsWith('.mjs')) fs.chmodSync('plugins/continuous-improvement/hooks/'+f, 0o755); } for (const f of fs.readdirSync('scripts')) { if (f.endsWith('.mjs')) fs.chmodSync('scripts/'+f, 0o755); } for (const f of fs.readdirSync('synthetic-checks')) { if (f.endsWith('.mjs')) fs.chmodSync('synthetic-checks/'+f, 0o755); } \"",
@@ -50,7 +51,8 @@
50
51
  "verify:test-imports-only": "node bin/check-test-imports-only.mjs",
51
52
  "verify:scripts-citation-drift": "node bin/check-scripts-citation-drift.mjs",
52
53
  "verify:third-party-shape": "node bin/check-third-party-shape.mjs",
53
- "verify:all": "npm run verify:skill-mirror && npm run verify:skill-tiers && npm run verify:skill-law-tag && npm run verify:skill-count && npm run verify:docs-substrings && npm run verify:everything-mirror && npm run verify:routing-targets && npm run verify:doc-runtime-claims && npm run verify:test-imports-only && npm run verify:scripts-citation-drift && npm run verify:third-party-shape && npm run typecheck"
54
+ "verify:tool-count": "node bin/check-tool-count.mjs",
55
+ "verify:all": "npm run verify:skill-mirror && npm run verify:skill-tiers && npm run verify:skill-law-tag && npm run verify:skill-count && npm run verify:docs-substrings && npm run verify:everything-mirror && npm run verify:routing-targets && npm run verify:doc-runtime-claims && npm run verify:test-imports-only && npm run verify:scripts-citation-drift && npm run verify:third-party-shape && npm run verify:tool-count && npm run typecheck"
54
56
  },
55
57
  "files": [
56
58
  ".claude-plugin/",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.11.0",
3
+ "version": "3.15.0",
4
4
  "mode": "beginner",
5
- "description": "Beginner mode: see what your agent learned, list its instincts, and request a session reflection. Bundles four discipline skills (gateguard, para-memory-files, tdd-workflow, verification-loop) so research, memory, tests, and verification happen by default.",
5
+ "description": "Beginner mode: see what your agent learned, list its instincts, and request a session reflection. Bundles three grounding skills (gateguard, tdd-workflow, verification-loop) so research, memory, tests, and verification happen by default — every edit starts from facts, not guesses.",
6
6
  "tools": [
7
7
  {
8
8
  "name": "ci_status",
@@ -53,6 +53,6 @@
53
53
  "PostToolUse",
54
54
  "UserPromptSubmit"
55
55
  ],
56
- "description": "Silently captures every tool call as observations and routes prompts to the matching discipline skill via the route table. Lightweight and non-blocking."
56
+ "description": "Silently captures every tool call as observations and routes prompts to the matching skill via the route table. Lightweight and non-blocking."
57
57
  }
58
58
  }
@@ -7,8 +7,8 @@
7
7
  "plugins": [
8
8
  {
9
9
  "name": "continuous-improvement",
10
- "description": "Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline 25 bundled skills, gating hooks, the Mulahazah auto-leveling instinct engine, and a GitHub Action transcript linter.",
11
- "version": "3.11.0",
10
+ "description": "The persistent-memory and runtime-discipline layer for Claude Code. It remembers the corrections you already gave, grounds every edit in real facts before it lands, and through the Mulahazah engine — turns each fix into a reusable instinct, so a lesson learned once is applied automatically next time with no re-teaching. Built on the 7 Laws of AI Agent Discipline (research, plan, verify, reflect, learn) and shipped as 25 bundled skills, instinct-aware hooks, an MCP toolset for recall and reflection, and a GitHub Action transcript linter that feeds real work history back into sharper instincts.",
11
+ "version": "3.15.0",
12
12
  "source": "./",
13
13
  "author": {
14
14
  "name": "naimkatiman"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.11.0",
4
- "description": "Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline 25 bundled skills, gating hooks, the Mulahazah auto-leveling instinct engine, and a GitHub Action transcript linter.",
3
+ "version": "3.15.0",
4
+ "description": "The persistent-memory and runtime-discipline layer for Claude Code. It remembers the corrections you already gave, grounds every edit in real facts before it lands, and through the Mulahazah engine — turns each fix into a reusable instinct, so a lesson learned once is applied automatically next time with no re-teaching. Built on the 7 Laws of AI Agent Discipline (research, plan, verify, reflect, learn) and shipped as 25 bundled skills, instinct-aware hooks, an MCP toolset for recall and reflection, and a GitHub Action transcript linter that feeds real work history back into sharper instincts.",
5
5
  "author": {
6
6
  "name": "naimkatiman",
7
7
  "url": "https://github.com/naimkatiman"
@@ -35,7 +35,7 @@ the trade-off is fallback quality vs dedicated-skill quality.
35
35
  - `tdd-workflow` — RED/GREEN/REFACTOR + 80% coverage gate
36
36
  - `workspace-surface-audit` — environment + capability audit
37
37
  - Tier-1/Tier-2 enforcement skills (`gateguard`, `verification-loop`,
38
- `para-memory-files`, `safety-guard`, `token-budget-advisor`,
38
+ `safety-guard`, `token-budget-advisor`,
39
39
  `strategic-compact`, `wild-risa-balance`)
40
40
 
41
41
  **Optional companions the orchestrator routes to (install separately if
@@ -40,7 +40,7 @@ Pick this only when **independent** investigations can run in parallel and produ
40
40
 
41
41
  - `/ship` → fans out to `code-reviewer` + `security-auditor` + `test-engineer` in parallel, then synthesizes their reports into a go/no-go decision
42
42
 
43
- This is the only orchestration pattern this repo endorses. See `references/orchestration-patterns.md` for the full pattern catalog and anti-patterns.
43
+ This is the only orchestration pattern this repo endorses. See the **Decision matrix** below for when to fan out versus invoke a single persona.
44
44
 
45
45
  ## Decision matrix
46
46
 
@@ -107,7 +107,7 @@ The personas in this repo are designed to work as Claude Code subagents and as A
107
107
  - **As subagents:** auto-discovered when this plugin is enabled (no path config needed). Use the Agent tool with `subagent_type: code-reviewer` (or `security-auditor`, `test-engineer`). `/ship` is the canonical example.
108
108
  - **As Agent Teams teammates** (experimental, requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`): reference the same persona name when spawning a teammate. The persona's body is **appended to** the teammate's system prompt as additional instructions (not a replacement), so your persona text sits on top of the team-coordination instructions the lead installs (SendMessage, task-list tools, etc.).
109
109
 
110
- Subagents only report results back to the main agent. Agent Teams let teammates message each other directly. Use subagents when reports are enough; use Agent Teams when sub-agents need to challenge each other's findings (e.g. competing-hypothesis debugging). See `references/orchestration-patterns.md` for the full mapping.
110
+ Subagents only report results back to the main agent. Agent Teams let teammates message each other directly. Use subagents when reports are enough; use Agent Teams when sub-agents need to challenge each other's findings (e.g. competing-hypothesis debugging).
111
111
 
112
112
  Plugin agents do not support `hooks`, `mcpServers`, or `permissionMode` frontmatter — those fields are silently ignored. Avoid relying on them when authoring new personas here.
113
113
 
@@ -117,4 +117,4 @@ Plugin agents do not support `hooks`, `mcpServers`, or `permissionMode` frontmat
117
117
  2. Define the role, scope, output format, and rules.
118
118
  3. Add a **Composition** block at the bottom (Invoke directly when / Invoke via / Do not invoke from another persona).
119
119
  4. Add the persona to the table at the top of this file.
120
- 5. If the persona enables a new orchestration pattern, document it in `references/orchestration-patterns.md` rather than inventing the pattern in the persona file itself.
120
+ 5. If the persona enables a new orchestration pattern, document it in the **Decision matrix** above rather than inventing the pattern in the persona file itself.
@@ -3,7 +3,7 @@
3
3
  * continuous-improvement MCP Server
4
4
  *
5
5
  * Exposes instincts, observations, and reflection as MCP tools + resources.
6
- * Two modes: beginner (3 tools) and expert (all tools).
6
+ * Two modes: beginner (4 tools) and expert (all tools).
7
7
  *
8
8
  * Usage:
9
9
  * node bin/mcp-server.mjs # default: beginner mode
@@ -13,15 +13,15 @@
13
13
  import { execSync } from "node:child_process";
14
14
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
15
15
  import { homedir } from "node:os";
16
- import { basename, dirname, join } from "node:path";
16
+ import { basename, dirname, join, resolve } from "node:path";
17
17
  import { createInterface } from "node:readline";
18
18
  import { fileURLToPath } from "node:url";
19
19
  import { createHash } from "node:crypto";
20
20
  import { PACKAGE_NAME, VERSION, getToolDefinitions, isPluginMode, } from "../lib/plugin-metadata.mjs";
21
21
  import { formatDriftReport, parseGoalFromPlan, scoreObservations, } from "../lib/goal-state.mjs";
22
22
  import { buildIndex, formatRecallHits, parseSince, query as queryRecall, } from "../lib/recall-index.mjs";
23
- import { draftFromCandidate, extractTrajectories, findCandidates, formatCandidates, serializeDraft, } from "../lib/skill-distill.mjs";
24
- import { MAX_CLEARED_FILES, clearFiles, resolveSessionDir, } from "../lib/gateguard-state.mjs";
23
+ import { draftFromCandidate, draftFromWorkflowRun, extractTrajectories, findCandidates, formatCandidates, serializeDraft, workflowRunFromObservations, } from "../lib/skill-distill.mjs";
24
+ import { MAX_CLEARED_FILES, canonicalizeFileKey, clearFiles, resolveInstinctsRoot, resolveSessionDir, } from "../lib/gateguard-state.mjs";
25
25
  function getHomeDir() {
26
26
  return process.env.HOME || process.env.USERPROFILE || homedir();
27
27
  }
@@ -508,10 +508,11 @@ function handleTool(name, params) {
508
508
  }
509
509
  case "ci_gateguard_clear": {
510
510
  // Beginner-available on purpose: the GateGuard hook fires for every
511
- // install, so the clearance action must too. Resolves the session dir via
512
- // gateguard-state (canonical), the same way the hook does, so the marker
513
- // lands where the hook looks regardless of how each process spelled the
514
- // project root.
511
+ // install, so the clearance action must too. The hook's block reason now
512
+ // prints state_path (the session-scoped state file); honoring it writes
513
+ // the marker exactly where the hook looks. Without it the MCP server can't
514
+ // know the caller's session, so it falls back to the canonical session dir
515
+ // — correct only on the legacy unscoped path.
515
516
  const rawList = Array.isArray(params.file_paths) ? params.file_paths : [];
516
517
  const listPaths = rawList.filter((value) => typeof value === "string" && value.length > 0);
517
518
  const single = getString(params.file_path).trim();
@@ -519,7 +520,24 @@ function handleTool(name, params) {
519
520
  if (paths.length === 0) {
520
521
  return error("file_paths is required — pass the file path(s) named in the GateGuard block reason, e.g. { file_paths: [\"src/x.ts\"] }.");
521
522
  }
522
- const sessionDir = resolveSessionDir();
523
+ // state_path is a model-controlled argument, so it could be a traversal
524
+ // string (`../../etc/...`). dirname leaves `..` segments for the OS to
525
+ // resolve at write time, so without a bound this is an arbitrary-write
526
+ // primitive. Resolve + canonicalize, then require containment within the
527
+ // instincts root (the only tree the hook ever prints a state_path inside).
528
+ const rawStatePath = getString(params.state_path).trim();
529
+ let sessionDir;
530
+ if (rawStatePath) {
531
+ const resolvedKey = canonicalizeFileKey(resolve(rawStatePath));
532
+ const rootKey = canonicalizeFileKey(resolveInstinctsRoot());
533
+ if (resolvedKey !== rootKey && !resolvedKey.startsWith(`${rootKey}/`)) {
534
+ return error("state_path must resolve inside ~/.claude/instincts/. Pass it verbatim from the GateGuard block reason.");
535
+ }
536
+ sessionDir = dirname(resolve(rawStatePath));
537
+ }
538
+ else {
539
+ sessionDir = resolveSessionDir();
540
+ }
523
541
  const { cleared, skippedForCap } = clearFiles(sessionDir, paths);
524
542
  const lines = [
525
543
  "## GateGuard clearance",
@@ -837,6 +855,45 @@ function handleTool(name, params) {
837
855
  "```",
838
856
  ].join("\n"));
839
857
  }
858
+ case "ci_distill_from_workflow": {
859
+ if (MODE !== "expert") {
860
+ return error("ci_distill_from_workflow requires expert mode");
861
+ }
862
+ const run = workflowRunFromObservations(readDistillObservations(project.hash));
863
+ if (!run) {
864
+ return text("No completed-and-verified Workflow run found in this project's observations. " +
865
+ "A run qualifies when a `Workflow` tool call is followed by a passing verify/test/build in the same feed. " +
866
+ "Run a workflow, verify its output, then try `ci_distill_from_workflow` again.");
867
+ }
868
+ const draftInstinct = draftFromWorkflowRun(run);
869
+ if (!isSafeDraftId(draftInstinct.id)) {
870
+ return error(`Internal error: generated draft id "${draftInstinct.id}" failed the safety check.`);
871
+ }
872
+ const draft = serializeDraft(draftInstinct);
873
+ const draftsDir = join(INSTINCTS_DIR, project.hash, "drafts");
874
+ const draftPath = join(draftsDir, `${draftInstinct.id}.yaml`);
875
+ try {
876
+ mkdirSync(draftsDir, { recursive: true });
877
+ writeFileSync(draftPath, draft);
878
+ }
879
+ catch (err) {
880
+ return error(`Failed to write draft to ${draftPath}: ${err instanceof Error ? err.message : String(err)}`);
881
+ }
882
+ return text([
883
+ "## Draft written from a verified workflow run",
884
+ "",
885
+ `**Workflow:** ${run.name}`,
886
+ `**Path:** ${draftPath}`,
887
+ "",
888
+ "Edit the body to capture the real recipe (preconditions, concrete steps, gotchas), then promote with:",
889
+ "",
890
+ ` ci_distill_promote id=${draftInstinct.id}`,
891
+ "",
892
+ "```yaml",
893
+ draft.trimEnd(),
894
+ "```",
895
+ ].join("\n"));
896
+ }
840
897
  case "ci_distill_promote": {
841
898
  if (MODE !== "expert") {
842
899
  return error("ci_distill_promote requires expert mode");
@@ -65,7 +65,7 @@ Appended 12 instinct(s) to /Users/.../instincts/0af156594b39/instincts.jsonl
65
65
  If `tool_complete rows: 0`, the bash-fallback hook is active (no jq AND the Node observer is not on PATH) and only emits `tool_start` events. Two remediation paths:
66
66
 
67
67
  - **Install jq** — `winget install jqlang.jq` (Windows), `brew install jq` (macOS), `apt install jq` (Linux).
68
- - **Wire the Node observer** — ensure `hooks/bin/observe.mjs` is reachable from the active hook script.
68
+ - **Wire the Node observer** — ensure the installed observer shim `instincts/bin/observe.mjs` (copied from `bin/observe.mjs`) sits beside the active hook script.
69
69
 
70
70
  Both are documented in the WARNING the classifier prints on a thin-schema host.
71
71
 
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: model-forward
3
+ description: Restate the model-forward stance — go with Claude, not against it; skills are scaffolding; the durable core is goal-driven execution plus guardrails.
4
+ ---
5
+
6
+ # /model-forward
7
+
8
+ Load the `model-forward` skill and apply its stance to the current session.
9
+
10
+ 1. Restate the two invariants: goal-driven execution (anchor on the highest stated goal) and self-discipline guardrails (the 7 Laws).
11
+ 2. Audit the current task for places where custom scaffolding fights a native Claude Code capability; list each with the native alternative.
12
+ 3. Apply the decision rules from the skill before adding any new skill, hook, or wrapper to the workflow.
13
+ 4. Close with one line naming which native capability was preferred, which scaffold (if any) was proposed for retirement, and that the operator decides.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: production-readiness-review
3
+ description: "Parallel multi-agent readiness gate — fan blind reviewers across performance, security, UI/UX, and test coverage, each grounding findings in real code/logs/live data, then reconcile into one deduplicated, severity-ranked punch-list. Reports only; never fixes, merges, or deploys."
4
+ ---
5
+
6
+ # /production-readiness-review
7
+
8
+ The review-side sibling of `/ship`. Fans a set of blind, specialized reviewers across distinct dimensions, then reconciles their findings into a single prioritized punch-list. It reports — it does not fix. Fixing a finding is a separate `/ship` run.
9
+
10
+ Pure routing over existing skills and agents. Adds no new code.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /production-readiness-review [scope]
16
+ ```
17
+
18
+ `scope` defaults to the current branch diff against `origin/main`. Pass a path or PR number to narrow it.
19
+
20
+ ## Behavior
21
+
22
+ 1. **Scope** — establish ground truth: the diff under review and which changes are recent (`git diff`; `reconcile` fallback for branch/base state). Recent changes get extra scrutiny because they are the likeliest source of self-inflicted defects.
23
+ 2. **Fan out** — `superpowers:dispatching-parallel-agents` launches four reviewers, each blind to the others. Every reviewer is instructed to ground each finding in real code, logs, or live queries, and never to assume or fabricate state:
24
+ - **Performance & bundle-size** — hot paths, N+1 queries, unbounded work, regressions.
25
+ - **Security & data-access** (`security-auditor`) — authn/authz, input handling, injection, secret exposure, unsafe data access.
26
+ - **UI/UX correctness** — verified live with Playwright when the MCP is available, else static review of the changed surface.
27
+ - **Test coverage & flaky/stale mocks** (`test-engineer`) — uncovered branches, stale mocks, timing-flaky tests.
28
+ 3. **Reconcile** — a final pass dedupes findings across reviewers, ranks each CRITICAL / HIGH / MEDIUM / LOW by severity and confidence, and explicitly flags any defect introduced by the changes under review.
29
+ 4. **Present** — emit the consolidated punch-list, severity-ranked, with file references. **Stop.**
30
+
31
+ ## Hard stops (report, never act)
32
+
33
+ - Does not fix, edit, commit, merge, or deploy anything — output is a punch-list only.
34
+ - A reviewer that cannot ground a finding marks it `unverified` rather than asserting it.
35
+ - If a dimension's tooling is unavailable (e.g. no Playwright MCP), it says so rather than silently skipping coverage.
36
+
37
+ ## Anti-patterns this command refuses
38
+
39
+ - **Fabricated state.** No finding may rest on an assumed SHA, row, or log line — ground it or mark it `unverified`.
40
+ - **Silent skip.** A dimension that cannot run is reported as not-run, never dropped from the summary.
41
+ - **Drive-by fix.** Findings become `/ship` tasks; this command does not touch code.
42
+
43
+ ## Composition
44
+
45
+ Routes through: `reconcile` (scope/ground truth) → `superpowers:dispatching-parallel-agents` (fan-out) → the `security-auditor` and `test-engineer` agents (two of the four dimensions) → a reconciliation pass that ranks and dedupes. Each step falls back to its inline behavior when the preferred skill or agent is not installed.
46
+
47
+ ## Example
48
+
49
+ ```
50
+ /production-readiness-review #246
51
+ ```
52
+
53
+ Scopes PR #246's diff, fans four blind reviewers across performance, security, UI/UX, and test coverage, then returns one deduplicated severity-ranked punch-list — flagging anything the PR's own changes introduced — and stops for you to prioritize.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: ship
3
+ description: "Single-defect fast path — walk one bug from ground-truth audit through a TDD fix, full verification, a single-concern commit, and an open PR, then stop. Never auto-merges, never deploys. For multi-PR rollouts use /release-train instead."
4
+ ---
5
+
6
+ # /ship
7
+
8
+ The one-defect fast path. `/release-train` is for stacked multi-PR rollouts and `/proceed-with-the-recommendation` walks an arbitrary recommendation list; `/ship` is the common case: fix one defect, open one PR, hand it back for review.
9
+
10
+ Pure routing over existing skills. It adds no new orchestration logic and it does NOT bypass branch protection, force-push, auto-merge, or deploy.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /ship <one-line description of the defect>
16
+ ```
17
+
18
+ If the description is ambiguous or names more than one concern, `/ship` halts and asks you to narrow it — one defect per run.
19
+
20
+ ## Behavior
21
+
22
+ In order, for the single defect:
23
+
24
+ 1. **Ground truth** — `reconcile` (or its inline fallback): confirm the working tree is clean and on a feature branch cut from an up-to-date `origin/<base>`. If on a protected branch or a stale base, halt and ask.
25
+ 2. **Reproduce (RED)** — `tdd-workflow`: write a failing test that reproduces the defect; watch it fail. Pre-test implementation code is deleted, not kept.
26
+ 3. **Fix (GREEN)** — write the minimal change that makes the test pass; watch it pass. One concern only.
27
+ 4. **Verify** — `verification-loop`: run the project's verify ladder (build, types, tests). Build-green is evidence of mechanism, not of the fix — confirm the defect itself no longer reproduces.
28
+ 5. **Commit** — one commit, one concern, staged by explicit filename (never `git add -A`). Use a Windows-safe commit message: a single-line `-m` (repeat `-m` for paragraphs) or `git commit -F <tempfile>` — no multi-line here-docs/here-strings.
29
+ 6. **Open PR** — `commit-commands:commit-push-pr` (or `gh pr create`): push the branch and open a single-concern PR that cites the plan or issue. **Stop here.** The merge is yours.
30
+ 7. **Deploy receipt (advisory)** — after you merge, `deploy-receipt` verifies the deployed SHA matches the merge SHA. Advisory only; `/ship` does not deploy.
31
+
32
+ ## Hard stops (halt and ask, never improvise)
33
+
34
+ - Ambiguous or multi-concern defect description.
35
+ - Working tree not clean, or branch is protected / cut from a stale base.
36
+ - Any verification step fails with a non-obvious fix.
37
+ - The fix would touch more than 15 non-generated files (that is no longer one concern — split it, or use `/release-train`).
38
+ - Push would target a protected branch.
39
+
40
+ ## Anti-patterns this command refuses
41
+
42
+ - **Auto-merge.** Never merges the PR it opens, even when CI is green.
43
+ - **Deploy.** Never runs a deploy; `deploy-receipt` only verifies after you merge.
44
+ - **Bypass.** No `--admin`, `--force`, `--no-verify`.
45
+ - **Bundled concerns.** Will not fold an unrelated fix into the same commit; logs it as a deferred follow-up instead.
46
+
47
+ ## Composition
48
+
49
+ Routes through, in order: `reconcile` → `tdd-workflow` → `verification-loop` → `commit-commands:commit-push-pr` → `deploy-receipt`. Each step falls back to its inline behavior when the preferred skill is not installed.
50
+
51
+ ## Example
52
+
53
+ ```
54
+ /ship registration form accepts a negative deposit amount
55
+ ```
56
+
57
+ Reconciles git state, writes a failing test asserting deposits must be positive, implements the guard, runs the verify ladder, commits one concern with a single-line message, opens the PR, and stops for your review.
@@ -17,7 +17,7 @@ The 7 Laws define *what* discipline must be applied. `/superpowers` decides *whi
17
17
  | `obra/superpowers` (Jesse Vincent) | vendored at `third-party/superpowers/`, pinned SHA `f2cbfbe` (v5.1.0) | `superpowers:brainstorming`, `:writing-plans`, `:executing-plans`, `:test-driven-development`, `:systematic-debugging`, `:requesting-code-review`, `:receiving-code-review`, `:verification-before-completion`, `:dispatching-parallel-agents`, `:using-git-worktrees`, `:finishing-a-development-branch`, `:subagent-driven-development`, `:writing-skills`, `:using-superpowers` |
18
18
  | `addyosmani/agent-skills` | vendored at `third-party/addy-agent-skills/`, pinned SHA `742dca5` (v1.0.0) | `spec-driven-development`, `source-driven-development`, `context-engineering`, `idea-refine`, `incremental-implementation`, `code-review-and-quality`, `code-simplification`, `security-and-hardening`, `debugging-and-error-recovery`, `performance-optimization`, `api-and-interface-design`, `frontend-ui-engineering`, `browser-testing-with-devtools`, `ci-cd-and-automation`, `deprecation-and-migration`, `documentation-and-adrs`, `git-workflow-and-versioning`, `planning-and-task-breakdown`, `shipping-and-launch` |
19
19
  | `ruflo-swarm` (ruvnet) | vendored at `third-party/ruflo-swarm/`, pinned SHA `addb5cd` (v0.2.0) | `swarm-init`, `monitor-stream`; `swarm_*` and `agent_*` MCP tools; `/swarm`, `/watch` |
20
- | `oh-my-claudecode` (Yeachan-Heo) | vendored at `third-party/oh-my-claudecode/`, pinned SHA `aacde3e` (v4.13.6) | 39 skills + 19 agents — `release`, `ultrawork`, `ultraqa`, `team`, `trace`, `visual-verdict`, `debug`, `deep-dive`, `deep-interview`, `autopilot`, `autoresearch`, plus a separate `ralph` (overlaps with our `/ralph` — see "Distinct variants" below) |
20
+ | `oh-my-claudecode` (Yeachan-Heo) | vendored at `third-party/oh-my-claudecode/`, pinned SHA `aacde3e` (v4.13.6) | 38 skills + 19 agents — `release`, `ultrawork`, `ultraqa`, `team`, `trace`, `visual-verdict`, `debug`, `deep-dive`, `deep-interview`, `autopilot`, `autoresearch`, plus a separate `ralph` (overlaps with our `/ralph` — see "Distinct variants" below) |
21
21
 
22
22
  PM coverage (product-management skills) lives **outside** this marketplace. If you need it, install [`phuryn/pm-skills`](https://github.com/phuryn/pm-skills) separately via Claude Code's host marketplace; the dispatcher names it as a routing target without pre-resolving the namespace. See [docs/THIRD_PARTY.md § Routing in /superpowers](../docs/THIRD_PARTY.md#routing-in-superpowers).
23
23