continuous-improvement 3.15.0 → 3.16.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.
@@ -0,0 +1,115 @@
1
+ // version-check.mts — Pure update-check decision core + a thin npm-registry fetch
2
+ // helper. The decision functions take no ambient I/O: the caller injects the local
3
+ // version, the fetched remote version, the cached state, and the clock, so the whole
4
+ // thing is unit-testable offline (mirrors how the goal-state / recall scorers are
5
+ // structured). The ONLY network is fetchLatestNpmVersion, which fails closed
6
+ // (returns null) on any error. No telemetry: a one-way read of the public registry.
7
+ //
8
+ // Wired into bin/install.mts at install end so the nudge only appears when the user
9
+ // explicitly invokes the CLI. See docs/plans/2026-06-25-version-check-nudge.md.
10
+ // Two-tier TTL, copied from gstack: poll often while up-to-date so a release is
11
+ // caught quickly, then back off once an upgrade is known so the nudge is not
12
+ // re-fetched on every invocation.
13
+ export const TTL_UP_TO_DATE_MS = 60 * 60 * 1000; // 60 min
14
+ export const TTL_UPGRADE_MS = 12 * 60 * 60 * 1000; // 720 min
15
+ const NPM_REGISTRY = "https://registry.npmjs.org";
16
+ /** Parse "a.b.c" (ignoring a leading v and any -prerelease/+build suffix) into a
17
+ * numeric triple. Fail closed: any non-numeric core component returns null. */
18
+ export function parseSemver(version) {
19
+ if (typeof version !== "string")
20
+ return null;
21
+ const core = version.trim().replace(/^v/, "").split(/[-+]/)[0] ?? "";
22
+ const parts = core.split(".");
23
+ if (parts.length !== 3)
24
+ return null;
25
+ const nums = parts.map((p) => (/^\d+$/.test(p) ? Number(p) : NaN));
26
+ if (nums.some((n) => !Number.isFinite(n)))
27
+ return null;
28
+ return [nums[0], nums[1], nums[2]];
29
+ }
30
+ /** Is `remote` a strictly higher release than `local`? Non-semver on either side
31
+ * fails closed to false (never nudge on garbage; never nudge a dev build that is
32
+ * ahead of or equal to the registry). */
33
+ export function isNewer(remote, local) {
34
+ const r = parseSemver(remote);
35
+ const l = parseSemver(local);
36
+ if (!r || !l)
37
+ return false;
38
+ for (let i = 0; i < 3; i += 1) {
39
+ if (r[i] > l[i])
40
+ return true;
41
+ if (r[i] < l[i])
42
+ return false;
43
+ }
44
+ return false;
45
+ }
46
+ /** Should the network fetch be skipped because the cached result is still fresh?
47
+ * Absent/NaN checkedAt fails OPEN (fetch) — a corrupt cache must not wedge the
48
+ * check off permanently. */
49
+ export function isThrottled(cache, now) {
50
+ if (!cache || typeof cache.checkedAt !== "number" || !Number.isFinite(cache.checkedAt))
51
+ return false;
52
+ const ttl = cache.status === "upgrade-available" ? TTL_UPGRADE_MS : TTL_UP_TO_DATE_MS;
53
+ return now - cache.checkedAt < ttl;
54
+ }
55
+ function buildNotice(local, remote) {
56
+ return (`continuous-improvement ${remote} is available (you have ${local}). ` +
57
+ "Update: marketplace → /plugin marketplace update continuous-improvement, " +
58
+ "or npm → npx continuous-improvement install. Silence: CLAUDE_CI_UPDATE_CHECK=off");
59
+ }
60
+ /** Re-surface a still-valid pending upgrade straight from the cache, so a throttled
61
+ * invocation does not lose the nudge. Returns null unless the cache says an upgrade
62
+ * is pending AND that cached remote is still newer than the current local. */
63
+ export function pendingNotice(cache, local) {
64
+ if (!cache || cache.status !== "upgrade-available")
65
+ return null;
66
+ if (typeof cache.remote !== "string" || !isNewer(cache.remote, local))
67
+ return null;
68
+ return buildNotice(local, cache.remote);
69
+ }
70
+ /** The pure decision from a fresh fetch. `remote === null` (fetch failed) yields
71
+ * `unknown` with no notice and no cache write, so the next invocation retries
72
+ * rather than caching a false "up-to-date". */
73
+ export function evaluateUpdateCheck(args) {
74
+ const { local, remote, now } = args;
75
+ if (remote === null || parseSemver(remote) === null) {
76
+ return { status: "unknown", notice: null, nextCache: null };
77
+ }
78
+ if (isNewer(remote, local)) {
79
+ return {
80
+ status: "upgrade-available",
81
+ notice: buildNotice(local, remote),
82
+ nextCache: { status: "upgrade-available", local, remote, checkedAt: now },
83
+ };
84
+ }
85
+ return {
86
+ status: "up-to-date",
87
+ notice: null,
88
+ nextCache: { status: "up-to-date", local, remote, checkedAt: now },
89
+ };
90
+ }
91
+ /** Fetch the `latest` dist-tag version for a package from the public npm registry.
92
+ * The only network in this module. Fails closed (returns null) on any error:
93
+ * timeout, non-2xx, malformed JSON, or a non-semver version string. fetchImpl and
94
+ * timeoutMs are injectable so callers and tests stay offline-deterministic. */
95
+ export async function fetchLatestNpmVersion(pkg, opts = {}) {
96
+ const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
97
+ if (typeof fetchImpl !== "function")
98
+ return null;
99
+ try {
100
+ const res = await fetchImpl(`${NPM_REGISTRY}/${pkg}/latest`, {
101
+ headers: { Accept: "application/vnd.npm.install-v1+json" },
102
+ signal: AbortSignal.timeout(opts.timeoutMs ?? 5000),
103
+ });
104
+ if (!res.ok)
105
+ return null;
106
+ const body = (await res.json());
107
+ const version = typeof body.version === "string" ? body.version : null;
108
+ if (!version || parseSemver(version) === null)
109
+ return null;
110
+ return version;
111
+ }
112
+ catch {
113
+ return null;
114
+ }
115
+ }
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # continuous-improvement
2
2
 
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.
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 26 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
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "continuous-improvement",
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.",
3
+ "version": "3.16.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 26 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",
@@ -44,6 +44,7 @@
44
44
  "verify:skill-tiers": "node bin/check-skill-tiers.mjs",
45
45
  "verify:skill-law-tag": "node bin/check-skill-law-tag.mjs",
46
46
  "verify:skill-count": "node bin/check-skill-count.mjs",
47
+ "verify:skill-count-prose": "node bin/check-skill-count-prose.mjs",
47
48
  "verify:docs-substrings": "node bin/check-docs-substrings.mjs",
48
49
  "verify:everything-mirror": "node bin/check-everything-mirror.mjs",
49
50
  "verify:routing-targets": "node bin/check-routing-targets.mjs",
@@ -52,7 +53,7 @@
52
53
  "verify:scripts-citation-drift": "node bin/check-scripts-citation-drift.mjs",
53
54
  "verify:third-party-shape": "node bin/check-third-party-shape.mjs",
54
55
  "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"
56
+ "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:skill-count-prose && 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"
56
57
  },
57
58
  "files": [
58
59
  ".claude-plugin/",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "mode": "beginner",
5
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,8 +7,8 @@
7
7
  "plugins": [
8
8
  {
9
9
  "name": "continuous-improvement",
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",
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 26 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.16.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.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.",
3
+ "version": "3.16.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 26 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"
@@ -219,6 +219,7 @@ function readDistillObservations(projectHash) {
219
219
  tool: getString(observation.tool),
220
220
  input_summary: getString(observation.input_summary),
221
221
  output_summary: getString(observation.output_summary),
222
+ event: getString(observation.event),
222
223
  }));
223
224
  }
224
225
  function detectLevel(projectHash) {
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: roast
3
+ description: "Convene a 5-persona adversarial council (Contrarian, Expansionist, Logician, Researcher, Buyer) to pressure-test an idea, then deliver one GO / RESHAPE / KILL verdict plus the cheapest 48-hour test to de-risk it. Enforces Law 1 (Research Before Executing)."
4
+ argument-hint: "[the idea to roast]"
5
+ ---
6
+
7
+ # /roast
8
+
9
+ Pressure-test an idea before you build it. Convene a council of five independent persona agents who attack the idea from every angle, then act as the Judge and return one decisive verdict — so Law 1 (Research Before Executing) is satisfied on the *idea* itself, not just the plan.
10
+
11
+ ## Trigger phrases
12
+
13
+ - `/roast`
14
+ - `/roast <the idea>`
15
+ - "roast this idea"
16
+ - "convene the council"
17
+ - "pressure-test this" / "stress-test this idea"
18
+ - "validate this business idea"
19
+ - "give me a brutal second opinion before I build this"
20
+
21
+ ## What happens
22
+
23
+ 1. **Brief.** Read the idea from the argument (if given) and ask up to 3-4 clarifying questions in one batch — the idea, the buyer + money model, your edge, your constraints. Skip the questions if the user says "just run it."
24
+ 2. **Council (parallel).** Spin up all five personas in parallel, each pasted the same brief: Contrarian (assume it fails), Expansionist (the 10x case), Logician (first-principles, no web), Researcher (web evidence + competitors), Buyer (role-play the target customer). Each returns a stance, 3-5 sharp points, the one thing you must hear, and a 1-10 score.
25
+ 3. **Verdict.** Act as the Judge: resolve the council's tension, fold in the economics lens, and return one `GO / RESHAPE / KILL` call with the biggest risk, biggest upside, money read, and — most importantly — the cheapest 48-hour test to validate the riskiest assumption before building anything.
26
+
27
+ ## Skill file
28
+
29
+ Full behavior is defined in [`skills/roast.md`](../skills/roast.md).
30
+
31
+ ## Pairs with
32
+
33
+ - `/grill-me` — roast validates the idea; grill-me then hardens the plan.
34
+ - `/proceed-with-the-recommendation` — walk the verdict's next steps under the 7 Laws.
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "Gateguard fact-forcing PreToolUse, companion-preference enforcement, observation, session lifecycle, 3-section-close discipline, goal-drift Stop gate, and UserPromptSubmit lazy-routing plus opt-in proactive recall-briefing hooks for continuous-improvement.",
2
+ "description": "Gateguard fact-forcing PreToolUse, companion-preference enforcement, observation, session lifecycle, 3-section-close discipline, goal-drift Stop gate, opt-in workflow-distill Stop nudge, and UserPromptSubmit lazy-routing plus opt-in proactive recall-briefing hooks for continuous-improvement.",
3
3
  "hooks": {
4
4
  "PreToolUse": [
5
5
  {
@@ -88,6 +88,11 @@
88
88
  "type": "command",
89
89
  "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/goal-drift-stop.mjs\"",
90
90
  "timeout": 5
91
+ },
92
+ {
93
+ "type": "command",
94
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/workflow-distill.mjs\"",
95
+ "timeout": 5
91
96
  }
92
97
  ]
93
98
  }
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env node
2
+ // workflow-distill.mts — Stop hook (opt-in, default off) that nudges the operator
3
+ // to persist a verified native Workflow run as a Mulahazah draft instinct via the
4
+ // ci_distill_from_workflow MCP tool. This is the one integration a per-turn
5
+ // orchestration primitive cannot do for itself: make the lesson of an expensive
6
+ // multi-agent run survive the run instead of evaporating when the turn ends — the
7
+ // fast-follow deferred in docs/plans/2026-06-08-workflow-instinct-bridge.md.
8
+ //
9
+ // Mode via CLAUDE_WORKFLOW_DISTILL_NUDGE: "on" | "off" (default).
10
+ // - off (default): no-op. Operators who do not use native Workflows are never
11
+ // nagged.
12
+ // - on: if the session's observation feed shows a verified Workflow run that
13
+ // has not already been nudged, print ONE stderr line suggesting
14
+ // ci_distill_from_workflow. It is an amplifier, never a gate — it cannot
15
+ // block the Stop and writes nothing to stdout.
16
+ //
17
+ // Project-hash resolution is byte-identical to bin/observe.mts and
18
+ // hooks/goal-drift-stop.mts so this hook reads the SAME observations.jsonl the
19
+ // observer writes. The "is this run verified" decision is the pure, already-tested
20
+ // workflowRunFromObservations (src/lib/skill-distill.mts), which fails closed:
21
+ // no Workflow row, unparseable meta, or no following verify-exit-0 => null => no
22
+ // nudge. Per-run dedup state lives in
23
+ // ~/.claude/instincts/<project-hash>/workflow-distill-state.json keyed by run
24
+ // name + verify command, so a run is nudged at most once. Fail-open by
25
+ // construction: any error exits 0 and never blocks. No network. 5s hook budget.
26
+ import { execFileSync } from "node:child_process";
27
+ import { createHash } from "node:crypto";
28
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
29
+ import { join } from "node:path";
30
+ import { resolveHomeDir } from "../lib/resolve-home-dir.mjs";
31
+ import { workflowRunFromObservations } from "../lib/skill-distill.mjs";
32
+ function safeJsonParse(text) {
33
+ try {
34
+ return JSON.parse(text);
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ }
40
+ function resolveMode() {
41
+ return (process.env.CLAUDE_WORKFLOW_DISTILL_NUDGE ?? "off").trim().toLowerCase() === "on" ? "on" : "off";
42
+ }
43
+ // Mirrors bin/observe.mts:resolveProjectRoot — the same basis the observer uses
44
+ // to bucket observations.jsonl, so the hash here resolves to the same file.
45
+ function resolveProjectRoot() {
46
+ const fromEnv = process.env.CLAUDE_PROJECT_DIR;
47
+ if (fromEnv)
48
+ return fromEnv;
49
+ try {
50
+ const root = execFileSync("git", ["rev-parse", "--show-toplevel"], {
51
+ encoding: "utf8",
52
+ stdio: ["ignore", "pipe", "ignore"],
53
+ }).trim();
54
+ if (root)
55
+ return root;
56
+ }
57
+ catch {
58
+ // not a git repo
59
+ }
60
+ return "global";
61
+ }
62
+ function projectHash(root) {
63
+ return createHash("sha256").update(root).digest("hex").slice(0, 12);
64
+ }
65
+ function readObservations(instinctsProjectDir) {
66
+ const file = join(instinctsProjectDir, "observations.jsonl");
67
+ try {
68
+ if (!existsSync(file))
69
+ return [];
70
+ const lines = readFileSync(file, "utf8")
71
+ .split("\n")
72
+ .filter((line) => line.trim().length > 0);
73
+ const out = [];
74
+ // A workflow row plus its following verify both sit near the tail; a bounded
75
+ // window keeps the 5s budget safe on a long-lived feed.
76
+ for (const line of lines.slice(-5000)) {
77
+ const row = safeJsonParse(line);
78
+ if (!row)
79
+ continue;
80
+ out.push({
81
+ ts: typeof row.ts === "string" ? row.ts : "",
82
+ session: typeof row.session === "string" ? row.session : "",
83
+ session_id: typeof row.session_id === "string" ? row.session_id : "",
84
+ tool: typeof row.tool === "string" ? row.tool : "",
85
+ input_summary: typeof row.input_summary === "string" ? row.input_summary : "",
86
+ output_summary: typeof row.output_summary === "string" ? row.output_summary : "",
87
+ });
88
+ }
89
+ return out;
90
+ }
91
+ catch {
92
+ return [];
93
+ }
94
+ }
95
+ function readNudgedKeys(instinctsProjectDir) {
96
+ const file = join(instinctsProjectDir, "workflow-distill-state.json");
97
+ try {
98
+ if (!existsSync(file))
99
+ return new Set();
100
+ const parsed = safeJsonParse(readFileSync(file, "utf8"));
101
+ const arr = parsed && Array.isArray(parsed.nudged) ? parsed.nudged : [];
102
+ return new Set(arr.filter((x) => typeof x === "string"));
103
+ }
104
+ catch {
105
+ return new Set();
106
+ }
107
+ }
108
+ function persistNudged(instinctsProjectDir, keys) {
109
+ try {
110
+ mkdirSync(instinctsProjectDir, { recursive: true });
111
+ writeFileSync(join(instinctsProjectDir, "workflow-distill-state.json"), JSON.stringify({ ts: new Date().toISOString(), nudged: [...keys] }) + "\n", "utf8");
112
+ }
113
+ catch {
114
+ // dedup persistence is best-effort; never throw
115
+ }
116
+ }
117
+ function main() {
118
+ if (resolveMode() === "off")
119
+ return;
120
+ const home = resolveHomeDir();
121
+ if (!home)
122
+ return;
123
+ const projectRoot = resolveProjectRoot();
124
+ const instinctsProjectDir = join(home, ".claude", "instincts", projectHash(projectRoot));
125
+ const observations = readObservations(instinctsProjectDir);
126
+ if (observations.length === 0)
127
+ return;
128
+ const run = workflowRunFromObservations(observations);
129
+ if (!run)
130
+ return; // fail closed: no verified run, nothing to nudge
131
+ const runKey = `${run.name}::${run.verifyCommand}`;
132
+ const nudged = readNudgedKeys(instinctsProjectDir);
133
+ if (nudged.has(runKey))
134
+ return; // already nudged this run — stay quiet
135
+ process.stderr.write(`[continuous-improvement] workflow-distill: verified workflow run "${run.name}" detected — ` +
136
+ "run the ci_distill_from_workflow MCP tool to persist it as a Mulahazah draft instinct.\n");
137
+ nudged.add(runKey);
138
+ persistNudged(instinctsProjectDir, nudged);
139
+ }
140
+ try {
141
+ main();
142
+ }
143
+ catch {
144
+ // fail open — never block the session due to a hook bug
145
+ }
@@ -26,7 +26,7 @@ const KEYWORDS = [
26
26
  "transcript-linter",
27
27
  ];
28
28
  const CLAUDE_PLUGIN_CATEGORY = "productivity";
29
- const SHARED_PLUGIN_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.";
29
+ const SHARED_PLUGIN_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 26 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.";
30
30
  // Four vendored upstream companions registered alongside the CI plugin.
31
31
  // Each entry points at a pinned-SHA snapshot under third-party/<name>/.
32
32
  // See third-party/MANIFEST.md for refresh recipes and per-snapshot
@@ -492,6 +492,11 @@ export function getPluginHooksConfig() {
492
492
  command: "node \"${CLAUDE_PLUGIN_ROOT}/hooks/goal-drift-stop.mjs\"",
493
493
  timeout: 5,
494
494
  };
495
+ const workflowDistillCommand = {
496
+ type: "command",
497
+ command: "node \"${CLAUDE_PLUGIN_ROOT}/hooks/workflow-distill.mjs\"",
498
+ timeout: 5,
499
+ };
495
500
  const routePromptCommand = {
496
501
  type: "command",
497
502
  command: "node \"${CLAUDE_PLUGIN_ROOT}/hooks/route-prompt.mjs\"",
@@ -503,7 +508,7 @@ export function getPluginHooksConfig() {
503
508
  timeout: 5,
504
509
  };
505
510
  return {
506
- description: "Gateguard fact-forcing PreToolUse, companion-preference enforcement, observation, session lifecycle, 3-section-close discipline, goal-drift Stop gate, and UserPromptSubmit lazy-routing plus opt-in proactive recall-briefing hooks for continuous-improvement.",
511
+ description: "Gateguard fact-forcing PreToolUse, companion-preference enforcement, observation, session lifecycle, 3-section-close discipline, goal-drift Stop gate, opt-in workflow-distill Stop nudge, and UserPromptSubmit lazy-routing plus opt-in proactive recall-briefing hooks for continuous-improvement.",
507
512
  hooks: {
508
513
  // gateguard runs FIRST on PreToolUse so its block decision short-circuits
509
514
  // before companion-preference sees the call. companion-preference runs
@@ -527,7 +532,7 @@ export function getPluginHooksConfig() {
527
532
  UserPromptSubmit: [{ hooks: [routePromptCommand, recallBriefingCommand] }],
528
533
  SessionStart: [{ hooks: [sessionCommand] }],
529
534
  SessionEnd: [{ hooks: [sessionCommand] }],
530
- Stop: [{ hooks: [threeSectionCloseCommand, goalDriftStopCommand] }],
535
+ Stop: [{ hooks: [threeSectionCloseCommand, goalDriftStopCommand, workflowDistillCommand] }],
531
536
  },
532
537
  };
533
538
  }
@@ -31,6 +31,7 @@ skill set on disk.
31
31
  - `handoff` — Enforces Law 5 (Reflect After Every Session) of the 7 Laws of AI Agent Discipline. Compact the current conversation into a handoff document for another agent to pick up. Ported from mattpocock/skills under MIT.
32
32
  - `reconcile` — Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations, and verifies a push actually landed instead of assuming it did.
33
33
  - `recovery-classification` — Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. After any failure in the verification ladder or auto-loop, classify the failure class before retrying — provider, tool-schema, deterministic-policy, git, worktree, runtime — so retry-vs-pause-vs-self-heal-vs-stop is an intentional decision, not a generic 'try again'.
34
+ - `roast` — Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Convene a 5-persona adversarial council (Contrarian, Expansionist, Logician, Researcher, Buyer) that attacks an idea from every angle, then a Judge returns one GO / RESHAPE / KILL verdict plus the cheapest 48-hour test to de-risk it — so you pressure-test an idea before sinking time into building the wrong thing.
34
35
  - `safety-guard` — Enforces Law 3 (One Thing at a Time) of the 7 Laws of AI Agent Discipline by scoping edits to a directory and blocking destructive shell commands. Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
35
36
  - `skill-distillation` — Enforces Law 7 (Learn From Every Session) of the 7 Laws of AI Agent Discipline. Distills repeated successful tool sequences into reusable draft instincts, so a pattern that worked three times becomes a captured recipe instead of being re-derived from scratch every session.
36
37
  - `state-reconciliation` — Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Pre-dispatch invariant: reconcile DB-vs-disk-vs-memory state before any unit runs, so a stale flag, missing artifact, or out-of-sync row never re-dispatches a unit that already completed or never started.
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: roast
3
+ tier: "2"
4
+ description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Convene a 5-persona adversarial council (Contrarian, Expansionist, Logician, Researcher, Buyer) that attacks an idea from every angle, then a Judge returns one GO / RESHAPE / KILL verdict plus the cheapest 48-hour test to de-risk it — so you pressure-test an idea before sinking time into building the wrong thing.
5
+ origin: continuous-improvement
6
+ user-invocable: true
7
+ argument-hint: "[the idea to roast]"
8
+ ---
9
+
10
+ # /roast — Convene the council before you build
11
+
12
+ Claude's default is to agree with you. `/roast` is the opposite. Law 1 says research before executing — and the cheapest, most-skipped research is an honest adversarial read of the idea *itself* before any plan or code exists. This skill convenes a council of five independent persona agents who tear an idea apart and build it up from every angle, then a Judge synthesizes everything into one decisive verdict.
13
+
14
+ The council is adversarial on purpose. No persona is allowed to hedge or be polite. The point is to surface what you can't see because you're too close to it — and to do it in an hour, not after a month of building.
15
+
16
+ Adapted from the community `/roast` idea-council pattern and reshaped as a continuous-improvement-native Law 1 skill.
17
+
18
+ ## When to activate
19
+
20
+ - Before you sink time or money into building something — a product, a feature, a business, a bet.
21
+ - When you catch yourself (or the agent) agreeing with a plan that has never been attacked.
22
+ - The user types `/roast`, "roast this idea", "convene the council", "pressure-test this", "stress-test this idea", "validate this business idea", or "give me a brutal second opinion".
23
+ - A `/proceed-with-the-recommendation` walk is about to start but the *premise* underneath the recommendation list was never challenged.
24
+
25
+ ## Step 1: Get the brief
26
+
27
+ If `$ARGUMENTS` contains the idea, start there. Then ask a tight set of clarifying questions so the council judges something real. Ask only what hasn't already been provided — 3-4 questions max, in **one batch**:
28
+
29
+ 1. **The idea** in one or two sentences (what it is, what it does).
30
+ 2. **Who it's for** and **how it makes money** (the buyer + the price/model).
31
+ 3. **Your edge** — relevant skills, audience, or assets you already have.
32
+ 4. **Constraints** — budget, timeline, how fast you need the first dollar.
33
+
34
+ If the user says "just run it" or has already given you enough, skip the questions and proceed. Don't over-interrogate — one round, then convene.
35
+
36
+ Write the brief into a single short paragraph you will paste verbatim into every council member's prompt, so all five judge the same thing.
37
+
38
+ ## Step 2: Convene the council (5 agents, in parallel)
39
+
40
+ Spin up **all five agents in parallel in a single message** — one subagent each (`general-purpose`). Paste the same brief into each, then give it its persona mandate below.
41
+
42
+ Each council member must return: a one-line stance, their 3-5 sharpest points, the single most important thing the user must hear, and a 1-10 score on their own dimension (1 = walk away, 10 = no-brainer).
43
+
44
+ **1. The Contrarian (Red Team)**
45
+ > You are the Contrarian on an idea council. Assume this idea fails. Find the fatal flaws, the fastest way it dies, and the load-bearing assumptions that are probably wrong. Be ruthless and specific. No hedging, no "but it could work." Attack the weakest points. THE BRIEF: [brief]
46
+
47
+ **2. The Expansionist (Bull)**
48
+ > You are the Expansionist on an idea council. Make the strongest possible case FOR this idea. Find the biggest upside, the 10x version, the adjacent opportunities and unlock points the founder isn't seeing. Fight for the potential. Be specific about where the real money and leverage could be. THE BRIEF: [brief]
49
+
50
+ **3. The Logician (First principles)**
51
+ > You are the Logician on an idea council. Use NO outside research and NO web. Reason purely from first principles: does the core mechanism make sense, do the incentives line up, is the underlying logic sound, does the math even work in theory? Strip it to fundamentals and tell us if it holds together. THE BRIEF: [brief]
52
+
53
+ **4. The Researcher (Evidence)**
54
+ > You are the Researcher on an idea council. Use web search. Bring real-world evidence: who the existing competitors are, market size or demand signals, what comparable products charge, whether this is validated by what's already out there or contradicted by it. Cite what you find. Is the real world saying yes or no? THE BRIEF: [brief]
55
+
56
+ **5. The Buyer (Voice of customer)**
57
+ > You are the Buyer on an idea council. Role-play the exact target customer described in the brief. React as them, in first person. Would you actually pay for this? What's your real objection? What would make you choose a competitor or just do nothing instead? What price feels right, and what would make you say yes today? Be the honest, slightly skeptical customer, not a cheerleader. THE BRIEF: [brief]
58
+
59
+ ## Step 3: The Judge delivers the verdict
60
+
61
+ Once all five return, YOU act as the Judge. Read every council member's findings, weigh them, and synthesize one decisive verdict. Do not average the scores. Name the real tension between the personas and resolve it.
62
+
63
+ Fold in the **economics lens** yourself: rough pricing, realistic time-to-first-dollar, and whether the user can actually ship this fast given the edge they described.
64
+
65
+ Output the verdict in this exact shape:
66
+
67
+ ```
68
+ ## THE VERDICT: GO / RESHAPE / KILL
69
+ Confidence: [low / medium / high]
70
+
71
+ **The call in one line:** [the decision, plainly]
72
+
73
+ **Why:** [2-3 sentences resolving the council's tension]
74
+
75
+ **Biggest risk:** [the single thing most likely to kill it]
76
+ **Biggest upside:** [the strongest reason to do it]
77
+
78
+ **Money read:** [rough price, time-to-first-dollar, can they ship fast]
79
+
80
+ **The cheapest 48-hour test:** [the smallest, fastest thing they can do
81
+ to validate the riskiest assumption BEFORE building anything]
82
+
83
+ **If RESHAPE:** [the specific pivot that fixes the fatal flaw while keeping the upside]
84
+ ```
85
+
86
+ Then list the five council scores in one line: `Contrarian X/10 · Expansionist X/10 · Logician X/10 · Researcher X/10 · Buyer X/10`.
87
+
88
+ ## Rules
89
+
90
+ - Every persona stays in character. None of them hedges or softens. The value is in the friction.
91
+ - The Judge must make an actual call. "It depends" is not a verdict. Pick GO, RESHAPE, or KILL and own it.
92
+ - The cheapest 48-hour test is the most important output. It's how the user finds out if they're right without building the whole thing.
93
+ - Keep the final verdict skimmable. The council does the depth; the Judge does the decision.
94
+
95
+ ## How it fits the 7 Laws
96
+
97
+ | Law | Role of this skill |
98
+ |---|---|
99
+ | Law 1 (Research Before Executing) | The council **is** the research — five independent investigations of an idea's viability before a single line of code is written. |
100
+ | Law 2 (Plan Is Sacred) | The verdict's RESHAPE pivot and cheapest-test become the plan's first checkpoint instead of an invented default. |
101
+ | Law 4 (Verify Before Reporting) | The Judge must commit to a falsifiable GO / RESHAPE / KILL call — the anti-pattern is the hedge, "it depends." |
102
+
103
+ ## Pairs with
104
+
105
+ - [`grill-me`](./grill-me.md) — once roast says GO or RESHAPE, `grill-me` hardens the **plan**; roast validates the **idea**. Roast first, then grill.
106
+ - [`proceed-with-the-recommendation`](./proceed-with-the-recommendation.md) — walk the verdict's next steps (the cheapest test, the RESHAPE pivot) top-to-bottom under the 7 Laws.
107
+ - [`wild-risa-balance`](./wild-risa-balance.md) — the verdict is a recommendation; run it through the R-I-S-A filter before acting.
108
+ - [`gateguard`](./gateguard.md) — the runtime gate (`hooks/gateguard.mjs`) that fires when the validated idea finally turns into Edit/Write/Bash.
@@ -32,37 +32,17 @@ Strategic compaction at logical boundaries:
32
32
 
33
33
  ## How It Works
34
34
 
35
- The `suggest-compact.js` script runs on PreToolUse (Edit/Write) and:
36
-
37
- 1. **Tracks tool calls** — Counts tool invocations in session
38
- 2. **Threshold detection** — Suggests at configurable threshold (default: 50 calls)
39
- 3. **Periodic reminders** — Reminds every 25 calls after threshold
40
-
41
- ## Hook Setup
42
-
43
- Add to your `~/.claude/settings.json`:
44
-
45
- ```json
46
- {
47
- "hooks": {
48
- "PreToolUse": [
49
- {
50
- "matcher": "Edit",
51
- "hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
52
- },
53
- {
54
- "matcher": "Write",
55
- "hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
56
- }
57
- ]
58
- }
59
- }
60
- ```
61
-
62
- ## Configuration
63
-
64
- Environment variables:
65
- - `COMPACT_THRESHOLD` — Tool calls before first suggestion (default: 50)
35
+ This skill is a manual phase-boundary checklist, not a bundled runtime hook. Use it when planning or reviewing a long session:
36
+
37
+ 1. **Name the current phase** — research, planning, implementation, testing, debugging, release, or handoff.
38
+ 2. **Check the next transition** — decide whether the next phase needs fresh context or the current context is still load-bearing.
39
+ 3. **Preserve state first** — write the plan, todo list, findings, or handoff note that must survive compaction.
40
+ 4. **Compact only at a boundary** — if compaction helps, run `/compact` with a specific summary for the next phase.
41
+ 5. **Resume from durable artifacts** — after compaction, re-read the plan/files instead of relying on lost conversation context.
42
+
43
+ ## Runtime Boundary
44
+
45
+ The current plugin does not ship `strategic-compact` PreToolUse automation or a threshold script. Treat compaction as an operator/agent decision: this skill gives the decision guide, while Claude Code's native `/compact` command performs the actual compaction.
66
46
 
67
47
  ## Compaction Decision Guide
68
48
 
@@ -94,7 +74,7 @@ Understanding what persists helps you compact with confidence:
94
74
  1. **Compact after planning** — Once plan is finalized in TodoWrite, compact to start fresh
95
75
  2. **Compact after debugging** — Clear error-resolution context before continuing
96
76
  3. **Don't compact mid-implementation** — Preserve context for related changes
97
- 4. **Read the suggestion** — The hook tells you *when*, you decide *if*
77
+ 4. **Use the checklist** — The phase table helps decide *when*; you still decide *if*
98
78
  5. **Write before compacting** — Save important context to files or memory before compacting
99
79
  6. **Use `/compact` with a summary** — Add a custom message: `/compact Focus on implementing auth middleware next`
100
80
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "mode": "expert",
5
5
  "description": "Expert mode: tune confidence, manage instincts, and persist plans on disk. Adds safety, token-budget, and strategic-compact skills plus the /learn-eval command so long sessions stay sharp and learnings survive context resets.",
6
6
  "tools": [