|
| 1 | +# Spec Persistence Models |
| 2 | + |
| 3 | +Spec Kit intentionally leaves teams in control of what happens to `spec.md`, |
| 4 | +`plan.md`, and `tasks.md` after requirements change. The toolkit gives you a |
| 5 | +repeatable workflow, but it does not force one artifact maintenance strategy. |
| 6 | + |
| 7 | +This page names three common models so teams can make that choice explicit. |
| 8 | +None is the default, and none is required by Spec Kit. |
| 9 | + |
| 10 | +## Two Separate Questions |
| 11 | + |
| 12 | +Spec-driven development has a temporal question: how long should the |
| 13 | +specification matter? One |
| 14 | +[overview of SDD tooling](https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html) |
| 15 | +frames that lifecycle in three levels: |
| 16 | + |
| 17 | +- **Spec-first**: write a spec before coding, then allow it to be discarded. |
| 18 | +- **Spec-anchored**: keep the spec after implementation and use it for future |
| 19 | + changes. |
| 20 | +- **Spec-as-source**: treat the spec as the only human-edited source and |
| 21 | + regenerate implementation artifacts from it. |
| 22 | + |
| 23 | +Spec Kit also exposes a second question: what happens to the artifact set when |
| 24 | +requirements change? The models below describe that mutation strategy. |
| 25 | + |
| 26 | +## Flow-Back Spec |
| 27 | + |
| 28 | +Use flow-back when `spec.md`, `plan.md`, `tasks.md`, and the implementation are |
| 29 | +all allowed to inform each other. |
| 30 | + |
| 31 | +In this model, edits can begin in any artifact. A developer might update |
| 32 | +`tasks.md` during implementation, revise `plan.md` after a technical discovery, |
| 33 | +or adjust `spec.md` after a product clarification. The team then reconciles the |
| 34 | +artifact set manually so the final project history still makes sense. |
| 35 | + |
| 36 | +Flow-back works well when: |
| 37 | + |
| 38 | +- the team is small enough to notice and reconcile drift quickly |
| 39 | +- implementation discoveries are expected to reshape the original plan |
| 40 | +- speed matters more than preserving each intermediate decision as immutable |
| 41 | + history |
| 42 | + |
| 43 | +The main risk is silent divergence. If the team changes lower-level artifacts |
| 44 | +without reflecting the decision back into `spec.md`, future contributors may |
| 45 | +not know which artifact to trust. |
| 46 | + |
| 47 | +## Flow-Forward Spec |
| 48 | + |
| 49 | +Use flow-forward when each feature directory should remain a historical record. |
| 50 | + |
| 51 | +In this model, completed artifacts are treated as immutable. When requirements |
| 52 | +change, the team creates a new feature directory instead of mutating the |
| 53 | +existing `spec.md`, `plan.md`, or `tasks.md`. The older directory remains useful |
| 54 | +for audit, comparison, or explaining how the project reached its current state. |
| 55 | + |
| 56 | +Flow-forward works well when: |
| 57 | + |
| 58 | +- auditability and traceability matter |
| 59 | +- features are well-scoped and rarely revisited in place |
| 60 | +- the team wants a clear sequence of requirement changes over time |
| 61 | + |
| 62 | +The main tradeoff is duplication. Related decisions can be spread across |
| 63 | +multiple feature directories, so teams need naming, linking, or review habits |
| 64 | +that make the lineage easy to follow. |
| 65 | + |
| 66 | +## Living Spec |
| 67 | + |
| 68 | +Use living spec when `spec.md` is the contract and the other artifacts are |
| 69 | +derived from it. |
| 70 | + |
| 71 | +In this model, teams update `spec.md` first and then regenerate or revise |
| 72 | +`plan.md` and `tasks.md` from that source. The plan and task list are still |
| 73 | +valuable, but they are treated as disposable derivations rather than permanent |
| 74 | +sources of truth. |
| 75 | + |
| 76 | +Living spec works well when: |
| 77 | + |
| 78 | +- the product contract is stable enough to own the workflow |
| 79 | +- the team is comfortable regenerating derived artifacts after spec changes |
| 80 | +- consistency between requirements and implementation matters more than keeping |
| 81 | + every intermediate plan intact |
| 82 | + |
| 83 | +The main risk is losing useful implementation rationale if derived artifacts are |
| 84 | +discarded without preserving important decisions elsewhere. |
| 85 | + |
| 86 | +## Choosing a Model |
| 87 | + |
| 88 | +The model is a team convention, not a CLI setting. A project can even use |
| 89 | +different models in different areas, as long as contributors know which one |
| 90 | +applies. |
| 91 | + |
| 92 | +| Model | Mutation rule | Best fit | Watch out for | |
| 93 | +|---|---|---|---| |
| 94 | +| Flow-back spec | Edit any artifact, then reconcile | Fast iteration and close collaboration | Silent drift between artifacts | |
| 95 | +| Flow-forward spec | Create a new feature directory for new requirements | Audit trails and historical clarity | Duplicate or fragmented context | |
| 96 | +| Living spec | Edit `spec.md`; regenerate derived artifacts | Spec as contract | Lost rationale in regenerated files | |
| 97 | + |
| 98 | +If your team has not chosen a model yet, start by answering two questions: |
| 99 | + |
| 100 | +1. Should completed feature directories be historical records or editable work |
| 101 | + areas? |
| 102 | +2. Is `spec.md` the single source of truth, or are `plan.md` and `tasks.md` |
| 103 | + allowed to become co-equal sources? |
| 104 | + |
| 105 | +Once those answers are clear, document the convention in your project |
| 106 | +constitution or team onboarding notes so future contributors know how to handle |
| 107 | +changes. |
0 commit comments