Skip to content

Conversation

@jin-joung
Copy link

Summary

Fixes #1541 by moving the constitution template from memory/ to templates/ to prevent overwrites when spec-kit is reinitialized with a different AI agent.

Changes

  • Move constitution template: memory/constitution.mdtemplates/constitution-template.md
  • Update CLI initialization: Added ensure_constitution_from_template() function that copies the template to memory only on first initialization
  • Update constitution command: Updated paths to use .specify/ prefix for clarity
  • Preserve existing constitution: When reinitializing, the CLI now checks if .specify/memory/constitution.md exists and preserves it

Behavior

The CLI now handles constitution initialization as follows:

  • First initialization: Copies constitution-template.md from templates to memory
  • Reinitialization: Preserves existing constitution.md in memory (no overwrite)

This allows users to customize their constitution without losing changes when adding support for additional AI agents or reinitializing the project.

Testing

  • ✅ Constitution file successfully moved from memory/ to templates/
  • ✅ Python CLI code compiles without syntax errors
  • ✅ Package creation script includes correct structure

Note: Full end-to-end testing on Linux/CI will verify the complete workflow, as there's a pre-existing macOS-specific issue with the package creation script's use of cp --parents.

AI Assistance

This PR was implemented with assistance from Claude Sonnet 4.5 (Claude Code).

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 github#1541

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constitution template should be in .specify/templates/ to prevent overwrites during reinitialization

2 participants