Repository navigation
docs(spec): add spec evolution guidance — V1 scoping and delta specs - #383
Conversation
Answers addyosmani#150 (how to mark a V1 and work on V2 features after /ship) and the workflow half of addyosmani#180 (avoiding a single overwritten global spec.md): - Spec template gains an 'Out of Scope (Deferred)' section so V2 ideas are captured in the spec without expanding V1. - New 'Spec Evolution' section: post-ship changes get a small delta spec (own template, same gated workflow), folded back into the original spec after shipping. - /spec command (Claude + Gemini twins) no longer overwrites an existing SPEC.md for change requests; it writes SPEC-<change-slug>.md. - Two positive trigger prompts added to the eval case; description gains the evolution vocabulary. All Tier 1/2 checks pass. Closes addyosmani#150
|
I like this one a lot. V1-scoping-with-a-V2-delta is a real question people hit the moment a spec survives contact with a second feature, and answering #150 and #180 inside the spec skill itself is the right home for it rather than a separate doc. Nice that you kept the command files in parity and shipped an eval case with it, that's the bar now. Let me read the guidance end to end to make sure it doesn't bloat the spec flow, but this is on-mission and close to a yes. |
|
|
||
| Save the spec as SPEC.md in the project root and confirm with the user before proceeding. | ||
|
|
||
| If SPEC.md already exists and this request is a change to what it describes, do not overwrite it: write a delta spec (e.g. SPEC-<change-slug>.md) covering only the change, per the skill's Spec Evolution section. |
There was a problem hiding this comment.
Could we mirror this guard in commands/spec.toml too? Antigravity still instructs the agent to always overwrite SPEC.md; validate-commands does not compare prompt bodies.
There was a problem hiding this comment.
Good catch — I'd missed that commands/ is a third twin and that validate-commands only diffs presence/descriptions, not bodies. Added the same guard line to commands/spec.toml in ce60dbc.
| [Only deltas from the original spec's boundaries; everything else inherits.] | ||
| ``` | ||
|
|
||
| Save it alongside the original (e.g. `SPEC-postgres-migration.md` next to `SPEC.md`) and run it through the same gated workflow: human review, then plan, tasks, implement. Keep one change per delta spec — that keeps each plan/build cycle small and reviewable. |
There was a problem hiding this comment.
Could we align this filename with the downstream workflow? /build auto only recognizes SPEC.md, docs/SPEC.md, or files under spec/, and does not allow root-level SPEC-*.md files as uncommitted planning artifacts. It may therefore select the old spec or stop at the clean-baseline check.
There was a problem hiding this comment.
Confirmed on both counts: discovery wouldn't select a root-level delta spec, and the clean-baseline check would stop on it. Rather than move delta specs into spec/ (which would drift into #73's storage-convention territory), ce60dbc updates all three /build twins: a root-level SPEC-<change>.md is now an accepted spec path (taking precedence over SPEC.md when the run is building that follow-up change) and SPEC-*.md is included in the planning-artifact exclusions. SKILL.md now states the convention is recognized downstream.
| Once a spec has shipped, a new requirement — swapping the storage engine, replacing a manual step with OCR, promoting a deferred V2 item — gets its own small spec rather than a hand-edit of the shipped one. A delta spec covers only what changes: | ||
|
|
||
| ```markdown | ||
| # Spec Delta: [Change Name] |
There was a problem hiding this comment.
How should a delta spec satisfy the existing “covers all six core areas” verification? This template intentionally omits Commands, Project Structure, Code Style, and Testing Strategy. Could the verification distinguish full specs from delta specs and require only the affected core areas?
There was a problem hiding this comment.
Agreed, the checklist item contradicted the delta template. In ce60dbc it now distinguishes the two: full specs cover all six areas; delta specs cover only the areas the change affects (at minimum objective, success criteria, and boundary deltas) and inherit the rest from the original.
|
|
||
| A spec describes one version of the work. New ideas and post-ship changes don't expand it — they queue behind it. | ||
|
|
||
| ### Scope each version explicitly |
There was a problem hiding this comment.
Could we explicitly answer whether the spec itself should be labeled V1? The Deferred section explains how to capture the V2 backlog, but the version-labeling part of #150 remains ambiguous.
There was a problem hiding this comment.
Made it explicit in ce60dbc: the spec template title is now # Spec: [Name] — V[N], and Spec Evolution says to label the version in the title and bump it when a shipped delta is folded back in, so the V1/V2 boundary is stated in the artifact itself rather than implied.
…pport, delta verification, V1 labeling
|
|
||
| 1. **Require a spec.** Look only for a spec at a known path: `SPEC.md` at the repo root, `docs/SPEC.md`, or a file under `spec/`. A README or arbitrary doc does **not** count. If none exists, stop and tell the user to run `/spec` first — do not invent requirements. | ||
| 2. **Establish a clean baseline.** Run `git status --porcelain`. If there are uncommitted changes outside the expected planning artifacts (`SPEC.md`, `docs/SPEC.md`, `spec/*`, `tasks/plan.md`, `tasks/todo.md`), stop and ask the user to commit, stash, or confirm how to handle them. Autonomous per-task commits must not absorb unrelated local work, or the clean-rollback guarantee breaks. | ||
| 1. **Require a spec.** Look only for a spec at a known path: `SPEC.md` at the repo root, a root-level `SPEC-<change>.md` delta spec (per the spec-driven-development skill's Spec Evolution section — when one exists and the run is building that follow-up change, it takes precedence over `SPEC.md`), `docs/SPEC.md`, or a file under `spec/`. A README or arbitrary doc does **not** count. If none exists, stop and tell the user to run `/spec` first — do not invent requirements. |
There was a problem hiding this comment.
The existing global tasks/plan.md behavior predates this change, but it becomes ambiguous with the newly introduced delta-spec workflow. After V1 ships, an existing V1 plan may remain; /build auto will then skip planning for SPEC-ocr.md because step 3 checks only whether tasks/plan.md exists.
One low-scope option would be to record the source spec in the generated plan—for example, Source spec: SPEC-ocr.md—and reuse an existing plan only when that value matches the selected spec. On a mismatch, /build auto could stop and ask whether to archive or replace the existing plan rather than silently reusing it. Would that fit the intended workflow? The same guard should be mirrored across the three /build twins.
There was a problem hiding this comment.
Agreed this was a real gap — spec selection became version-aware but plan reuse didn't. Implemented your suggestion in 5971d80 across all three /build twins: plans are stamped with Source spec: <path> at generation, reused only on a match, and a mismatch stops to ask whether to archive or replace. One addition: a plan with no Source spec: line is treated as a mismatch rather than assumed current, since silently trusting an unstamped legacy plan is the same failure mode. The planning skill's plan template now includes the line so standalone /plan output participates in the guard too.
| Then generate a structured spec covering all six core areas: objective, commands, project structure, code style, testing strategy, and boundaries. | ||
|
|
||
| Save the spec as SPEC.md in the project root and confirm with the user before proceeding. | ||
|
|
There was a problem hiding this comment.
Consider: Would it be clearer to express this as an explicit new-spec/delta-spec branch? The preceding instructions are written unconditionally for a full SPEC.md, while this line introduces the exception for an existing shipped spec.
There was a problem hiding this comment.
Yes, clearer as a branch. 5971d80 restructures all three /spec twins to decide the flow up front: New spec (no SPEC.md, or unrelated request) runs the full six-area flow; Delta spec (SPEC.md exists and the request changes it) writes SPEC-.md per Spec Evolution. No behavior change, just the structure you suggested.
…ew/delta branch - /build auto step 3 now stamps generated plans with 'Source spec: <path>' and reuses an existing tasks/plan.md only when the stamp matches the selected spec; on mismatch (or an unstamped legacy plan) it stops and asks whether to archive or replace, across all three /build twins - planning-and-task-breakdown plan template carries the Source spec line so standalone /plan output is compatible with the guard - /spec twins restructured into an explicit new-spec / delta-spec branch instead of an unconditional flow with a trailing exception
|
@federicobartoli gentle nudge on this one — all six points from your two review rounds are addressed (ce60dbc for the first round, 5971d80 for the plan source-spec guard and the new/delta branch), with replies on each thread. Anything else you need from me here? |
…lity requirements (#431) Implements the v1 scope agreed in #431: when one requirement bundles several independently testable capabilities, spec-driven-development now runs a bounded front-step before Specify — detect multi-capability scope, propose a capability map (stable module ids, one-way dependency direction, build order), gate it on human approval, then recurse the gated workflow per module in dependency order. Kept deliberately small per the maintainer's scoping: - detection + module map + stable identity only; no per-module artifact tree — module specs reuse the root-level SPEC-<id>.md naming so the layout follows the delta-spec direction in #383 rather than leading it - the simple path is preserved: single-capability requests skip Phase 0 entirely, and the section says so first - non-goals held: no PM framework, no forced hierarchy on small features Also: - description gains the decomposition vocabulary so realistic asks route here (both new positive triggers rank #1) - /spec command wrappers (.claude, commands/, .gemini) gain one matching step, kept in parity - eval case: +2 positive triggers, +1 owner-negative guarding the planning-and-task-breakdown boundary, +1 execution eval backed by a new multi-capability fixture (portal-brief.md) Verification: validate-skills 24/24, validate-commands 8/8, run-evals 127 checks 0 errors 0 warnings, rank-1 86% (67/78) over floor 80, behavioral dry-run resolves both spec evals.
…lity requirements (addyosmani#431) Implements the v1 scope agreed in addyosmani#431: when one requirement bundles several independently testable capabilities, spec-driven-development now runs a bounded front-step before Specify — detect multi-capability scope, propose a capability map (stable module ids, one-way dependency direction, build order), gate it on human approval, then recurse the gated workflow per module in dependency order. Kept deliberately small per the maintainer's scoping: - detection + module map + stable identity only; no per-module artifact tree — module specs reuse the root-level SPEC-<id>.md naming so the layout follows the delta-spec direction in addyosmani#383 rather than leading it - the simple path is preserved: single-capability requests skip Phase 0 entirely, and the section says so first - non-goals held: no PM framework, no forced hierarchy on small features Also: - description gains the decomposition vocabulary so realistic asks route here (both new positive triggers rank addyosmani#1) - /spec command wrappers (.claude, commands/, .gemini) gain one matching step, kept in parity - eval case: +2 positive triggers, +1 owner-negative guarding the planning-and-task-breakdown boundary, +1 execution eval backed by a new multi-capability fixture (portal-brief.md) Verification: validate-skills 24/24, validate-commands 8/8, run-evals 127 checks 0 errors 0 warnings, rank-1 86% (67/78) over floor 80, behavioral dry-run resolves both spec evals.
* docs(security): add data privacy & compliance section Adds a Data Privacy & Compliance section to security-and-hardening: PII/sensitive classification, data minimization + purpose, retention/deletion paths (incl. backups), data-subject rights (GDPR/CCPA), consent for third-party/vendor sharing, and data residency. Complements the hardening content (can an attacker read it) with the privacy question (should we hold it, and for how long). * fix(security): trim frontmatter description to clear eval routing regression The privacy trigger phrase used generic verbs (collecting, storing, retaining, deleting, sharing) that pulled the security skill's routing rank above other skills on unrelated prompts. Replacing with a tight 'personal data or privacy compliance' phrase preserves discoverability without over-triggering. * evals: make the TDD behavioral case discriminate skill effect Replace the invoice fixture with a split-payment project where the obvious remainder-dump fix passes the existing suite and the reported case but violates a README fairness invariant. Neutral eval-1 prompt (no test-first hint), pressure eval-2 now dictates the wrong one-liner under a hotfix deadline. Expectations pin the exact earliest-shares arrays so every remainder-dump variant is distinguishable, and the schema example in evals/README.md is synced to the new eval 1. * fix(evals): reject incomplete grader results * fix(hooks): emit the standard SessionStart envelope (addyosmani#465) The session-start hook emitted {"priority", "message"} JSON on all three of its output paths. Codex CLI validates SessionStart hook output and fails the hook on that shape ('hook returned invalid session start JSON output', addyosmani#465); the documented contract for both Codex and Claude Code is {"hookSpecificOutput": {"hookEventName": "SessionStart", "additionalContext": "..."}} Switch all three paths (meta-skill injection, jq-missing fallback, meta-skill-missing fallback) to that envelope. Verified each path emits valid JSON of the new shape: happy path via jq shape assertion, jq-missing via PATH='' run, meta-skill-missing via a copy outside the repo. * feat(spec): add Phase 0 scope check — capability map for multi-capability requirements (addyosmani#431) Implements the v1 scope agreed in addyosmani#431: when one requirement bundles several independently testable capabilities, spec-driven-development now runs a bounded front-step before Specify — detect multi-capability scope, propose a capability map (stable module ids, one-way dependency direction, build order), gate it on human approval, then recurse the gated workflow per module in dependency order. Kept deliberately small per the maintainer's scoping: - detection + module map + stable identity only; no per-module artifact tree — module specs reuse the root-level SPEC-<id>.md naming so the layout follows the delta-spec direction in addyosmani#383 rather than leading it - the simple path is preserved: single-capability requests skip Phase 0 entirely, and the section says so first - non-goals held: no PM framework, no forced hierarchy on small features Also: - description gains the decomposition vocabulary so realistic asks route here (both new positive triggers rank #1) - /spec command wrappers (.claude, commands/, .gemini) gain one matching step, kept in parity - eval case: +2 positive triggers, +1 owner-negative guarding the planning-and-task-breakdown boundary, +1 execution eval backed by a new multi-capability fixture (portal-brief.md) Verification: validate-skills 24/24, validate-commands 8/8, run-evals 127 checks 0 errors 0 warnings, rank-1 86% (67/78) over floor 80, behavioral dry-run resolves both spec evals. * docs(antigravity): correct plugin install path per Issue addyosmani#445 The setup doc claimed plugins install to ~/.gemini/antigravity-cli/plugins/ but on current agy releases they land in ~/.gemini/config/plugins/. Issue addyosmani#445 reporter confirmed the plugin lives under config/ on disk. Update the path and add a note so users check the right location first. Signed-off-by: Yunare Maia <yunare@gmail.com> * fix(planning): define a single pluggable task list target (addyosmani#482) The task list destination was hardcoded as tasks/todo.md in five places across planning-and-task-breakdown, plus once more in spec-driven-development's Phase 2 output convention. Projects tracking tasks in an external tracker (bd/beads, Jira, Linear, GitHub Issues) had to hand-edit every reference in a local fork. Define the target once in a Task List Target section: default remains the tasks/todo.md markdown checklist (downstream /build behavior is unchanged), and projects can designate an external tracker via their agent rules. All other references now defer to that single definition, and spec-driven-development points at it instead of restating the path. * docs(api): add idempotency-key implementation guidance Reworked from a standalone skill into an addition to api-and-interface-design, per review feedback on addyosmani#479. addyosmani#241 covers the contract surface: which methods are idempotent, accepting an Idempotency-Key header, replaying the stored result. This picks up where that stops -- what the server has to do so the guarantee actually holds: * derive the key from the intent, not the attempt, with the patterns that look right and are not (randomUUID per call, timestamps, user+amount) * claim atomically; a SELECT then an INSERT is a race, and the unique constraint is the mechanism * guard the payload, so a reused key with a different body fails loudly instead of replaying the wrong response * decide deliberately what an in-flight duplicate receives -- 409, wait, or 202 -- rather than accepting whatever falls out of the control flow * treat unknown as a third outcome distinct from failure, and record intent before calling out so a crash leaves evidence * set key retention from the longest re-delivery path, including DLQ replay Adds three rationalizations, four red flags and five verification items so the guidance is enforceable rather than advisory. Validators: validate-skills 24 skills 0 errors 0 warnings, validate-reference-links 0 errors, run-evals --min-rank1 80 -> 124 checks, 0 errors, rank-1 86%. * chore(release): bump plugin manifests to 0.6.7 * docs(specs): anchor spec paths to repository root (/specs/**) Models resolved specs/<feature>/ inconsistently — some as repo-root, others relative to the current working directory (apps/specs/...). All pipeline paths now use the leading-/ form (/specs/<feature>/SPEC.md, /specs/<feature>/tasks/{plan,todo}.md) with an explicit Path Anchoring note in spec-driven-development and planning-and-task-breakdown, and repo-root qualifiers in the /spec, /plan, and /issue-build commands. Legacy root fallbacks (SPEC.md, tasks/) and historical docs unchanged. * feat(issue-pr): apply the build label to implementation PRs issue-create labels build issues 'build' but the PRs that resolve them were unlabelled, so implementation PRs and spec PRs were inseparable in GitHub's filter view. issue-pr now ensures the label exists (gh label create build --force, same convention as issue-create) and passes --label build to gh pr create. Skill steps renumbered (label step inserted as Step 6), rationalizations/red flags/verification updated, and the behavioural eval expects the label. * feat(issue-pr): prefix implementation PR titles with [BUILD] The PR title now keeps the [BUILD] prefix from the build issue (previously stripped), so implementation PRs group with their build issues in listings and search, and are distinguishable from [SPEC] PRs. Custom titles get the prefix too. Red flags and verification checklist updated; behavioural eval expects the prefixed title. --------- Signed-off-by: Yunare Maia <yunare@gmail.com> Co-authored-by: Arun Kumar Thiagarajan <arunkt.bm14@gmail.com> Co-authored-by: Federico Bartoli <federico.bartoli@madisoft.it> Co-authored-by: NgoQuocViet2001 <ngoquocviet2001@gmail.com> Co-authored-by: ayobamiseun <adegokeayobamiseun@gmail.com> Co-authored-by: Addy Osmani <addyosmani@gmail.com> Co-authored-by: Yunare Maia <yunare@gmail.com> Co-authored-by: Abhishek Sharma <abhicse24@gmail.com>
Main gained Phase 0 capability maps (addyosmani#476) in the same places this branch adds spec evolution. Every conflict was additive: keep both. The spec commands take main's structure, with the separate save line, and the delta-spec paragraph follows it. The description is main's, plus this branch's evolution sentence (594 characters).
|
Merged @federicobartoli, all six points from your two rounds are still addressed in ce60dbc and 5971d80. @addyosmani, this is ready for the end-to-end read you mentioned in July. |
|
I've now read it end to end, and it's a yes from me. It answers #150 and #180 where people will look, and the suggestion (non-blocking): step 1 of @federicobartoli all six of your threads look addressed to me (ce60dbc, 5971d80). Could you re-review so your changes-requested clears? I'll merge once you're happy. |
From review: once a few deltas have shipped there are several SPEC-<change>.md files, and "the one this run is building" does not say which. The delta template gains a Status: line (proposed, then implemented when the change ships, which the skill already asked for without saying how), and /build auto uses the one not marked implemented, asking when more than one remains. Same wording in all three command copies.
|
Took the suggestion in 480bed1. The skill already said to "mark the delta implemented" without saying how, so the delta template now carries a @federicobartoli, the remaining changes-requested flag is from your July review; a re-review would clear it. |
addyosmani
left a comment
There was a problem hiding this comment.
praise: the Status: line is a neat way to close that gap. Thanks for carrying this since July.
@federicobartoli I've checked your six threads and all of them are addressed, so I'm merging rather than letting it sit another month. If anything still looks off, tell me and I'll follow up.
Summary
Answers two long-open user questions about what happens to a spec after V1:
/buildand/ship?/specwrites a single globalSPEC.md, which gets overwritten when you spec something else.Closes #150
What changed
skills/spec-driven-development/SKILL.mdSPEC-postgres-migration.mdnext toSPEC.md), run through the same gated workflow, and folded back into the original after shipping — the original spec always describes the current system, delta specs describe transitions (answering Recommended way to handle V2 features without polluting V1 spec? #150's second question)..claude/commands/spec.md+.gemini/commands/spec.toml(kept in parity;validate-commandspasses)SPEC.mdexists and the request is a change to what it describes, write a delta spec instead of overwriting. This fixes the overwrite pain in Support for multiple/parallel specs #180 at the workflow level.evals/cases/spec-driven-development.jsonNon-overlap check
Verification
Rebased on current main (6bcfeb9), all tiers green locally:
validate-skills.js— 24 skills, 0 errorsvalidate-commands.js— 8 commands, parity holds across Claude/Gemini twinsrun-evals.js— 126 checks passed, 0 errors; both new trigger prompts route within top-3; rank-1 rate unchanged at 85%