You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: preserve constitution.md during reinitialization (#1541) (#1553)
Moves constitution template from memory/ to templates/ to prevent
overwrites when spec-kit is reinitialized with a different AI agent.
Changes:
- Move memory/constitution.md to templates/constitution-template.md
- Update CLI to copy template to memory/ only on first initialization
- Update constitution command to reference correct paths with .specify/ prefix
- Preserve existing constitution.md when reinitializing project
The CLI now checks if .specify/memory/constitution.md exists:
- If it exists: preserve it (no overwrite)
- If it doesn't exist: copy from .specify/templates/constitution-template.md
This allows users to customize their constitution without losing changes
when adding support for additional AI agents or reinitializing.
Fixes#1541
Co-authored-by: jjoung1128 <jinwoong.joung@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: templates/commands/constitution.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,13 @@ You **MUST** consider the user input before proceeding (if not empty).
16
16
17
17
## Outline
18
18
19
-
You are updating the project constitution at `/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
19
+
You are updating the project constitution at `.specify/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
20
+
21
+
**Note**: If `.specify/memory/constitution.md` does not exist yet, it should have been initialized from `.specify/templates/constitution-template.md` during project setup. If it's missing, copy the template first.
20
22
21
23
Follow this execution flow:
22
24
23
-
1. Load the existing constitution template at `/memory/constitution.md`.
25
+
1. Load the existing constitution at `.specify/memory/constitution.md`.
24
26
- Identify every placeholder token of the form `[ALL_CAPS_IDENTIFIER]`.
25
27
**IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
4. Consistency propagation checklist (convert prior checklist into active validations):
44
-
- Read `/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
45
-
- Read `/templates/spec-template.md` for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints.
46
-
- Read `/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
47
-
- Read each command file in `/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
46
+
- Read `.specify/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
47
+
- Read `.specify/templates/spec-template.md` for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints.
48
+
- Read `.specify/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
49
+
- Read each command file in `.specify/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
48
50
- Read any runtime guidance docs (e.g., `README.md`, `docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed.
49
51
50
52
5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
@@ -61,7 +63,7 @@ Follow this execution flow:
61
63
- Dates ISO format YYYY-MM-DD.
62
64
- Principles are declarative, testable, and free of vague language ("should" → replace with MUST/SHOULD rationale where appropriate).
63
65
64
-
7. Write the completed constitution back to `/memory/constitution.md` (overwrite).
66
+
7. Write the completed constitution back to `.specify/memory/constitution.md` (overwrite).
65
67
66
68
8. Output a final summary to the user with:
67
69
- New version and bump rationale.
@@ -79,4 +81,4 @@ If the user supplies partial updates (e.g., only one principle revision), still
79
81
80
82
If critical info missing (e.g., ratification date truly unknown), insert `TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items.
81
83
82
-
Do not create a new template; always operate on the existing `/memory/constitution.md` file.
84
+
Do not create a new template; always operate on the existing `.specify/memory/constitution.md` file.
0 commit comments