@punks/cli 2.0.0 → 2.1.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.
package/README.md CHANGED
@@ -11,33 +11,33 @@ At runtime, scaffold content resolves from the latest stable GitHub release base
11
11
  - `punks scaffold`
12
12
  show the scaffold lifecycle index
13
13
  - `punks scaffold init`
14
- scaffold the requirements-stage discovery skill and seed the wiki tree
15
- - `punks scaffold backlog`
16
- print the backlog-stage operator prompt; no backlog-stage packs are scaffolded today
14
+ scaffold requirements/backlog skills and seed the initial wiki tree
17
15
  - `punks scaffold setup`
18
16
  detect the target repo, confirm pack selection, and write repo-aware scaffold output
17
+ - `punks report`
18
+ submit structured Harness friction for maintainer triage
19
19
 
20
20
  ## Usage
21
21
 
22
22
  ```bash
23
23
  punks scaffold
24
24
  punks scaffold init
25
- punks scaffold backlog
26
25
  punks scaffold setup
27
26
  punks scaffold setup -i /path/to/repo
28
27
  punks scaffold setup -i /path/to/repo -o /path/to/output
28
+ punks report --help
29
29
  bun run sync:skills
30
30
  bun run baseline:build
31
31
  ```
32
32
 
33
33
  `bun run sync:skills` updates a local cache clone of `wearedevpunks/skills` and then replaces only `skills/`, overwriting any local changes there.
34
34
 
35
- `punks scaffold init` copies `.agents/skills/grill-me`, seeds a dedicated wiki tree at `apps/wiki` for monorepos or `wiki` for single-repo layouts, and then prints the fixed operator prompt for the requirements gate.
36
-
37
- `punks scaffold backlog` does not currently copy any stage-specific packs. It prints the fixed operator prompt for the backlog gate so the lifecycle stays explicit.
35
+ `punks scaffold init` copies `.agents/skills/requirements-grill` and `.agents/skills/write-backlog`, seeds an initial wiki tree at `apps/wiki` for monorepos or `wiki` for single-repo layouts, and then prints the fixed operator prompt for the requirements gate. Agents should activate `$dp-cli` and reconcile that wiki root with the real repo layout before writing durable docs.
38
36
 
39
37
  `punks scaffold setup` scans the target repo from `cwd` or `-i`, resolves the active scaffold baseline, writes scaffold output into the scan root or `-o`, copies the selected baseline skills, resolves pack-owned lint assets into `.devpunks/specs/lint/`, and ensures required global tool prerequisites for those skills.
40
38
 
39
+ `punks report` submits reusable Harness docs, workflow, tooling, or bug friction when the control plane and auth are configured.
40
+
41
41
  Use `--baseline bundled` to force the npm-shipped baseline, or `--refresh-baseline` to refetch the stable remote baseline.
42
42
 
43
43
  Language packs are detected separately from framework packs. TypeScript is selected when scanned manifests depend on `typescript` or when nested source files include `.ts` / `.tsx`; Python is selected from nested `.py` files. Root-level config files and vendor, virtualenv, generated, scaffold, docs, examples, `scripts`, `opensrc`, cache, and build output directories are ignored.
@@ -55,8 +55,9 @@ export const packCatalog = [
55
55
  id: "debug",
56
56
  category: "default",
57
57
  triggerPackages: [],
58
- description: "Default debug pack: debugging phase and debug-agent runtime-evidence workflow.",
59
- skills: ["debugging-phase", "debug-agent"],
58
+ description:
59
+ "Default debug pack: runtime debugging, ClawPatch bug discovery/resolution, and debug-agent workflow.",
60
+ skills: ["debugging-phase", "bug-discovery-phase", "bug-resolution-phase", "debug-agent"],
60
61
  lintAssets: [],
61
62
  hooks: [],
62
63
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
@@ -100,6 +100,22 @@ export const skillCatalog = [
100
100
  framework: null,
101
101
  requiresTools: ["debug-agent"],
102
102
  },
103
+ {
104
+ id: "bug-discovery-phase",
105
+ sourceDirectory: "skills/phases/bug-discovery-phase",
106
+ tier: "agnostic",
107
+ language: null,
108
+ framework: null,
109
+ requiresTools: ["clawpatch"],
110
+ },
111
+ {
112
+ id: "bug-resolution-phase",
113
+ sourceDirectory: "skills/phases/bug-resolution-phase",
114
+ tier: "agnostic",
115
+ language: null,
116
+ framework: null,
117
+ requiresTools: ["clawpatch"],
118
+ },
103
119
  {
104
120
  id: "docs-ingest-phase",
105
121
  sourceDirectory: "skills/phases/docs-ingest-phase",
@@ -11,6 +11,12 @@ export const toolCatalog = [
11
11
  requiredBins: ["node"],
12
12
  ensureCommands: [],
13
13
  },
14
+ {
15
+ id: "clawpatch",
16
+ packageName: "clawpatch",
17
+ requiredBins: ["node"],
18
+ ensureCommands: [],
19
+ },
14
20
  {
15
21
  id: "opensrc",
16
22
  packageName: "opensrc",
package/dist/index.js CHANGED
@@ -52252,6 +52252,34 @@ class OperatorIdentity extends exports_Schema.Class("OperatorIdentity")({
52252
52252
  emailVerified: exports_Schema.optional(exports_Schema.Boolean)
52253
52253
  }) {
52254
52254
  }
52255
+ var BackofficeAccessRole = exports_Schema.Literal("admin", "member");
52256
+ var BackofficeAccessStatus = exports_Schema.Literal("invited", "active", "revoked");
52257
+
52258
+ class BackofficeAccessSummary extends exports_Schema.Class("BackofficeAccessSummary")({
52259
+ email: exports_Schema.String,
52260
+ role: BackofficeAccessRole,
52261
+ status: BackofficeAccessStatus,
52262
+ userId: exports_Schema.optional(exports_Schema.String),
52263
+ invitedBy: exports_Schema.optional(exports_Schema.String),
52264
+ revokedBy: exports_Schema.optional(exports_Schema.String),
52265
+ invitedAt: exports_Schema.optional(exports_Schema.String),
52266
+ activatedAt: exports_Schema.optional(exports_Schema.String),
52267
+ revokedAt: exports_Schema.optional(exports_Schema.String),
52268
+ createdAt: exports_Schema.String,
52269
+ updatedAt: exports_Schema.String
52270
+ }) {
52271
+ }
52272
+
52273
+ class BackofficeAccessList extends exports_Schema.Class("BackofficeAccessList")({
52274
+ users: exports_Schema.Array(BackofficeAccessSummary)
52275
+ }) {
52276
+ }
52277
+
52278
+ class BackofficeAccessInviteRequest extends exports_Schema.Class("BackofficeAccessInviteRequest")({
52279
+ email: exports_Schema.String,
52280
+ role: BackofficeAccessRole
52281
+ }) {
52282
+ }
52255
52283
  var ProductTelemetryEventName = exports_Schema.Literal("cli.auth.login.completed", "cli.artifact.pull.completed", "cli.scaffold.setup.completed", "cli.scaffold.update.applied", "cli.harness.report.submitted");
52256
52284
  var TelemetrySource = exports_Schema.Literal("normal", "local-dev", "ci", "debug", "test");
52257
52285
  var isoDateTimePattern = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})(?:\.(?<fraction>\d{1,9}))?(?:Z|[+-]\d{2}:\d{2})$/u;
@@ -52459,7 +52487,7 @@ class TelemetryApi extends exports_HttpApiGroup.make("telemetry").add(exports_Ht
52459
52487
  class ReportsApi extends exports_HttpApiGroup.make("reports").add(exports_HttpApiEndpoint.post("submit")`/`.setPayload(HarnessReportInput).addSuccess(HarnessReportCreated).addError(HarnessReportRejected).addError(HarnessReportPersistenceUnavailable)).middleware(CliBearerAuth).prefix("/reports").annotateContext(exports_OpenApi.annotations({ title: "Harness reports" })) {
52460
52488
  }
52461
52489
 
52462
- class BackofficeApi extends exports_HttpApiGroup.make("backoffice").add(exports_HttpApiEndpoint.get("projectUsageList")`/project-usages`.addSuccess(ProjectUsageList).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("projectUsageDetail")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}`.addSuccess(ProjectUsageDetail).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("mapRepository")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}/repositories`.setPayload(BackofficeRepositoryMappingRequest).addSuccess(ObservedRepositorySummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.patch("updateReport")`/reports/${exports_HttpApiSchema.param("reportId", exports_Schema.String)}`.setPayload(BackofficeReportUpdateRequest).addSuccess(HarnessReportSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).middleware(CliBearerAuth).prefix("/backoffice").annotateContext(exports_OpenApi.annotations({ title: "Backoffice project usage" })) {
52490
+ class BackofficeApi extends exports_HttpApiGroup.make("backoffice").add(exports_HttpApiEndpoint.get("currentAccess")`/access/current`.addSuccess(BackofficeAccessSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("accessList")`/access-users`.addSuccess(BackofficeAccessList).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("inviteAccess")`/access-users`.setPayload(BackofficeAccessInviteRequest).addSuccess(BackofficeAccessSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("revokeAccess")`/access-users/${exports_HttpApiSchema.param("email", exports_Schema.String)}/revoke`.addSuccess(BackofficeAccessSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("projectUsageList")`/project-usages`.addSuccess(ProjectUsageList).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("projectUsageDetail")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}`.addSuccess(ProjectUsageDetail).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("mapRepository")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}/repositories`.setPayload(BackofficeRepositoryMappingRequest).addSuccess(ObservedRepositorySummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.patch("updateReport")`/reports/${exports_HttpApiSchema.param("reportId", exports_Schema.String)}`.setPayload(BackofficeReportUpdateRequest).addSuccess(HarnessReportSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).middleware(CliBearerAuth).prefix("/backoffice").annotateContext(exports_OpenApi.annotations({ title: "Backoffice project usage" })) {
52463
52491
  }
52464
52492
 
52465
52493
  class HarnessApi extends exports_HttpApi.make("harness").add(HealthApi).add(BaselineApi).add(TelemetryApi).add(ReportsApi).add(BackofficeApi).addError(Forbidden2).prefix("/api").annotateContext(exports_OpenApi.annotations({
@@ -52503,7 +52531,7 @@ var submitHarnessReport = (options9) => exports_Effect.gen(function* () {
52503
52531
 
52504
52532
  // package.json
52505
52533
  var name = "@punks/cli";
52506
- var version = "2.0.0";
52534
+ var version = "2.1.0";
52507
52535
  // src/telemetry/product.ts
52508
52536
  var git = (cwd, args2) => {
52509
52537
  try {
@@ -52762,21 +52790,25 @@ var renderCommandGuide = () => [
52762
52790
  "commands:",
52763
52791
  " \u203A punks auth",
52764
52792
  " \u2514 manage CLI credentials for authenticated internal baseline access",
52793
+ " \u203A punks report",
52794
+ " \u2514 submit structured Harness friction for maintainer triage",
52765
52795
  " \u203A punks scaffold",
52766
- " \u2514 show the scaffold lifecycle index and available setup stages",
52796
+ " \u2514 show the scaffold lifecycle index and available setup commands",
52767
52797
  " \u203A punks update",
52768
52798
  " \u2514 refresh managed scaffold assets from `.devpunks/scaffold-manifest.json`",
52769
52799
  "",
52770
52800
  "usage:",
52801
+ " \u2022 agents should activate `$dp-cli` before acting on `.devpunks` output",
52771
52802
  " \u2022 start with `punks scaffold` to inspect the lifecycle",
52772
52803
  " \u2022 use `punks scaffold init` for requirements grilling, backlog authoring, and wiki schema seeding",
52773
- " \u2022 use `punks scaffold backlog` to inspect the backlog handoff even when no packs are available",
52774
- " \u2022 use `punks scaffold setup` after repo boilerplate is ready",
52804
+ " \u2022 reconcile the seeded wiki into the real repo layout before writing durable docs",
52805
+ " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52775
52806
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
52807
+ " \u2022 use `punks report` when reusable Harness friction should enter the support loop",
52776
52808
  " \u2022 use `punks auth login` before pulling authenticated internal baselines",
52777
52809
  "",
52778
52810
  "operator notes:",
52779
- " \u2022 pre-boilerplate commands copy only the stage-specific skills",
52811
+ " \u2022 init copies only requirements/backlog skills and the initial wiki structure",
52780
52812
  " \u2022 `setup` remains the repo-aware pack-driven scaffold flow",
52781
52813
  " \u2022 each command prints an operator-facing next-step prompt"
52782
52814
  ].join(`
@@ -52796,9 +52828,11 @@ var renderStageIntro = ({
52796
52828
  body,
52797
52829
  "",
52798
52830
  "usage:",
52799
- commandId === "init" ? " \u2022 use this to scaffold requirements grill/backlog skills and seed the dedicated wiki tree" : " \u2022 use this to inspect the backlog stage even when no scaffolded backlog packs are currently available",
52831
+ " \u2022 agents should activate `$dp-cli` before following generated output",
52832
+ " \u2022 use this to scaffold requirements grill/backlog skills and seed the initial wiki tree",
52833
+ " \u2022 reconcile the wiki into the real repo layout, such as `apps/wiki` in a monorepo",
52800
52834
  " \u2022 rerunning this command overwrites only the files for this stage",
52801
- " \u2022 read the generated prompt/output and follow it before moving to the next scaffold stage"
52835
+ " \u2022 read the generated prompt/output and follow it before running repo-aware setup"
52802
52836
  ].join(`
52803
52837
  `)
52804
52838
  });
@@ -52809,8 +52843,10 @@ var renderSetupIntro = () => renderCommandIntro({
52809
52843
  "Detect repo stack, resolve scaffold packs, and prepare prompt/manifest output.",
52810
52844
  "",
52811
52845
  "usage:",
52846
+ " \u2022 agents should activate `$dp-cli` before following `.devpunks` handoff artifacts",
52812
52847
  " \u2022 run this from the outer repo root so docs/wiki and nested app/package workspaces stay in one scan",
52813
52848
  " \u2022 review detected manifests, technologies, and packs before confirming",
52849
+ " \u2022 reconcile generic scaffold output with the real repo layout before committing final guidance",
52814
52850
  " \u2022 if detection looks incomplete or suspicious, answer `n` and edit the pack selection before accepting",
52815
52851
  " \u2022 after scaffold completes, use the generated next-agent prompt instead of relying on the terminal summary alone"
52816
52852
  ].join(`
@@ -52828,15 +52864,15 @@ var renderScaffoldGuide = () => [
52828
52864
  "commands:",
52829
52865
  " \u203A punks scaffold init",
52830
52866
  " \u2514 requirements gate: scaffold `requirements-grill`, `write-backlog`, and seed the wiki tree",
52831
- " \u203A punks scaffold backlog",
52832
- " \u2514 backlog gate: no scaffolded packs right now; print the operator handoff",
52833
52867
  " \u203A punks scaffold setup",
52834
52868
  " \u2514 repo-aware setup: detect packs, scaffold prompts/manifests/hooks",
52835
52869
  "",
52836
52870
  "operator notes:",
52837
- " \u2022 `init` and `backlog` overwrite their scaffolded skill files on rerun",
52871
+ " \u2022 agents should activate `$dp-cli` before acting on generated scaffold output",
52872
+ " \u2022 `init` overwrites only its scaffolded skill files on rerun",
52873
+ " \u2022 `init` seeds a wiki root that agents must reconcile with the real repo layout",
52838
52874
  " \u2022 `setup` is the first repo-aware command in the lifecycle",
52839
- " \u2022 pre-boilerplate commands print the operator prompt in stdout"
52875
+ " \u2022 setup output must be followed from `.devpunks`, not summarized from terminal text alone"
52840
52876
  ].join(`
52841
52877
  `)
52842
52878
  })
@@ -53034,7 +53070,7 @@ var reportCommand = exports_Command.make("report", {
53034
53070
  `)));
53035
53071
  },
53036
53072
  catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report submission failed.")
53037
- })).pipe(exports_Command.withDescription("Submit structured Harness Intelligence friction."));
53073
+ })).pipe(exports_Command.withDescription("Submit structured Harness friction for maintainer triage. Agents: use after $dp-cli evidence gathering."));
53038
53074
 
53039
53075
  // src/cli/scaffold-command.ts
53040
53076
  import path13 from "path";
@@ -53421,8 +53457,8 @@ var packCatalog = [
53421
53457
  id: "debug",
53422
53458
  category: "default",
53423
53459
  triggerPackages: [],
53424
- description: "Default debug pack: debugging phase and debug-agent runtime-evidence workflow.",
53425
- skills: ["debugging-phase", "debug-agent"],
53460
+ description: "Default debug pack: runtime debugging, ClawPatch bug discovery/resolution, and debug-agent workflow.",
53461
+ skills: ["debugging-phase", "bug-discovery-phase", "bug-resolution-phase", "debug-agent"],
53426
53462
  lintAssets: [],
53427
53463
  hooks: [],
53428
53464
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
@@ -53769,6 +53805,22 @@ var skillCatalog = [
53769
53805
  framework: null,
53770
53806
  requiresTools: ["debug-agent"]
53771
53807
  },
53808
+ {
53809
+ id: "bug-discovery-phase",
53810
+ sourceDirectory: "skills/phases/bug-discovery-phase",
53811
+ tier: "agnostic",
53812
+ language: null,
53813
+ framework: null,
53814
+ requiresTools: ["clawpatch"]
53815
+ },
53816
+ {
53817
+ id: "bug-resolution-phase",
53818
+ sourceDirectory: "skills/phases/bug-resolution-phase",
53819
+ tier: "agnostic",
53820
+ language: null,
53821
+ framework: null,
53822
+ requiresTools: ["clawpatch"]
53823
+ },
53772
53824
  {
53773
53825
  id: "docs-ingest-phase",
53774
53826
  sourceDirectory: "skills/phases/docs-ingest-phase",
@@ -54057,6 +54109,12 @@ var toolCatalog = [
54057
54109
  requiredBins: ["node"],
54058
54110
  ensureCommands: []
54059
54111
  },
54112
+ {
54113
+ id: "clawpatch",
54114
+ packageName: "clawpatch",
54115
+ requiredBins: ["node"],
54116
+ ensureCommands: []
54117
+ },
54060
54118
  {
54061
54119
  id: "opensrc",
54062
54120
  packageName: "opensrc",
@@ -55322,6 +55380,8 @@ import path10 from "path";
55322
55380
 
55323
55381
  // src/content/prompts.ts
55324
55382
  var phaseSkillIds = [
55383
+ "bug-discovery-phase",
55384
+ "bug-resolution-phase",
55325
55385
  "debugging-phase",
55326
55386
  "delivery-phase",
55327
55387
  "docs-ingest-phase",
@@ -57007,7 +57067,7 @@ When processing source material into routed domain knowledge:
57007
57067
  "build": "fumadocs-mdx && next build",
57008
57068
  "check": "oxlint . && oxfmt --check .",
57009
57069
  "check-types": "fumadocs-mdx && next typegen && tsc --noEmit",
57010
- "dev": "next dev --webpack --port=4000",
57070
+ "dev": "next dev --turbopack --port=4000",
57011
57071
  "postinstall": "fumadocs-mdx",
57012
57072
  "start": "next start"
57013
57073
  },
@@ -57623,31 +57683,24 @@ Required skills:
57623
57683
  - \`write-backlog\`
57624
57684
 
57625
57685
  Scaffolded wiki base:
57626
- - treat \`${wikiRoot ?? "wiki"}\` as the dedicated wiki root for specs, raw inputs, routed wiki/project docs, and ingest bookkeeping
57686
+ - treat \`${wikiRoot}\` as the dedicated wiki root for specs, raw inputs, routed wiki/project docs, and ingest bookkeeping
57627
57687
  - this is not the same thing as \`docs/\`
57628
- - if the repo is monorepo-shaped, the wiki root belongs at \`apps/wiki\`; otherwise it belongs at \`wiki\`
57629
- - keep using that scaffolded wiki root when later steps create specs, plans, or ingest domain knowledge
57688
+ - if the repo is monorepo-shaped, reconcile the scaffolded wiki into the real app layout, usually \`apps/wiki\`
57689
+ - if the CLI guessed the wrong root, move or refactor the scaffolded wiki before creating specs, plans, or ingesting domain knowledge
57690
+ - keep using the reconciled wiki root when later steps create specs, plans, or ingest domain knowledge
57630
57691
 
57631
57692
  Execution order:
57632
57693
  1. Start with \`requirements-grill\` and run the requirements grill session.
57633
57694
  2. Follow the skill's artifact and wiki-synthesis guidance.
57634
57695
  3. Run \`write-backlog\` only after the grill gate is closed.
57635
- 4. Use \`punks scaffold backlog\` only as the next CLI handoff after backlog authoring is ready.
57696
+ 4. Use \`punks scaffold setup\` only after the repo shape is ready for repo-aware AI setup.
57636
57697
 
57637
57698
  Gate:
57638
57699
  - do not create backlog items while active requirement branches remain unresolved
57639
57700
  - treat this as the canonical step before backlog creation
57640
57701
 
57641
57702
  When this gate is complete, the next CLI step is:
57642
- - \`punks scaffold backlog\``
57643
- },
57644
- {
57645
- id: "backlog",
57646
- summary: "Backlog scaffolding is currently unavailable.",
57647
- skills: [],
57648
- renderPrompt: () => `You are the operator agent continuing a \`punks scaffold backlog\` run.
57649
-
57650
- No scaffolded backlog packs are currently available.`
57703
+ - \`punks scaffold setup\``
57651
57704
  }
57652
57705
  ];
57653
57706
  var stageScaffoldById = Object.fromEntries(stageScaffoldCatalog.map((stage) => [stage.id, stage]));
@@ -57764,23 +57817,23 @@ var runStageScaffold = ({
57764
57817
  baseline = bundledBaseline
57765
57818
  }) => exports_Effect.gen(function* () {
57766
57819
  const stage = stageScaffoldById[commandId];
57767
- const detection = commandId === "init" ? yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null))) : null;
57768
- const wikiRoot = commandId === "init" ? detection?.monorepo === true ? "apps/wiki" : "wiki" : null;
57820
+ const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
57821
+ const wikiRoot = detection?.monorepo === true ? "apps/wiki" : "wiki";
57769
57822
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
57770
57823
  outputDirectory,
57771
57824
  skillId,
57772
57825
  baseline
57773
57826
  }));
57774
- const wikiFiles = commandId === "init" && wikiRoot !== null ? scaffoldWiki({
57827
+ const wikiFiles = scaffoldWiki({
57775
57828
  outputDirectory,
57776
57829
  wikiRoot
57777
- }) : [];
57830
+ });
57778
57831
  const operatorPrompt = stage.renderPrompt({ wikiRoot });
57779
57832
  yield* prompt4.writeLine(renderScaffoldTitle());
57780
57833
  yield* prompt4.writeLine("");
57781
57834
  yield* prompt4.writeLine(renderStageIntro({
57782
57835
  commandId,
57783
- title: commandId === "init" ? "Requirements" : "Backlog",
57836
+ title: "Requirements",
57784
57837
  body: stage.summary
57785
57838
  }));
57786
57839
  yield* prompt4.writeLine("");
@@ -57854,10 +57907,9 @@ var setupCommand = exports_Command.make("setup", {
57854
57907
  }) : exports_Effect.fail(new CliPromptError({
57855
57908
  cause: error4.cause,
57856
57909
  message: error4.message
57857
- })))))).pipe(exports_Command.withDescription("Detect repo technologies from the target repo, resolve packs, confirm selection, and write prompt/manifest scaffold output."));
57858
- var scaffoldCommand = exports_Command.make("scaffold", {}, () => exports_Effect.sync(() => console.log(renderScaffoldGuide()))).pipe(exports_Command.withDescription("Scaffold the project lifecycle: requirements init, backlog prep, and repo-aware AI setup."), exports_Command.withSubcommands([
57859
- stageCommand("init", "Scaffold requirements grill and backlog authoring skills, seed the wiki tree, and print the operator prompt."),
57860
- stageCommand("backlog", "Print the backlog-stage operator prompt even though no backlog-stage packs are currently scaffolded."),
57910
+ })))))).pipe(exports_Command.withDescription("Repo-aware AI setup. Agents: activate $dp-cli, then reconcile .devpunks output with the real repo layout."));
57911
+ var scaffoldCommand = exports_Command.make("scaffold", {}, () => exports_Effect.sync(() => console.log(renderScaffoldGuide()))).pipe(exports_Command.withDescription("Scaffold init or setup. Agents: activate $dp-cli before following generated handoffs."), exports_Command.withSubcommands([
57912
+ stageCommand("init", "Seed requirements/backlog skills and wiki structure. Agents: activate $dp-cli and reconcile wiki layout."),
57861
57913
  setupCommand
57862
57914
  ]));
57863
57915
 
@@ -59430,7 +59482,7 @@ var startupCheckCliEnv = "DP_STARTUP_CHECK_CLI";
59430
59482
  var startupCheckSkillEnv = "DP_STARTUP_CHECK_SKILL";
59431
59483
  var startupCheckIntervalMs = Number.parseInt(process.env.DP_STARTUP_CHECK_INTERVAL_MS ?? String(12 * 60 * 60 * 1000), 10);
59432
59484
  var startupCheckCacheFile = path16.join(homedir4(), ".cache", "punks", "startup-check.json");
59433
- var app = exports_Command.make("punks", {}, () => exports_Effect.sync(() => console.log(renderCommandGuide()))).pipe(exports_Command.withDescription("Harness Intelligence scaffolding CLI."), exports_Command.withSubcommands([authCommand, reportCommand, scaffoldCommand, updateCommand]));
59485
+ var app = exports_Command.make("punks", {}, () => exports_Effect.sync(() => console.log(renderCommandGuide()))).pipe(exports_Command.withDescription("Harness Intelligence CLI. Agents: activate $dp-cli before acting on generated .devpunks output."), exports_Command.withSubcommands([authCommand, reportCommand, scaffoldCommand, updateCommand]));
59434
59486
  var cli = exports_Command.run(app, {
59435
59487
  name: "punks",
59436
59488
  version
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dp-cli
3
- description: Operates the Devpunks `dp` CLI and interactively follows scaffold, stage, update, and post-command handoff artifacts through to completion. Use when a repo contains `.devpunks/` output, when the user mentions `dp scaffold`, `dp update`, Devpunks CLI setup, or asks what to do after running a `dp` command.
3
+ description: Operates the Devpunks `dp` CLI and interactively follows scaffold, update, report, and post-command handoff artifacts through to completion. Use when a repo contains `.devpunks/` output, when the user mentions `dp scaffold`, `dp update`, `dp report`, Devpunks CLI setup, or asks what to do after running a `dp` command.
4
4
  metadata: {"Devpunks":{"entrypoint":true}}
5
5
  ---
6
6
 
@@ -13,9 +13,9 @@ The `dp` CLI scaffolds Devpunks agent assets and writes follow-up instructions f
13
13
  ```bash
14
14
  dp scaffold setup
15
15
  dp scaffold init
16
- dp scaffold backlog
17
16
  dp update --check
18
17
  dp update --write
18
+ dp report --help
19
19
  ```
20
20
 
21
21
  After any command, read the command output and generated artifacts before acting.
@@ -46,6 +46,14 @@ See [references/commands.md](references/commands.md) for command intent and when
46
46
 
47
47
  See [references/post-command-flow.md](references/post-command-flow.md) for the required agent flow after `dp scaffold` or `dp update`.
48
48
 
49
+ The former backlog scaffold subcommand is not part of current guidance. `dp scaffold init` provides the requirements/backlog skills and initial wiki structure; `dp scaffold setup` provides repo-aware managed scaffold output.
50
+
51
+ ## Scaffold Init
52
+
53
+ After `dp scaffold init`, expect `.agents/skills/requirements-grill`, `.agents/skills/write-backlog`, and an initial wiki root.
54
+
55
+ Run the requirements grill before backlog authoring. If the generated wiki root does not match the real repository layout, move or refactor it before creating durable specs, plans, or routed docs. Monorepos usually use `apps/wiki`; single-repo layouts usually use `wiki`.
56
+
49
57
  ## Scaffold Setup
50
58
 
51
59
  After `dp scaffold setup`, expect artifacts such as:
@@ -62,6 +70,8 @@ Read `.devpunks/AGENT-SYSTEM-PROMPT.md` first when present.
62
70
 
63
71
  Then author or reconcile the final repo files requested by the specs, including prompt files, harness mirrors, lint configuration, and subagent manifests.
64
72
 
73
+ Reconcile generated wiki guidance with the real repository layout. Do not assume a newly seeded wiki root is canonical until it matches the project boundary.
74
+
65
75
  Before authoring prompts or plans, identify the detected core libraries whose source behavior matters. Ask the user which ones to prioritize if the choice is not obvious, then run `opensrc path <package>` or `opensrc path owner/repo` only for that focused set.
66
76
 
67
77
  When lint specs suggest Oxlint or hooks suggest Oxfmt, treat migration as a repo-policy change. Ask before replacing existing ESLint/Prettier/Biome scripts or CI, then update package scripts, task pipelines, editor/docs references, and hooks together.
@@ -74,6 +84,12 @@ After `dp update`, inspect `.devpunks/scaffold-manifest.json` and the update sum
74
84
  - `--write` refreshes scaffold-managed assets.
75
85
  - pack drift is a setup decision point, not a silent auto-fix.
76
86
 
87
+ ## Report
88
+
89
+ Use `dp report` when reusable Harness friction should enter maintainer triage: stale generated guidance, confusing CLI output, missing docs, broken setup, or shared tooling issues.
90
+
91
+ Do not use reports as the default destination for project product backlog. Report submission requires control-plane configuration and auth.
92
+
77
93
  ## Completion Checklist
78
94
 
79
95
  - `.devpunks/AGENT-SYSTEM-PROMPT.md` was followed or consciously superseded.
@@ -12,13 +12,9 @@ It does not finish all repo-specific authoring. The next agent must use `.devpun
12
12
 
13
13
  Use before boilerplate exists.
14
14
 
15
- It scaffolds requirements-stage assets and prints an operator prompt. Follow that prompt before moving to another stage.
15
+ It scaffolds `requirements-grill`, `write-backlog`, and the initial wiki tree, then prints an operator prompt. Follow that prompt before moving to repo-aware setup.
16
16
 
17
- ## `dp scaffold backlog`
18
-
19
- Use to inspect or enter the backlog stage.
20
-
21
- When no backlog-stage packs are available, the command still prints the operator prompt so the stage boundary is explicit.
17
+ If the generated wiki root does not match the repository layout, move or refactor it before writing specs, plans, or routed docs. Monorepos usually use `apps/wiki`; single-repo layouts usually use `wiki`.
22
18
 
23
19
  ## `dp update --check`
24
20
 
@@ -31,3 +27,9 @@ Report missing, changed, or pack-drift findings. Do not write files.
31
27
  Use to refresh scaffold-managed files recorded in `.devpunks/scaffold-manifest.json`.
32
28
 
33
29
  After writing, verify the refreshed files still fit the repo shape and any pack drift is handled intentionally.
30
+
31
+ ## `dp report`
32
+
33
+ Use to submit reusable Harness friction for maintainer triage when the control plane and auth are configured.
34
+
35
+ Reports are for shared Harness/docs/tooling/workflow issues, not the default path for project product backlog.
@@ -27,6 +27,7 @@ If a file is missing, continue with the next available artifact and say what was
27
27
  After `dp scaffold setup`:
28
28
 
29
29
  - Generate final root/docs/workspace `AGENTS.md` files from prompt specs.
30
+ - Reconcile any scaffolded wiki root with the real repo layout before writing durable docs.
30
31
  - Create sibling `CLAUDE.md` symlink mirrors for those neutral prompt files.
31
32
  - Keep `.agents/AGENTS.md` as the shared global prompt source.
32
33
  - Keep `.agents/skills/` as the main skill directory; only `.claude/skills` mirrors it.
@@ -37,6 +38,12 @@ After `dp scaffold setup`:
37
38
 
38
39
  Do not stop after saying the files exist.
39
40
 
41
+ After `dp scaffold init`:
42
+
43
+ - Run `requirements-grill` before `write-backlog`.
44
+ - Treat the seeded wiki root as provisional until it matches the repo layout.
45
+ - Use `dp scaffold setup` only after the repo is ready for repo-aware setup.
46
+
40
47
  ## Reporting
41
48
 
42
49
  Final reports should say:
@@ -12,9 +12,9 @@ Use this reference before asking clarifying questions.
12
12
  - Prefer the domain whose contract most clearly owns the request.
13
13
  - If multiple domains are involved, pick the primary owner and note cross-domain scope in the spec.
14
14
  - If no domain matches, stop and tell the user to run `/create-wiki-domain <name>` first.
15
- 4. Read the relevant routed domain index:
16
- - `apps/wiki/content/docs/<domain>/index.mdx`
17
- 5. Optionally read related routed concepts or flows when they are obviously relevant.
15
+ 4. Read the relevant domain contract:
16
+ - `apps/wiki/domains/<domain>/<domain>-contract.md`
17
+ 5. Optionally read related domain concepts or flows when they are obviously relevant.
18
18
  6. Check for existing overlapping specs in:
19
19
  - `apps/wiki/specs/<domain>/<domain>-specs.md`
20
20
  7. If backlog context exists, inspect the parent epic/capability and every child story beneath it.
@@ -22,7 +22,7 @@ Use wiki synthesis when the user asks to persist closed grill decisions into `ap
22
22
  Both workflows can happen in one long session, but keep the responsibilities distinct:
23
23
 
24
24
  - `docs/<topic>-grill-log.md` and `docs/<topic>-grill-status.md` are the detailed requirements and glossary record
25
- - `apps/wiki/content/docs/<domain>/` is synthesized routed domain knowledge
25
+ - `apps/wiki/domains/` is synthesized domain knowledge
26
26
  - backlog/user-story creation is the next phase after the grill gate, outside this skill's scope
27
27
 
28
28
  ## Core Behavior
@@ -80,7 +80,7 @@ Create or update decision pages only when:
80
80
 
81
81
  Keep `docs/` as the detailed design record.
82
82
 
83
- Use `apps/wiki/content/docs/<domain>/` for synthesized routed domain knowledge.
83
+ Use `apps/wiki/domains/` for synthesized domain knowledge.
84
84
 
85
85
  Do not duplicate the full grill log in wiki pages.
86
86
  Summarize stable meaning, glossary, and axioms; link back to source docs when useful.
@@ -0,0 +1,140 @@
1
+ # Bug Discovery Phase Reference
2
+
3
+ ## Preflight Record
4
+
5
+ Before running ClawPatch, write down the run contract in the conversation, goal
6
+ handoff, or local run notes:
7
+
8
+ ```text
9
+ repo root: <absolute path>
10
+ scope: <whole repo | path | feature/project selector>
11
+ provider: <codex|acpx|grok|opencode|pi|mock|mock-fail>
12
+ model: <model name or unset>
13
+ limit: <number or unset>
14
+ jobs: <number or unset>
15
+ state dir: <repo>/.clawpatch/
16
+ report path: <repo>/.clawpatch/reports/<name>.md
17
+ dirty posture: include dirty changes? <yes|no>
18
+ output format: markdown file | markdown stdout | json stdout redirected to file
19
+ ```
20
+
21
+ This record is part of the phase contract. Do it before launching any long AFK
22
+ review so the user can understand cost, scope, state, and replay boundaries.
23
+
24
+ ## Provider Warnings
25
+
26
+ Warn, but do not block, when any of these are true:
27
+
28
+ - provider is `pi`
29
+ - provider is `acpx` and the model or ACP config resolves to Claude
30
+ - provider, model, config, or environment mentions `claude`, `anthropic`, or an
31
+ Anthropic model family such as `claude-3`, `claude-3.5`, `claude-3-7`,
32
+ `claude-sonnet`, `claude-opus`, or `claude-haiku`
33
+ - `ANTHROPIC_API_KEY` is set
34
+
35
+ Use wording like:
36
+
37
+ ```text
38
+ Provider warning: this run appears to use Claude/Anthropic or another metered
39
+ route. That is allowed, but confirm the provider/model/cost boundary before
40
+ leaving it AFK. I will make the provider explicit in every generated command.
41
+ ```
42
+
43
+ Do not imply Anthropic routes are banned. The operator chooses the route.
44
+
45
+ ## Command Rules
46
+
47
+ Use explicit provider flags in generated ClawPatch commands. Add `--model` when
48
+ the model is known. Keep `--root`, `--state-dir`, `--limit`, `--jobs`, and
49
+ `--output` visible when they matter.
50
+
51
+ Prefer repo-local state:
52
+
53
+ ```sh
54
+ clawpatch doctor --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL"
55
+ clawpatch status --root "$REPO" --state-dir "$REPO/.clawpatch" --plain
56
+ clawpatch init --root "$REPO" --state-dir "$REPO/.clawpatch"
57
+ clawpatch map --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL"
58
+ ```
59
+
60
+ For discovery, use `review` for normal AFK review and `ci` when the user wants
61
+ CI-shaped discovery:
62
+
63
+ ```sh
64
+ clawpatch review --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL" --limit "$LIMIT" --jobs "$JOBS"
65
+ clawpatch ci --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL" --limit "$LIMIT" --jobs "$JOBS" --output "$REPORT"
66
+ ```
67
+
68
+ Use `--include-dirty` only when the user wants current uncommitted work included
69
+ in discovery. If omitted, say dirty work was excluded or left to ClawPatch
70
+ defaults.
71
+
72
+ For report and ledger inspection, use `clawpatch report` after `review` or `ci`
73
+ has produced finding state. It renders the current findings ledger. With
74
+ `--output <path>` it writes Markdown to that path. With global `--json` it
75
+ emits machine-readable JSON to stdout; do not pair `--json` with `--output
76
+ <json-file>` expecting JSON to be written there, because `--output` is the
77
+ Markdown report file.
78
+
79
+ ```sh
80
+ # Write a durable Markdown report and print a short completion summary.
81
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch" --output "$REPORT" --plain
82
+
83
+ # Emit the Markdown report to stdout when no file is needed.
84
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch"
85
+
86
+ # Save machine-readable JSON by redirecting stdout.
87
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch" --json > "$REPORT_JSON"
88
+
89
+ # Narrow the report when triaging a queue.
90
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch" --status open --severity high --plain
91
+
92
+ clawpatch next --root "$REPO" --state-dir "$REPO/.clawpatch" --plain
93
+ clawpatch show --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID" --plain
94
+ clawpatch status --root "$REPO" --state-dir "$REPO/.clawpatch" --plain
95
+ ```
96
+
97
+ Triage commands are allowed for discovery classification when no source mutation
98
+ is performed:
99
+
100
+ ```sh
101
+ clawpatch triage --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID" --status "$STATUS"
102
+ clawpatch revalidate --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL" --finding "$FINDING_ID" --plain
103
+ ```
104
+
105
+ Discovery classification should reflect what was learned from static review:
106
+ branch relevance, runtime-debugging need, false-positive candidacy, resolution
107
+ candidacy, deferral, or blockers. Use ClawPatch statuses only where they match
108
+ the tool's supported values. Do not claim runtime truth from ClawPatch alone.
109
+
110
+ ## No-Mutation Boundary
111
+
112
+ Never run these by default in `bug-discovery-phase`:
113
+
114
+ ```sh
115
+ clawpatch fix --finding "$FINDING_ID"
116
+ clawpatch open-pr --patch "$PATCH_ATTEMPT_ID"
117
+ ```
118
+
119
+ If the user asks for fixing, stop discovery and enter `$bug-resolution-phase`.
120
+ If a finding needs runtime reproduction, enter `$debugging-phase`. If a selected
121
+ finding becomes tech debt, route repo docs through `$docs-ingest-phase`; broad
122
+ discovery itself does not create tech-debt docs.
123
+
124
+ ## Output Checklist
125
+
126
+ The final report must include:
127
+
128
+ - report path, usually `.clawpatch/reports/<run>.md`; if JSON was requested,
129
+ include the redirected JSON artifact path separately
130
+ - durable ledger/state path, usually `.clawpatch/`
131
+ - provider, model, scope, `--limit`, `--jobs`, report path, and dirty posture
132
+ - command list and whether each command completed
133
+ - relevant finding IDs, status, severity if available, and why they matter
134
+ - explicit statement: ClawPatch findings are static-review candidates, not
135
+ proven runtime root causes
136
+ - next recommended phase for each important finding:
137
+ `$bug-resolution-phase`, `$debugging-phase`, `$docs-ingest-phase`, or none
138
+
139
+ Keep the summary concise. Preserve report and state paths so later resolution
140
+ goals can resume from the durable ClawPatch ledger.
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: bug-discovery-phase
3
+ description: >-
4
+ Runs AFK ClawPatch bug discovery, reporting, and triage without source
5
+ mutation. Use when the user asks for ClawPatch discovery, broad bug discovery,
6
+ bug lifecycle triage, finding ledgers, AFK bug review, or durable bug reports.
7
+ ---
8
+
9
+ # Bug Discovery Phase
10
+
11
+ `bug-discovery-phase` wraps ClawPatch discovery. It produces review state,
12
+ reports, and triage notes; it does not prove runtime root causes and does not
13
+ patch code by default.
14
+
15
+ See [REFERENCE.md](REFERENCE.md) for command patterns, provider warning wording,
16
+ and the full output checklist.
17
+
18
+ ## Contract
19
+
20
+ - **Role:** public AFK ClawPatch discovery/report/triage phase
21
+ - **Owns:** ClawPatch setup checks, discovery scope, report path, durable state,
22
+ finding IDs, and branch-relevant triage notes
23
+ - **Does not own:** runtime reproduction, root-cause proof, code fixes, PRs, or
24
+ repo tech-debt docs
25
+ - **Allowed commands:** `clawpatch init`, `map`, `review`, `ci`, `report`,
26
+ `show`, `next`, `triage`, `status`, `doctor`, `revalidate`
27
+ - **Blocked by default:** `clawpatch fix --finding`, `clawpatch open-pr`
28
+
29
+ ## Use When
30
+
31
+ - The user asks for broad ClawPatch review, discovery, report, triage, or status.
32
+ - A goal needs AFK static bug-finding before humans choose findings to resolve.
33
+ - Existing `.clawpatch/` state needs inspection, report generation, or triage.
34
+ - The desired output is a durable finding ledger, not a patch.
35
+
36
+ ## Do Not Use When
37
+
38
+ - There is one concrete runtime symptom; use `$debugging-phase`.
39
+ - The user asks to fix a selected ClawPatch finding; use `$bug-resolution-phase`.
40
+ - The user wants repo tech-debt docs; route that through `$docs-ingest-phase`
41
+ after a selected finding is classified.
42
+ - The target repo, provider, or scope cannot be identified.
43
+
44
+ ## Workflow
45
+
46
+ 1. **Bound the run.** Record repo root, scope, provider, model, `--limit`,
47
+ `--jobs`, state dir, report path, dirty-worktree posture, and requested output
48
+ format before running ClawPatch.
49
+ 2. **Warn on cost-sensitive routes.** Warn, but do not ban, Claude, Anthropic,
50
+ `acpx` resolving to Claude, `pi`, Anthropic model names, or
51
+ `ANTHROPIC_API_KEY`.
52
+ 3. **Make provider explicit.** Generated goals and commands must include the
53
+ selected provider. Include the model when known.
54
+ 4. **Inspect readiness.** Prefer `clawpatch doctor`, `status`, and existing
55
+ `.clawpatch/` state before long runs.
56
+ 5. **Discover.** Use read-oriented ClawPatch commands: usually `init`, `map`,
57
+ then `review` or `ci` with explicit provider, model, limit, jobs, state dir,
58
+ scope, and output.
59
+ 6. **Report and triage.** Generate a report under `.clawpatch/reports/` unless
60
+ the user supplied another path. Use `clawpatch report --output <path>` for
61
+ Markdown reports; for JSON, run `clawpatch report --json > <path>` because
62
+ `--output` writes Markdown. Use `show`, `next`, `triage`, `status`, or
63
+ `revalidate` only for inspection and classification.
64
+ 7. **Stop before mutation.** Do not run `fix --finding` or `open-pr` unless the
65
+ user gives a new explicit resolution request.
66
+
67
+ ## Output Contract
68
+
69
+ Return:
70
+
71
+ - repo root, scope, provider, model, `--limit`, `--jobs`
72
+ - report path and durable ClawPatch ledger/state path
73
+ - commands run and validation status
74
+ - relevant finding IDs, statuses, and branch relevance
75
+ - warning that findings are static-review candidates, not proven runtime root
76
+ causes
77
+ - next action: inspect selected finding, enter `$bug-resolution-phase`, enter
78
+ `$debugging-phase`, or stop
@@ -0,0 +1,160 @@
1
+ # Bug Resolution Phase Reference
2
+
3
+ ## Operating Model
4
+
5
+ `bug-resolution-phase` starts after a human or upstream discovery step selects one ClawPatch finding. ClawPatch is the ledger and context source; it is not treated as proof of runtime behavior and is not the default patching engine.
6
+
7
+ Default to one finding. Accept a batch only when the user bounds it and the findings share at least one concrete constraint:
8
+
9
+ - same confirmed or suspected root cause
10
+ - same owned file set or package boundary
11
+ - same validation path or failing check
12
+ - same contract or test coverage gap
13
+
14
+ Do not turn a broad report into an automatic repair campaign. If the request is ambiguous, ask for the finding ID or batch boundary.
15
+
16
+ ## Useful ClawPatch Commands
17
+
18
+ Use commands like these for context and state:
19
+
20
+ ```sh
21
+ clawpatch show --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID"
22
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch" --status open
23
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch" --json > "$REPORT_JSON"
24
+ clawpatch triage --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID" --status "$STATUS" --note "$REASON"
25
+ clawpatch revalidate --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID"
26
+ clawpatch fix --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID" --dry-run
27
+ ```
28
+
29
+ `clawpatch report` renders the current finding ledger for context. Use it to
30
+ recover report context when a resolution goal starts from only a finding ID or
31
+ state directory. `--output <path>` writes Markdown. `--json` writes JSON to
32
+ stdout, so redirect stdout when a JSON artifact is needed.
33
+
34
+ `clawpatch fix --finding <id> --dry-run` is allowed for inspection when it clarifies the proposed patch, but do not apply it by default. `clawpatch fix --finding <id>` and `clawpatch open-pr --patch <patchAttemptId>` are explicit mutation paths and require a clear user request.
35
+
36
+ Preserve report linkage in notes and final output: finding ID, report path if known, `.clawpatch/` state path when relevant, and command outputs used for decisions.
37
+
38
+ ## Classification Matrix
39
+
40
+ ### `resolve-now`
41
+
42
+ Use when the finding is selected, bounded, code/docs ownership is clear, and verification is available.
43
+
44
+ Actions:
45
+
46
+ 1. Inspect ClawPatch evidence and relevant source.
47
+ 2. Optionally inspect `clawpatch fix --finding <id> --dry-run` for context only.
48
+ 3. Patch through normal Harness/Codex edits.
49
+ 4. Run focused tests, type checks, smoke checks, or docs validation appropriate to the touched scope.
50
+ 5. Revalidate with `clawpatch revalidate --finding <id>` when possible.
51
+ 6. If revalidation is unavailable or inconclusive, update triage/status with a clear note.
52
+
53
+ ### `needs-runtime-debugging`
54
+
55
+ Use when the finding depends on runtime behavior, reproduction, logs, browser/CLI checks, flakiness, performance, or an observed symptom.
56
+
57
+ Actions:
58
+
59
+ 1. Stop resolution edits unless a cause is already proven.
60
+ 2. Route into `$debugging-phase`.
61
+ 3. Pass input artifacts: finding ID, report path, source evidence, expected behavior, observed or suspected behavior, affected scenario, and any failed revalidation.
62
+ 4. Let `$debugging-phase` own hypotheses, runtime evidence, fix, and verification.
63
+
64
+ ### `tech-debt`
65
+
66
+ Use when the finding is real or plausible but too broad for selected-finding repair, needs product/architecture decisions, lacks acceptance criteria, or would require a larger spec.
67
+
68
+ Actions:
69
+
70
+ 1. Classify the selected finding first. Discovery alone must not create debt docs.
71
+ 2. Update ClawPatch triage/history with the tech-debt reason.
72
+ 3. Run `$docs-ingest-phase` to create or update durable repo debt/docs context.
73
+ 4. Preserve these fields in the durable context:
74
+ - ClawPatch finding ID
75
+ - ClawPatch report path or state path
76
+ - source evidence and affected paths
77
+ - classification reason
78
+ - human-review question
79
+ - why immediate resolution is unsafe or too broad
80
+ 5. Do not write speculative architecture as current truth.
81
+
82
+ The debt context should be small and reviewable. It should point to the
83
+ ClawPatch report and finding instead of copying the full report. It should name
84
+ the human decision needed before architecture, product scope, or acceptance
85
+ criteria can change.
86
+
87
+ Human-review questions should be concrete, for example: "Should this contract be changed, tested, or accepted as a known limitation?"
88
+
89
+ ### `false-positive`
90
+
91
+ Use when source inspection proves the finding is incorrect, stale, unreachable, already covered, or intentionally accepted behavior.
92
+
93
+ Actions:
94
+
95
+ 1. Record the proof with file paths, tests, docs, or command evidence.
96
+ 2. Run `clawpatch triage --finding <id> --status false-positive --note "<clear reason>"` or the closest supported false-positive status.
97
+ 3. Revalidate only if it adds signal; otherwise report the triage command as the state update.
98
+
99
+ ### `blocked`
100
+
101
+ Use when resolution cannot proceed because required access, artifacts, environment, owner decision, or reproduction evidence is missing.
102
+
103
+ Actions:
104
+
105
+ 1. Record the blocker and the specific missing item.
106
+ 2. Leave source unchanged unless partial safe cleanup was already verified.
107
+ 3. Update ClawPatch triage/status when useful with a note that names the blocker.
108
+ 4. Report the next human action.
109
+
110
+ ## Parallel Batch Resolution
111
+
112
+ `parallel: true` means bounded batch findings can be resolved concurrently, not merely inspected concurrently.
113
+
114
+ Preconditions:
115
+
116
+ - The batch list is explicit.
117
+ - Each finding has a classification target or classification owner.
118
+ - File ownership is disjoint, or the batch intentionally shares one root-cause patch with one coordination owner.
119
+ - Validation commands are known and can be merged centrally.
120
+ - Shared files, generated files, lockfiles, migrations, docs, and schemas have a single owner.
121
+ - Every worker can state which files it may edit, which files it must not edit,
122
+ and which validation it must run before handoff.
123
+
124
+ Worker brief must include:
125
+
126
+ - finding IDs
127
+ - classification route
128
+ - owned files and forbidden files
129
+ - allowed validation commands
130
+ - ClawPatch context command outputs or paths
131
+ - merge/revalidation handoff expectations
132
+ - explicit note that final ClawPatch status changes are centralized unless the
133
+ coordinator assigns one worker to a single finding end to end
134
+
135
+ Central coordinator responsibilities:
136
+
137
+ 1. Confirm no worker overwrote unrelated edits.
138
+ 2. Review combined diff for overlap and consistency.
139
+ 3. Run final focused validation.
140
+ 4. Run `clawpatch revalidate --finding <id>` for each resolved finding when possible.
141
+ 5. Update false-positive, tech-debt, or blocked statuses centrally.
142
+ 6. Produce one final report mapping each finding to classification, changes, validation, and ClawPatch state.
143
+
144
+ If two workers discover that their findings require the same file or root-cause
145
+ patch, pause fan-out for that subset and consolidate under one owner. Do not let
146
+ parallel workers race on the same fix.
147
+
148
+ ## Output Contract
149
+
150
+ Return:
151
+
152
+ - mode: `parallel: true|false`
153
+ - finding IDs and report/state paths used
154
+ - classification for each finding
155
+ - route taken: resolved, debugging, debt, false-positive, or blocked
156
+ - changes made through normal edits, if any
157
+ - ClawPatch commands run and resulting state
158
+ - verification commands and results
159
+ - debt/docs artifacts or debugging handoff, if created
160
+ - caveats, residual risk, and next human action
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: bug-resolution-phase
3
+ description: >-
4
+ Resolves selected ClawPatch findings through classification, bounded fixes,
5
+ triage, docs/debt routing, and revalidation. Use when the user selects a
6
+ ClawPatch finding, asks for ClawPatch-backed bug resolution, or gives a
7
+ tightly bounded finding batch for sequential or parallel handling.
8
+ ---
9
+
10
+ # Bug Resolution Phase
11
+
12
+ ## Contract
13
+
14
+ - **Role:** public ClawPatch selected-finding resolution phase
15
+ - **Scope:** one selected finding by default; bounded batch only when explicitly tied by root cause, owned files, validation path, or contract/test gap
16
+ - **Primary input:** ClawPatch finding ID plus report or `.clawpatch/` state path when available
17
+ - **Uses ClawPatch for:** finding context, report linkage, triage/history, optional dry-run inspection, revalidation
18
+ - **Does not use by default:** `clawpatch fix --finding`, `clawpatch open-pr --patch`
19
+ - **Patch path:** normal Harness/Codex edits unless the user explicitly requests ClawPatch patch attempts
20
+ - **Exit conditions:** resolved and revalidated, routed to debugging, recorded as debt, triaged false positive, or blocked with evidence
21
+
22
+ ## Use When
23
+
24
+ - The user selects a ClawPatch finding for resolution.
25
+ - The user asks to resolve a ClawPatch finding or bounded batch.
26
+ - Discovery output needs follow-up classification and repair.
27
+ - `parallel: true` is requested for a bounded finding batch.
28
+
29
+ ## Do Not Use When
30
+
31
+ - No finding is selected; use `$bug-discovery-phase` or ask for the finding ID.
32
+ - The work starts from a runtime symptom rather than a ClawPatch finding; use `$debugging-phase`.
33
+ - The user wants broad debt resolution from an existing debt artifact; use `$resolve-debt-phase`.
34
+ - The request is discovery/report generation only.
35
+
36
+ ## Quick Start
37
+
38
+ 1. Read the selected finding with `clawpatch show --finding <id>` and, when
39
+ useful, `clawpatch report`. Use `report --output <path>` for Markdown or
40
+ `report --json > <path>` for JSON.
41
+ 2. Capture finding ID, report path, source evidence, affected files, claimed behavior, and current ClawPatch status.
42
+ 3. Classify each finding as `resolve-now`, `needs-runtime-debugging`, `tech-debt`, `false-positive`, or `blocked`.
43
+ 4. Execute the classification route:
44
+ - `resolve-now`: patch through normal Harness/Codex edits, then test and revalidate.
45
+ - `needs-runtime-debugging`: route into `$debugging-phase` with the finding context as input artifact.
46
+ - `tech-debt`: after classification, run `$docs-ingest-phase` to create or update durable debt/docs context.
47
+ - `false-positive`: run `clawpatch triage --finding <id> --status <status> --note <reason>`.
48
+ - `blocked`: record blocker, missing evidence, and next human action.
49
+ 5. Finish with centralized verification and `clawpatch revalidate --finding <id>` or a triage/status update.
50
+
51
+ ## Parallel Rules
52
+
53
+ `bug-resolution-phase` may run with `parallel: true` or `parallel: false`.
54
+
55
+ - `parallel: false`: resolve one finding, or a tiny batch sequentially.
56
+ - `parallel: true`: only for bounded batches with explicit worker ownership.
57
+ - Before fan-out, prove findings are safely disjoint or intentionally share one root-cause scope.
58
+ - Assign owned finding IDs, files, tests, and allowed commands per worker.
59
+ - Workers may patch only their owned scope through normal Harness/Codex edits.
60
+ - Final verification, status decisions, and ClawPatch revalidation stay centralized.
61
+
62
+ ## Reference
63
+
64
+ See [REFERENCE.md](REFERENCE.md) for classification rules, ClawPatch command guidance, tech-debt artifact requirements, and output format.
@@ -58,6 +58,7 @@ Why: concept pages can cross-link flow pages, so flows must exist first.
58
58
 
59
59
  Keep the private Fumadocs app discoverable:
60
60
 
61
+ - `/docs/wiki` is the canonical routed surface for product/domain knowledge: usage, concepts, theory, flows, glossary, and concept/flow ingest output.
61
62
  - `/docs/project` is the canonical routed surface for internal project operations: specs, plans, implementation notes, maintenance logs, decisions, repo guidance, runbooks, and useful management context.
62
63
 
63
64
  Do not create a second wiki or a separate `domains/` content-owner layer. Routed MDX pages under `content/docs` are the durable human-facing wiki/project pages.
@@ -80,7 +81,7 @@ Always report:
80
81
  - Leave new or moved routed pages out of Fumadocs `meta.json`.
81
82
  - Strip or omit `surface` / `permission` frontmatter from routed pages.
82
83
  - Proceed to concept writing after a flow write fails.
83
- - Write canonical concept or flow content outside routed `content/docs` pages.
84
+ - Write canonical concept or flow content under `<wiki-root>/domains/`.
84
85
  - Create `docs/prd`, `docs/dev`, roadmap, sprint, or backlog-mirror folders.
85
86
  - Put agent task instructions inside human-facing docs pages.
86
87
  - Leave docs orphaned from `docs/README.md` after adding or renaming them.
@@ -6,7 +6,7 @@ Use this reference when `docs-ingest-phase` writes concepts into routed wiki doc
6
6
 
7
7
  For each extracted concept:
8
8
 
9
- 1. Read related routed flow pages under `<wiki-root>/content/docs/<domain>/`.
9
+ 1. Read related routed flow pages under `<wiki-root>/content/docs/wiki/<domain>/`.
10
10
  2. Scan `<wiki-root>/raw/` recursively and collect files where frontmatter `ingested: false` or `ingested` is absent.
11
11
  3. Use relevant raw content only as supplementary material. Do not mark raw files as ingested here.
12
12
 
@@ -27,7 +27,7 @@ Determine status:
27
27
  Derive the routed output path:
28
28
 
29
29
  1. Use the domain's existing route section if the concept clearly belongs there.
30
- 2. Otherwise write to `<wiki-root>/content/docs/<domain>/<concept-name>.mdx`.
30
+ 2. Otherwise write to `<wiki-root>/content/docs/wiki/<domain>/<concept-name>.mdx`.
31
31
  3. Slugify the concept name to kebab-case.
32
32
 
33
33
  For Harness-style domains, prefer existing topical sections such as `foundations`, `prompt-surfaces`, `skills-and-packs`, `execution-modes`, `validation-and-tools`, and `lifecycle-flows` when they already exist.
@@ -8,7 +8,7 @@ For each extracted flow:
8
8
 
9
9
  1. Derive the routed output path:
10
10
  - use the domain's existing flow section when one exists
11
- - otherwise write to `<wiki-root>/content/docs/<domain>/<flow-name>.mdx`
11
+ - otherwise write to `<wiki-root>/content/docs/wiki/<domain>/<flow-name>.mdx`
12
12
  - slugify the flow name to kebab-case
13
13
  2. Determine status:
14
14
  - `proposed` when only `SPEC.md` is present
@@ -4,18 +4,26 @@ Use this reference when `docs-ingest-phase` updates routed wiki or project docs.
4
4
 
5
5
  ## Canonical Routed Content
6
6
 
7
- `apps/wiki` owns the wiki application and its documentation content. The default scaffolded routed docs surface is:
7
+ `apps/wiki` owns the wiki application and its documentation content. Routed MDX pages are the canonical human-facing docs surface:
8
8
 
9
+ - `<wiki-root>/content/docs/wiki`
9
10
  - `<wiki-root>/content/docs/project`
10
11
 
11
- Product/domain routes are repository-owned. Add them only when that project deliberately defines them.
12
-
13
12
  Do not create or maintain a separate canonical `domains/` tree for concepts and flows. That split creates drift because one article then has two homes.
14
13
 
15
14
  `<wiki-root>/specs`, `<wiki-root>/raw`, `<wiki-root>/index.md`, and `<wiki-root>/log.md` may remain source/input/bookkeeping surfaces. They are not duplicate article trees.
16
15
 
17
16
  ## Route Boundaries
18
17
 
18
+ Use `/docs/wiki` for product/domain knowledge:
19
+
20
+ - usage model
21
+ - concepts
22
+ - theory
23
+ - flows
24
+ - glossary
25
+ - docs-ingest-phase concept/flow output
26
+
19
27
  Use `/docs/project` for internal project operations:
20
28
 
21
29
  - specs
@@ -33,20 +41,27 @@ Keep implementation specs and notes linked or summarized. Do not paste large sou
33
41
 
34
42
  Fumadocs uses file paths to determine route slugs. Examples:
35
43
 
36
- - `content/docs/project/index.mdx` -> `/docs/project`
44
+ - `content/docs/wiki/index.mdx` -> `/docs/wiki`
45
+ - `content/docs/wiki/cli/index.mdx` -> `/docs/wiki/cli`
37
46
  - `content/docs/project/specs/index.mdx` -> `/docs/project/specs`
38
47
 
39
48
  Each folder with an explicit `meta.json` `pages` array must list every page or child folder that should appear in the page tree. Update `meta.json` whenever pages are added, moved, or removed.
40
49
 
41
- Use the project folder as the default scaffolded surface:
50
+ Use root folders for the two main surfaces:
42
51
 
43
52
  ```json
44
53
  {
45
- "title": "Project"
54
+ "title": "Wiki",
55
+ "root": true
46
56
  }
47
57
  ```
48
58
 
49
- Default scaffold output should keep project internals exploded without adding a redundant Project parent section. Product/domain routes are added later only when a repository explicitly defines them.
59
+ ```json
60
+ {
61
+ "title": "Project",
62
+ "root": true
63
+ }
64
+ ```
50
65
 
51
66
  ## Routed Page Frontmatter
52
67
 
@@ -17,7 +17,7 @@ Resolve to a full spec folder before continuing. If ambiguous, ask only for the
17
17
  1. Read `SPEC.md`. Stop if missing.
18
18
  2. Check `SPEC.md` frontmatter for `ingested: true`; if set, exit with a clear no-op.
19
19
  3. Verify `domain:` exists in frontmatter.
20
- 4. Verify the routed domain root exists under `<wiki-root>/content/docs/<domain>/` with an `index.mdx` file and `meta.json`. If missing, stop and scaffold the routed domain structure first.
20
+ 4. Verify the routed domain root exists under `<wiki-root>/content/docs/wiki/<domain>/` with an `index.mdx` file and `meta.json`. If missing, stop and scaffold the routed domain structure first.
21
21
 
22
22
  ## Source Read
23
23
 
@@ -2,6 +2,10 @@
2
2
 
3
3
  Use these as structure, not fixed templates. Keep the generated goal prompt matched to the user context.
4
4
 
5
+ Every `/goal` block must be non-empty and at most 4,000 characters. If the
6
+ details cannot fit, make the goal point at a separate file that contains the
7
+ expanded contract.
8
+
5
9
  ## Delivery-Style Goal
6
10
 
7
11
  ```text
@@ -44,6 +48,8 @@ Final report:
44
48
  - Changed files, validation evidence, unresolved questions, and follow-up goals if split.
45
49
  ```
46
50
 
51
+ After returning the fenced block, include its character count.
52
+
47
53
  ## Debugging-Style Goal
48
54
 
49
55
  ```text
@@ -8,6 +8,10 @@ description: Compile messy intent, handoffs, issues, logs, specs, or notes into
8
8
  `goalify` is a prompt compiler. It produces a `/goal` prompt; it does not run the
9
9
  goal unless the user explicitly asks.
10
10
 
11
+ Codex goal objectives have a hard platform limit: the text after `/goal` must be
12
+ non-empty and at most 4,000 characters. Longer instructions belong in a file
13
+ that the goal points to; do not emit an over-limit `/goal` block.
14
+
11
15
  ## Use When
12
16
 
13
17
  - The user asks to "goalify", "write the goal prompt", "prepare a goal", or "turn this into a goal".
@@ -40,6 +44,15 @@ Every generated goal prompt must include:
40
44
  - progress-report expectations
41
45
  - final-report expectations
42
46
 
47
+ Within the 4,000-character hard limit, prefer the official goal-shape fields:
48
+
49
+ - outcome
50
+ - verification surface
51
+ - constraints
52
+ - boundaries
53
+ - iteration policy
54
+ - blocked stop condition
55
+
43
56
  ## Workflow
44
57
 
45
58
  1. **Collect context.**
@@ -58,18 +71,23 @@ Every generated goal prompt must include:
58
71
  - Use [EXAMPLES.md](EXAMPLES.md) for structure.
59
72
  - Include only context the future goal runner needs.
60
73
  - Make the prompt self-contained enough to survive compaction.
74
+ - Keep the full `/goal ...` text at or below 4,000 characters.
75
+ - Be as descriptive as possible within the 4,000-character limit: preserve concrete paths, constraints, proof, and stop conditions before trimming style or repetition.
76
+ - Compress only when needed to fit: group files by area, collapse repeated commands, and remove non-execution-critical background before dropping useful detail.
77
+ - If the real operating contract cannot fit, produce a short `/goal` that points at an existing or user-requested goal file instead of pasting the full contract.
61
78
  5. **Review before returning.**
62
79
  - Confirm the prompt has one objective and one stopping condition.
63
80
  - Confirm it says what to read first.
64
81
  - Confirm it tells Codex when to stop early.
65
82
  - Confirm validation is explicit, not "make sure it works".
83
+ - Confirm the fenced `/goal` text is non-empty and no more than 4,000 characters.
66
84
 
67
85
  ## Output Contract
68
86
 
69
87
  Return:
70
88
 
71
89
  1. A ready-to-paste `/goal ...` prompt in a fenced `text` block.
72
- 2. A short note listing any assumptions or missing inputs.
90
+ 2. A short note with the character count for the `/goal` text and any assumptions or missing inputs.
73
91
  3. No execution, no file edits, no tracker updates, and no commits unless separately requested.
74
92
 
75
93
  ## Prompt Sections
@@ -90,6 +108,9 @@ Use these headings when they fit:
90
108
 
91
109
  ## Gotchas
92
110
 
111
+ - HARD LIMIT: never output a `/goal` prompt longer than 4,000 characters.
112
+ - Do not treat `/goal` as a spec dump. It is a compact operating contract.
113
+ - If a user asks for a giant goal, preserve the richest useful contract that fits, then point at a file for overflow detail.
93
114
  - Do not hardcode project-specific phase families; use the skills/phases named by the context.
94
115
  - Do not turn a backlog grab bag into one goal. Split or ask.
95
116
  - Do not bury the stopping condition near the end in vague prose.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: resolve-debt-phase
3
- description: Resolves one candidate or accepted tech debt item through validation, resolution spec creation, delivery, and closeout. Use when the user asks to resolve a tech debt entry, process a debt candidate, or continue from a canonical routed `apps/wiki/content/docs/project/tech-debt/<domain>/<spec>/<debt-slug>.md` artifact.
3
+ description: Resolves one candidate or accepted tech debt item through validation, resolution spec creation, delivery, and closeout. Use when the user asks to resolve a tech debt entry, process a debt candidate, or continue from a canonical `docs/reference/tech-debt/<domain>/<spec>/<debt-slug>.md` artifact.
4
4
  ---
5
5
 
6
6
  # Resolve Debt Phase
@@ -9,14 +9,14 @@ description: Resolves one candidate or accepted tech debt item through validatio
9
9
 
10
10
  - **Role:** public lifecycle entrypoint for one tech debt phase item
11
11
  - **Scope:** one candidate or accepted debt item, never generic debt management
12
- - **Canonical input:** `apps/wiki/content/docs/project/tech-debt/<domain>/<spec>/<debt-slug>.md`
12
+ - **Canonical input:** `docs/reference/tech-debt/<domain>/<spec>/<debt-slug>.md`
13
13
  - **Source of truth:** debt file; backlog mirrors are secondary and may be stale
14
14
  - **Delegates to:** `$parallel-research` for independent readonly checks; `$create-spec` or equivalent spec workflow for accepted debt; `$delivery-phase` for implementation
15
15
  - **Stop conditions:** draft decision requested, accepted item handed to delivery, resolved item no-oped, or completed item marked resolved with links
16
16
 
17
17
  ## Use When
18
18
 
19
- - The user provides or points to one tech debt artifact under `apps/wiki/content/docs/project/tech-debt/`.
19
+ - The user provides or points to one tech debt artifact under `docs/reference/tech-debt/`.
20
20
  - The user asks to validate, accept, delete, or resolve one debt candidate.
21
21
  - The user asks to continue an accepted tech debt item into implementation.
22
22
 
@@ -28,7 +28,7 @@ description: Resolves one candidate or accepted tech debt item through validatio
28
28
 
29
29
  ## Workflow
30
30
 
31
- 1. Locate the debt file at `apps/wiki/content/docs/project/tech-debt/<domain>/<spec>/<debt-slug>.md`; stop if multiple items are implied.
31
+ 1. Locate the debt file at `docs/reference/tech-debt/<domain>/<spec>/<debt-slug>.md`; stop if multiple items are implied.
32
32
  2. Read the debt file first and extract status, domain, originating spec, linked backlog mirror, evidence, and proposed resolution.
33
33
  3. Treat the debt file as canonical. Use backlog mirrors only to sync status or discover context.
34
34
  4. Branch by status: `draft`, `accepted`, or `resolved`. If missing or ambiguous, inspect context and ask before changing state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punks/cli",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Harness Intelligence scaffolding CLI",
5
5
  "bin": {
6
6
  "devpunks": "dist/index.js",