Files
msd-core/commands/gsd/capture.md
Tom Boucher 779f67cb11 fix(#4378): mint collision-free SEED-YYMMDD-xxx seed ids instead of a shared count (#4754)
* test(#4378): regression tests for collision-free seed ids

* fix(#4378): mint collision-free SEED-YYMMDD-xxx ids, not a shared count

plant-seed derived the next seed id from 'ls .planning/seeds/SEED-*.md | wc -l'.
.planning/seeds/ is shared but each worktree only sees what has merged, so two
workstreams planting before either merges computed the same id and git merged
both files silently.

The id is now the local date plus a 3-char random base36 suffix -- the shape
.planning/quick/ already uses -- computed from knowledge one worktree has alone,
with a same-day regen guard. deriveSeedIdentity learns the new canonical grammar
alongside legacy SEED-NNN (whose parsing never changes), the --enrich parser and
the filename-prefix fallback keep the full new-format id, and the docs that
state the filename shape move to it.

The prefix fallback previously truncated any non-pure-numeric id at
'SEED-<digits>' -- the same one-id-two-answers ambiguity the issue reports,
reproduced one level down.

* fix(#4378): harden seed id generation per adversarial review

- parse-idea: anchor the --enrich extractor to the flag and capture the
  complete id, uppercase-tolerant; a leftmost 'SEED-[0-9]+' truncated an
  uppercase or malformed suffix to its date and enriched an arbitrary
  same-day seed via head -1. Ambiguous and unmatched targets now fail
  closed instead.
- generate-seed-id: tolerate the expected SIGPIPE under pipefail, abort
  loudly when the suffix cannot be drawn (an empty suffix would collapse
  every seed's id to the bare date), and run the same-day regen guard as
  a find existence test (the 'ls <glob>' shape trips the #3409 drift
  guard and degenerates under a stray nullglob).
- deriveSeedIdentity: document the theoretical legacy/new grammar
  ambiguity (6-digit counter + 3-char base36 slug, no frontmatter).
- changeset: state the residual same-day collision bound instead of
  implying zero.

Emitted-Drift-Ack-Growth: plant-seed.md — the counting step became hardened date+random generation with explicit failure modes; growth is the failure handling, not duplicated logic

* fix(#4378): address standards and spec review findings

- tests: move the allow-test-rule marker to its suppression site (the
  file-header placement was inert per CONTRIBUTING site-scoping); add
  width-boundary coverage (5/7-digit dates, 2/4-char suffixes pin the
  documented branch behavior); add a writer-to-reader parity property
  that parses the mint widths out of the shipped workflow so the two
  grammar owners cannot drift; cover uppercase ids end-to-end in the
  reader.
- plant-seed.md: draw/retry restructured as one loop with a loud
  terminal failure; SEED_SUFX renamed SEED_SUFFIX; regen guard drops
  the redundant head -1; the ambiguity error no longer advises an
  impossible 'complete id' for duplicate legacy ids.
- commands.cts: refresh the cmdListSeeds comment still describing
  SEED-NNN as the only canonical form.
- changeset: drop the audit claim the spec axis showed to be an
  overstatement (audit's id display is filename-derived, pre-existing).
- remove a stray untracked artifact file swept into the tree.

* test(#4378): correct boundary expectations to the module's real branch behavior

The first matrix run on the boundary tests caught my hand-trace of the
regex branches, not a module defect: the slug regex's alternation
backtracks to the legacy branch whenever the canonical branch cannot
complete (so the slug is the remainder after the legacy numeric
prefix), and the 7-digit case fails the canonical branch at its 7th
digit before the dash. Pin the verified values.

* docs(#4378): backfill changeset PR number

* fix(#4378): audit seed identity uses the canonical grammar

Review of this PR found the audit surface publishing a fused filename
stem (SEED-081-region for SEED-081-region.md) where list-seeds reports
the canonical id -- one id, two answers across surfaces, the same
ambiguity class the issue files. scanSeeds now derives identity through
the SAME deriveSeedIdentity the list-seeds gate uses (frontmatter id,
then filename id-prefix, then stem), and audit-open acknowledge
resolves --seed-id by scanning for the derived identity, falling back
to the literal stem so callers scripted against pre-canonical output
keep working. Roll-in per the fix-inline rule: found during this PR's
review, same seed-identity seam.

RED probe: pre-fix audit published seed_id SEED-081-region-becomes /
slug 081-region-becomes for a legacy seeded file; post-fix SEED-081 /
region-becomes, matching list-seeds.

* test(#4378): probe timeout uses the class norm after windows-lane timeout

The windows conformance shard failed its bounded sh -c probes at the
local 5000ms bound (cold sh.exe spawn under shard load) while the
identical code passed this PR's two earlier windows waves. The probe
now uses PROBE_TIMEOUT_MS from the class-norm module instead of a local
override, per the helpers/timeouts.cjs convention.

---------

Co-authored-by: sim <sim@local>
2026-09-15 11:41:29 -04:00

2.5 KiB

name, description, argument-hint, allowed-tools
name description argument-hint allowed-tools
gsd:capture Capture ideas, tasks, notes, and seeds to their destination [--note | --backlog | --seed | --list | --list-seeds] [text]
Read
Write
Edit
Bash
Glob
Grep
AskUserQuestion
Capture ideas, tasks, notes, and seeds to their appropriate destination in the GSD system.

Mode routing:

  • default (no flag): Capture as a structured todo for later work → add-todo workflow
  • --note: Zero-friction idea capture (append/list/promote) → note workflow
  • --backlog: Add an idea to the backlog parking lot (999.x numbering) → add-backlog workflow
  • --seed: Capture a forward-looking idea with trigger conditions → plant-seed workflow
  • --list: List pending todos and select one to work on → check-todos workflow
  • --list-seeds: List/audit captured seeds (optional status filter) → list-seeds workflow
Flag Destination Workflow
(none) Structured todo in .planning/todos/ add-todo
--note Timestamped note file, list, or promote note
--backlog ROADMAP.md backlog section (999.x) add-backlog
--seed .planning/seeds/SEED-YYMMDD-xxx-slug.md plant-seed
--list Interactive todo browser + action router check-todos
--list-seeds Read-only seed list/audit (optional status filter) list-seeds

<execution_context> @/.claude/gsd-core/workflows/add-todo.md @/.claude/gsd-core/workflows/note.md @/.claude/gsd-core/workflows/add-backlog.md @/.claude/gsd-core/workflows/plant-seed.md @/.claude/gsd-core/workflows/check-todos.md @/.claude/gsd-core/workflows/list-seeds.md @~/.claude/gsd-core/references/ui-brand.md </execution_context>

Arguments: $ARGUMENTS

Parse the first token of $ARGUMENTS:

  • If it is --note: strip the flag, pass remainder to note workflow
  • If it is --backlog: strip the flag, pass remainder to add-backlog workflow
  • If it is --seed: strip the flag, pass remainder to plant-seed workflow
  • If it is --list-seeds: strip the flag, pass remainder (optional status filter) to list-seeds workflow
  • If it is --list: pass remainder (optional area filter) to check-todos workflow
  • Otherwise: pass all of $ARGUMENTS to add-todo workflow
1. Parse the leading flag (if any) from $ARGUMENTS. 2. Load and execute the appropriate workflow end-to-end based on the routing table above. 3. Preserve all workflow gates from the target workflow (directory structure, duplicate detection, commits, etc.).