@srobroek/pi-speckit-beads 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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## speckit-beads [2.1.0](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v2.0.1...speckit-beads--v2.1.0) (2026-11-29)
2
+
3
+ ### Features
4
+
5
+ * **beads:** beads-feature formula and epic-feature-task hierarchy ([d88484a](https://github.com/srobroek/harness-plugins/commit/d88484a3f9296b7faaa7cdb63e725a5c70ad1bf8)), closes [GH#852](https://github.com/srobroek/GH/issues/852) [gastownhall/beads#5754](https://github.com/gastownhall/beads/issues/5754)
6
+
7
+ ## speckit-beads [2.0.1](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v2.0.0...speckit-beads--v2.0.1) (2026-11-29)
8
+
9
+ ### Bug Fixes
10
+
11
+ * **speckit-beads:** nest the SpecKit run under its feature epic ([3336691](https://github.com/srobroek/harness-plugins/commit/3336691aa105dc8fe37a1dfabf6c4a33007633dd))
12
+
1
13
  ## speckit-beads [2.0.0](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v1.0.1...speckit-beads--v2.0.0) (2026-11-25)
2
14
 
3
15
  ### ⚠ BREAKING CHANGES
package/README.md CHANGED
@@ -97,14 +97,28 @@ checks. Never skip a review or verification because its extension is not install
97
97
  an explicit routine-approval choice before pouring, records it on the run root, reads
98
98
  it back, and reuses it on resume.
99
99
 
100
+ A new run goes under the spec's feature epic. That is the `epic` argument, or else the
101
+ one open epic with the spec's `spec_id`.
102
+
103
+ - The tool bonds the run with `bd mol bond <profile> <epic> --type parallel --pour --ref speckit`.
104
+ The root is the epic's child in the same write, with no `blocks` edge.
105
+ - The root id reads `<epic>.speckit`. A second run under the same epic takes `speckit-2`.
106
+ - A spec without an epic gets a poured run with no parent, as before.
107
+ - In both cases the root title is `<NNN-slug> (<profile>)`, not the bare profile name. Each
108
+ profile declares a required `title` var, and bd titles the root from it.
109
+
100
110
  | Human approvals | Formula selection | Routine sign-offs |
101
111
  | --- | --- | --- |
102
112
  | Required | `autonomous=no` | Retained |
103
113
  | Declined | `autonomous=yes` | Omitted |
104
114
 
105
- - `CHOICE_REQUIRED` and `MIGRATION_REQUIRED` return a question. Ask the user, then call again: after `CHOICE_REQUIRED` with `approvals` and `decision`; after `MIGRATION_REQUIRED`, on consent, with the pending `approvals=no`, `migrate=true`, the returned `root` and `decision`. `migrate` with any other `approvals` is refused, so a yes to migrating cannot become `approvals=yes`.
106
- - `READY` names the run root and both selections.
107
- - `INCOMPLETE` means the store-lock wait ran out, a bounded `bd` command passed its 120 s bound, or the call was cancelled. It names the step reached and whether a pour was issued; inspect the run before retrying. `mol pour` and `gate resolve` are never cut off.
115
+ - `CHOICE_REQUIRED`, `MIGRATION_REQUIRED` and `REPARENT_REQUIRED` return a question. Ask the user. Then call again with the answer:
116
+ - After `CHOICE_REQUIRED`, send `approvals` and `decision`.
117
+ - After `MIGRATION_REQUIRED`, on consent, send the pending `approvals=no` and `migrate=true`. Also send the returned `root` and `decision`. `migrate` with any other `approvals` is refused, so a yes to migrating cannot become `approvals=yes`.
118
+ - An older run with no parent gets `REPARENT_REQUIRED` once its spec has an epic. Send the returned `root` with `reparent=true` or `reparent=false`. A yes moves the run under the epic and retitles it. A no is recorded, and the question does not come back.
119
+ - An epic that already blocks on a step of the run gets an error, because the move would make a cycle. The tool adds no `blocks` edge between an epic and its run.
120
+ - `READY` names the run root, its epic and both selections. It carries a warning when the epic has open `blocks` edges. bd marks every child of a blocked epic blocked, so no step of the run reaches `bd ready` until those edges close.
121
+ - `INCOMPLETE` means the store-lock wait ran out, a bounded `bd` command passed its 120 s bound, or the call was canceled. It names the step reached and whether a pour was issued; inspect the run before retrying. `mol pour`, `mol bond` and `gate resolve` run without a time bound.
108
122
 
109
123
  The whole start holds the beads store's embedded-write lock, so concurrent starts for
110
124
  a spec cannot pour duplicate runs. The lock module comes from this repository's shared
@@ -704,10 +704,35 @@ MUST Pour one molecule per spec dir. Profiles: \`speckit-basic\`,
704
704
  --set-metadata spec_dir=specs/<NNN-slug>\`.
705
705
  DEFAULT Track position with \`bd mol current <root-id>\`.
706
706
 
707
+ SPEC EPIC (spec-producing commands)
708
+ MUST Nest the molecule root under the spec's feature epic: the open epic with the
709
+ spec's \`spec_id\`.
710
+ DEFAULT \`speckit_start\` bonds the root there and titles it \`<NNN-slug> (<profile>)\`.
711
+ MUST File the spec's tasks under the molecule's implement step, never directly
712
+ under the epic.
713
+
714
+ EPIC EDGES (spec-producing commands)
715
+ NEVER Link an epic to a step of its own molecule with \`blocks\`. The parent link
716
+ already carries that relation, and the edge turns the nesting into a cycle.
717
+ MUST Order specced epics (epics with a live molecule) with \`related\` edges and a
718
+ note on both epics. A \`blocks\` edge on such an epic marks every step of its
719
+ molecule blocked, specify included.
720
+
721
+ TASK ORDER (spec-producing commands)
722
+ MUST Put the real cross-spec order on task edges. The consuming task blocks on the
723
+ producing task or its contract bead.
724
+ DEFAULT Use epic-to-epic \`blocks\` only onto an epic that has no live molecule.
725
+
726
+ SPEC START TOOL (new or resumed spec lifecycle)
707
727
  MUST Use the \`speckit_start\` tool for workflow start and resume.
708
- MUST On \`CHOICE_REQUIRED\` or \`MIGRATION_REQUIRED\`, ask the returned question
709
- and supply only the explicit user answer and decision when invoking it again.
710
- A migration answer is \`migrate\`, sent with the pending \`approvals=no\` and root.
728
+ MUST On \`CHOICE_REQUIRED\`, \`MIGRATION_REQUIRED\` or \`REPARENT_REQUIRED\`, ask the
729
+ returned question. Then call the tool again with only the user's explicit answer
730
+ and decision.
731
+ MUST Send a migration answer as \`migrate\`, with the pending \`approvals=no\` and root.
732
+ MUST Send a reparent answer as \`reparent\`, with the root.
733
+ MUST Pass \`epic\` when more than one open epic carries the spec's \`spec_id\`.
734
+ MUST Relay every warning a READY result carries to the user.
735
+
711
736
  SPEC START (new or resumed spec lifecycle)
712
737
  MUST Before pouring, bonding, or advancing, find the spec's existing molecule root;
713
738
  read its metadata if one exists.
@@ -1318,6 +1343,11 @@ function installFormulas(repo, srcDir) {
1318
1343
  copyFileSync(src, dest);
1319
1344
  return copies.map(({ name }) => `copied ${name}`);
1320
1345
  }
1346
+ function storyFormulaNote(repo) {
1347
+ if (lstatSync2(join4(repo, ".beads", "formulas", "beads-feature.formula.toml"), { throwIfNoEntry: false })?.isFile())
1348
+ return;
1349
+ return "beads-feature is not installed; run the beads plugin's beads_formulas tool to split user stories into features";
1350
+ }
1321
1351
  function installedExtensions(repo) {
1322
1352
  const registry = join4(repo, ".specify", "extensions", ".registry");
1323
1353
  safePath(registry, repo);
@@ -1465,7 +1495,9 @@ ${ver.stderr}`))
1465
1495
  }
1466
1496
  current = "formulas";
1467
1497
  const copied = installFormulas(repo, join4(pluginRoot(), "formulas"));
1468
- record(current, copied.length ? "done" : "skipped", copied.length ? copied.join(", ") : "every formula already present");
1498
+ const story = storyFormulaNote(repo);
1499
+ const formulas = copied.length ? copied.join(", ") : "every formula already present";
1500
+ record(current, copied.length ? "done" : "skipped", story ? `${formulas}; ${story}` : formulas);
1469
1501
  current = "gitignore";
1470
1502
  const gitignore = ensureGitignore(repo);
1471
1503
  record(current, gitignore.startsWith("appended") ? "done" : "skipped", gitignore);
@@ -1833,7 +1865,15 @@ function issueList(value) {
1833
1865
  issue_type: typeof row.issue_type === "string" ? row.issue_type : undefined,
1834
1866
  spec_id: typeof row.spec_id === "string" ? row.spec_id : undefined,
1835
1867
  await_type: typeof row.await_type === "string" ? row.await_type : undefined,
1836
- metadata: row.metadata === undefined || row.metadata === null ? undefined : object(row.metadata)
1868
+ parent: typeof row.parent === "string" && row.parent ? row.parent : undefined,
1869
+ metadata: row.metadata === undefined || row.metadata === null ? undefined : object(row.metadata),
1870
+ dependencies: Array.isArray(row.dependencies) ? row.dependencies.map(object).flatMap((link) => typeof link.id === "string" ? [
1871
+ {
1872
+ id: link.id,
1873
+ status: typeof link.status === "string" ? link.status : undefined,
1874
+ dependency_type: typeof link.dependency_type === "string" ? link.dependency_type : undefined
1875
+ }
1876
+ ] : []) : undefined
1837
1877
  };
1838
1878
  });
1839
1879
  }
@@ -1850,8 +1890,15 @@ var ROUTINE = [
1850
1890
  ["analyze-approval", "analyze approval"],
1851
1891
  ["verify-signoff", "verify sign-off"]
1852
1892
  ];
1893
+ var runTitle = (spec, profile) => `${spec} (${profile})`;
1894
+ function profileOf(row) {
1895
+ const named = PROFILES.find((profile) => profile === row.title);
1896
+ if (named)
1897
+ return named;
1898
+ return PROFILES.find((profile) => row.spec_id !== undefined && row.title === runTitle(row.spec_id, profile));
1899
+ }
1853
1900
  function isRunRoot(row) {
1854
- return (row.issue_type === "molecule" || row.issue_type === "epic") && PROFILES.some((profile) => profile === row.title);
1901
+ return (row.issue_type === "molecule" || row.issue_type === "epic") && profileOf(row) !== undefined;
1855
1902
  }
1856
1903
  function recordedChoice(root, spec) {
1857
1904
  const metadata = root?.metadata ?? {};
@@ -1962,6 +2009,89 @@ async function migrateRoutine(root, options, command) {
1962
2009
  if (resolutions.some((row) => after.find((issue) => issue.id === row.gate)?.status !== "closed" || after.find((issue) => issue.id === row.step)?.status !== "closed"))
1963
2010
  throw new Error("Routine migration readback failed; do not record approvals as declined");
1964
2011
  }
2012
+ async function specEpic(spec, named, rows, command) {
2013
+ const id = named ?? (() => {
2014
+ const open = rows.filter((row) => row.issue_type === "epic" && !isRunRoot(row) && row.status !== "closed");
2015
+ if (open.length > 1)
2016
+ throw new Error(`Several open epics carry spec_id ${spec} (${open.map((row) => row.id).join(", ")}); pass epic to choose one`);
2017
+ return open[0]?.id;
2018
+ })();
2019
+ if (id === undefined)
2020
+ return;
2021
+ const epic = issueList(await command(["show", id]))[0];
2022
+ if (epic?.issue_type !== "epic" || isRunRoot(epic))
2023
+ throw new Error(`${id} is not a feature epic`);
2024
+ if (epic.status === "closed")
2025
+ throw new Error(`Epic ${id} is closed; reopen it or pass another epic`);
2026
+ if (epic.spec_id !== undefined && epic.spec_id !== spec)
2027
+ throw new Error(`Epic ${id} belongs to spec ${epic.spec_id}, not ${spec}`);
2028
+ return epic;
2029
+ }
2030
+ var blocksOf = (epic) => (epic.dependencies ?? []).filter((link) => link.dependency_type === "blocks");
2031
+ function refuseBlocksOnRun(epic, run, root) {
2032
+ const steps = new Set([root, ...run.children.map((row) => row.id)]);
2033
+ const onRun = blocksOf(epic).filter((link) => steps.has(link.id));
2034
+ if (onRun.length)
2035
+ throw new Error(`Epic ${epic.id} blocks on ${onRun.map((link) => link.id).join(", ")} of run ${root}, so nesting the run under it would be a cycle. Remove that edge first (bd dep remove ${epic.id} ${onRun[0]?.id}); the run's tasks under its implement step carry the order.`);
2036
+ }
2037
+ function blockedEpicWarning(epic) {
2038
+ const open = blocksOf(epic).filter((link) => link.status !== "closed");
2039
+ if (!open.length)
2040
+ return;
2041
+ return `Epic ${epic.id} waits on open ${open.map((link) => link.id).join(", ")} (blocks). bd marks every child of a blocked epic blocked, so no step of this run reaches bd ready until those close. Order specced epics with related edges and put the real order on task edges.`;
2042
+ }
2043
+ async function runRef(epic, command) {
2044
+ const taken = new Set(issueList(await command(["list", "--parent", epic, "--all", "--limit", "0"])).map((row) => row.id));
2045
+ let ref = "speckit";
2046
+ for (let n = 2;taken.has(`${epic}.${ref}`); n++)
2047
+ ref = `speckit-${n}`;
2048
+ return ref;
2049
+ }
2050
+ async function placeExisting(root, epic, options, command) {
2051
+ const current = issueList(await command(["show", root.id]))[0] ?? root;
2052
+ if (current.parent === epic.id || current.metadata?.reparent === "declined")
2053
+ return { kind: "place" };
2054
+ if (current.parent !== undefined)
2055
+ throw new Error(`Run ${root.id} is under ${current.parent}, not epic ${epic.id}; move it by hand or pass that epic`);
2056
+ refuseBlocksOnRun(epic, await moleculeGraph(root, command), root.id);
2057
+ const title = runTitle(options.spec, profileOf(current) ?? options.profile);
2058
+ if (options.reparent === undefined) {
2059
+ const question = `Move existing run ${root.id} under epic ${epic.id} and retitle it "${title}", so the spec's work shows under its epic? Yes or no.`;
2060
+ return { kind: "ask", result: { status: "REPARENT_REQUIRED", root: root.id, epic: epic.id, question, text: question } };
2061
+ }
2062
+ if (options.reparent)
2063
+ return { kind: "place", move: { title, parent: epic.id } };
2064
+ await command([
2065
+ "update",
2066
+ root.id,
2067
+ "--set-metadata",
2068
+ "reparent=declined",
2069
+ "--append-notes",
2070
+ `Declined moving this run under epic ${epic.id}.`
2071
+ ]);
2072
+ return { kind: "place" };
2073
+ }
2074
+ async function createRun(spec, profile, mode, epic, command) {
2075
+ const vars = ["--var", `feature=${spec}`, "--var", `autonomous=${mode}`, "--var", `title=${runTitle(spec, profile)}`];
2076
+ if (epic) {
2077
+ const ref = await runRef(epic.id, command);
2078
+ const bonded = object(payload(await command(["mol", "bond", profile, epic.id, "--type", "parallel", "--pour", "--ref", ref, ...vars])));
2079
+ const id = bonded.id_mapping === undefined ? undefined : object(bonded.id_mapping)[profile];
2080
+ if (typeof id !== "string")
2081
+ throw new Error("Bond returned no root id; inspect the epic's children before retrying");
2082
+ return { id };
2083
+ }
2084
+ const poured = object(payload(await command(["mol", "pour", profile, ...vars])));
2085
+ if (typeof poured.new_epic_id !== "string")
2086
+ throw new Error("Pour returned no new_epic_id; inspect the created run before retrying");
2087
+ return { id: poured.new_epic_id };
2088
+ }
2089
+ function readBackPlacement(confirmed, title, parent) {
2090
+ if (title !== undefined && confirmed.title !== title)
2091
+ throw new Error(`Title readback failed for ${confirmed.id}; do not advance`);
2092
+ if (parent !== undefined && confirmed.parent !== parent)
2093
+ throw new Error(`Parent readback failed for ${confirmed.id}: expected epic ${parent}; do not advance`);
2094
+ }
1965
2095
  async function startSpec(input, command) {
1966
2096
  const options = { ...input, spec: input.spec ?? await specOfRoot(input.root, command) };
1967
2097
  if (!/^[0-9]{3}-[a-z0-9-]+$/.test(options.spec))
@@ -1972,7 +2102,8 @@ async function startSpec(input, command) {
1972
2102
  const requested = approval(options.approvals);
1973
2103
  if (options.migrate !== undefined && requested !== "no")
1974
2104
  throw new Error("migrate answers MIGRATION_REQUIRED only: send it with approvals=no (the pending choice) and the returned root, never the migration answer as approvals");
1975
- const roots = issueList(await command(["query", `spec_id="${options.spec}"`, "--limit", "0"])).filter(isRunRoot);
2105
+ const rows = issueList(await command(["query", `spec_id="${options.spec}"`, "--limit", "0"]));
2106
+ const roots = rows.filter(isRunRoot);
1976
2107
  if (roots.length > 1 && !options.root)
1977
2108
  throw new Error("Multiple runs exist; select an explicit root");
1978
2109
  let root = options.root ? issueList(await command(["show", options.root]))[0] : roots[0];
@@ -1993,17 +2124,31 @@ async function startSpec(input, command) {
1993
2124
  const question = `Explicitly migrate existing run ${root.id} to omit routine approvals, resolving only its routine formula approval gates while preserving history? Yes or no.`;
1994
2125
  return { status: "MIGRATION_REQUIRED", root: root.id, question, text: question };
1995
2126
  }
2127
+ const epic = await specEpic(options.spec, options.epic, rows, command);
2128
+ const warnings = [epic && blockedEpicWarning(epic)].filter((warning) => !!warning);
2129
+ const placed = root && epic ? await placeExisting(root, epic, { ...options, profile }, command) : undefined;
2130
+ if (placed?.kind === "ask")
2131
+ return placed.result;
2132
+ const move = placed?.move;
1996
2133
  if ((saved === undefined || migration) && !options.decision?.trim())
1997
2134
  throw new Error("Record the explicit user decision before creating or migrating a workflow");
1998
2135
  if (root && migration)
1999
2136
  await migrateRoutine(root, options, command);
2000
2137
  const mode = selected === "yes" ? "no" : "yes";
2001
- if (!root) {
2002
- const poured = object(payload(await command(["mol", "pour", profile, "--var", `feature=${options.spec}`, "--var", `autonomous=${mode}`])));
2003
- if (typeof poured.new_epic_id !== "string")
2004
- throw new Error("Pour returned no new_epic_id; inspect the created run before retrying");
2005
- root = { id: poured.new_epic_id };
2006
- }
2138
+ const fresh = !root;
2139
+ root ??= await createRun(options.spec, profile, mode, epic, command);
2140
+ const title = fresh ? runTitle(options.spec, profile) : move?.title;
2141
+ if (move)
2142
+ await command([
2143
+ "update",
2144
+ root.id,
2145
+ "--parent",
2146
+ move.parent,
2147
+ "--title",
2148
+ move.title,
2149
+ "--append-notes",
2150
+ `Moved under epic ${move.parent} and retitled with the user's consent.`
2151
+ ]);
2007
2152
  if (saved === undefined || migration)
2008
2153
  await command([
2009
2154
  "update",
@@ -2022,12 +2167,17 @@ async function startSpec(input, command) {
2022
2167
  const confirmed = issueList(await command(["show", root.id]))[0];
2023
2168
  if (confirmed?.metadata?.human_approvals !== selected || confirmed.metadata.autonomous !== mode)
2024
2169
  throw new Error(`Approval choice readback failed for ${root.id}; do not advance`);
2170
+ readBackPlacement(confirmed, title, fresh ? epic?.id : move?.parent);
2171
+ const nested = epic && confirmed.parent === epic.id ? ` under epic ${epic.id}` : "";
2172
+ const notes = warnings.map((warning) => ` Warning: ${warning}`).join("");
2025
2173
  return {
2026
2174
  status: "READY",
2027
2175
  root: root.id,
2176
+ ...epic ? { epic: epic.id } : {},
2028
2177
  humanApprovals: selected,
2029
2178
  autonomous: mode,
2030
- text: `${options.spec} / ${root.id}: human approvals=${selected}; autonomous=${mode}. Routine clarify, analyze, and verification sign-offs ${selected === "yes" ? "enabled" : "omitted"}. Reviews, verification, tests, and consequential safety/provider confirmations remain required. Only actual dependency consumers wait.`
2179
+ ...warnings.length ? { warnings } : {},
2180
+ text: `${options.spec} / ${root.id}${nested}: human approvals=${selected}; autonomous=${mode}. Routine clarify, analyze, and verification sign-offs ${selected === "yes" ? "enabled" : "omitted"}. Reviews, verification, tests, and consequential safety/provider confirmations remain required. Only actual dependency consumers wait.${notes}`
2031
2181
  };
2032
2182
  }
2033
2183
 
@@ -2701,7 +2851,9 @@ async function withEmbeddedWriteLock(cwd, owner, write, env = process.env, deadl
2701
2851
  // plugins/speckit-beads/opencode/src/spec-start-runtime.ts
2702
2852
  var BEADS_LOCK = { embeddedStoreFor, withEmbeddedWriteLock };
2703
2853
  var COMMAND_MS = 120000;
2704
- var UNBOUNDED = new Set(["mol pour", "gate resolve"]);
2854
+ var UNBOUNDED = new Set(["mol pour", "mol bond", "gate resolve"]);
2855
+ var CREATES = new Set(["mol pour", "mol bond"]);
2856
+ var READS = new Set(["query", "show", "list", "mol"]);
2705
2857
  var TERMINATION_GRACE_MS = 5000;
2706
2858
 
2707
2859
  class IncompleteStart extends Error {
@@ -2712,6 +2864,18 @@ class IncompleteStart extends Error {
2712
2864
  this.name = "IncompleteStart";
2713
2865
  }
2714
2866
  }
2867
+ function createdRootOf(created, formula) {
2868
+ if (created === null || typeof created !== "object")
2869
+ return;
2870
+ const result = created;
2871
+ if (typeof result.new_epic_id === "string")
2872
+ return result.new_epic_id;
2873
+ const mapping = result.id_mapping;
2874
+ if (formula === undefined || mapping === null || typeof mapping !== "object")
2875
+ return;
2876
+ const id = mapping[formula];
2877
+ return typeof id === "string" ? id : undefined;
2878
+ }
2715
2879
  async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BEADS_LOCK, timers = globalThis) {
2716
2880
  const started = Date.now();
2717
2881
  const cwd = realpathSync4(options.workspace);
@@ -2741,7 +2905,7 @@ async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BE
2741
2905
  };
2742
2906
  if (!completedSteps.length && why === "cancelled before")
2743
2907
  return new IncompleteStart(`Workflow start cancelled before \`${step}\`. No workflow-start command ran.`, details);
2744
- const pour = completedSteps.includes("mol pour") ? `the pour completed${root === undefined ? "" : ` (root ${root})`}` : step === "mol pour" ? "a pour was issued and may be partial" : "no pour was issued";
2908
+ const pour = completedSteps.some((done) => CREATES.has(done)) ? `the pour completed${root === undefined ? "" : ` (root ${root})`}` : CREATES.has(step) ? "a pour was issued and may be partial" : "no pour was issued";
2745
2909
  const ran = completedSteps.length ? `Completed: ${completedSteps.join(", ")}` : "No earlier command completed";
2746
2910
  return new IncompleteStart(`Workflow start incomplete: ${why} \`${step}\`. ${ran}; ${pour}. Inspect the run before retrying.`, details);
2747
2911
  };
@@ -2796,7 +2960,7 @@ async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BE
2796
2960
  return;
2797
2961
  }
2798
2962
  completedSteps.push(step);
2799
- if (args[0] !== "query" && args[0] !== "show" && args[0] !== "mol") {
2963
+ if (!READS.has(String(args[0]))) {
2800
2964
  resolveResult(undefined);
2801
2965
  return;
2802
2966
  }
@@ -2807,9 +2971,10 @@ async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BE
2807
2971
  reject(new Error("Beads returned invalid JSON; inspect the run before retrying"));
2808
2972
  return;
2809
2973
  }
2810
- const poured = step === "mol pour" ? payload(value) : undefined;
2811
- if (poured && typeof poured === "object" && "new_epic_id" in poured && typeof poured.new_epic_id === "string")
2812
- root = poured.new_epic_id;
2974
+ const created = CREATES.has(step) ? payload(value) : undefined;
2975
+ const createdRoot = createdRootOf(created, args[2]);
2976
+ if (createdRoot !== undefined)
2977
+ root = createdRoot;
2813
2978
  resolveResult(value);
2814
2979
  });
2815
2980
  return promise;
@@ -2871,12 +3036,20 @@ var START_INPUT = {
2871
3036
  migrate: {
2872
3037
  type: "boolean",
2873
3038
  description: "Only after MIGRATION_REQUIRED: true for the user's yes to migrating, with approvals=no and root"
3039
+ },
3040
+ epic: {
3041
+ type: "string",
3042
+ description: "Feature epic to nest the run under; default the one open epic with this spec_id"
3043
+ },
3044
+ reparent: {
3045
+ type: "boolean",
3046
+ description: "Only after REPARENT_REQUIRED: the user's answer to moving the run under its epic, with root"
2874
3047
  }
2875
3048
  },
2876
3049
  additionalProperties: false
2877
3050
  };
2878
3051
  var START_DESCRIPTION = `Start or resume a spec workflow, with an explicit routine approval choice from the user before pouring.
2879
- ` + "Persists and reads back the answer, reuses it on resume, and requires separate consent to migrate an existing gated run. Holds the Beads store's write lock for the whole start. Returns CHOICE_REQUIRED or MIGRATION_REQUIRED with a question to ask the user, READY when the run can advance, or INCOMPLETE (store-lock wait ran out, a bd command passed its bound, or cancellation) with the step reached and whether a pour was issued; inspect the run before retrying. Reviews, tests and safety confirmations remain required.";
3052
+ ` + "Persists and reads back the answer, reuses it on resume, and requires separate consent to migrate an existing gated run. Nests a new run under the spec's feature epic and titles it <spec> (<profile>); moving an existing unparented run needs the user's yes to REPARENT_REQUIRED. Refuses an epic that blocks on a step of the run, and warns when the epic's open blocks edges would hide the run from bd ready. Holds the Beads store's write lock for the whole start. Returns CHOICE_REQUIRED, MIGRATION_REQUIRED or REPARENT_REQUIRED with a question to ask the user, READY when the run can advance, or INCOMPLETE (store-lock wait ran out, a bd command passed its bound, or cancellation) with the step reached and whether a pour was issued; inspect the run before retrying. Reviews, tests and safety confirmations remain required.";
2880
3053
  var within = (base, path) => path === undefined ? base : isAbsolute7(path) ? path : resolve7(base, path);
2881
3054
  var record = (input) => input !== null && typeof input === "object" && !Array.isArray(input) ? input : {};
2882
3055
  function toolDirectory(input, session, speckitWorkspace) {
@@ -2950,7 +3123,7 @@ function readStartParams(input, directory) {
2950
3123
  return "approvals must be exactly yes or no";
2951
3124
  options.approvals = value.approvals;
2952
3125
  }
2953
- for (const key of ["root", "decision"]) {
3126
+ for (const key of ["root", "decision", "epic"]) {
2954
3127
  const field = value[key];
2955
3128
  if (field === undefined)
2956
3129
  continue;
@@ -2963,6 +3136,11 @@ function readStartParams(input, directory) {
2963
3136
  return "migrate must be a boolean";
2964
3137
  options.migrate = value.migrate;
2965
3138
  }
3139
+ if (value.reparent !== undefined) {
3140
+ if (typeof value.reparent !== "boolean")
3141
+ return "reparent must be a boolean";
3142
+ options.reparent = value.reparent;
3143
+ }
2966
3144
  return options;
2967
3145
  }
2968
3146
  async function executeStart(input, directory, signal, lock = BEADS_LOCK) {
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Install: copy this file into <repo>/.beads/formulas/ (or ~/.beads/formulas/).
4
4
  # Pour one molecule per feature:
5
- # bd mol pour speckit-basic --var feature=<NNN-slug> --var autonomous=<yes|no>
5
+ # bd mol pour speckit-basic --var feature=<NNN-slug> --var autonomous=<yes|no> --var title="<NNN-slug> (speckit-basic)"
6
6
  #
7
7
  # Every /speckit.* command here ships with spec-kit itself: specify,
8
8
  # clarify, plan, tasks, analyze. Verification requires no community extension.
@@ -24,6 +24,10 @@ pattern = "^[0-9]{3}-[a-z0-9-]+$"
24
24
  # Pass "no" for approvals enabled, or "yes" for approvals declined.
25
25
  # Persist the explicit choice on the root; reuse it on resume.
26
26
  # Reviews, verification, tests, and safety/provider confirmations remain required.
27
+ [vars.title]
28
+ description = "The run root's title, <NNN-slug> (speckit-basic); speckit_start passes it. bd titles the root from it."
29
+ required = true
30
+
27
31
  [vars.autonomous]
28
32
  required = true
29
33
  pattern = "^(yes|no)$"
@@ -31,6 +35,7 @@ pattern = "^(yes|no)$"
31
35
 
32
36
  [[steps]]
33
37
  id = "specify"
38
+ labels = ["speckit:specify"]
34
39
  title = "specify {{feature}}"
35
40
  type = "task"
36
41
  description = "Run /speckit.specify to create specs/{{feature}}/spec.md. PRECONDITION: the /speckit.* skills come from spec-kit, which this package does not ship -- run the speckit-setup skill first. All five command steps here are spec-kit core; no community extension is needed."
@@ -40,6 +45,7 @@ skill_hints = "speckit.specify"
40
45
 
41
46
  [[steps]]
42
47
  id = "clarify"
48
+ labels = ["speckit:clarify"]
43
49
  title = "clarify {{feature}}"
44
50
  type = "task"
45
51
  needs = ["specify"]
@@ -51,6 +57,7 @@ execution_mode = "interactive"
51
57
 
52
58
  [[steps]]
53
59
  id = "clarify-approval"
60
+ labels = ["speckit:clarify-approval"]
54
61
  title = "clarify approval {{feature}}"
55
62
  type = "task"
56
63
  needs = ["clarify"]
@@ -62,6 +69,7 @@ type = "human"
62
69
 
63
70
  [[steps]]
64
71
  id = "plan"
72
+ labels = ["speckit:plan"]
65
73
  title = "plan {{feature}}"
66
74
  type = "task"
67
75
  needs = ["clarify", "clarify-approval"]
@@ -72,6 +80,7 @@ skill_hints = "speckit.plan"
72
80
 
73
81
  [[steps]]
74
82
  id = "tasks"
83
+ labels = ["speckit:tasks"]
75
84
  title = "tasks {{feature}}"
76
85
  type = "task"
77
86
  needs = ["plan"]
@@ -82,6 +91,7 @@ skill_hints = "speckit.tasks"
82
91
 
83
92
  [[steps]]
84
93
  id = "analyze"
94
+ labels = ["speckit:analyze"]
85
95
  title = "analyze {{feature}}"
86
96
  type = "task"
87
97
  needs = ["tasks"]
@@ -93,6 +103,7 @@ execution_mode = "interactive"
93
103
 
94
104
  [[steps]]
95
105
  id = "analyze-approval"
106
+ labels = ["speckit:analyze-approval"]
96
107
  title = "analyze approval {{feature}}"
97
108
  type = "task"
98
109
  needs = ["analyze"]
@@ -104,13 +115,15 @@ type = "human"
104
115
 
105
116
  [[steps]]
106
117
  id = "implement"
118
+ labels = ["speckit:implement"]
107
119
  title = "implement {{feature}}"
108
120
  type = "task"
109
121
  needs = ["analyze", "analyze-approval"]
110
- description = "Work the implementation task beads that are children of this step: bd ready -> bd update <id> --claim -> bd close <id> --reason. There is no assign/validate chain in this profile. Per-file progress and retries ride a [wisp:worklog] wisp linked relates-to this step; the step thread keeps the outcome only. Keep this step open until every child is closed -- bd close on a parent with open children succeeds silently."
122
+ description = "Work the implementation task beads that are children of this step: bd ready -> bd update <id> --claim -> bd close <id> --reason. There is no assign/validate chain in this profile. Per-file progress and retries ride a [wisp:worklog] wisp linked relates-to this step; the step thread keeps the outcome only. Keep this step open until every child is closed -- bd close on a parent with open children succeeds silently. When the spec's user stories ship as separate changes, the children are one beads-feature molecule per story instead, each holding that story's tasks (speckit-ledger: User stories as features)."
111
123
 
112
124
  [[steps]]
113
125
  id = "verify"
126
+ labels = ["speckit:verify"]
114
127
  title = "verify {{feature}}"
115
128
  type = "task"
116
129
  needs = ["implement"]
@@ -122,6 +135,7 @@ execution_agent_mode = "requirements"
122
135
 
123
136
  [[steps]]
124
137
  id = "verify-signoff"
138
+ labels = ["speckit:verify-signoff"]
125
139
  title = "verify sign-off {{feature}}"
126
140
  type = "task"
127
141
  needs = ["verify"]
@@ -133,6 +147,7 @@ type = "human"
133
147
 
134
148
  [[steps]]
135
149
  id = "final-checkpoint"
150
+ labels = ["speckit:final-checkpoint"]
136
151
  title = "final checkpoint {{feature}}"
137
152
  type = "task"
138
153
  needs = ["verify", "verify-signoff"]
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Install: copy this file into <repo>/.beads/formulas/ (or ~/.beads/formulas/).
4
4
  # Pour one molecule per feature:
5
- # bd mol pour speckit-feature --var feature=<NNN-slug> --var autonomous=<yes|no>
5
+ # bd mol pour speckit-feature --var feature=<NNN-slug> --var autonomous=<yes|no> --var title="<NNN-slug> (speckit-feature)"
6
6
  #
7
7
  # Authoring gotchas (verified against the bd 1.3.0 floor):
8
8
  # - [steps.gate] must be a TOML table, not a string.
@@ -24,6 +24,10 @@ pattern = "^[0-9]{3}-[a-z0-9-]+$"
24
24
  # Pass "no" for approvals enabled, or "yes" for approvals declined.
25
25
  # Persist the explicit choice on the root; reuse it on resume.
26
26
  # Reviews, verification, tests, and safety/provider confirmations remain required.
27
+ [vars.title]
28
+ description = "The run root's title, <NNN-slug> (speckit-feature); speckit_start passes it. bd titles the root from it."
29
+ required = true
30
+
27
31
  [vars.autonomous]
28
32
  required = true
29
33
  pattern = "^(yes|no)$"
@@ -31,6 +35,7 @@ pattern = "^(yes|no)$"
31
35
 
32
36
  [[steps]]
33
37
  id = "specify"
38
+ labels = ["speckit:specify"]
34
39
  title = "specify {{feature}}"
35
40
  type = "task"
36
41
  description = "Run /speckit.specify to create specs/{{feature}}/spec.md. PRECONDITION: the /speckit.* skills come from spec-kit and its extensions, which this package does not ship -- run the speckit-setup skill first. For a no-community workflow, use the basic profile or perform unavailable extension steps directly with the same deliverables and checks; record each fallback on its bead and never skip review or verification."
@@ -40,6 +45,7 @@ skill_hints = "speckit.specify"
40
45
 
41
46
  [[steps]]
42
47
  id = "clarify"
48
+ labels = ["speckit:clarify"]
43
49
  title = "clarify {{feature}}"
44
50
  type = "task"
45
51
  needs = ["specify"]
@@ -51,6 +57,7 @@ execution_mode = "interactive"
51
57
 
52
58
  [[steps]]
53
59
  id = "clarify-approval"
60
+ labels = ["speckit:clarify-approval"]
54
61
  title = "clarify approval {{feature}}"
55
62
  type = "task"
56
63
  needs = ["clarify"]
@@ -62,6 +69,7 @@ type = "human"
62
69
 
63
70
  [[steps]]
64
71
  id = "plan"
72
+ labels = ["speckit:plan"]
65
73
  title = "plan {{feature}}"
66
74
  type = "task"
67
75
  needs = ["clarify", "clarify-approval"]
@@ -72,6 +80,7 @@ skill_hints = "speckit.plan"
72
80
 
73
81
  [[steps]]
74
82
  id = "checklist"
83
+ labels = ["speckit:checklist"]
75
84
  title = "checklist {{feature}}"
76
85
  type = "task"
77
86
  needs = ["tasks"]
@@ -83,6 +92,7 @@ execution_mode = "interactive"
83
92
 
84
93
  [[steps]]
85
94
  id = "tasks"
95
+ labels = ["speckit:tasks"]
86
96
  title = "tasks {{feature}}"
87
97
  type = "task"
88
98
  needs = ["plan"]
@@ -93,6 +103,7 @@ skill_hints = "speckit.tasks"
93
103
 
94
104
  [[steps]]
95
105
  id = "critique"
106
+ labels = ["speckit:critique"]
96
107
  title = "critique {{feature}}"
97
108
  type = "task"
98
109
  needs = ["checklist"]
@@ -103,6 +114,7 @@ skill_hints = "speckit.critique.run"
103
114
 
104
115
  [[steps]]
105
116
  id = "security-review"
117
+ labels = ["speckit:security-review"]
106
118
  title = "security review {{feature}}"
107
119
  type = "task"
108
120
  needs = ["checklist"]
@@ -113,6 +125,7 @@ skill_hints = "speckit.security-review.plan"
113
125
 
114
126
  [[steps]]
115
127
  id = "analyze"
128
+ labels = ["speckit:analyze"]
116
129
  title = "analyze {{feature}}"
117
130
  type = "task"
118
131
  needs = ["critique", "security-review"]
@@ -124,6 +137,7 @@ execution_mode = "interactive"
124
137
 
125
138
  [[steps]]
126
139
  id = "analyze-approval"
140
+ labels = ["speckit:analyze-approval"]
127
141
  title = "analyze approval {{feature}}"
128
142
  type = "task"
129
143
  needs = ["analyze"]
@@ -135,17 +149,18 @@ type = "human"
135
149
 
136
150
  [[steps]]
137
151
  id = "implement"
152
+ labels = ["speckit:implement"]
138
153
  title = "implement {{feature}}"
139
154
  type = "task"
140
155
  needs = ["analyze", "analyze-approval"]
141
- description = "Work the implementation task beads directly. These beads are children of this step; work them via the beads CLI ready -> update <id> --claim -> close <id> --reason. Begin child work only after prerequisites are satisfied; keep this step open until every child is closed."
156
+ description = "Work the implementation task beads directly. These beads are children of this step; work them via the beads CLI ready -> update <id> --claim -> close <id> --reason. Begin child work only after prerequisites are satisfied; keep this step open until every child is closed. When the spec's user stories ship as separate changes, the children are one beads-feature molecule per story instead, each holding that story's tasks (speckit-ledger: User stories as features)."
142
157
 
143
158
  [[steps]]
144
159
  id = "verify-tasks"
145
160
  title = "verify tasks {{feature}}"
146
161
  type = "task"
147
162
  needs = ["implement"]
148
- labels = ["agent:speckit-verify"]
163
+ labels = ["speckit:verify-tasks", "agent:speckit-verify"]
149
164
  description = "Spawn the speckit-verify agent (mode: tasks) for phantom-completion detection; it returns findings as its final message, and the parent writes them to verify-tasks-report.md."
150
165
 
151
166
  [steps.metadata]
@@ -158,7 +173,7 @@ id = "verify"
158
173
  title = "verify {{feature}}"
159
174
  type = "task"
160
175
  needs = ["verify-tasks"]
161
- labels = ["agent:speckit-verify"]
176
+ labels = ["speckit:verify", "agent:speckit-verify"]
162
177
  description = "Spawn the speckit-verify agent (mode: requirements) to validate code against spec.md; it returns findings as its final message, and the parent writes them to verify-report.md."
163
178
 
164
179
  [steps.metadata]
@@ -168,6 +183,7 @@ execution_mode = "subagent"
168
183
 
169
184
  [[steps]]
170
185
  id = "verify-signoff"
186
+ labels = ["speckit:verify-signoff"]
171
187
  title = "verify sign-off {{feature}}"
172
188
  type = "task"
173
189
  needs = ["verify"]
@@ -182,7 +198,7 @@ id = "review"
182
198
  title = "review {{feature}}"
183
199
  type = "task"
184
200
  needs = ["verify", "verify-signoff"]
185
- labels = ["agent:speckit-verify"]
201
+ labels = ["speckit:review", "agent:speckit-verify"]
186
202
  description = "Spawn the speckit-verify agent (mode: review) to review the branch diff against spec.md, plan.md and the spec's task beads; route its findings through the mol-speckit-fix-findings molecule. Multi-dimension or cross-model review: create one review-wisp shell per dimension plus a blocks edge from the downstream step to each, before spawning any reviewer."
187
203
 
188
204
  [steps.metadata]
@@ -192,6 +208,7 @@ execution_mode = "subagent"
192
208
 
193
209
  [[steps]]
194
210
  id = "qa"
211
+ labels = ["speckit:qa"]
195
212
  title = "qa {{feature}}"
196
213
  type = "task"
197
214
  needs = ["review"]
@@ -205,7 +222,7 @@ id = "code-review"
205
222
  title = "code review {{feature}}"
206
223
  type = "task"
207
224
  needs = ["qa"]
208
- labels = ["agent:speckit-verify"]
225
+ labels = ["speckit:code-review", "agent:speckit-verify"]
209
226
  description = "Spawn the speckit-verify agent (mode: review) for a post-QA code review of the branch diff against spec.md, plan.md and the spec's task beads; route its findings through the mol-speckit-fix-findings molecule. Parallel with security-review-post."
210
227
 
211
228
  [steps.metadata]
@@ -215,6 +232,7 @@ execution_mode = "subagent"
215
232
 
216
233
  [[steps]]
217
234
  id = "security-review-post"
235
+ labels = ["speckit:security-review-post"]
218
236
  title = "post-implementation security review {{feature}}"
219
237
  type = "task"
220
238
  needs = ["qa"]
@@ -226,6 +244,7 @@ execution_mode = "subagent"
226
244
 
227
245
  [[steps]]
228
246
  id = "cleanup"
247
+ labels = ["speckit:cleanup"]
229
248
  title = "cleanup {{feature}}"
230
249
  type = "task"
231
250
  needs = ["code-review", "security-review-post"]
@@ -239,7 +258,7 @@ id = "sync-drift"
239
258
  title = "sync drift {{feature}}"
240
259
  type = "task"
241
260
  needs = ["cleanup"]
242
- labels = ["agent:speckit-sync"]
261
+ labels = ["speckit:sync-drift", "agent:speckit-sync"]
243
262
  description = "Spawn the speckit-sync agent (scope: drift) to detect spec/implementation drift. Parallel with sync-conflicts."
244
263
 
245
264
  [steps.metadata]
@@ -252,7 +271,7 @@ id = "sync-conflicts"
252
271
  title = "sync conflicts {{feature}}"
253
272
  type = "task"
254
273
  needs = ["cleanup"]
255
- labels = ["agent:speckit-sync"]
274
+ labels = ["speckit:sync-conflicts", "agent:speckit-sync"]
256
275
  description = "Spawn the speckit-sync agent (scope: conflicts) to detect inter-spec contradictions. Parallel with sync-drift."
257
276
 
258
277
  [steps.metadata]
@@ -262,6 +281,7 @@ execution_mode = "subagent"
262
281
 
263
282
  [[steps]]
264
283
  id = "retro"
284
+ labels = ["speckit:retro"]
265
285
  title = "retro {{feature}}"
266
286
  type = "task"
267
287
  needs = ["sync-drift", "sync-conflicts"]
@@ -272,6 +292,7 @@ skill_hints = "speckit.retro.run"
272
292
 
273
293
  [[steps]]
274
294
  id = "docs-update"
295
+ labels = ["speckit:docs-update"]
275
296
  title = "documentation update {{feature}}"
276
297
  type = "task"
277
298
  needs = ["retro"]
@@ -279,6 +300,7 @@ description = "Update user-facing documentation for the shipped feature on the m
279
300
 
280
301
  [[steps]]
281
302
  id = "final-checkpoint"
303
+ labels = ["speckit:final-checkpoint"]
282
304
  title = "final checkpoint {{feature}}"
283
305
  type = "task"
284
306
  needs = ["docs-update"]
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Install: copy this file into <repo>/.beads/formulas/ (or ~/.beads/formulas/).
4
4
  # Pour one molecule per feature:
5
- # bd mol pour speckit-lean --var feature=<NNN-slug> --var autonomous=<yes|no>
5
+ # bd mol pour speckit-lean --var feature=<NNN-slug> --var autonomous=<yes|no> --var title="<NNN-slug> (speckit-lean)"
6
6
  #
7
7
  # Omits the feature profile's checklist, security-review, code-review,
8
8
  # security-review-post, cleanup, sync-drift, sync-conflicts, and retro.
@@ -20,6 +20,10 @@ pattern = "^[0-9]{3}-[a-z0-9-]+$"
20
20
  # Pass "no" for approvals enabled, or "yes" for approvals declined.
21
21
  # Persist the explicit choice on the root; reuse it on resume.
22
22
  # Reviews, verification, tests, and safety/provider confirmations remain required.
23
+ [vars.title]
24
+ description = "The run root's title, <NNN-slug> (speckit-lean); speckit_start passes it. bd titles the root from it."
25
+ required = true
26
+
23
27
  [vars.autonomous]
24
28
  required = true
25
29
  pattern = "^(yes|no)$"
@@ -27,6 +31,7 @@ pattern = "^(yes|no)$"
27
31
 
28
32
  [[steps]]
29
33
  id = "specify"
34
+ labels = ["speckit:specify"]
30
35
  title = "specify {{feature}}"
31
36
  type = "task"
32
37
  description = "Run /speckit.specify to create specs/{{feature}}/spec.md. PRECONDITION: the /speckit.* skills come from spec-kit and its extensions, which this package does not ship -- run the speckit-setup skill first. For a no-community workflow, use the basic profile or perform unavailable extension steps directly with the same deliverables and checks; record each fallback on its bead and never skip review or verification."
@@ -36,6 +41,7 @@ skill_hints = "speckit.specify"
36
41
 
37
42
  [[steps]]
38
43
  id = "clarify"
44
+ labels = ["speckit:clarify"]
39
45
  title = "clarify {{feature}}"
40
46
  type = "task"
41
47
  needs = ["specify"]
@@ -47,6 +53,7 @@ execution_mode = "interactive"
47
53
 
48
54
  [[steps]]
49
55
  id = "clarify-approval"
56
+ labels = ["speckit:clarify-approval"]
50
57
  title = "clarify approval {{feature}}"
51
58
  type = "task"
52
59
  needs = ["clarify"]
@@ -58,6 +65,7 @@ type = "human"
58
65
 
59
66
  [[steps]]
60
67
  id = "plan"
68
+ labels = ["speckit:plan"]
61
69
  title = "plan {{feature}}"
62
70
  type = "task"
63
71
  needs = ["clarify", "clarify-approval"]
@@ -68,6 +76,7 @@ skill_hints = "speckit.plan"
68
76
 
69
77
  [[steps]]
70
78
  id = "tasks"
79
+ labels = ["speckit:tasks"]
71
80
  title = "tasks {{feature}}"
72
81
  type = "task"
73
82
  needs = ["plan"]
@@ -78,6 +87,7 @@ skill_hints = "speckit.tasks"
78
87
 
79
88
  [[steps]]
80
89
  id = "critique"
90
+ labels = ["speckit:critique"]
81
91
  title = "critique {{feature}}"
82
92
  type = "task"
83
93
  needs = ["tasks"]
@@ -88,6 +98,7 @@ skill_hints = "speckit.critique.run"
88
98
 
89
99
  [[steps]]
90
100
  id = "analyze"
101
+ labels = ["speckit:analyze"]
91
102
  title = "analyze {{feature}}"
92
103
  type = "task"
93
104
  needs = ["critique"]
@@ -99,6 +110,7 @@ execution_mode = "interactive"
99
110
 
100
111
  [[steps]]
101
112
  id = "analyze-approval"
113
+ labels = ["speckit:analyze-approval"]
102
114
  title = "analyze approval {{feature}}"
103
115
  type = "task"
104
116
  needs = ["analyze"]
@@ -110,17 +122,18 @@ type = "human"
110
122
 
111
123
  [[steps]]
112
124
  id = "implement"
125
+ labels = ["speckit:implement"]
113
126
  title = "implement {{feature}}"
114
127
  type = "task"
115
128
  needs = ["analyze", "analyze-approval"]
116
- description = "Work the implementation task beads directly. These beads are children of this step; work them via the beads CLI ready -> update <id> --claim -> close <id> --reason. Begin child work only after prerequisites are satisfied; keep this step open until every child is closed."
129
+ description = "Work the implementation task beads directly. These beads are children of this step; work them via the beads CLI ready -> update <id> --claim -> close <id> --reason. Begin child work only after prerequisites are satisfied; keep this step open until every child is closed. When the spec's user stories ship as separate changes, the children are one beads-feature molecule per story instead, each holding that story's tasks (speckit-ledger: User stories as features)."
117
130
 
118
131
  [[steps]]
119
132
  id = "verify-tasks"
120
133
  title = "verify tasks {{feature}}"
121
134
  type = "task"
122
135
  needs = ["implement"]
123
- labels = ["agent:speckit-verify"]
136
+ labels = ["speckit:verify-tasks", "agent:speckit-verify"]
124
137
  description = "Spawn the speckit-verify agent (mode: tasks) for phantom-completion detection; it returns findings as its final message, and the parent writes them to verify-tasks-report.md."
125
138
 
126
139
  [steps.metadata]
@@ -133,7 +146,7 @@ id = "verify"
133
146
  title = "verify {{feature}}"
134
147
  type = "task"
135
148
  needs = ["verify-tasks"]
136
- labels = ["agent:speckit-verify"]
149
+ labels = ["speckit:verify", "agent:speckit-verify"]
137
150
  description = "Spawn the speckit-verify agent (mode: requirements) to validate code against spec.md; it returns findings as its final message, and the parent writes them to verify-report.md."
138
151
 
139
152
  [steps.metadata]
@@ -143,6 +156,7 @@ execution_mode = "subagent"
143
156
 
144
157
  [[steps]]
145
158
  id = "verify-signoff"
159
+ labels = ["speckit:verify-signoff"]
146
160
  title = "verify sign-off {{feature}}"
147
161
  type = "task"
148
162
  needs = ["verify"]
@@ -157,7 +171,7 @@ id = "review"
157
171
  title = "review {{feature}}"
158
172
  type = "task"
159
173
  needs = ["verify", "verify-signoff"]
160
- labels = ["agent:speckit-verify"]
174
+ labels = ["speckit:review", "agent:speckit-verify"]
161
175
  description = "Spawn the speckit-verify agent (mode: review) to review the branch diff against spec.md, plan.md and the spec's task beads; route its findings through the mol-speckit-fix-findings molecule. Multi-dimension or cross-model review: create one review-wisp shell per dimension plus a blocks edge from the downstream step to each, before spawning any reviewer."
162
176
 
163
177
  [steps.metadata]
@@ -167,6 +181,7 @@ execution_mode = "subagent"
167
181
 
168
182
  [[steps]]
169
183
  id = "qa"
184
+ labels = ["speckit:qa"]
170
185
  title = "qa {{feature}}"
171
186
  type = "task"
172
187
  needs = ["review"]
@@ -177,6 +192,7 @@ skill_hints = "speckit.qa.run"
177
192
 
178
193
  [[steps]]
179
194
  id = "docs-update"
195
+ labels = ["speckit:docs-update"]
180
196
  title = "documentation update {{feature}}"
181
197
  type = "task"
182
198
  needs = ["qa"]
@@ -184,6 +200,7 @@ description = "Update user-facing documentation for the shipped feature on the m
184
200
 
185
201
  [[steps]]
186
202
  id = "final-checkpoint"
203
+ labels = ["speckit:final-checkpoint"]
187
204
  title = "final checkpoint {{feature}}"
188
205
  type = "task"
189
206
  needs = ["docs-update"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srobroek/pi-speckit-beads",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "SpecKit on Beads: a tasks.md guard, setup, ledger and bugfix skills, formulas, and the speckit-sync and speckit-verify subagents.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -13,9 +13,25 @@ speckit-beads plugin refuses the write. Once per session, run `bd prime` for the
13
13
  ## Find the implement step
14
14
 
15
15
  1. `bd query 'spec_id="<NNN-slug>"' --json` lists the spec's beads. The run root is the
16
- epic or molecule titled `speckit-basic`, `speckit-lean` or `speckit-feature`.
16
+ molecule titled `<NNN-slug> (<profile>)`, or for an older run, the epic or molecule
17
+ titled `speckit-basic`, `speckit-lean` or `speckit-feature`. The spec's feature epic
18
+ is its parent.
17
19
  2. `bd mol current <root-id>` shows the steps. Note the id of the `implement` step.
18
20
 
21
+ ## Where the spec's beads go
22
+
23
+ - The molecule root is a child of the spec's feature epic. `speckit_start` puts it
24
+ there. For an older run that has no parent, it asks first.
25
+ - Tasks go under the molecule's `implement` step, never directly under the epic.
26
+ - Never link the epic to a step of its own molecule with `blocks`. The parent link
27
+ already relates them, and that edge turns the nesting into a cycle.
28
+ - bd marks every child of a blocked epic blocked. Thus a `blocks` edge on an epic
29
+ with a live molecule hides every step of that molecule from `bd ready`.
30
+ Order specced epics with a `related` edge and a note on both epics instead.
31
+ - Put the real order between specs on task edges. The consuming task blocks on the
32
+ producing task, or on its contract bead.
33
+ - When the waiting epic has no live molecule, an epic-to-epic `blocks` edge is safe.
34
+
19
35
  ## Write the task graph
20
36
 
21
37
  Where `/speckit.tasks` says to write `tasks.md`, write `specs/<NNN-slug>/tasks.graph.json`
@@ -79,6 +95,29 @@ first. Then add only the missing tasks, one at a time.
79
95
  The graph file is input to one create. Beads holds the state afterwards, so do not edit
80
96
  the file to record progress.
81
97
 
98
+ ## User stories as features
99
+
100
+ A spec's user stories can ship as separate changes. In that case, each story becomes
101
+ one `beads-feature` molecule under the run's implement step. The feature carries the
102
+ story's own design, tests, docs, review and delivery. A spec that ships as one change
103
+ keeps its tasks directly under the implement step.
104
+
105
+ 1. Check that `bd formula list` shows `beads-feature`. If it does not, install it
106
+ with the beads plugin's `beads_formulas` tool.
107
+ 2. For each story, bond a feature under the implement step:
108
+ `bd mol bond beads-feature <implement-step-id> --type parallel --pour --ref us<N> --var title="US<N> <story>"`.
109
+ When the spec does not ask for tests, add `--var tdd=no`.
110
+ 3. Claim the feature root and give it the spec id:
111
+ `bd update <root> --claim --spec-id <NNN-slug>`. bd titles the root from `title`.
112
+ 4. In `tasks.graph.json`, set each task's `parent_id` to its story feature's
113
+ `implement` step. Set it to the feature's `tests` step for the story's test tasks.
114
+ 5. Read the tasks back with `bd query 'spec_id="<NNN-slug>"' --json`. A query by
115
+ `spec_id` reaches every depth. `bd list --parent <implement-step-id>` lists the
116
+ story features only, not their tasks.
117
+
118
+ The run's implement step closes after every story feature closes. When plan.md
119
+ already covers a story's design, close its design step with a note naming plan.md.
120
+
82
121
  ## Work the tasks
83
122
 
84
123
  `bd ready` picks work, `bd update <id> --claim` claims it and `bd close <id> --reason "<evidence>"`
@@ -69,19 +69,36 @@ Workflow order is the poured molecule; `bd mol current <root>` is the current po
69
69
  Where the tool is absent, do what it does, with `--json` on every `bd` call:
70
70
 
71
71
  1. Find the run root: `bd query 'spec_id="<NNN-slug>"' --limit 0`, keeping the
72
- epics and molecules titled `speckit-basic`, `speckit-lean` or `speckit-feature`.
73
- With several, ask the user which one.
72
+ molecules titled `<NNN-slug> (<profile>)` and, for older runs, the epics and
73
+ molecules titled `speckit-basic`, `speckit-lean` or `speckit-feature`.
74
+ With more than one, ask the user which one. The same query finds the spec's
75
+ feature epic: the open epic among the results. With more than one, ask the user
76
+ which one.
74
77
  2. Reuse a `human_approvals` value of exactly `yes` or `no` recorded in the root's
75
78
  metadata. Otherwise ask the user "Require routine human approval checkpoints for
76
79
  this spec/run? Yes or no." (the `question` tool in OpenCode, `AskUserQuestion` in
77
80
  Claude Code), and wait for an explicit answer.
78
81
  3. Set `autonomous` to the opposite of `human_approvals`.
79
- 4. With no root, pour one:
80
- `bd mol pour <profile> --var feature=<NNN-slug> --var autonomous=<yes|no>`.
81
- The profile defaults to `speckit-feature`; the root is `new_epic_id`.
82
+ 4. With no root, create one. The profile defaults to `speckit-feature`.
83
+ - With a feature epic, bond the run under it:
84
+ `bd mol bond <profile> <epic> --type parallel --pour --ref speckit --var feature=<NNN-slug> --var autonomous=<yes|no> --var title="<NNN-slug> (<profile>)"`.
85
+ The root is the profile's entry in `id_mapping`, `<epic>.speckit`.
86
+ - When the epic already has a child `<epic>.speckit`, use `--ref speckit-2`.
87
+ If `speckit-2` exists too, use `speckit-3`, and so on. bd accepts a used ref
88
+ without an error and merges the two runs.
89
+ - Without one, pour it:
90
+ `bd mol pour <profile> --var feature=<NNN-slug> --var autonomous=<yes|no> --var title="<NNN-slug> (<profile>)"`.
91
+ The root is `new_epic_id`. bd titles it from `title`.
82
92
  5. Record the choice:
83
93
  `bd update <root> --spec-id <NNN-slug> --set-metadata spec_dir=specs/<NNN-slug> --set-metadata human_approvals=<answer> --set-metadata autonomous=<yes|no> --append-notes "Routine approvals: <answer>. Explicit user decision: <decision>"`.
84
- 6. Read it back with `bd show <root>`. Stop when the metadata differs.
94
+ 6. Read it back with `bd show <root>`. If the metadata, the title or the parent differs, stop.
95
+
96
+ An existing run with no parent moves under its epic only with the user's yes:
97
+
98
+ 1. Run `bd show <epic>`. If the epic blocks on a step of that run, stop and report it.
99
+ 2. Run `bd update <root> --parent <epic> --title "<NNN-slug> (<profile>)"`.
100
+
101
+ Never add a `blocks` edge from an epic to a step of its own molecule.
85
102
 
86
103
  Never add approval gates to an existing ungated run; start a new run instead. Changing
87
104
  a gated run to ungated needs `speckit_start` with the user's separate consent; without