@punks/cli 2.1.10 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/data/catalog/packs.ts +8 -1
  2. package/dist/data/catalog/skills.ts +8 -0
  3. package/dist/data/scripts/sync-subagents.mjs +34 -1
  4. package/dist/index.js +151 -42
  5. package/dist/skills/agnostic/generic/handoff/SKILL.md +15 -0
  6. package/dist/skills/agnostic/planning/create-plan/SKILL.md +7 -6
  7. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +20 -0
  8. package/dist/skills/agnostic/planning/create-plan/references/tdd-phase.md +23 -1
  9. package/dist/skills/agnostic/planning/create-spec/SKILL.md +11 -10
  10. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +2 -2
  11. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +7 -1
  12. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +15 -8
  13. package/dist/skills/agnostic/planning/implement-spec/references/sequential.md +8 -3
  14. package/dist/skills/agnostic/quality/tdd/SKILL.md +31 -0
  15. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -0
  16. package/dist/skills/phases/bug-discovery-phase/REFERENCE.md +30 -0
  17. package/dist/skills/phases/bug-discovery-phase/SKILL.md +8 -1
  18. package/dist/skills/phases/debugging-phase/SKILL.md +1 -0
  19. package/dist/skills/phases/delivery-phase/SKILL.md +33 -70
  20. package/dist/skills/phases/delivery-phase/phases/closeout.md +33 -0
  21. package/dist/skills/phases/delivery-phase/phases/debug.md +30 -0
  22. package/dist/skills/phases/delivery-phase/phases/docs-ingest.md +27 -0
  23. package/dist/skills/phases/delivery-phase/phases/implement.md +30 -0
  24. package/dist/skills/phases/delivery-phase/phases/plan.md +27 -0
  25. package/dist/skills/phases/delivery-phase/phases/review.md +29 -0
  26. package/dist/skills/phases/delivery-phase/phases/router.md +46 -0
  27. package/dist/skills/phases/delivery-phase/phases/spec.md +26 -0
  28. package/dist/skills/phases/delivery-phase/references/artifact-state.md +42 -0
  29. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +25 -0
  30. package/dist/skills/phases/docs-ingest-phase/SKILL.md +28 -78
  31. package/dist/skills/phases/docs-ingest-phase/agents/openai.yaml +2 -2
  32. package/dist/skills/phases/docs-ingest-phase/phases/private-internal.md +57 -0
  33. package/dist/skills/phases/docs-ingest-phase/phases/public-docs.md +52 -0
  34. package/dist/skills/phases/docs-ingest-phase/phases/router.md +42 -0
  35. package/dist/skills/phases/docs-ingest-phase/references/learning-artifacts.md +96 -0
  36. package/dist/skills/phases/docs-ingest-phase/references/public-docs.md +8 -0
  37. package/dist/skills/phases/requirements-phase/SKILL.md +1 -0
  38. package/dist/skills/phases/review-phase/SKILL.md +2 -0
  39. package/package.json +1 -1
  40. package/dist/skills/agnostic/docs/upstream/mattpocock-writing-skills.md +0 -41
@@ -71,7 +71,13 @@ export const packCatalog = [
71
71
  category: "default",
72
72
  triggerPackages: [],
73
73
  description: "Default docs pack: docs ingest plus public-doc writing primitives.",
74
- skills: ["docs-ingest-phase", "writing-fragments", "writing-beats", "writing-shape"],
74
+ skills: [
75
+ "docs-ingest-phase",
76
+ "docs-onboarding",
77
+ "writing-fragments",
78
+ "writing-beats",
79
+ "writing-shape",
80
+ ],
75
81
  lintAssets: [],
76
82
  hooks: [],
77
83
  promptSurfaces: ["shared-agents", "root-prompt-spec", "docs-prompt-spec"],
@@ -178,6 +184,7 @@ export const packCatalog = [
178
184
  "delivery-phase",
179
185
  "goalify",
180
186
  "grill-me",
187
+ "handoff",
181
188
  "create-spec",
182
189
  "create-plan",
183
190
  "implement-spec",
@@ -228,6 +228,14 @@ export const skillCatalog = [
228
228
  framework: null,
229
229
  requiresTools: [],
230
230
  },
231
+ {
232
+ id: "handoff",
233
+ sourceDirectory: "skills/agnostic/generic/handoff",
234
+ tier: "agnostic",
235
+ language: null,
236
+ framework: null,
237
+ requiresTools: [],
238
+ },
231
239
  {
232
240
  id: "improve-codebase-architecture",
233
241
  sourceDirectory: "skills/agnostic/research/improve-codebase-architecture",
@@ -220,6 +220,37 @@ function encodeJson(value) {
220
220
  return `${JSON.stringify(value, null, 2)}\n`;
221
221
  }
222
222
 
223
+ function encodeOpencodeJson(value, depth = 0) {
224
+ const indent = " ".repeat(depth);
225
+ const childIndent = " ".repeat(depth + 1);
226
+
227
+ if (Array.isArray(value)) {
228
+ return `[${value.map((item) => JSON.stringify(item)).join(", ")}]`;
229
+ }
230
+
231
+ if (value && typeof value === "object") {
232
+ const entries = Object.entries(value);
233
+ if (entries.length === 0) {
234
+ return "{}";
235
+ }
236
+
237
+ const body = entries
238
+ .map(
239
+ ([key, entry]) =>
240
+ `${childIndent}${JSON.stringify(key)}: ${encodeOpencodeJson(entry, depth + 1)}`,
241
+ )
242
+ .join(",\n");
243
+
244
+ return `{\n${body}\n${indent}}`;
245
+ }
246
+
247
+ return JSON.stringify(value);
248
+ }
249
+
250
+ function encodeOpenCodeConfig(value) {
251
+ return `${encodeOpencodeJson(value)}\n`;
252
+ }
253
+
223
254
  async function readGuidance(files) {
224
255
  const entries = await Promise.all(
225
256
  files.map(async (file) => {
@@ -475,7 +506,9 @@ async function main() {
475
506
  if (availableHooks.hasFormatHook || (await pathExists(opencodeConfigPath))) {
476
507
  await writeFile(
477
508
  opencodeConfigPath,
478
- encodeJson(buildOpenCodeConfig(await readJsonFile(opencodeConfigPath), availableHooks)),
509
+ encodeOpenCodeConfig(
510
+ buildOpenCodeConfig(await readJsonFile(opencodeConfigPath), availableHooks),
511
+ ),
479
512
  "utf8",
480
513
  );
481
514
  }
package/dist/index.js CHANGED
@@ -52324,7 +52324,7 @@ import { execFileSync } from "child_process";
52324
52324
 
52325
52325
  // package.json
52326
52326
  var name = "@punks/cli";
52327
- var version = "2.1.10";
52327
+ var version = "2.1.11";
52328
52328
  // src/telemetry/product.ts
52329
52329
  var git = (cwd, args2) => {
52330
52330
  try {
@@ -53177,7 +53177,13 @@ var packCatalog = [
53177
53177
  category: "default",
53178
53178
  triggerPackages: [],
53179
53179
  description: "Default docs pack: docs ingest plus public-doc writing primitives.",
53180
- skills: ["docs-ingest-phase", "writing-fragments", "writing-beats", "writing-shape"],
53180
+ skills: [
53181
+ "docs-ingest-phase",
53182
+ "docs-onboarding",
53183
+ "writing-fragments",
53184
+ "writing-beats",
53185
+ "writing-shape"
53186
+ ],
53181
53187
  lintAssets: [],
53182
53188
  hooks: [],
53183
53189
  promptSurfaces: ["shared-agents", "root-prompt-spec", "docs-prompt-spec"],
@@ -53283,6 +53289,7 @@ var packCatalog = [
53283
53289
  "delivery-phase",
53284
53290
  "goalify",
53285
53291
  "grill-me",
53292
+ "handoff",
53286
53293
  "create-spec",
53287
53294
  "create-plan",
53288
53295
  "implement-spec",
@@ -53639,6 +53646,14 @@ var skillCatalog = [
53639
53646
  framework: null,
53640
53647
  requiresTools: []
53641
53648
  },
53649
+ {
53650
+ id: "handoff",
53651
+ sourceDirectory: "skills/agnostic/generic/handoff",
53652
+ tier: "agnostic",
53653
+ language: null,
53654
+ framework: null,
53655
+ requiresTools: []
53656
+ },
53642
53657
  {
53643
53658
  id: "improve-codebase-architecture",
53644
53659
  sourceDirectory: "skills/agnostic/research/improve-codebase-architecture",
@@ -55527,7 +55542,11 @@ For code review requests, take a review stance: findings first, severity ordered
55527
55542
 
55528
55543
  Use \`parallel-research\` for readonly repo orientation when the work can be split across independent questions, subsystems, artifacts, or hypotheses. Keep the immediate blocking path local, delegate sidecar reading only, synthesize findings before deciding, and skip it for code-writing or tightly coupled work.
55529
55544
 
55530
- Before delegating to subagents, verify the active harness global/project settings actually enable subagent execution, then verify repo-local routing. For Codex, \`.codex/config.toml\` should have an \`[agents]\` section with usable thread/depth limits. For Claude Code, OpenCode, Cursor, or other harnesses, check their equivalent global/project agent settings before trusting repo-local mirrors. Then confirm \`.agents/subagents/manifest.mjs\` exists and the selected specialist has matching owned paths, guidance files, and skills. If that guard fails, repair settings or execute locally; do not claim worker coverage from an inactive harness.
55545
+ When routed learning artifacts exist, consult relevant learnings during discovery, planning, debugging, and review.
55546
+
55547
+ Implementation work must be handed off to at least one scoped worker. Sequential implementation uses exactly one worker plus parent validation. Use multiple workers only when the user asks for parallelism or the plan declares explicit independent waves with disjoint write scopes. The main thread owns orchestration, context preservation, review, validation, and reporting.
55548
+
55549
+ Before handing work to subagents, verify the active harness global/project settings actually enable subagent execution, then verify repo-local routing. For Codex, \`.codex/config.toml\` should have an \`[agents]\` section with usable thread/depth limits. For Claude Code, OpenCode, Cursor, or other harnesses, check their equivalent global/project agent settings before trusting repo-local mirrors. Then confirm \`.agents/subagents/manifest.mjs\` exists and the selected specialist has matching owned paths, guidance files, and skills. If that guard fails, stop and repair settings or report the blocker; do not implement in the main thread or claim worker coverage from an inactive harness.
55531
55550
 
55532
55551
  When inspecting external library internals, prefer official docs first. If \`opensrc/<package>.md\` exists, read that guide card before resolving cached source. Then use \`opensrc path --cwd . <package>\` for packages or \`opensrc path owner/repo\` for repositories, and inspect the returned absolute path.
55533
55552
 
@@ -56000,7 +56019,7 @@ var summarizeSourceGuide = (guide) => ({
56000
56019
  packageSpec: guide.packageSpec,
56001
56020
  ...guide.fallbackSpec === undefined ? {} : { fallbackSpec: guide.fallbackSpec }
56002
56021
  });
56003
- var renderSourceGuideReadme = (guides) => [
56022
+ var renderSourceGuideReadme = (guides) => `${[
56004
56023
  "# opensrc",
56005
56024
  "",
56006
56025
  "This directory is an index for source code inspected through the global `opensrc` cache.",
@@ -56013,8 +56032,9 @@ var renderSourceGuideReadme = (guides) => [
56013
56032
  "",
56014
56033
  ...guides.map((guide) => `- [${guide.title}](./${guide.id}.md)`)
56015
56034
  ].join(`
56016
- `);
56017
- var renderSourceGuide = (guide) => [
56035
+ `)}
56036
+ `;
56037
+ var renderSourceGuide = (guide) => `${[
56018
56038
  `# ${guide.title}`,
56019
56039
  "",
56020
56040
  "This is an index card for the global `opensrc` cache. Do not commit cloned source here.",
@@ -56048,7 +56068,8 @@ var renderSourceGuide = (guide) => [
56048
56068
  "- Keep the cloned source in the global `~/.opensrc` cache unless the user explicitly asks for a different cache root.",
56049
56069
  "- Do not copy upstream source into this directory."
56050
56070
  ].join(`
56051
- `);
56071
+ `)}
56072
+ `;
56052
56073
 
56053
56074
  // src/content/hooks.ts
56054
56075
  var hookRegistryForBaseline = (baseline = bundledBaseline) => baseline.hooks;
@@ -56591,6 +56612,32 @@ var existingJsonOxlintConfigPath = ({
56591
56612
  }
56592
56613
  return null;
56593
56614
  };
56615
+ var hasRootDocsContent = (scanDirectory) => {
56616
+ const docsDirectory = path10.join(scanDirectory, "docs");
56617
+ if (!existsSync5(docsDirectory)) {
56618
+ return false;
56619
+ }
56620
+ return readdirSync2(docsDirectory).some((entry) => entry !== "AGENTS.md");
56621
+ };
56622
+ var hasJavaScriptWorkspaceDependency = (manifest) => manifest.dependencies.some((dependency) => dependency === "next" || dependency === "react" || dependency === "react-dom" || dependency === "typescript" || dependency === "vite" || dependency.startsWith("@effect/") || dependency.startsWith("@tanstack/") || dependency.startsWith("@trpc/"));
56623
+ var isPythonUvWorkspace = ({
56624
+ scanDirectory,
56625
+ outputDirectory,
56626
+ workspacePath,
56627
+ manifest
56628
+ }) => {
56629
+ const prefix = workspacePath === "." ? "" : `${workspacePath}/`;
56630
+ const hasPythonProject = sourceOrOutputPath({
56631
+ scanDirectory,
56632
+ outputDirectory,
56633
+ relativePath: `${prefix}pyproject.toml`
56634
+ }) !== null || sourceOrOutputPath({
56635
+ scanDirectory,
56636
+ outputDirectory,
56637
+ relativePath: `${prefix}uv.lock`
56638
+ }) !== null;
56639
+ return hasPythonProject && !hasJavaScriptWorkspaceDependency(manifest);
56640
+ };
56594
56641
  var writeAppliedLintConfigs = ({
56595
56642
  scanDirectory,
56596
56643
  outputDirectory,
@@ -56604,6 +56651,14 @@ var writeAppliedLintConfigs = ({
56604
56651
  const manifestRelativePath = toPosixPath(manifest.relativePath);
56605
56652
  const workspacePath = path10.posix.dirname(manifestRelativePath);
56606
56653
  const normalizedWorkspacePath = workspacePath === "." ? "." : workspacePath;
56654
+ if (isPythonUvWorkspace({
56655
+ scanDirectory,
56656
+ outputDirectory,
56657
+ workspacePath: normalizedWorkspacePath,
56658
+ manifest
56659
+ })) {
56660
+ continue;
56661
+ }
56607
56662
  const workspacePacks = packsForWorkspace({
56608
56663
  relativeWorkspacePath: normalizedWorkspacePath,
56609
56664
  manifest,
@@ -57029,7 +57084,7 @@ var promptTargetsForDetection = (scanDirectory, detection) => {
57029
57084
  { relativePath: ".agents/AGENTS.md", manifest: null },
57030
57085
  { relativePath: "AGENTS.md", manifest: null }
57031
57086
  ];
57032
- if (existsSync5(path10.join(scanDirectory, "docs"))) {
57087
+ if (hasRootDocsContent(scanDirectory)) {
57033
57088
  targets.push({ relativePath: "docs/AGENTS.md", manifest: null });
57034
57089
  }
57035
57090
  if (!detection.monorepo) {
@@ -57888,11 +57943,42 @@ When processing source material into routed domain knowledge:
57888
57943
  "@types/node": "^25.6.0",
57889
57944
  "@types/react": "^19.2.14",
57890
57945
  "@types/react-dom": "^19.2.3",
57946
+ "oxfmt": "latest",
57947
+ "oxlint": "latest",
57891
57948
  "postcss": "^8.5.13",
57892
57949
  "tailwindcss": "^4.2.4",
57893
- "typescript": "^5.8.3"
57950
+ "typescript": "^5.8.3",
57951
+ "ultracite": "latest"
57894
57952
  }
57895
57953
  }
57954
+ `
57955
+ },
57956
+ {
57957
+ path: "oxlint.config.ts",
57958
+ content: `import { defineConfig } from "oxlint";
57959
+
57960
+ export default defineConfig({
57961
+ categories: {
57962
+ correctness: "error"
57963
+ },
57964
+ env: {
57965
+ builtin: true
57966
+ },
57967
+ ignorePatterns: [
57968
+ ".next/**",
57969
+ "node_modules/**"
57970
+ ],
57971
+ plugins: ["typescript", "unicorn", "oxc"],
57972
+ rules: {
57973
+ "curly": "off",
57974
+ "func-style": "off",
57975
+ "no-use-before-define": "off",
57976
+ "require-await": "off",
57977
+ "sort-keys": "off",
57978
+ "unicorn/filename-case": "off",
57979
+ "unicorn/prefer-top-level-await": "off"
57980
+ }
57981
+ });
57896
57982
  `
57897
57983
  },
57898
57984
  {
@@ -59429,6 +59515,11 @@ var tanstackStartDevDependencies = {
59429
59515
  vite: "^8.0.14",
59430
59516
  "vite-tsconfig-paths": "^5.1.4"
59431
59517
  };
59518
+ var nextWikiCheckDevDependencies = {
59519
+ oxfmt: "latest",
59520
+ oxlint: "latest",
59521
+ ultracite: "latest"
59522
+ };
59432
59523
  var updateExistingWikiPackage = ({
59433
59524
  outputDirectory,
59434
59525
  packagePath,
@@ -59444,7 +59535,7 @@ var updateExistingWikiPackage = ({
59444
59535
  mermaid: "11.15.0",
59445
59536
  "next-themes": "0.4.6"
59446
59537
  } : tanstackStartDependencies;
59447
- const expectedDevDependencies = wikiFramework === "next" ? {} : tanstackStartDevDependencies;
59538
+ const expectedDevDependencies = wikiFramework === "next" ? nextWikiCheckDevDependencies : tanstackStartDevDependencies;
59448
59539
  const nextDependencies = mergePackageSection(dependencies, expectedDependencies);
59449
59540
  const nextDevDependencies = mergePackageSection(devDependencies, expectedDevDependencies);
59450
59541
  const nextScripts = wikiFramework === "next" ? scripts === undefined ? undefined : {
@@ -59471,7 +59562,7 @@ var updateExistingWikiPackage = ({
59471
59562
  writeFileSync5(packagePath, JSON.stringify({
59472
59563
  ...packageJson,
59473
59564
  dependencies: nextDependencies,
59474
- ...packageJson.devDependencies === undefined && wikiFramework === "next" ? {} : { devDependencies: nextDevDependencies },
59565
+ devDependencies: nextDevDependencies,
59475
59566
  ...nextScripts === undefined ? {} : { scripts: nextScripts }
59476
59567
  }, null, 2) + `
59477
59568
  `);
@@ -60757,10 +60848,22 @@ var scaffoldManifestFile = ".devpunks/scaffold-manifest.json";
60757
60848
  var yesValues2 = new Set(["", "y", "yes"]);
60758
60849
  var encodeJson3 = encodeSync(parseJson(Unknown));
60759
60850
  var encodePrettyJson3 = (value6) => JSON.stringify(JSON.parse(encodeJson3(value6)), null, 2);
60851
+ var updateCompleteMessage = ({
60852
+ applyRequested,
60853
+ hasManagedUpdates
60854
+ }) => {
60855
+ if (applyRequested && hasManagedUpdates) {
60856
+ return "Managed scaffold files updated.";
60857
+ }
60858
+ if (applyRequested) {
60859
+ return "No managed scaffold changes were needed.";
60860
+ }
60861
+ return "No files were written.";
60862
+ };
60760
60863
  var managedFileSchema = Struct({
60761
60864
  path: String$,
60762
60865
  sha256: String$,
60763
- kind: Literal2("agent-prompt", "handoff", "harness", "hook", "lint-spec", "manifest", "prompt-spec", "required-tools", "script", "skill", "subagent")
60866
+ kind: Literal2("agent-prompt", "handoff", "harness", "hook", "lint-spec", "manifest", "prompt-spec", "required-tools", "script", "skill", "source-guide", "subagent")
60764
60867
  });
60765
60868
  var scaffoldManifestSchema = parseJson(Struct({
60766
60869
  repoShapeMode: optional(String$),
@@ -60953,21 +61056,26 @@ var copyIfExists = ({
60953
61056
  if (!existsSync7(sourcePath))
60954
61057
  return;
60955
61058
  const targetPath = path14.join(targetDirectory, relativePath);
61059
+ const stat3 = lstatSync2(sourcePath);
60956
61060
  mkdirSync5(path14.dirname(targetPath), { recursive: true });
60957
- cpSync3(sourcePath, targetPath, { recursive: true });
61061
+ if (stat3.isSymbolicLink()) {
61062
+ symlinkSync2(readlinkSync2(sourcePath), targetPath);
61063
+ return;
61064
+ }
61065
+ cpSync3(sourcePath, targetPath, { recursive: true, verbatimSymlinks: true });
60958
61066
  };
60959
61067
  var buildWikiAlignment = ({
60960
61068
  rootDirectory,
60961
61069
  detection
60962
61070
  }) => {
60963
61071
  const expectedDirectory = mkdtempSync2(path14.join(tmpdir3(), "punks-wiki-update-"));
60964
- const wikiRoot = detection.monorepo ? "apps/wiki" : "wiki";
61072
+ const wikiRoot = existsSync7(path14.join(rootDirectory, "apps/wiki")) ? "apps/wiki" : existsSync7(path14.join(rootDirectory, "wiki")) ? "wiki" : detection.monorepo ? "apps/wiki" : "wiki";
60965
61073
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: wikiRoot });
60966
61074
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: "docs" });
60967
61075
  const wikiFramework = readWikiFrameworkPin(path14.join(expectedDirectory, wikiRoot));
60968
61076
  scaffoldWikiForDirectory({
60969
61077
  outputDirectory: expectedDirectory,
60970
- monorepo: detection.monorepo,
61078
+ monorepo: wikiRoot === "apps/wiki",
60971
61079
  wikiFramework
60972
61080
  });
60973
61081
  const syncScript = path14.join(expectedDirectory, wikiRoot, "scripts", "sync-content.mjs");
@@ -61040,6 +61148,7 @@ var runUpdate = ({
61040
61148
  baseline = bundledBaseline,
61041
61149
  toolRuntime
61042
61150
  }) => exports_Effect.gen(function* () {
61151
+ const writeHuman = (line4) => emitJson ? exports_Effect.void : prompt4.writeLine(line4);
61043
61152
  const manifest = yield* exports_Effect.try({
61044
61153
  try: () => readManifest(rootDirectory),
61045
61154
  catch: (cause3) => new CliValidationError({
@@ -61093,20 +61202,20 @@ var runUpdate = ({
61093
61202
  const hasManagedUpdates = allChanges.length > 0 || staleFiles.length > 0;
61094
61203
  const needsAttention = hasManagedUpdates || packDrift || baselineDrift;
61095
61204
  const driftPrompt = packDrift ? packDriftPrompt({ rootDirectory, finalPacks, resolvedPacks }) : null;
61096
- yield* prompt4.writeLine(renderCommandSection("Update Detection", formatDetectionSummary(detection)));
61097
- yield* prompt4.writeLine("");
61098
- yield* prompt4.writeLine(renderCommandSection("Recorded Packs", finalPacks.length === 0 ? "\u2205" : finalPacks.map((pack2) => `\u2022 ${pack2}`).join(`
61205
+ yield* writeHuman(renderCommandSection("Update Detection", formatDetectionSummary(detection)));
61206
+ yield* writeHuman("");
61207
+ yield* writeHuman(renderCommandSection("Recorded Packs", finalPacks.length === 0 ? "\u2205" : finalPacks.map((pack2) => `\u2022 ${pack2}`).join(`
61099
61208
  `)));
61100
- yield* prompt4.writeLine("");
61101
- yield* prompt4.writeLine(renderCommandSection("Baseline", [
61209
+ yield* writeHuman("");
61210
+ yield* writeHuman(renderCommandSection("Baseline", [
61102
61211
  `active: ${baseline.summary.source}/${baseline.summary.channel} ${baseline.summary.version}`,
61103
61212
  `recorded: ${typeof manifestBaseline?.version === "string" ? manifestBaseline.version : "unknown"}`,
61104
61213
  `drift: ${baselineDrift ? "yes" : "no"}`
61105
61214
  ].join(`
61106
61215
  `)));
61107
61216
  if (packDrift) {
61108
- yield* prompt4.writeLine("");
61109
- yield* prompt4.writeLine(renderCommandSection("Pack Drift", [
61217
+ yield* writeHuman("");
61218
+ yield* writeHuman(renderCommandSection("Pack Drift", [
61110
61219
  "Current package manifests resolve to a different scaffold pack set.",
61111
61220
  "",
61112
61221
  formatResolvedPackSummary({
@@ -61123,16 +61232,16 @@ var runUpdate = ({
61123
61232
  ].join(`
61124
61233
  `)));
61125
61234
  }
61126
- yield* prompt4.writeLine("");
61127
- yield* prompt4.writeLine(renderCommandSection("Managed Changes", summarizeChanges(allChanges)));
61235
+ yield* writeHuman("");
61236
+ yield* writeHuman(renderCommandSection("Managed Changes", summarizeChanges(allChanges)));
61128
61237
  if (staleFiles.length > 0) {
61129
- yield* prompt4.writeLine("");
61130
- yield* prompt4.writeLine(renderCommandSection("Stale Managed Files", summarizeStaleFiles(staleFiles)));
61238
+ yield* writeHuman("");
61239
+ yield* writeHuman(renderCommandSection("Stale Managed Files", summarizeStaleFiles(staleFiles)));
61131
61240
  }
61132
61241
  const patchPreview = diffableChanges(allChanges);
61133
61242
  if (patchPreview.length > 0) {
61134
- yield* prompt4.writeLine("");
61135
- yield* prompt4.writeLine(renderCommandSection("Diff Preview", [
61243
+ yield* writeHuman("");
61244
+ yield* writeHuman(renderCommandSection("Diff Preview", [
61136
61245
  ...patchPreview.map((change) => change.patch),
61137
61246
  ...allChanges.length > patchPreview.length ? [
61138
61247
  `Showing ${patchPreview.length} focused diffs. Full structured details are available with --json.`
@@ -61140,20 +61249,21 @@ var runUpdate = ({
61140
61249
  ].join(`
61141
61250
  `)));
61142
61251
  }
61143
- const shouldApply = write4 || yes ? true : check2 || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
61252
+ const applyRequested = write4 || yes ? true : check2 || emitJson || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
61253
+ const shouldApply = applyRequested && hasManagedUpdates;
61144
61254
  let toolBootstrapStatuses = [];
61145
- if (shouldApply && ensureTools) {
61255
+ if (applyRequested && ensureTools) {
61146
61256
  const requiredTools = requiredToolsForSkills(selectedSkills3(finalPacks, baseline), baseline);
61147
61257
  if (requiredTools.length > 0) {
61148
- yield* prompt4.writeLine("");
61149
- yield* prompt4.writeLine(renderHint(`Ensuring required tools: ${requiredTools.join(", ")}`));
61258
+ yield* writeHuman("");
61259
+ yield* writeHuman(renderHint(`Ensuring required tools: ${requiredTools.join(", ")}`));
61150
61260
  toolBootstrapStatuses = ensureToolsInstalledBestEffort(requiredTools, baseline, toolRuntime);
61151
- yield* prompt4.writeLine(renderCommandSection("Tool bootstrap", toolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${formatToolBootstrapStatus(entry)}`).join(`
61261
+ yield* writeHuman(renderCommandSection("Tool bootstrap", toolBootstrapStatuses.map((entry) => `\u2022 ${entry.toolId}: ${formatToolBootstrapStatus(entry)}`).join(`
61152
61262
  `)));
61153
61263
  const failureDetails = formatToolBootstrapFailureDetails(toolBootstrapStatuses);
61154
61264
  if (failureDetails !== null) {
61155
- yield* prompt4.writeLine("");
61156
- yield* prompt4.writeLine(renderCommandSection("Tool Bootstrap Warning", failureDetails));
61265
+ yield* writeHuman("");
61266
+ yield* writeHuman(renderCommandSection("Tool Bootstrap Warning", failureDetails));
61157
61267
  }
61158
61268
  }
61159
61269
  }
@@ -61202,9 +61312,9 @@ var runUpdate = ({
61202
61312
  driftPrompt,
61203
61313
  baselineDrift
61204
61314
  };
61205
- yield* prompt4.writeLine("");
61206
- yield* prompt4.writeLine(renderCommandSection("Update Complete", [
61207
- shouldApply ? "Managed scaffold files updated." : "No files were written.",
61315
+ yield* writeHuman("");
61316
+ yield* writeHuman(renderCommandSection("Update Complete", [
61317
+ updateCompleteMessage({ applyRequested, hasManagedUpdates }),
61208
61318
  `Changed files: ${allChanges.length}`,
61209
61319
  `Stale files: ${staleFiles.length}`,
61210
61320
  `Manifests scanned: ${manifestPaths(detection).join(", ") || "\u2205"}`,
@@ -61212,8 +61322,6 @@ var runUpdate = ({
61212
61322
  ].join(`
61213
61323
  `)));
61214
61324
  if (emitJson) {
61215
- yield* prompt4.writeLine("");
61216
- yield* prompt4.writeLine(renderJsonLabel());
61217
61325
  yield* prompt4.writeLine(encodePrettyJson3(result));
61218
61326
  }
61219
61327
  rmSync4(expectedDirectory, { recursive: true, force: true });
@@ -61259,9 +61367,10 @@ var updateCommand = exports_Command.make("update", {
61259
61367
  baseline: resolvedBaseline
61260
61368
  });
61261
61369
  }).pipe(exports_Effect.catchTag("CliValidationError", (error4) => exports_Effect.sync(() => {
61262
- console.log(renderHint(error4.message));
61370
+ console.error(renderHint(error4.message));
61371
+ process.exitCode = 1;
61263
61372
  })), exports_Effect.catchTag("CliPromptError", (error4) => isPromptQuitSignal(error4.cause) ? exports_Effect.sync(() => {
61264
- console.log(renderHint("Update cancelled."));
61373
+ console.error(renderHint("Update cancelled."));
61265
61374
  }) : exports_Effect.fail(new CliPromptError({
61266
61375
  cause: error4.cause,
61267
61376
  message: error4.message
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: handoff
3
+ description: Compact the current conversation into a handoff document for another agent to pick up.
4
+ argument-hint: "What will the next session be used for?"
5
+ ---
6
+
7
+ Write a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS - not the current workspace.
8
+
9
+ Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
10
+
11
+ Do not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
12
+
13
+ Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
14
+
15
+ If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
@@ -47,12 +47,13 @@ Create a plan first. Never implement code in this skill.
47
47
  2. Ask only for missing high-impact inputs such as scope, goal, or backlog target.
48
48
  3. Every plan-shaping question must use the exact block: `Decision`, `Recommendation`, `Question`, `Why it matters`.
49
49
  4. Keep `$grill-me`, `$parallel-research`, `$swarm-planner`, and `$tdd` as visible inner phases of one planning run; record when `$parallel-research`, `planning-discovery`, or `plan-reviewer` is used or intentionally skipped because the work is not split-friendly or subagents are unavailable.
50
- 5. Resolve each task's scoped guidance from root `AGENTS.md` down to the nearest `AGENTS.md` for its `location`.
51
- 6. Use each task's required skill guidance while shaping its scope, dependencies, validation, RED target, and review mode; do not merely list skills after the plan is written.
52
- 7. Assign each task the exact existing skills required by those scoped `Primary skills here` lists, merging all scopes for cross-directory tasks.
53
- 8. Normalize every task with stable ids, `depends_on`, `location`, `description`, `validation`, `status`, `log`, `files edited/created`, owning-story backlog references, `assigned_skills`, `tdd_target`, and `review_mode`.
54
- 9. Keep the saved plan standalone: include situation, issue, solution shape, assumptions, findings, research, dependency graph, testing strategy, skill-routing notes, risks, validation gates, unresolved questions, and a resolved decision ledger.
55
- 10. Stop after plan creation and backlog sync. Do not implement code or spawn implementation workers.
50
+ 5. Scan relevant routed learning artifacts before task synthesis when prior bug knowledge, domain behavior, or project conventions could affect the plan.
51
+ 6. Resolve each task's scoped guidance from root `AGENTS.md` down to the nearest `AGENTS.md` for its `location`.
52
+ 7. Use each task's required skill guidance while shaping its scope, dependencies, validation, RED target, and review mode; do not merely list skills after the plan is written.
53
+ 8. Assign each task the exact existing skills required by those scoped `Primary skills here` lists, merging all scopes for cross-directory tasks.
54
+ 9. Normalize every task with stable ids, `depends_on`, `location`, `description`, `validation`, `status`, `log`, `files edited/created`, owning-story backlog references, `assigned_skills`, `tdd_status`, `tdd_target`, RED/GREEN commands, evidence fields, and `review_mode`.
55
+ 10. Keep the saved plan standalone: include situation, issue, solution shape, assumptions, findings, research, dependency graph, testing strategy, skill-routing notes, risks, validation gates, unresolved questions, and a resolved decision ledger.
56
+ 11. Stop after plan creation and backlog sync. Do not implement code or spawn implementation workers.
56
57
 
57
58
  ### Stack-aware preservation
58
59
 
@@ -40,7 +40,14 @@ Every task must include:
40
40
  - `backlog_item_url`
41
41
  - `relation_mode`
42
42
  - `assigned_skills`
43
+ - `tdd_status`
43
44
  - `tdd_target`
45
+ - `red_command`
46
+ - `expected_red_failure`
47
+ - `green_command`
48
+ - `reason_not_testable`
49
+ - `red_evidence`
50
+ - `green_evidence`
44
51
  - `review_mode`
45
52
 
46
53
  `backlog_item_id` and `backlog_item_url` reference the owning product-facing story, not a task-owned backlog record.
@@ -51,6 +58,12 @@ Do not create a new backlog item only because a task boundary exists in the plan
51
58
 
52
59
  `assigned_skills` must list the skills used to shape the task during planning, not only skills expected during implementation. Skill guidance should be reflected in the task's boundary, validation, `tdd_target`, and `review_mode`.
53
60
 
61
+ For behavior-changing code tasks, `tdd_status` must be `required` and the task must include concrete RED/GREEN commands before implementation starts. For docs-only, formatting-only, generated-code-only, config-only, scaffold/bookkeeping-only, or truly non-testable tasks, record `tdd_status: not_applicable` or `not_testable` with an explicit `reason_not_testable`.
62
+
63
+ `red_evidence` and `green_evidence` are execution fields. They should be present but blank when the plan is created, then filled by `implement-spec` before the task is marked complete.
64
+
65
+ `reason_not_testable` cannot be used for "forgot RED." If production code came first, the executor must recover by writing a real public-result RED test, capturing failure evidence, patching to GREEN, and setting `tdd_status: recovered`.
66
+
54
67
  ```md
55
68
  ### T3: Example task
56
69
 
@@ -65,6 +78,13 @@ Do not create a new backlog item only because a task boundary exists in the plan
65
78
  - **backlog_item_url**: https://linear.app/workspace/issue/CP-128/example-story
66
79
  - **relation_mode**: native | body-links
67
80
  - **assigned_skills**: [`effect-authoring`, `effect-best-practices`, `tdd`]
81
+ - **tdd_status**: required
68
82
  - **tdd_target**: First failing public behavior to implement.
83
+ - **red_command**: Exact command expected to fail before implementation.
84
+ - **expected_red_failure**: Expected assertion, error, or mismatch.
85
+ - **green_command**: Exact command expected to pass after implementation.
86
+ - **reason_not_testable**:
87
+ - **red_evidence**:
88
+ - **green_evidence**:
69
89
  - **review_mode**: cli | browser | mixed
70
90
  ```
@@ -6,6 +6,7 @@ Use this reference for the `$tdd` shaping phase across execution tasks.
6
6
 
7
7
  Preserve `$tdd` behavior:
8
8
 
9
+ - classify every task as `tdd_status: required | not_testable | recovered | not_applicable`
9
10
  - surface the public interface change and the behavior priority behind the task
10
11
  - identify deep-module or testability opportunities while task boundaries are still fluid
11
12
  - define the first public-interface behavior that should fail before implementation
@@ -14,10 +15,31 @@ Preserve `$tdd` behavior:
14
15
  - avoid horizontal slicing; every task should represent a RED -> GREEN tracer bullet
15
16
  - make the first failing test concrete enough that a worker can start without guessing
16
17
  - do not leave TDD intent implicit or hidden outside the saved plan artifact
18
+ - for behavior-changing code tasks, require `red_command`, `expected_red_failure`, and `green_command`
19
+ - require empty `red_evidence` and `green_evidence` fields so implementation can fill proof into the durable plan
20
+ - use `reason_not_testable` only for truly non-testable work, never for forgotten RED
21
+ - for code-before-RED recovery, require the executor to write the intended public-result test, capture real failure, patch to pass, and mark `tdd_status: recovered`
17
22
 
18
23
  ## Execution metadata
19
24
 
20
- `tdd_target` must name one public behavior to prove first.
25
+ `tdd_status` must be one of:
26
+
27
+ - `required` for behavior-changing code work
28
+ - `not_testable` for behavior that cannot be tested in this task, with `reason_not_testable`
29
+ - `recovered` when production code came first and RED was reconstructed honestly
30
+ - `not_applicable` for docs-only, formatting-only, generated-code-only, config-only, scaffold/bookkeeping-only, or other non-behavior-changing work
31
+
32
+ `tdd_target` must name one public behavior to prove first, or explain the non-runtime artifact being validated when `tdd_status` is not applicable.
33
+
34
+ `red_command` must be the exact command to run before implementation for testable tasks.
35
+
36
+ `expected_red_failure` must name the failing assertion, error, or observable mismatch expected before implementation.
37
+
38
+ `green_command` must be the exact command to run after implementation.
39
+
40
+ `reason_not_testable` must be blank unless `tdd_status: not_testable` or `not_applicable`.
41
+
42
+ `red_evidence` and `green_evidence` start blank in the plan and must be filled during implementation before task completion.
21
43
 
22
44
  `review_mode` must be:
23
45
 
@@ -43,16 +43,17 @@ Resolve the output root from the repo before writing. Prefer `apps/wiki/content/
43
43
  ### Default workflow
44
44
 
45
45
  1. Build orientation first; do not jump straight into writing.
46
- 2. Ask only enough to make the spec crisp, testable, and bounded.
47
- 3. Use `$parallel-research` when readonly orientation can be split cleanly across independent evidence sources; keep synthesis and spec decisions local.
48
- 4. When an epic has child stories, harvest and preserve each story's requirements before drafting.
49
- 5. Use `$requirements-grill` for meaningful spec-affecting unknowns; do not replace that phase with ad hoc `Open Questions` prompts.
50
- 6. Use `$write-backlog` automatically before final drafting when accepted spec direction implies backlog changes, whether that direction came from the user's objective, discovery, or a grill phase.
51
- 7. Keep the spec free of implementation detail.
52
- 8. Use the template structure exactly, then remove all template scaffolding.
53
- 9. Use `spec-reviewer` to catch invented requirements, missing constraints, vague acceptance criteria, and contradictions before yielding when subagents are available.
54
- 10. Update planning-surface bookkeeping in the same run.
55
- 11. Stop after presenting the spec and the recommended next step.
46
+ 2. Scan relevant routed learning artifacts when prior bug knowledge, domain behavior, or project conventions could affect the spec.
47
+ 3. Ask only enough to make the spec crisp, testable, and bounded.
48
+ 4. Use `$parallel-research` when readonly orientation can be split cleanly across independent evidence sources; keep synthesis and spec decisions local.
49
+ 5. When an epic has child stories, harvest and preserve each story's requirements before drafting.
50
+ 6. Use `$requirements-grill` for meaningful spec-affecting unknowns; do not replace that phase with ad hoc `Open Questions` prompts.
51
+ 7. Use `$write-backlog` automatically before final drafting when accepted spec direction implies backlog changes, whether that direction came from the user's objective, discovery, or a grill phase.
52
+ 8. Keep the spec free of implementation detail.
53
+ 9. Use the template structure exactly, then remove all template scaffolding.
54
+ 10. Use `spec-reviewer` to catch invented requirements, missing constraints, vague acceptance criteria, and contradictions before yielding when subagents are available.
55
+ 11. Update planning-surface bookkeeping in the same run.
56
+ 12. Stop after presenting the spec and the recommended next step.
56
57
 
57
58
  ### Dependency readiness and stack intent
58
59