continuous-improvement 3.22.1 → 3.23.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.
@@ -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 28 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.22.1",
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 29 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.23.0",
12
12
  "source": "./plugins/continuous-improvement",
13
13
  "author": {
14
14
  "name": "naimkatiman"
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this skill are documented here.
4
4
 
5
5
  ---
6
6
 
7
+ ## [3.23.0] — 2026-08-15
8
+
9
+ ### Added
10
+
11
+ - **`ship` is now a native tier-1 global skill** — the full single-defect workflow lives in `skills/ship.md`: detect `main` or `master` from the live remote, preserve unrelated dirty work in an owner-locked clean worktree, enforce RED/GREEN verification, open one PR, and return only eligible clean checkouts to the default branch. The legacy `/ship` command is now a thin argument-forwarding compatibility entry point, and the npm installer writes the user-invocable skill to `~/.claude/skills/ship/SKILL.md` without overwriting or removing an unowned skill at that generic path. Brings the bundle to 29 skills.
12
+
7
13
  ## [3.22.1] — 2026-08-04
8
14
 
9
15
  ### Fixed
package/README.md CHANGED
@@ -270,7 +270,7 @@ Hooks capture every tool call. After ~20 observations Claude analyzes patterns a
270
270
  ## Slash commands
271
271
 
272
272
  <details>
273
- <summary><b>All 29 commands (Beginner gets every one)</b></summary>
273
+ <summary><b>All 29 commands (marketplace bundle)</b></summary>
274
274
 
275
275
  `/seven-laws` is the canonical reflect-and-learn command. `/continuous-improvement` is kept as an alias for backward compatibility — both run the same workflow.
276
276
 
@@ -306,7 +306,7 @@ Hooks capture every tool call. After ~20 observations Claude analyzes patterns a
306
306
  /swarm Fan-out coordination across parallel sub-agents
307
307
  ```
308
308
 
309
- All 29 ship in the marketplace bundle. The Beginner install gets all of them with one caveat: `/learn-eval`, `/harvest`, and `/distill` only produce useful output once Mulahazah has accumulated observation history (~20 observations), so running them on day 1 returns an empty result, not a broken command. `/swarm` and `/release-train` are orchestration commands aimed at larger multi-agent or multi-PR work. In Expert (`npx`) mode, the installer mirrors the full set into `~/.claude/commands/` and additionally exposes the planning workflow through the MCP tools `ci_plan_init` (initialize `task_plan.md`, `findings.md`, `progress.md` in the project root) and `ci_plan_status` (summarize their current contents).
309
+ All 29 legacy commands ship in the marketplace bundle. The marketplace Beginner install gets all of them, with one caveat: `/learn-eval`, `/harvest`, and `/distill` only produce useful output once Mulahazah has accumulated observation history (~20 observations), so running them on day 1 returns an empty result, not a broken command. `/swarm` and `/release-train` are orchestration commands aimed at larger multi-agent or multi-PR work. The npm installer writes its curated command set and installs the native `ship` skill at `~/.claude/skills/ship/SKILL.md`; that user-invocable skill supplies `/ship` without creating a duplicate personal command. Expert npm mode additionally exposes the planning workflow through the MCP tools `ci_plan_init` (initialize `task_plan.md`, `findings.md`, `progress.md` in the project root) and `ci_plan_status` (summarize their current contents).
310
310
 
311
311
  </details>
312
312
 
@@ -314,7 +314,7 @@ All 29 ship in the marketplace bundle. The Beginner install gets all of them —
314
314
 
315
315
  ## Skills
316
316
 
317
- The plugin ships **28 skills** — 1 core + 1 featured + 6 tier-1 + 17 tier-2 + 3 always-bundled. Beginner install gets tier-1, featured, and the always-bundled companion; Expert adds tier-2, the MCP server, and observation hooks. Full catalog with per-skill descriptions, Law tagging, and drop-in single-file install: [docs/skills.md](docs/skills.md). Adding a 29th skill: [CONTRIBUTING.md § Evolution — adding a new skill](CONTRIBUTING.md#evolution--adding-a-new-skill).
317
+ The plugin ships **29 skills** — 1 core + 1 featured + 7 tier-1 + 17 tier-2 + 3 always-bundled. Beginner install gets tier-1, featured, and the always-bundled companion; Expert adds tier-2, the MCP server, and observation hooks. The tier-1 `ship` skill is the single source for the `/ship` workflow and the npm installer makes it global across Claude Code projects. Full catalog with per-skill descriptions, Law tagging, and drop-in single-file install: [docs/skills.md](docs/skills.md). Adding a 30th skill: [CONTRIBUTING.md § Evolution — adding a new skill](CONTRIBUTING.md#evolution--adding-a-new-skill).
318
318
 
319
319
  ---
320
320
 
@@ -357,7 +357,7 @@ Proof-format templates ship in [templates/](templates/): `release_receipt_templa
357
357
 
358
358
  - [QUICKSTART.md](QUICKSTART.md) — 2-minute setup
359
359
  - [SKILL.md](SKILL.md) — full 7 Laws spec
360
- - [docs/skills.md](docs/skills.md) — full 28-skill catalog
360
+ - [docs/skills.md](docs/skills.md) — full 29-skill catalog
361
361
  - [examples/](examples/) — bug fix, feature build, refactor walkthroughs
362
362
  - [templates/insights-claude-md.md](templates/insights-claude-md.md) — paste-in CLAUDE.md blocks for verification discipline, environment notes, think-before-acting, and git/deploy workflow (sourced from the 28-day usage report)
363
363
  - [CONTRIBUTING.md](CONTRIBUTING.md) — architecture, repo internals, adding a new skill
package/bin/install.mjs CHANGED
@@ -9,10 +9,10 @@
9
9
  * npx continuous-improvement install --target gemini,codex # skill into other agents' rules files
10
10
  * npx continuous-improvement install --uninstall # remove everything
11
11
  */
12
- import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, } from "node:fs";
12
+ import { chmodSync, copyFileSync, existsSync, lstatSync, mkdtempSync, mkdirSync, readFileSync, realpathSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, } from "node:fs";
13
13
  import { execSync } from "node:child_process";
14
14
  import { homedir } from "node:os";
15
- import { dirname, join } from "node:path";
15
+ import { dirname, isAbsolute, join, relative, sep } from "node:path";
16
16
  import { fileURLToPath } from "node:url";
17
17
  import { createHash } from "node:crypto";
18
18
  import { PACKAGE_NAME, VERSION, getToolNames } from "../lib/plugin-metadata.mjs";
@@ -21,6 +21,7 @@ import { evaluateUpdateCheck, fetchLatestNpmVersion, isThrottled, pendingNotice,
21
21
  const __filename = fileURLToPath(import.meta.url);
22
22
  const __dirname = dirname(__filename);
23
23
  const SKILL_SOURCE = join(__dirname, "..", "SKILL.md");
24
+ const SHIP_SKILL_SOURCE = join(__dirname, "..", "skills", "ship.md");
24
25
  const SKILL_NAME = "continuous-improvement";
25
26
  const REPO_ROOT = join(__dirname, "..");
26
27
  const COMMAND_FILES = [
@@ -124,17 +125,169 @@ const modeIndex = rawArgs.indexOf("--mode");
124
125
  const requestedMode = modeIndex !== -1 ? rawArgs[modeIndex + 1] : undefined;
125
126
  const INSTALL_MODE = isInstallMode(requestedMode) ? requestedMode : "beginner";
126
127
  const SKILL_DIR = join(getHomeDir(), ".claude", "skills", SKILL_NAME);
128
+ const SHIP_SKILL_DIR = join(getHomeDir(), ".claude", "skills", "ship");
129
+ const SHIP_SKILLS_DIR = dirname(SHIP_SKILL_DIR);
130
+ const SHIP_STAGING_ROOT = join(getHomeDir(), ".claude", ".continuous-improvement-staging");
131
+ const SHIP_SKILL_OWNER_FILE = join(SHIP_SKILL_DIR, ".continuous-improvement-owner");
132
+ const SHIP_SKILL_OWNER = `${PACKAGE_NAME}\n`;
133
+ function pathEntryExists(path) {
134
+ try {
135
+ lstatSync(path);
136
+ return true;
137
+ }
138
+ catch (error) {
139
+ if (error.code === "ENOENT")
140
+ return false;
141
+ throw error;
142
+ }
143
+ }
144
+ function isOwnedShipSkill() {
145
+ try {
146
+ const dir = lstatSync(SHIP_SKILL_DIR);
147
+ const owner = lstatSync(SHIP_SKILL_OWNER_FILE);
148
+ if (!dir.isDirectory() || dir.isSymbolicLink())
149
+ return false;
150
+ if (!owner.isFile() || owner.isSymbolicLink() || owner.nlink !== 1)
151
+ return false;
152
+ return readFileSync(SHIP_SKILL_OWNER_FILE, "utf8") === SHIP_SKILL_OWNER;
153
+ }
154
+ catch {
155
+ return false;
156
+ }
157
+ }
158
+ function isSameOrChildPath(parent, candidate) {
159
+ const relativePath = relative(parent, candidate);
160
+ return (relativePath === "" ||
161
+ (relativePath !== ".." && !relativePath.startsWith(`..${sep}`) && !isAbsolute(relativePath)));
162
+ }
163
+ function getSafeShipStagingRoot() {
164
+ mkdirSync(dirname(SHIP_STAGING_ROOT), { recursive: true });
165
+ try {
166
+ mkdirSync(SHIP_STAGING_ROOT);
167
+ }
168
+ catch (error) {
169
+ if (error.code !== "EEXIST")
170
+ throw error;
171
+ }
172
+ const stagingEntry = lstatSync(SHIP_STAGING_ROOT);
173
+ if (!stagingEntry.isDirectory() || stagingEntry.isSymbolicLink()) {
174
+ throw new Error(`Ship staging root must be a plain directory, not a link or junction: ${SHIP_STAGING_ROOT}`);
175
+ }
176
+ const stagingRoot = realpathSync(SHIP_STAGING_ROOT);
177
+ const skillsRoot = realpathSync(SHIP_SKILLS_DIR);
178
+ if (isSameOrChildPath(skillsRoot, stagingRoot)) {
179
+ throw new Error(`Ship staging root resolves inside skill discovery: ${stagingRoot}`);
180
+ }
181
+ return { stagingRoot, skillsRoot };
182
+ }
183
+ function stageShipSkill() {
184
+ mkdirSync(SHIP_SKILLS_DIR, { recursive: true });
185
+ const { stagingRoot, skillsRoot } = getSafeShipStagingRoot();
186
+ const createdStagingDir = mkdtempSync(join(stagingRoot, "ship-"));
187
+ try {
188
+ const stagingEntry = lstatSync(createdStagingDir);
189
+ const stagingDir = realpathSync(createdStagingDir);
190
+ if (!stagingEntry.isDirectory() ||
191
+ stagingEntry.isSymbolicLink() ||
192
+ !isSameOrChildPath(stagingRoot, stagingDir) ||
193
+ isSameOrChildPath(skillsRoot, stagingDir)) {
194
+ throw new Error(`Ship staging directory escaped its safe root: ${stagingDir}`);
195
+ }
196
+ copyFileSync(SHIP_SKILL_SOURCE, join(stagingDir, "SKILL.md"));
197
+ writeFileSync(join(stagingDir, ".continuous-improvement-owner"), SHIP_SKILL_OWNER);
198
+ return stagingDir;
199
+ }
200
+ catch (error) {
201
+ rmSync(createdStagingDir, { recursive: true, force: true });
202
+ throw error;
203
+ }
204
+ }
205
+ function installShipSkill() {
206
+ const shipSkillExists = pathEntryExists(SHIP_SKILL_DIR);
207
+ if (shipSkillExists && !isOwnedShipSkill()) {
208
+ console.warn(` ! Preserved existing unowned ship skill at ${SHIP_SKILL_DIR}`);
209
+ return "preserved";
210
+ }
211
+ let stagingDir = "";
212
+ let preserveStagingDir = false;
213
+ try {
214
+ stagingDir = stageShipSkill();
215
+ if (shipSkillExists) {
216
+ const skillPath = join(SHIP_SKILL_DIR, "SKILL.md");
217
+ const previousSkillPath = join(stagingDir, "previous-SKILL.md");
218
+ let previousSkillMoved = false;
219
+ if (pathEntryExists(skillPath)) {
220
+ const skillEntry = lstatSync(skillPath);
221
+ if (skillEntry.isDirectory()) {
222
+ throw new Error(`Refusing to replace directory at ${skillPath}`);
223
+ }
224
+ renameSync(skillPath, previousSkillPath);
225
+ previousSkillMoved = true;
226
+ }
227
+ try {
228
+ renameSync(join(stagingDir, "SKILL.md"), skillPath);
229
+ }
230
+ catch (error) {
231
+ if (previousSkillMoved) {
232
+ try {
233
+ renameSync(previousSkillPath, skillPath);
234
+ }
235
+ catch (restoreError) {
236
+ preserveStagingDir = true;
237
+ let recoveryRenameError = "";
238
+ const stagedSkillPath = join(stagingDir, "SKILL.md");
239
+ if (pathEntryExists(stagedSkillPath)) {
240
+ try {
241
+ renameSync(stagedSkillPath, join(stagingDir, "new-SKILL.md"));
242
+ }
243
+ catch (recoveryError) {
244
+ recoveryRenameError = ` Recovery artifact rename also failed (${getErrorMessage(recoveryError)}).`;
245
+ }
246
+ }
247
+ throw new Error(`Ship skill replacement failed (${getErrorMessage(error)}) and rollback failed (${getErrorMessage(restoreError)}).${recoveryRenameError} Recovery files retained outside skill discovery at ${stagingDir}`);
248
+ }
249
+ }
250
+ throw error;
251
+ }
252
+ rmSync(stagingDir, { recursive: true });
253
+ stagingDir = "";
254
+ }
255
+ else {
256
+ renameSync(stagingDir, SHIP_SKILL_DIR);
257
+ stagingDir = "";
258
+ }
259
+ console.log(` ✓ Global ship skill → ${SHIP_SKILL_DIR}/SKILL.md`);
260
+ return "installed";
261
+ }
262
+ catch (error) {
263
+ console.error(` ✗ Global ship skill install failed: ${getErrorMessage(error)}`);
264
+ return "failed";
265
+ }
266
+ finally {
267
+ if (stagingDir && !preserveStagingDir) {
268
+ try {
269
+ if (pathEntryExists(stagingDir)) {
270
+ rmSync(stagingDir, { recursive: true, force: true });
271
+ }
272
+ }
273
+ catch (cleanupError) {
274
+ console.error(` ! Staged ship skill cleanup failed at ${stagingDir}: ${getErrorMessage(cleanupError)}`);
275
+ }
276
+ }
277
+ }
278
+ }
127
279
  function installSkill() {
128
280
  try {
129
281
  mkdirSync(SKILL_DIR, { recursive: true });
130
282
  copyFileSync(SKILL_SOURCE, join(SKILL_DIR, "SKILL.md"));
131
283
  console.log(` ✓ Claude Code skill → ${SKILL_DIR}/SKILL.md`);
284
+ const shipOutcome = installShipSkill();
132
285
  setupMulahazah();
133
- return true;
286
+ return shipOutcome;
134
287
  }
135
288
  catch (error) {
136
289
  console.error(` ✗ Install failed: ${getErrorMessage(error)}`);
137
- return false;
290
+ return "failed";
138
291
  }
139
292
  }
140
293
  function setupMulahazah() {
@@ -326,9 +479,10 @@ function patchClaudeSettings(observePath) {
326
479
  }
327
480
  }
328
481
  function uninstallAll() {
329
- console.log("\nUninstalling continuous-improvement skill...\n");
482
+ console.log("\nUninstalling continuous-improvement skills...\n");
330
483
  const home = getHomeDir();
331
484
  let removed = 0;
485
+ let failed = false;
332
486
  if (existsSync(SKILL_DIR)) {
333
487
  try {
334
488
  rmSync(SKILL_DIR, { recursive: true });
@@ -337,6 +491,23 @@ function uninstallAll() {
337
491
  }
338
492
  catch (error) {
339
493
  console.error(` ✗ Skill removal failed: ${getErrorMessage(error)}`);
494
+ failed = true;
495
+ }
496
+ }
497
+ if (existsSync(SHIP_SKILL_DIR)) {
498
+ if (!isOwnedShipSkill()) {
499
+ console.warn(` ! Preserved existing unowned ship skill at ${SHIP_SKILL_DIR}`);
500
+ }
501
+ else {
502
+ try {
503
+ rmSync(SHIP_SKILL_DIR, { recursive: true });
504
+ console.log(" ✓ Removed global ship skill");
505
+ removed++;
506
+ }
507
+ catch (error) {
508
+ console.error(` ✗ Global ship skill removal failed: ${getErrorMessage(error)}`);
509
+ failed = true;
510
+ }
340
511
  }
341
512
  }
342
513
  for (const commandName of COMMAND_FILES) {
@@ -350,6 +521,7 @@ function uninstallAll() {
350
521
  }
351
522
  catch (error) {
352
523
  console.error(` ✗ ${commandName}: ${getErrorMessage(error)}`);
524
+ failed = true;
353
525
  }
354
526
  }
355
527
  for (const hookFile of ["observe.sh", "session.sh", "session.mjs"]) {
@@ -363,6 +535,7 @@ function uninstallAll() {
363
535
  }
364
536
  catch (error) {
365
537
  console.error(` ✗ ${hookFile}: ${getErrorMessage(error)}`);
538
+ failed = true;
366
539
  }
367
540
  }
368
541
  // Remove the Node observer artifacts deployed alongside observe.sh.
@@ -379,6 +552,7 @@ function uninstallAll() {
379
552
  }
380
553
  catch (error) {
381
554
  console.error(` ✗ ${observerFile}: ${getErrorMessage(error)}`);
555
+ failed = true;
382
556
  }
383
557
  }
384
558
  const settingsPath = join(home, ".claude", "settings.json");
@@ -435,12 +609,17 @@ function uninstallAll() {
435
609
  }
436
610
  else {
437
611
  console.warn(" ! Could not clean settings.json — remove hooks manually");
612
+ failed = true;
438
613
  }
439
614
  }
440
615
  const desktopConfigPath = join(home, ".claude", "claude_desktop_config.json");
441
616
  if (existsSync(desktopConfigPath)) {
442
617
  const desktopConfig = readJsonFile(desktopConfigPath);
443
- if (desktopConfig?.mcpServers?.["continuous-improvement"]) {
618
+ if (!desktopConfig) {
619
+ console.warn(" ! Could not clean claude_desktop_config.json — remove the MCP server manually");
620
+ failed = true;
621
+ }
622
+ else if (desktopConfig.mcpServers?.["continuous-improvement"]) {
444
623
  delete desktopConfig.mcpServers["continuous-improvement"];
445
624
  writeFileSync(desktopConfigPath, JSON.stringify(desktopConfig, null, 2) + "\n");
446
625
  console.log(" ✓ Removed MCP server from Claude Desktop config");
@@ -451,6 +630,7 @@ function uninstallAll() {
451
630
  }
452
631
  console.log("\n Note: Instinct data in ~/.claude/instincts/ was preserved.\n" +
453
632
  " To remove learned data too: rm -rf ~/.claude/instincts/\n");
633
+ return !failed;
454
634
  }
455
635
  function printUsage() {
456
636
  console.log(`
@@ -463,11 +643,11 @@ Subcommands:
463
643
 
464
644
  Options for 'install':
465
645
  --mode <mode> Installation mode:
466
- beginner — hooks + skill + commands (default)
646
+ beginner — hooks + skills + commands (default)
467
647
  expert — beginner + MCP server + session hooks
468
648
  --pack <name> Load a starter instinct pack (react, python, go, meta)
469
649
  --target <names> Comma-separated platform list (default: claude):
470
- claude — full install: hooks + skill + commands
650
+ claude — full install: hooks + skills + commands
471
651
  gemini — GEMINI.md (Gemini CLI)
472
652
  codex — AGENTS.md (Codex CLI / agents.md standard)
473
653
  cursor — .cursor/rules/continuous-improvement.mdc
@@ -534,8 +714,7 @@ if (command === "backfill") {
534
714
  process.exit(0);
535
715
  }
536
716
  if (args.includes("--uninstall")) {
537
- uninstallAll();
538
- process.exit(0);
717
+ process.exit(uninstallAll() ? 0 : 1);
539
718
  }
540
719
  // --target <names>: comma-separated platform list, default claude-only.
541
720
  // Non-claude targets receive the skill text in their platform's rules file
@@ -597,7 +776,9 @@ Research → Plan → Execute → Verify → Reflect → Learn → Iterate
597
776
  `);
598
777
  warnOnMarketplaceCollision();
599
778
  console.log("Installing to Claude Code...\n");
600
- const installed = installSkill() ? 1 : 0;
779
+ const installOutcome = installSkill();
780
+ if (installOutcome === "failed")
781
+ process.exitCode = 1;
601
782
  const modeInfo = {
602
783
  beginner: "Hooks are capturing silently. System auto-levels as you use it.",
603
784
  expert: `Full plugin active: hooks + MCP server + session hooks. ${getToolNames("expert").length} tools available.`,
@@ -651,19 +832,23 @@ if (packIndex !== -1 && rawArgs[packIndex + 1]) {
651
832
  console.error(` ✗ Unknown pack: ${packName}. Available: ${available.join(", ")}`);
652
833
  }
653
834
  }
654
- console.log(`
655
- ${installed === 1 ? "Done." : "Failed."}
656
- ${modeInfo[INSTALL_MODE]}
835
+ const installedNextSteps = `${modeInfo[INSTALL_MODE]}
657
836
 
658
837
  Next steps:
659
838
  1. Start a new Claude Code session
660
839
  2. Say: "Use the continuous-improvement framework to [your task]"
661
- 3. If a task needs persistent planning, run: /planning-with-files
662
- 4. After your first task, run: /continuous-improvement
663
- 5. Try: /discipline for quick reference, /dashboard for instinct health
840
+ 3. For one defect, run: /ship [one-line defect description]
841
+ 4. If a task needs persistent planning, run: /planning-with-files
842
+ 5. After your first task, run: /continuous-improvement
843
+ 6. Try: /discipline for quick reference, /dashboard for instinct health
664
844
  ${INSTALL_MODE === "expert" ? `\nMCP tools available (${getToolNames("expert").length}): ${getToolNames("expert").join(", ")}` : ""}
665
- Available instinct packs: npx continuous-improvement install --pack react|python|go|meta
666
- `);
845
+ Available instinct packs: npx continuous-improvement install --pack react|python|go|meta`;
846
+ const installSummary = installOutcome === "installed"
847
+ ? `Done.\n${installedNextSteps}`
848
+ : installOutcome === "preserved"
849
+ ? `Done with warning.\n${modeInfo[INSTALL_MODE]}\n\nPackage /ship was not installed because an existing unowned ship skill was preserved. Resolve that collision, then reinstall before using the package workflow.`
850
+ : "Failed.\nInstallation incomplete. Fix the errors above and rerun the installer. Do not assume hooks, skills, or commands are ready.";
851
+ console.log(`\n${installSummary}\n`);
667
852
  // Update-available nudge for the npm/CLI install path (the marketplace path is
668
853
  // covered by Claude Code's native plugin auto-update). Reads the public npm
669
854
  // registry only — no telemetry. Throttled, default-on, off via
package/commands/ship.md CHANGED
@@ -1,57 +1,13 @@
1
1
  ---
2
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."
3
+ description: "Compatibility entry point for the native ship skill. Passes one defect request through unchanged."
4
+ argument-hint: "[one-line defect description]"
4
5
  ---
5
6
 
6
7
  # /ship
7
8
 
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
+ Invoke the native `ship` skill with this complete defect request:
9
10
 
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
+ $ARGUMENTS
11
12
 
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.
13
+ Follow that skill exactly. Do not reconstruct or duplicate its Git, worktree, TDD, return, cleanup, merge, or deploy rules here. If the native skill is unavailable, stop and tell the operator to update or reinstall `continuous-improvement`.
@@ -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 28 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 29 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
@@ -386,7 +386,7 @@ const EXPERT_TOOL_ENTRIES = [
386
386
  ];
387
387
  const MODE_METADATA = {
388
388
  beginner: {
389
- 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.",
389
+ description: "Beginner mode: see what your agent learned, list its instincts, and request a session reflection. Bundles the ship fast path plus grounding skills (gateguard, tdd-workflow, verification-loop) so one-defect delivery, research, tests, and verification happen by default — every edit starts from facts, not guesses.",
390
390
  hooks: ["PreToolUse", "PostToolUse", "UserPromptSubmit"],
391
391
  hookDescription: "Silently captures every tool call as observations and routes prompts to the matching skill via the route table. Lightweight and non-blocking.",
392
392
  },
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 28 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 29 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.22.1",
4
- "description": "Claude Code that gets sharper every session: the persistent-memory and runtime-discipline layer built on the 7 Laws of AI Agent Discipline. It 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. Shipped as 28 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.23.0",
4
+ "description": "Claude Code that gets sharper every session: the persistent-memory and runtime-discipline layer built on the 7 Laws of AI Agent Discipline. It 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. Shipped as 29 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-plugin",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.22.1",
3
+ "version": "3.23.0",
4
4
  "mode": "beginner",
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.",
5
+ "description": "Beginner mode: see what your agent learned, list its instincts, and request a session reflection. Bundles the ship fast path plus grounding skills (gateguard, tdd-workflow, verification-loop) so one-defect delivery, research, tests, and verification happen by default — every edit starts from facts, not guesses.",
6
6
  "tools": [
7
7
  {
8
8
  "name": "ci_status",
@@ -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 28 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.22.1",
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 29 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.23.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.22.1",
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 28 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.23.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 29 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"
@@ -1,57 +1,13 @@
1
1
  ---
2
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."
3
+ description: "Compatibility entry point for the native ship skill. Passes one defect request through unchanged."
4
+ argument-hint: "[one-line defect description]"
4
5
  ---
5
6
 
6
7
  # /ship
7
8
 
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
+ Invoke the native `ship` skill with this complete defect request:
9
10
 
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
+ $ARGUMENTS
11
12
 
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.
13
+ Follow that skill exactly. Do not reconstruct or duplicate its Git, worktree, TDD, return, cleanup, merge, or deploy rules here. If the native skill is unavailable, stop and tell the operator to update or reinstall `continuous-improvement`.
@@ -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 28 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 29 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
@@ -386,7 +386,7 @@ const EXPERT_TOOL_ENTRIES = [
386
386
  ];
387
387
  const MODE_METADATA = {
388
388
  beginner: {
389
- 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.",
389
+ description: "Beginner mode: see what your agent learned, list its instincts, and request a session reflection. Bundles the ship fast path plus grounding skills (gateguard, tdd-workflow, verification-loop) so one-defect delivery, research, tests, and verification happen by default — every edit starts from facts, not guesses.",
390
390
  hooks: ["PreToolUse", "PostToolUse", "UserPromptSubmit"],
391
391
  hookDescription: "Silently captures every tool call as observations and routes prompts to the matching skill via the route table. Lightweight and non-blocking.",
392
392
  },
@@ -20,6 +20,7 @@ skill set on disk.
20
20
  - `gateguard` — Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Fact-forcing gate that blocks Edit/Write/Bash (including MultiEdit) and demands concrete investigation (importers, data schemas, user instruction) before allowing the action. Measurably improves output quality by +2.25 points vs ungated agents.
21
21
  - `model-forward` — Enforces all 7 Laws as a standing stance — go with Claude Code and the model, not against it. Skills are scaffolding that merges into the model over time; the durable core is goal-driven execution (the higher the stated goal, the better) plus self-discipline guardrails.
22
22
  - `recall` — Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Makes past sessions first-class research material by searching the observation log with BM25 ranking, so 'have I hit this before?' is answerable before re-deriving a fix or repeating a mistake.
23
+ - `ship` — Enforces Law 1 (Research Before Executing), Law 3 (One Thing at a Time), and Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Fix one defect through TDD and one PR, isolate unrelated dirty checkouts in an owner-locked clean worktree, and return only eligible clean checkouts to the detected default branch. Use for urgent hotfixes, bug fixes from a messy checkout, or requests to ship one defect without stashing current work.
23
24
  - `tdd-workflow` — Enforces Law 3 (One Thing at a Time) and Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.
24
25
  - `verification-loop` — Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. A comprehensive verification system for agent coding sessions covering build, types, lint, tests, security, and diff with a PASS/FAIL report.
25
26
 
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: ship
3
+ tier: "1"
4
+ description: >-
5
+ Enforces Law 1 (Research Before Executing), Law 3 (One Thing at a Time), and Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Fix one defect through TDD and one PR, isolate unrelated dirty checkouts in an owner-locked clean worktree, and return only eligible clean checkouts to the detected default branch. Use for urgent hotfixes, bug fixes from a messy checkout, or requests to ship one defect without stashing current work.
6
+ origin: continuous-improvement
7
+ user-invocable: true
8
+ disable-model-invocation: true
9
+ argument-hint: "[one-line defect description]"
10
+ ---
11
+
12
+ # Ship
13
+
14
+ Fix one defect, open one PR, and hand it back for review. Use `release-train` for stacked multi-PR rollouts and `proceed-with-the-recommendation` for an arbitrary recommendation list.
15
+
16
+ Preserve branch protection. Never force-push, auto-merge, or deploy from this skill.
17
+
18
+ ## Request
19
+
20
+ Treat `$ARGUMENTS` as the defect request when supplied. Otherwise use the single concrete defect from the active conversation. Halt and ask for one narrower defect when the request is empty, ambiguous, or contains more than one concern.
21
+
22
+ ## Workflow
23
+
24
+ Run these steps in order:
25
+
26
+ 1. **Capture ground truth and resolve the base**: run the read-only `reconcile` probes. Record the initiating checkout's absolute root, branch, HEAD, real tracked drift, staged drift, untracked files, in-progress Git operations, registered worktrees, and task ownership. Ownership requires the current session ID in the authoritative worktree lease or an equivalent active harness task ledger that names this exact checkout; merely starting there is not proof. Set `return_allowed=true` only when the initiating checkout is clean, that ownership proof matches the current session, and no other task reserves it. Without such a lease or ledger, fail closed with `return_allowed=false`. A dirty-tree blocker may continue only through the isolated path in step 2 after the changes are confirmed unrelated. Every other blocker still halts. After classification, make the fetch below the first allowed repository mutation and refresh the remote before choosing a base:
27
+ ```
28
+ git fetch --prune origin
29
+ git ls-remote --symref origin HEAD
30
+ ```
31
+ Use the live `refs/heads/<base>` returned for `HEAD`. Validate it with `git check-ref-format --branch "<base>"`. Compare it with `refs/remotes/origin/HEAD`, but never let a stale local symbolic ref override the live result. The query must also return the remote HEAD commit. If it succeeds without a symbolic ref, compare that remote HEAD commit with the resolved tips of `origin/main` and `origin/master`, and require exactly one matching candidate. Zero or multiple matches are ambiguous: halt instead of guessing. Halt on a fetch/query failure or if no verified base exists. Confirm `origin/<base>` resolves after the fetch, record its immutable commit as `<base-sha>`, require a full hexadecimal commit ID, and require that it equals the verified remote HEAD commit. Pin worktree creation to `<base-sha>`, not the mutable remote-tracking name.
32
+ 2. **Select a safe checkout**:
33
+ - Always perform the defect work in a separate isolated worktree created from the pinned `<base-sha>`. Do not reuse the initiating checkout, even when it is clean. One isolation path keeps ownership, retention, return, and cleanup behavior consistent.
34
+ - If dirty changes are not clearly unrelated to the defect, halt and ask. Never guess which changes belong to whom.
35
+ - Preserve the initiating checkout until the return decision in step 8. When it is dirty with unrelated work, protected, stale, ahead, or owned by another task, do not stash, switch, reset, clean, or copy its changes. Choose an absent absolute sibling or temporary path. Generate the feature branch from ASCII lowercase letters, digits, slash, underscore, and hyphen only (`[a-z0-9/_-]+`), require an alphanumeric first character, and validate the final name before any lookup. Prove the proposed branch is absent locally, then query the remote successfully and require empty output before using the name:
36
+ ```
37
+ git check-ref-format --branch "<feature-branch>"
38
+ git show-ref --verify "refs/heads/<feature-branch>"
39
+ git ls-remote --heads origin "refs/heads/<feature-branch>"
40
+ ```
41
+ The local command must report no ref. The remote command must complete without a network/authentication error and return no matching ref. If either branch exists, choose another unique name. Create a no-upstream worktree with an atomic owner lock:
42
+ ```
43
+ git worktree add --no-track --lock --reason "owner=<session-id>; purpose=/ship" -b "<feature-branch>" "<worktree-path>" "<base-sha>"
44
+ ```
45
+ - Use the current harness session ID as `<session-id>`. If it is unavailable, generate a unique recorded run token before creating the worktree and reuse that exact token through handoff and cleanup. Treat the lock reason as an advisory coordination ledger for compliant sessions, not as a filesystem write lock. Run `worktree-safety` in the new checkout and confirm its resolved root, `.git` pointer, registration, branch, pinned HEAD, and lock reason all match the current session. A missing or foreign owner blocks work. Recheck that envelope and observable branch, HEAD, and diff state before every source mutation. Halt when another writer cannot be excluded.
46
+ 3. **Reproduce (RED)**: use `tdd-workflow` to write a failing test that reproduces the defect and watch it fail. Delete any pre-test implementation code.
47
+ 4. **Fix (GREEN)**: write the minimal change that makes the failing test pass, then watch it pass. Keep one concern only.
48
+ 5. **Verify**: use `verification-loop` to run the project's verify ladder, including build, types, and relevant tests. A green build proves only the mechanism. Confirm the original defect no longer reproduces.
49
+ 6. **Commit**: make one single-concern commit, staged by explicit filename. Never use `git add -A` or `git add .`. Recheck the branch, HEAD, owner lock, and real diff immediately before staging and committing. Use a Windows-safe commit message with a single-line `-m`, repeated `-m` paragraphs, or `git commit -F <tempfile>`. Do not use multi-line here-docs or here-strings.
50
+ 7. **Push and open the PR**: confirm the feature branch has no upstream to the protected base. Re-run the remote collision query immediately before pushing, require empty output, then push its name explicitly without force:
51
+ ```
52
+ git ls-remote --heads origin "refs/heads/<feature-branch>"
53
+ git push -u origin "<feature-branch>"
54
+ ```
55
+ Verify the remote tip equals local HEAD. Use `commit-commands:commit-push-pr` only when it accepts the explicit base and head below; otherwise open the PR directly and cite the plan or issue:
56
+ ```
57
+ gh pr create --base "<base>" --head "<feature-branch>"
58
+ gh pr view "<pr-number-or-url>" --json baseRefName,headRefName,headRefOid
59
+ ```
60
+ Require `baseRefName=<base>`, `headRefName=<feature-branch>`, and `headRefOid` equal to local HEAD. Record that exact PR URL or number for cleanup. A mismatch halts. Do not merge it.
61
+ 8. **Return before stopping**:
62
+ - Confirm the fix checkout is clean and every commit is pushed. If the captured `return_allowed` value is true, immediately revalidate that the initiating checkout remains clean, current-session-owned, and unreserved. Freeze the final decision and its reason. Any drift changes the final value to false.
63
+ - Persist a local cleanup receipt at `<git-common-dir>/continuous-improvement/ship-receipts/<pr-number>.json` with the PR URL and number, base, base SHA, feature branch, feature tip SHA, absolute worktree path, owner token, initiating checkout path, and final `return_allowed` decision and reason. Write a sibling temporary file first, atomically rename it into place, then read and parse it back before continuing. Keep the local path and owner token out of the public PR body and comments. If later drift appears before a return mutation, atomically downgrade the receipt to `return_allowed=false`, read it back, and leave the initiating checkout unchanged.
64
+ - Only when the final `return_allowed=true`, meaning the initiating checkout was clean, owned by the current session, and not reserved by another task, consider returning it. Fetch immediately before any switch, revalidate the remote base, and prove no other worktree has `<base>` checked out:
65
+ ```
66
+ git fetch --prune origin
67
+ ```
68
+ If local `<base>` exists and is not the initiating checkout's current branch, require it to be an ancestor of `origin/<base>`, update that branch ref before switching, then switch only after every network and ref check has passed:
69
+ ```
70
+ git merge-base --is-ancestor "refs/heads/<base>" "origin/<base>"
71
+ git branch -f "<base>" "origin/<base>"
72
+ git switch "<base>"
73
+ ```
74
+ If local `<base>` does not exist, create it without switching, then switch:
75
+ ```
76
+ git branch --track "<base>" "origin/<base>"
77
+ git switch "<base>"
78
+ ```
79
+ If the initiating checkout is already on `<base>`, require ancestry and use `git merge --ff-only "origin/<base>"`; a non-fast-forward halts without switching branches. Verify local `<base>` equals `origin/<base>`. If the fetch, remote-base validation, checked-out-elsewhere check, ancestry preflight, branch update, branch creation, fast-forward, or switch fails, leave the initiating checkout's branch and files unchanged and report the blocker. Never switch first and pull afterward.
80
+ - When `return_allowed=false`, leave the initiating checkout's branch and path unchanged even if it appears clean later. Another task may own that state. Report the recorded reason instead of switching it.
81
+ - A dirty initiating checkout is the exception: leave its branch and files exactly as found. Return the shell to that path, but do not carry its changes onto `<base>`. Report that default-branch return is intentionally blocked by preserved local work.
82
+ - During PR review, only the recorded owner or an explicit operator-confirmed handoff may change the retained fix worktree. After every authorized review-fix commit and push, rerun the verification ladder, require a clean worktree, verify the remote feature tip equals local HEAD, and query the same PR again for base, head, and `headRefOid`. Atomically replace the receipt's feature tip SHA with that verified `headRefOid`, then read and parse the receipt back. Halt and retain the worktree if any verification or receipt refresh fails.
83
+ - Stop with the PR open for human review. Keep an isolated fix worktree registered and owner-locked until the PR is merged so review fixes remain safe.
84
+ 9. **Clean up after the PR merges**: run cleanup from the initiating checkout or another retained worktree, never from inside the worktree being removed. Refresh remote state and verify the actual PR merge commit is contained in the detected base, including for squash merges:
85
+ ```
86
+ git fetch --prune origin
87
+ gh pr view "<pr-number-or-url>" --json state,mergeCommit,baseRefName,headRefName,headRefOid
88
+ git merge-base --is-ancestor "<merge-sha>" "origin/<base>"
89
+ ```
90
+ Read `<git-common-dir>/continuous-improvement/ship-receipts/<pr-number>.json` and compare every field with the registered worktree, current refs, PR response, and initiating checkout before cleanup. Halt on a missing, malformed, or mismatched receipt. Halt unless the PR state is `MERGED`, its base and head still match the recorded receipt, its pre-merge `headRefOid` identifies the pushed feature tip, and the ancestry check succeeds. Cleanup may proceed only as the original owner recorded in the local receipt, or after an explicit operator-confirmed handoff that proves the original session is inactive, replaces the owner token in that receipt atomically, and reruns `worktree-safety`. Never silently treat a foreign lock as stale. Confirm the isolated worktree is clean, its HEAD equals both the receipt's feature tip SHA and the PR `headRefOid`, it still carries the authorized owner lock, and it has no observed competing writer. A missing remote feature ref after fetch is expected when GitHub deleted the merged branch; if that ref still exists, require its tip to equal the receipt's feature tip. Recheck immediately before unlock, then release the lock and remove only the named worktree without pausing between commands:
91
+ ```
92
+ git worktree unlock "<worktree-path>"
93
+ git worktree remove "<worktree-path>"
94
+ ```
95
+ If state shifts or removal fails, halt and re-establish ownership instead of forcing. Do not run repository-wide pruning. Return or refresh the initiating checkout on `<base>` only when its recorded `return_allowed` decision permits it, using the same fetch-before-switch, checked-out-elsewhere, ancestry, pre-update, create-if-missing, and already-on-base procedures from step 8, then verify local and remote HEADs match. Delete the local feature branch only if `git branch -d "<feature-branch>"` accepts it. Squash merges may make safe deletion refuse; retain and report the branch instead of forcing it. Remove the local receipt only after cleanup and every permitted return check succeeds. A dirty or foreign-owned initiating checkout remains untouched.
96
+ 10. **Deploy receipt (advisory)**: after the human merge and deployment, `deploy-receipt` may verify that the deployed SHA matches the merge SHA. This skill does not deploy.
97
+
98
+ ## Hard stops
99
+
100
+ - The defect description is ambiguous or includes multiple concerns.
101
+ - Dirty changes may overlap the defect or their ownership is unclear.
102
+ - The live remote default branch cannot be resolved and refreshed.
103
+ - The remote default is ambiguous because the live HEAD query has zero or multiple matching `main` or `master` candidates.
104
+ - The selected feature branch or worktree path already exists.
105
+ - The remote feature-branch collision query fails or returns an existing ref.
106
+ - `worktree-safety` cannot prove the new checkout is registered, aligned, and owner-locked to this session.
107
+ - The branch, HEAD, or owner lock shifts after the ground-truth snapshot.
108
+ - Any verification step fails with a non-obvious fix.
109
+ - The fix would touch more than 15 non-generated files. Split it or use `release-train`.
110
+ - A push would target a protected branch or the remote feature tip cannot be verified.
111
+ - Post-merge state or merge-commit ancestry cannot be verified.
112
+ - Cleanup would require force or discard dirty, untracked, or unpushed work.
113
+
114
+ ## Refuse these anti-patterns
115
+
116
+ - **Stashing unrelated work**: an isolated worktree removes the need.
117
+ - **Moving dirty changes across branches**: preservation takes priority over returning to the default branch.
118
+ - **Hardcoding `main`**: detect the live remote default and support `main` or `master`.
119
+ - **Giving the feature branch a protected upstream**: create with `--no-track` and push the feature name explicitly.
120
+ - **Force cleanup**: never use `git worktree remove --force`, `git branch -D`, `git reset --hard`, or `git clean -fd`.
121
+ - **Repository-wide cleanup**: remove only the named worktree created by this run.
122
+ - **Foreign checkout return**: never switch a checkout without a recorded current-session ownership decision.
123
+ - **Silent lock takeover**: require explicit operator-confirmed handoff when cleanup runs under a different session.
124
+ - **Auto-merge**: never merge the PR this skill opens, even when CI is green.
125
+ - **Deploy**: never run a deploy. `deploy-receipt` only verifies after a human merges and deploys.
126
+ - **Bypass**: never use `--admin`, `--force`, or `--no-verify`.
127
+ - **Bundled concerns**: log unrelated defects as deferred follow-ups instead of adding them to the commit.
128
+
129
+ ## Composition
130
+
131
+ Route through `reconcile`, mandatory `worktree-safety`, `tdd-workflow`, `verification-loop`, `commit-commands:commit-push-pr`, the safe-return and post-merge cleanup rules above, then advisory `deploy-receipt`. Fall back to equivalent inline checks when a companion skill is unavailable, except ownership: no proven single-writer ledger means no source mutation.
132
+
133
+ ## Example
134
+
135
+ ```
136
+ /ship registration form accepts a negative deposit amount
137
+ ```
138
+
139
+ If the initiating checkout contains unrelated feature work, leave it untouched. Create an owner-locked no-upstream worktree from the verified `<base-sha>`, reproduce and fix the defect, verify and push one commit, open one explicitly targeted PR, and return the shell to the initiating path. After the PR merges, read the local receipt, freshly verify the merge commit, and remove only the clean temporary worktree. Switch the initiating checkout to the default branch only when that checkout is clean and current-session-owned.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.22.1",
3
+ "version": "3.23.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": [
package/skills/README.md CHANGED
@@ -22,6 +22,7 @@ These add concrete enforcement to the 7 Laws. Tier-1 skills are the always-on mi
22
22
  | `gateguard` | PreToolUse fact-forcing gate that blocks Edit/Write/destructive Bash until concrete investigation is presented | Law 1 (Research) |
23
23
  | `model-forward` | Standing stance: go with Claude Code and the model, not against it — skills are scaffolding that merges into the model; the durable core is goal-driven execution + guardrails | All 7 Laws (stance) |
24
24
  | `recall` | BM25 search over the observation log so "have I hit this before?" is answerable before re-deriving a fix | Law 1 (Research) |
25
+ | `ship` | Single-defect delivery path that preserves unrelated dirty work in an owner-locked worktree, verifies through TDD, opens one PR, and safely returns eligible clean checkouts to `main` or `master` | Laws 1, 3, and 4 |
25
26
  | `tdd-workflow` | RED→GREEN→REFACTOR enforcement, 80%+ coverage gate across unit/integration/E2E | Law 3 (One Thing), Law 4 (Verify) |
26
27
  | `verification-loop` | Six-phase verification (build, types, lint, tests, security, diff) with a structured PASS/FAIL report | Law 4 (Verify Before Reporting) |
27
28
 
package/skills/ship.md ADDED
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: ship
3
+ tier: "1"
4
+ description: >-
5
+ Enforces Law 1 (Research Before Executing), Law 3 (One Thing at a Time), and Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Fix one defect through TDD and one PR, isolate unrelated dirty checkouts in an owner-locked clean worktree, and return only eligible clean checkouts to the detected default branch. Use for urgent hotfixes, bug fixes from a messy checkout, or requests to ship one defect without stashing current work.
6
+ origin: continuous-improvement
7
+ user-invocable: true
8
+ disable-model-invocation: true
9
+ argument-hint: "[one-line defect description]"
10
+ ---
11
+
12
+ # Ship
13
+
14
+ Fix one defect, open one PR, and hand it back for review. Use `release-train` for stacked multi-PR rollouts and `proceed-with-the-recommendation` for an arbitrary recommendation list.
15
+
16
+ Preserve branch protection. Never force-push, auto-merge, or deploy from this skill.
17
+
18
+ ## Request
19
+
20
+ Treat `$ARGUMENTS` as the defect request when supplied. Otherwise use the single concrete defect from the active conversation. Halt and ask for one narrower defect when the request is empty, ambiguous, or contains more than one concern.
21
+
22
+ ## Workflow
23
+
24
+ Run these steps in order:
25
+
26
+ 1. **Capture ground truth and resolve the base**: run the read-only `reconcile` probes. Record the initiating checkout's absolute root, branch, HEAD, real tracked drift, staged drift, untracked files, in-progress Git operations, registered worktrees, and task ownership. Ownership requires the current session ID in the authoritative worktree lease or an equivalent active harness task ledger that names this exact checkout; merely starting there is not proof. Set `return_allowed=true` only when the initiating checkout is clean, that ownership proof matches the current session, and no other task reserves it. Without such a lease or ledger, fail closed with `return_allowed=false`. A dirty-tree blocker may continue only through the isolated path in step 2 after the changes are confirmed unrelated. Every other blocker still halts. After classification, make the fetch below the first allowed repository mutation and refresh the remote before choosing a base:
27
+ ```
28
+ git fetch --prune origin
29
+ git ls-remote --symref origin HEAD
30
+ ```
31
+ Use the live `refs/heads/<base>` returned for `HEAD`. Validate it with `git check-ref-format --branch "<base>"`. Compare it with `refs/remotes/origin/HEAD`, but never let a stale local symbolic ref override the live result. The query must also return the remote HEAD commit. If it succeeds without a symbolic ref, compare that remote HEAD commit with the resolved tips of `origin/main` and `origin/master`, and require exactly one matching candidate. Zero or multiple matches are ambiguous: halt instead of guessing. Halt on a fetch/query failure or if no verified base exists. Confirm `origin/<base>` resolves after the fetch, record its immutable commit as `<base-sha>`, require a full hexadecimal commit ID, and require that it equals the verified remote HEAD commit. Pin worktree creation to `<base-sha>`, not the mutable remote-tracking name.
32
+ 2. **Select a safe checkout**:
33
+ - Always perform the defect work in a separate isolated worktree created from the pinned `<base-sha>`. Do not reuse the initiating checkout, even when it is clean. One isolation path keeps ownership, retention, return, and cleanup behavior consistent.
34
+ - If dirty changes are not clearly unrelated to the defect, halt and ask. Never guess which changes belong to whom.
35
+ - Preserve the initiating checkout until the return decision in step 8. When it is dirty with unrelated work, protected, stale, ahead, or owned by another task, do not stash, switch, reset, clean, or copy its changes. Choose an absent absolute sibling or temporary path. Generate the feature branch from ASCII lowercase letters, digits, slash, underscore, and hyphen only (`[a-z0-9/_-]+`), require an alphanumeric first character, and validate the final name before any lookup. Prove the proposed branch is absent locally, then query the remote successfully and require empty output before using the name:
36
+ ```
37
+ git check-ref-format --branch "<feature-branch>"
38
+ git show-ref --verify "refs/heads/<feature-branch>"
39
+ git ls-remote --heads origin "refs/heads/<feature-branch>"
40
+ ```
41
+ The local command must report no ref. The remote command must complete without a network/authentication error and return no matching ref. If either branch exists, choose another unique name. Create a no-upstream worktree with an atomic owner lock:
42
+ ```
43
+ git worktree add --no-track --lock --reason "owner=<session-id>; purpose=/ship" -b "<feature-branch>" "<worktree-path>" "<base-sha>"
44
+ ```
45
+ - Use the current harness session ID as `<session-id>`. If it is unavailable, generate a unique recorded run token before creating the worktree and reuse that exact token through handoff and cleanup. Treat the lock reason as an advisory coordination ledger for compliant sessions, not as a filesystem write lock. Run `worktree-safety` in the new checkout and confirm its resolved root, `.git` pointer, registration, branch, pinned HEAD, and lock reason all match the current session. A missing or foreign owner blocks work. Recheck that envelope and observable branch, HEAD, and diff state before every source mutation. Halt when another writer cannot be excluded.
46
+ 3. **Reproduce (RED)**: use `tdd-workflow` to write a failing test that reproduces the defect and watch it fail. Delete any pre-test implementation code.
47
+ 4. **Fix (GREEN)**: write the minimal change that makes the failing test pass, then watch it pass. Keep one concern only.
48
+ 5. **Verify**: use `verification-loop` to run the project's verify ladder, including build, types, and relevant tests. A green build proves only the mechanism. Confirm the original defect no longer reproduces.
49
+ 6. **Commit**: make one single-concern commit, staged by explicit filename. Never use `git add -A` or `git add .`. Recheck the branch, HEAD, owner lock, and real diff immediately before staging and committing. Use a Windows-safe commit message with a single-line `-m`, repeated `-m` paragraphs, or `git commit -F <tempfile>`. Do not use multi-line here-docs or here-strings.
50
+ 7. **Push and open the PR**: confirm the feature branch has no upstream to the protected base. Re-run the remote collision query immediately before pushing, require empty output, then push its name explicitly without force:
51
+ ```
52
+ git ls-remote --heads origin "refs/heads/<feature-branch>"
53
+ git push -u origin "<feature-branch>"
54
+ ```
55
+ Verify the remote tip equals local HEAD. Use `commit-commands:commit-push-pr` only when it accepts the explicit base and head below; otherwise open the PR directly and cite the plan or issue:
56
+ ```
57
+ gh pr create --base "<base>" --head "<feature-branch>"
58
+ gh pr view "<pr-number-or-url>" --json baseRefName,headRefName,headRefOid
59
+ ```
60
+ Require `baseRefName=<base>`, `headRefName=<feature-branch>`, and `headRefOid` equal to local HEAD. Record that exact PR URL or number for cleanup. A mismatch halts. Do not merge it.
61
+ 8. **Return before stopping**:
62
+ - Confirm the fix checkout is clean and every commit is pushed. If the captured `return_allowed` value is true, immediately revalidate that the initiating checkout remains clean, current-session-owned, and unreserved. Freeze the final decision and its reason. Any drift changes the final value to false.
63
+ - Persist a local cleanup receipt at `<git-common-dir>/continuous-improvement/ship-receipts/<pr-number>.json` with the PR URL and number, base, base SHA, feature branch, feature tip SHA, absolute worktree path, owner token, initiating checkout path, and final `return_allowed` decision and reason. Write a sibling temporary file first, atomically rename it into place, then read and parse it back before continuing. Keep the local path and owner token out of the public PR body and comments. If later drift appears before a return mutation, atomically downgrade the receipt to `return_allowed=false`, read it back, and leave the initiating checkout unchanged.
64
+ - Only when the final `return_allowed=true`, meaning the initiating checkout was clean, owned by the current session, and not reserved by another task, consider returning it. Fetch immediately before any switch, revalidate the remote base, and prove no other worktree has `<base>` checked out:
65
+ ```
66
+ git fetch --prune origin
67
+ ```
68
+ If local `<base>` exists and is not the initiating checkout's current branch, require it to be an ancestor of `origin/<base>`, update that branch ref before switching, then switch only after every network and ref check has passed:
69
+ ```
70
+ git merge-base --is-ancestor "refs/heads/<base>" "origin/<base>"
71
+ git branch -f "<base>" "origin/<base>"
72
+ git switch "<base>"
73
+ ```
74
+ If local `<base>` does not exist, create it without switching, then switch:
75
+ ```
76
+ git branch --track "<base>" "origin/<base>"
77
+ git switch "<base>"
78
+ ```
79
+ If the initiating checkout is already on `<base>`, require ancestry and use `git merge --ff-only "origin/<base>"`; a non-fast-forward halts without switching branches. Verify local `<base>` equals `origin/<base>`. If the fetch, remote-base validation, checked-out-elsewhere check, ancestry preflight, branch update, branch creation, fast-forward, or switch fails, leave the initiating checkout's branch and files unchanged and report the blocker. Never switch first and pull afterward.
80
+ - When `return_allowed=false`, leave the initiating checkout's branch and path unchanged even if it appears clean later. Another task may own that state. Report the recorded reason instead of switching it.
81
+ - A dirty initiating checkout is the exception: leave its branch and files exactly as found. Return the shell to that path, but do not carry its changes onto `<base>`. Report that default-branch return is intentionally blocked by preserved local work.
82
+ - During PR review, only the recorded owner or an explicit operator-confirmed handoff may change the retained fix worktree. After every authorized review-fix commit and push, rerun the verification ladder, require a clean worktree, verify the remote feature tip equals local HEAD, and query the same PR again for base, head, and `headRefOid`. Atomically replace the receipt's feature tip SHA with that verified `headRefOid`, then read and parse the receipt back. Halt and retain the worktree if any verification or receipt refresh fails.
83
+ - Stop with the PR open for human review. Keep an isolated fix worktree registered and owner-locked until the PR is merged so review fixes remain safe.
84
+ 9. **Clean up after the PR merges**: run cleanup from the initiating checkout or another retained worktree, never from inside the worktree being removed. Refresh remote state and verify the actual PR merge commit is contained in the detected base, including for squash merges:
85
+ ```
86
+ git fetch --prune origin
87
+ gh pr view "<pr-number-or-url>" --json state,mergeCommit,baseRefName,headRefName,headRefOid
88
+ git merge-base --is-ancestor "<merge-sha>" "origin/<base>"
89
+ ```
90
+ Read `<git-common-dir>/continuous-improvement/ship-receipts/<pr-number>.json` and compare every field with the registered worktree, current refs, PR response, and initiating checkout before cleanup. Halt on a missing, malformed, or mismatched receipt. Halt unless the PR state is `MERGED`, its base and head still match the recorded receipt, its pre-merge `headRefOid` identifies the pushed feature tip, and the ancestry check succeeds. Cleanup may proceed only as the original owner recorded in the local receipt, or after an explicit operator-confirmed handoff that proves the original session is inactive, replaces the owner token in that receipt atomically, and reruns `worktree-safety`. Never silently treat a foreign lock as stale. Confirm the isolated worktree is clean, its HEAD equals both the receipt's feature tip SHA and the PR `headRefOid`, it still carries the authorized owner lock, and it has no observed competing writer. A missing remote feature ref after fetch is expected when GitHub deleted the merged branch; if that ref still exists, require its tip to equal the receipt's feature tip. Recheck immediately before unlock, then release the lock and remove only the named worktree without pausing between commands:
91
+ ```
92
+ git worktree unlock "<worktree-path>"
93
+ git worktree remove "<worktree-path>"
94
+ ```
95
+ If state shifts or removal fails, halt and re-establish ownership instead of forcing. Do not run repository-wide pruning. Return or refresh the initiating checkout on `<base>` only when its recorded `return_allowed` decision permits it, using the same fetch-before-switch, checked-out-elsewhere, ancestry, pre-update, create-if-missing, and already-on-base procedures from step 8, then verify local and remote HEADs match. Delete the local feature branch only if `git branch -d "<feature-branch>"` accepts it. Squash merges may make safe deletion refuse; retain and report the branch instead of forcing it. Remove the local receipt only after cleanup and every permitted return check succeeds. A dirty or foreign-owned initiating checkout remains untouched.
96
+ 10. **Deploy receipt (advisory)**: after the human merge and deployment, `deploy-receipt` may verify that the deployed SHA matches the merge SHA. This skill does not deploy.
97
+
98
+ ## Hard stops
99
+
100
+ - The defect description is ambiguous or includes multiple concerns.
101
+ - Dirty changes may overlap the defect or their ownership is unclear.
102
+ - The live remote default branch cannot be resolved and refreshed.
103
+ - The remote default is ambiguous because the live HEAD query has zero or multiple matching `main` or `master` candidates.
104
+ - The selected feature branch or worktree path already exists.
105
+ - The remote feature-branch collision query fails or returns an existing ref.
106
+ - `worktree-safety` cannot prove the new checkout is registered, aligned, and owner-locked to this session.
107
+ - The branch, HEAD, or owner lock shifts after the ground-truth snapshot.
108
+ - Any verification step fails with a non-obvious fix.
109
+ - The fix would touch more than 15 non-generated files. Split it or use `release-train`.
110
+ - A push would target a protected branch or the remote feature tip cannot be verified.
111
+ - Post-merge state or merge-commit ancestry cannot be verified.
112
+ - Cleanup would require force or discard dirty, untracked, or unpushed work.
113
+
114
+ ## Refuse these anti-patterns
115
+
116
+ - **Stashing unrelated work**: an isolated worktree removes the need.
117
+ - **Moving dirty changes across branches**: preservation takes priority over returning to the default branch.
118
+ - **Hardcoding `main`**: detect the live remote default and support `main` or `master`.
119
+ - **Giving the feature branch a protected upstream**: create with `--no-track` and push the feature name explicitly.
120
+ - **Force cleanup**: never use `git worktree remove --force`, `git branch -D`, `git reset --hard`, or `git clean -fd`.
121
+ - **Repository-wide cleanup**: remove only the named worktree created by this run.
122
+ - **Foreign checkout return**: never switch a checkout without a recorded current-session ownership decision.
123
+ - **Silent lock takeover**: require explicit operator-confirmed handoff when cleanup runs under a different session.
124
+ - **Auto-merge**: never merge the PR this skill opens, even when CI is green.
125
+ - **Deploy**: never run a deploy. `deploy-receipt` only verifies after a human merges and deploys.
126
+ - **Bypass**: never use `--admin`, `--force`, or `--no-verify`.
127
+ - **Bundled concerns**: log unrelated defects as deferred follow-ups instead of adding them to the commit.
128
+
129
+ ## Composition
130
+
131
+ Route through `reconcile`, mandatory `worktree-safety`, `tdd-workflow`, `verification-loop`, `commit-commands:commit-push-pr`, the safe-return and post-merge cleanup rules above, then advisory `deploy-receipt`. Fall back to equivalent inline checks when a companion skill is unavailable, except ownership: no proven single-writer ledger means no source mutation.
132
+
133
+ ## Example
134
+
135
+ ```
136
+ /ship registration form accepts a negative deposit amount
137
+ ```
138
+
139
+ If the initiating checkout contains unrelated feature work, leave it untouched. Create an owner-locked no-upstream worktree from the verified `<base-sha>`, reproduce and fix the defect, verify and push one commit, open one explicitly targeted PR, and return the shell to the initiating path. After the PR merges, read the local receipt, freshly verify the merge commit, and remove only the clean temporary worktree. Switch the initiating checkout to the default branch only when that checkout is clean and current-session-owned.