@juicesharp/rpiv-pi 2.13.10 → 2.14.1

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.
@@ -21,7 +21,8 @@
21
21
  * disk-corroborated basename fallback — when both scans miss (agent mangled
22
22
  * the directory prefix in prose), a bare `<file>.md` token from the transcript
23
23
  * is accepted iff it resolves to exactly one existing file under
24
- * `.rpiv/artifacts/` — see that section below.
24
+ * `.rpiv/artifacts/` — see that section below. A scanned path that is not on
25
+ * disk yields to the newest announced full path that is (see `withDiskFallback`).
25
26
  *
26
27
  * One parser: `frontmatterParser` parses YAML frontmatter from the
27
28
  * primary fs artifact into `Record<string, unknown>` — what
@@ -92,8 +93,8 @@ const RPIV_ARTIFACT_PATTERN = new RegExp(String.raw`\.rpiv/artifacts/${TEMPERED_
92
93
  // fatal stands.
93
94
  const BASENAME_PATTERN = new RegExp(String.raw`${TEMPERED_SEGMENT}\.md`, "g");
94
95
 
95
- /** Bare `<file>.md` tokens from assistant text, last-mentioned first, deduped. */
96
- function basenameCandidates(branch: BranchEntry[], offsetStart?: number): string[] {
96
+ /** Matches of `pattern` in assistant text, last-mentioned first, deduped. */
97
+ function textMentions(branch: BranchEntry[], pattern: RegExp, offsetStart?: number): string[] {
97
98
  const out: string[] = [];
98
99
  const seen = new Set<string>();
99
100
  const start = Math.max(offsetStart ?? 0, 0);
@@ -105,7 +106,7 @@ function basenameCandidates(branch: BranchEntry[], offsetStart?: number): string
105
106
  for (let j = content.length - 1; j >= 0; j--) {
106
107
  const part = content[j]!;
107
108
  if (part.type !== "text" || typeof part.text !== "string") continue;
108
- const matches = part.text.match(BASENAME_PATTERN) ?? [];
109
+ const matches = part.text.match(pattern) ?? [];
109
110
  for (let k = matches.length - 1; k >= 0; k--) {
110
111
  const m = matches[k]!;
111
112
  if (!seen.has(m)) {
@@ -130,13 +131,29 @@ function resolveUnderArtifacts(cwd: string, basename: string, bucket?: string):
130
131
  return buckets.filter((b) => existsSync(join(root, b, basename))).map((b) => `.rpiv/artifacts/${b}/${basename}`);
131
132
  }
132
133
 
133
- /** Full-path scan first; on miss, the disk-corroborated basename fallback. */
134
- function withDiskFallback(primary: ArtifactCollector, bucket?: string): ArtifactCollector {
134
+ /** A handle path resolved against `cwd` when repo-relative. */
135
+ const absArtifactPath = (cwd: string, path: string): string => (isAbsolute(path) ? path : join(cwd, path));
136
+
137
+ /**
138
+ * Full-path scan first. A scanned path that is not on disk — an agent that
139
+ * announced its own file and then cited a sibling's path it misremembered —
140
+ * yields to the newest announced full path that is on disk; with none, the
141
+ * scanned path stands and the parser fatals on it. On a scan miss, the
142
+ * disk-corroborated basename fallback.
143
+ */
144
+ function withDiskFallback(primary: ArtifactCollector, pattern: RegExp, bucket?: string): ArtifactCollector {
135
145
  return defineCollector({
136
146
  collect: async (ctx) => {
137
147
  const scanned = await primary.collect(ctx);
138
- if (scanned.kind === "ok") return scanned;
139
- for (const basename of basenameCandidates(ctx.branch, ctx.branchOffset)) {
148
+ if (scanned.kind === "ok") {
149
+ const handle = scanned.artifacts[0]?.handle;
150
+ if (handle?.kind !== "fs" || existsSync(absArtifactPath(ctx.cwd, handle.path))) return scanned;
151
+ const onDisk = textMentions(ctx.branch, pattern, ctx.branchOffset).find((p) =>
152
+ existsSync(absArtifactPath(ctx.cwd, p)),
153
+ );
154
+ return onDisk ? { kind: "ok", artifacts: [{ handle: fsHandle(onDisk), role: "primary" }] } : scanned;
155
+ }
156
+ for (const basename of textMentions(ctx.branch, BASENAME_PATTERN, ctx.branchOffset)) {
140
157
  const hits = resolveUnderArtifacts(ctx.cwd, basename, bucket);
141
158
  if (hits.length === 1) {
142
159
  return { kind: "ok", artifacts: [{ handle: fsHandle(hits[0]!), role: "primary" }] };
@@ -170,6 +187,7 @@ const TOOL_ARG_FALLBACK = { match: isFileWrite, argKeys: ["path"] as const };
170
187
  /** Bucket-agnostic — accepts any `.rpiv/artifacts/<bucket>/...md`. */
171
188
  export const rpivArtifactCollector: ArtifactCollector = withDiskFallback(
172
189
  transcriptPathCollector({ pattern: RPIV_ARTIFACT_PATTERN, ...TOOL_ARG_FALLBACK }),
190
+ RPIV_ARTIFACT_PATTERN,
173
191
  );
174
192
 
175
193
  /** Bucket-narrowed — accepts only `.rpiv/artifacts/<bucket>/...md`. The filename
@@ -178,7 +196,7 @@ export const rpivArtifactCollector: ArtifactCollector = withDiskFallback(
178
196
  export function rpivBucketCollector(bucket: string): ArtifactCollector {
179
197
  const escaped = bucket.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
180
198
  const pattern = new RegExp(String.raw`\.rpiv/artifacts/${escaped}/${TEMPERED_SEGMENT}\.md`, "g");
181
- return withDiskFallback(transcriptPathCollector({ pattern, ...TOOL_ARG_FALLBACK }), bucket);
199
+ return withDiskFallback(transcriptPathCollector({ pattern, ...TOOL_ARG_FALLBACK }), pattern, bucket);
182
200
  }
183
201
 
184
202
  // ---------------------------------------------------------------------------
@@ -209,7 +227,7 @@ export const frontmatterParser: ArtifactParser<undefined, "artifact-md", Record<
209
227
  message: `${ctx.skill}: frontmatterParser requires an fs artifact (got ${primary?.handle.kind ?? "none"})`,
210
228
  };
211
229
  }
212
- const abs = isAbsolute(primary.handle.path) ? primary.handle.path : join(ctx.cwd, primary.handle.path);
230
+ const abs = absArtifactPath(ctx.cwd, primary.handle.path);
213
231
  if (!existsSync(abs)) {
214
232
  return {
215
233
  kind: "fatal",
@@ -236,10 +236,13 @@ export const planAuthoredRisks = (state: RunView, channel: string): Map<string,
236
236
  * regex carries the `/g` flag, so `.test()` is stateful across calls
237
237
  * (`lastIndex` advances) and would
238
238
  * intermittently miss a present citation. An id with no authored mechanics
239
- * risk carries no evidence duty ⇒ returns `true`.
239
+ * risk, or one deferred with `verify-at-implement`, carries no evidence duty ⇒
240
+ * returns `true`.
240
241
  */
241
242
  export const evidenceCitesFileLine = (r: RiskRuling, authored?: RiskRecord): boolean => {
242
- if (authored?.claim_type !== "mechanics") return true;
243
+ // A deferred claim may concern code the plan has not written yet, so its
244
+ // procedure + owner are the duty instead.
245
+ if (authored?.claim_type !== "mechanics" || authored.disposition === "verify-at-implement") return true;
243
246
  return typeof r.evidence === "string" && r.evidence.match(FILE_LINE_CITATION_RE) !== null;
244
247
  };
245
248
 
@@ -260,8 +263,8 @@ export const procedureSatisfiesDuty = (r: RiskRuling, authored?: RiskRecord): bo
260
263
 
261
264
  /**
262
265
  * The single gate-fold authority: a ruling is effective-pass iff it is a bare
263
- * `pass` AND (when the plan authored a mechanics risk for its id) its evidence
264
- * cites a `file:line` AND (when the plan authored a verify-at-implement risk
266
+ * `pass` AND (when the plan authored a mechanics risk for its id that it did not
267
+ * defer) its evidence cites a `file:line` AND (when the plan authored a verify-at-implement risk
265
268
  * for its id) its procedure+owner discharge the verify duty. `allRiskFlagsPass`,
266
269
  * `dimensionsToRegrade` clause 3, and `confirmDue`'s `riskFail` ALL consult this
267
270
  * — so the three risk folds agree on what "passing" means and a demoted
@@ -73,8 +73,8 @@ const codeSnapshot = snapshotLatestPlan("code-snapshot");
73
73
  * A duty demotion stamped onto a verdict's on-disk JSON — the legible record
74
74
  * that a risk ruling the panel marked `pass: true` was demoted to effective-
75
75
  * fail by the evidence or verify-at-implement duty. One entry per FAILING
76
- * duty (a ruling authored as BOTH mechanics AND verify-at-implement can carry
77
- * two). `reason` is decision-code-free prose (no run/phase ids, no absolute
76
+ * duty (a verify-at-implement flag carries only the procedure-owner duty, even
77
+ * when also authored as mechanics). `reason` is decision-code-free prose (no run/phase ids, no absolute
78
78
  * line numbers) naming the duty that failed, so disk readers (amend, confirm
79
79
  * `--prior`) can tell a grader-side demotion from a genuine `pass: false`.
80
80
  */
@@ -225,54 +225,74 @@ const sectionIndexOf = (lines: readonly string[]): string[] => {
225
225
  return idx;
226
226
  };
227
227
 
228
+ /** Group a document's lines by their `sectionIndexOf` key, preserving order within each section. */
229
+ const linesBySection = (lines: readonly string[]): Map<string, string[]> => {
230
+ const keys = sectionIndexOf(lines);
231
+ const out = new Map<string, string[]>();
232
+ for (let i = 0; i < lines.length; i++) {
233
+ const run = out.get(keys[i]);
234
+ if (run) run.push(lines[i]);
235
+ else out.set(keys[i], [lines[i]]);
236
+ }
237
+ return out;
238
+ };
239
+
228
240
  /**
229
- * Line-level diff of `prior` vs `current` plan bodies, mapped to plan sections.
230
- * Each changed line (a deletion from `prior` OR an insertion in `current` under
231
- * an LCS match) is attributed to its nearest preceding `## ` heading in its own
232
- * document. Returns the union of touched section keys and a coarse changed-line
233
- * count (deletions + insertions). Insertion-tolerant: a 1-line insert does not
234
- * mark every trailing line changed (the LCS keeps shared context matched).
241
+ * LCS length of two line sequences. The common prefix and suffix are counted
242
+ * directly and trimmed, so the O(n·m) time is spent only on the edited span,
243
+ * and two `Uint32Array` rows stand in for the full table: memory is O(m).
235
244
  */
236
- const sectionDiff = (prior: string, current: string): { touchedSections: Set<string>; changedLines: number } => {
237
- const a = prior.split("\n");
238
- const b = current.split("\n");
239
- const sa = sectionIndexOf(a);
240
- const sb = sectionIndexOf(b);
241
- // LCS length table (bottom-up). Plans are a few hundred lines ⇒ O(n·m) trivial.
242
- const dp: number[][] = Array.from({ length: a.length + 1 }, () => new Array<number>(b.length + 1).fill(0));
243
- for (let i = a.length - 1; i >= 0; i--) {
244
- for (let j = b.length - 1; j >= 0; j--) {
245
- dp[i][j] = a[i] === b[j] ? dp[i + 1][j + 1] + 1 : Math.max(dp[i + 1][j], dp[i][j + 1]);
245
+ const lcsLength = (a: readonly string[], b: readonly string[]): number => {
246
+ let lo = 0;
247
+ while (lo < a.length && lo < b.length && a[lo] === b[lo]) lo++;
248
+ let ha = a.length;
249
+ let hb = b.length;
250
+ while (ha > lo && hb > lo && a[ha - 1] === b[hb - 1]) {
251
+ ha--;
252
+ hb--;
253
+ }
254
+ const shared = lo + (a.length - ha);
255
+ const n = ha - lo;
256
+ const m = hb - lo;
257
+ if (n === 0 || m === 0) return shared;
258
+ let prev = new Uint32Array(m + 1);
259
+ let cur = new Uint32Array(m + 1);
260
+ for (let i = 1; i <= n; i++) {
261
+ const ai = a[lo + i - 1];
262
+ for (let j = 1; j <= m; j++) {
263
+ cur[j] = ai === b[lo + j - 1] ? prev[j - 1] + 1 : Math.max(prev[j], cur[j - 1]);
246
264
  }
265
+ [prev, cur] = [cur, prev];
247
266
  }
267
+ return shared + prev[m];
268
+ };
269
+
270
+ /**
271
+ * Line-level diff of `prior` vs `current` plan bodies, mapped to plan sections.
272
+ * Lines are grouped by their `## ` section key (`sectionIndexOf`, in their own
273
+ * document) and each section is diffed only against its counterpart, so memory
274
+ * scales with the largest section, not the whole plan — an out-of-memory kill
275
+ * is not an exception, and `decideSurgicalFix`'s catch could not fail closed on
276
+ * it. A section is touched when its prior and current lines differ; the
277
+ * changed-line count is deletions + insertions summed over sections
278
+ * (`|prior| + |current| − 2·LCS`). Insertion-tolerant: a 1-line insert does not
279
+ * mark every trailing line changed. A line moved between sections counts as a
280
+ * deletion in one and an insertion in the other, the fail-closed direction.
281
+ */
282
+ const sectionDiff = (prior: string, current: string): { touchedSections: Set<string>; changedLines: number } => {
283
+ const pa = linesBySection(prior.split("\n"));
284
+ const pb = linesBySection(current.split("\n"));
248
285
  const touched = new Set<string>();
249
286
  let changed = 0;
250
- let i = 0;
251
- let j = 0;
252
- while (i < a.length && j < b.length) {
253
- if (a[i] === b[j]) {
254
- i++;
255
- j++;
256
- } else if (dp[i + 1][j] >= dp[i][j + 1]) {
257
- touched.add(sa[i]); // a[i] deleted (present in prior, absent in current)
258
- changed++;
259
- i++;
260
- } else {
261
- touched.add(sb[j]); // b[j] inserted (present in current, absent in prior)
262
- changed++;
263
- j++;
287
+ for (const key of new Set([...pa.keys(), ...pb.keys()])) {
288
+ const a = pa.get(key) ?? [];
289
+ const b = pb.get(key) ?? [];
290
+ const delta = a.length + b.length - 2 * lcsLength(a, b);
291
+ if (delta > 0) {
292
+ touched.add(key);
293
+ changed += delta;
264
294
  }
265
295
  }
266
- while (i < a.length) {
267
- touched.add(sa[i]);
268
- changed++;
269
- i++;
270
- }
271
- while (j < b.length) {
272
- touched.add(sb[j]);
273
- changed++;
274
- j++;
275
- }
276
296
  return { touchedSections: touched, changedLines: changed };
277
297
  };
278
298
 
@@ -74,8 +74,12 @@ const VERDICT_FAIL_SCORE = 0;
74
74
  * (`(?<![\w.])`), and a dotless start only at a word boundary (`(?<!\w)`), so a
75
75
  * prose ellipsis (`...packages/x.ts:5`) still yields `packages/x.ts`, never
76
76
  * `...packages/x.ts`.
77
+ *
78
+ * The extension is 1–10 chars, so `.csproj`, `.cshtml`, `.config` and
79
+ * `.gradle` count; the adjacent `:NN` keeps dotted identifiers out without a
80
+ * tighter length cap.
77
81
  */
78
- const FILE_LINE_CITATION_RE = /((?:(?<![\w.])\.)?(?<!\w)[\w][\w./-]*\.[a-zA-Z][a-zA-Z0-9]{0,4}):(\d+)(?:-(\d+))?/g;
82
+ const FILE_LINE_CITATION_RE = /((?:(?<![\w.])\.)?(?<!\w)[\w][\w./-]*\.[a-zA-Z][a-zA-Z0-9]{0,9}):(\d+)(?:-(\d+))?/g;
79
83
 
80
84
  /** A structure-dimension finding — the shared shape the deterministic verdict
81
85
  * checks emit (`detail` is the actionable message, `where` locates the defect).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-pi",
3
- "version": "2.13.10",
3
+ "version": "2.14.1",
4
4
  "description": "A skill-based development workflow for Pi Agent. 30 contract-carrying skills (discover → research → design → plan → implement → validate → code-review → commit, and more), the 15 named subagents they dispatch, and four built-in /wf workflows that chain them end to end in detached parallel runs.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -52,7 +52,7 @@
52
52
  ]
53
53
  },
54
54
  "dependencies": {
55
- "@juicesharp/rpiv-config": "^2.13.10"
55
+ "@juicesharp/rpiv-config": "^2.14.1"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@earendil-works/pi-ai": "*",
@@ -78,7 +78,7 @@ The verdict shape for this dimension: `pass` is `true` only when every ruling is
78
78
  Two duties tighten what a `pass` means, and the gate enforces both (an un-grounded `pass` is demoted as if it were `fail`):
79
79
 
80
80
  - **Echo the flag's duty fields verbatim.** Copy `claim_type`, `disposition`, `procedure`, and `owner` from the plan's `risks:` entry into your ruling UNCHANGED. The duty itself is imposed by the plan's `risks:` frontmatter — the gate cross-references it by flag `id`, so dropping or mistyping `claim_type`/`disposition` in your ruling waives NOTHING: a mechanics `pass` is still demoted unless the ruling carries a `file:line` `evidence`, and a verify-at-implement `pass` is still demoted unless the ruling carries a concrete `procedure` and a numeric `owner`. Echo the fields anyway — the ruling stays self-describing for the audit trail and for `validate`, which runs the deferred `procedure` against the shipped code.
81
- - **Mechanics evidence duty (`claim_type: mechanics`).** A mechanics risk ruled `pass` MUST cite the `file:line` you actually checked in the ruling's `evidence` (e.g. `"packages/x/y.ts:42 — the helper returns early on undefined"`). A mechanics `pass` with no `evidence`, or whose `evidence` is not `file:line`-shaped, is demoted to `fail` — the gate refuses a confident-but-ungrounded mechanism assertion (the honest-lazy class: a confident pass that never opened a file). **The adjacency rule — what "`file:line`-shaped" means:** at least one site in the `evidence` string must be a dotted file path with its line number IMMEDIATELY adjacent (`path.ext:NN`, colon-number directly after the extension, no space — e.g. `packages/x/y.ts:1168`). Make the FIRST cited site that shape; later refs in the same string may be abbreviated bare `:NN`. `symbol :NN`, a bare `(:NN/:NN)` list, or a path with no adjacent `:NN` anywhere all fail the rule and demote the ruling. Rule `fail` outright if the mechanism does not hold.
81
+ - **Mechanics evidence duty (`claim_type: mechanics`).** A mechanics risk ruled `pass` MUST cite the `file:line` you actually checked in the ruling's `evidence` (e.g. `"packages/x/y.ts:42 — the helper returns early on undefined"`). A mechanics `pass` with no `evidence`, or whose `evidence` is not `file:line`-shaped, is demoted to `fail` — the gate refuses a confident-but-ungrounded mechanism assertion (the honest-lazy class: a confident pass that never opened a file). **The adjacency rule — what "`file:line`-shaped" means:** at least one site in the `evidence` string must be a dotted file path with its line number IMMEDIATELY adjacent (`path.ext:NN`, colon-number directly after the extension, no space — e.g. `packages/x/y.ts:1168`). Make the FIRST cited site that shape; later refs in the same string may be abbreviated bare `:NN`. `symbol :NN`, a bare `(:NN/:NN)` list, or a path with no adjacent `:NN` anywhere all fail the rule and demote the ruling. Rule `fail` outright if the mechanism does not hold. A mechanics flag that also carries `disposition: verify-at-implement` is deferred: the verify-at-implement rule below applies instead, and no `evidence` is required.
82
82
  - **Verify-at-implement rule (`disposition: verify-at-implement`).** You may defer a risk to the owner phase instead of ruling it finally here. Rule `pass` ONLY when the flag carries a concrete `procedure` (the named command/test the owner phase runs) AND a numeric `owner` phase AND you judge that phase actually carries that step; otherwise rule `fail` (a bare "verify later" with no procedure does not defer — it fails). When you defer, echo `procedure` and `owner` verbatim so `validate` can run the procedure against the shipped code.
83
83
 
84
84
  Emit these as a `risk_rulings: [{ id, pass, evidence?, claim_type?, disposition?, procedure?, owner? }]` array in your verdict — one ruling per declared flag, none omitted. `evidence` is REQUIRED on a mechanics `pass` (and must be `file:line`-shaped); `claim_type`/`disposition`/`procedure`/`owner` are echoed whenever the plan flag carries them.
@@ -108,7 +108,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field; `<slug>` is the
108
108
  - **Integration** — wire the seams: an input that depends on another's interface must reference the real shape the other defines. In root mode, this is where each sub-plan's `exports` get connected.
109
109
  - **Conflict** — when two inputs make incompatible decisions, resolve to one, and record the resolution in Synthesis Notes (the grade panel's correctness/architecture-fit members will check it).
110
110
  - **Risk flags** — a decision you're not confident is correct (an unverified assumption, an edge case wanting a second opinion) goes in the frontmatter `risks:` array as a `{ id, claim }` entry (stable `id`; `claim` = the one-line assertion to rule on) plus a `## Risk Flags` line — **never** buried in prose. This is the first-class channel grade and validate are REQUIRED to rule on; flag anything you'd otherwise write "flagging this so the grade panel can weigh in" about. Two optional fields tighten what "passing" means, so the gate can refuse a confident-but-ungrounded assertion (the honest-lazy class — a confident pass that never opened a file):
111
- - **`claim_type: mechanics`** — the `claim` asserts a verified mechanism (a behavior that holds because code was checked). A grade panel ruling it `pass` MUST cite the checked `file:line` in that ruling's `evidence`, else the gate demotes the pass as un-grounded. Use it for risks like "the revert is byte-identical" or "the helper no-ops on absent fields" where the assertion is checkable against code right now.
111
+ - **`claim_type: mechanics`** — the `claim` asserts a verified mechanism (a behavior that holds because code was checked). A grade panel ruling it `pass` MUST cite the checked `file:line` in that ruling's `evidence`, else the gate demotes the pass as un-grounded. Use it for risks like "the revert is byte-identical" or "the helper no-ops on absent fields" where the assertion is checkable against code right now. Do not pair it with `verify-at-implement` for a claim about code a phase has not written yet; a deferred flag carries only the procedure duty.
112
112
  - **`disposition: verify-at-implement`** — the panel may defer the risk to a later phase rather than rule it in this panel. A deferred pass is accepted ONLY when the flag ALSO carries a concrete **`procedure`** (the named command/test the owner phase runs to discharge it) and an **`owner`** (the phase `n` that runs that step); a bare "verify later" with no procedure demotes. Use it for risks that genuinely need the shipped tree (a real `build` run, a coverage gate) the plan-grade panel cannot run.
113
113
  - Default (no `claim_type`, no `disposition`) stays the ordinary `{ id, claim }` shape — the panel rules it on the artifact as today, with no evidence or procedure duty.
114
114
  3. **Sequence phases** — one phase per slice (flat/partial) or carry the sub-plans' phases through (root), ordered so a phase never precedes one it `depends_on`. Tightly-coupled units may merge into one phase; note any merge. Populate each entry's `files:` from that phase's `### Changes` paths (every repo-root-relative path the phase creates or edits) and `depends_on` only for semantic ordering NOT visible in `files:` (a phase that needs an earlier phase to run first despite no shared file) — lower `n` only.
@@ -161,7 +161,7 @@ For each phase in the plan:
161
161
  ### Step 3: Write the Validation Report
162
162
 
163
163
  1. **Determine metadata** (from the Metadata block at the top of this skill):
164
- - Filename: `.rpiv/artifacts/validation/<slug>_<plan-topic-kebab>.md` — `<slug>` is the second tab-separated field on line 1 of the Metadata block above; `<plan-topic-kebab>` is the plan's `topic:` frontmatter value lowercased and hyphen-joined.
164
+ - Filename: `.rpiv/artifacts/validation/<slug>_<plan-name>.md` — `<slug>` is the second tab-separated field on line 1 of the Metadata block above; `<plan-name>` is the plan file's basename without its leading timestamp and `.md` (plan `2026-10-15_13-56-46_tkt-1234-widget-sync.md` → `tkt-1234-widget-sync`). Never build it from the plan's `topic:` value: its em dashes, parentheses and commas make a path the workflow cannot collect.
165
165
  - `repository:` ← `repo:` label; `branch:` / `commit:` ← matching labels.
166
166
  - `date:` ← `<iso>` (first tab-separated field on line 1 of the Metadata block above, offset verbatim).
167
167
  - `author:` ← matching label (fallback: `unknown`).