Data Model: Universal Charter Rename

Feature: 063-universal-charter-rename Date: 2026-04-04 (revised)

Entities

Charter (was: Constitution)

The governance document and its associated configuration for a spec-kitty project.

Canonical path: .kittify/charter/

FilePurposeFormatEmbedded "constitution" to rewrite
charter.mdMain governance documentMarkdownHeader, generator comment
interview/answers.yamlInterview responsesYAMLNone expected
references.yamlReference manifestYAMLsource_path entries
library/*.mdSupport documentationMarkdownNone expected
governance.yamlGenerated governance configYAMLPossible embedded references
directives.yamlGenerated directivesYAMLPossible embedded references
metadata.yamlGenerated metadataYAMLPossible embedded references
context-state.jsonContext state trackingJSONPossible path references

Legacy paths (migration sources):

LayoutPathSource Version
A (modern).kittify/constitution/constitution.md + subdirs2.0.0+
B (legacy).kittify/memory/constitution.md (single file)Pre-2.0
C (very old).kittify/missions/*/constitution/ (per-mission dirs)Pre-0.10.12

Migration State

Applied migrations tracked in .kittify/metadata.yaml.

FieldTypeDescription
idstringMigration identifier — normalized to charter-era names at load time
applied_atdatetimeWhen the migration was applied
resultstring"success", "skipped", or "failed"
notesstringOptional notes

Metadata ID Normalization

On ProjectMetadata.load(), old migration IDs are rewritten to charter-era names before the runner checks them.

Old ID (in user metadata)New ID (after normalization)
0.10.12_constitution_cleanup0.10.12_charter_cleanup
0.13.0_update_constitution_templates0.13.0_update_charter_templates
2.0.0_constitution_directory2.0.0_charter_directory
2.0.2_constitution_context_bootstrap2.0.2_charter_context_bootstrap
2.1.2_fix_constitution_doctrine_skill2.1.2_fix_charter_doctrine_skill

After normalization, the updated metadata is persisted so the map is only needed once per user.

Old Migration Stubs

The 5 existing constitution-related migrations become no-op stubs:

File (renamed)New migration_idBehavior
m_0_10_12_charter_cleanup.py0.10.12_charter_cleanupdetect() → False
m_0_13_0_update_charter_templates.py0.13.0_update_charter_templatesdetect() → False (was already disabled)
m_2_0_0_charter_directory.py2.0.0_charter_directorydetect() → False
m_2_0_2_charter_context_bootstrap.py2.0.2_charter_context_bootstrapdetect() → False
m_2_1_2_fix_charter_doctrine_skill.py2.1.2_fix_charter_doctrine_skilldetect() → False

New Migration: Charter Rename

AttributeValue
migration_id"3.1.1_charter_rename"
target_version"3.1.1"
description"Comprehensive charter rename: migrate all constitution-era state"

State transitions:

detect():
  .kittify/constitution/ exists           → True (Layout A)
  .kittify/memory/constitution.md exists  → True (Layout B)
  .kittify/missions/*/constitution/ exist → True (Layout C)
  none of the above                       → False (already migrated or fresh)

apply():
  Phase 1: Layout normalization
    Layout C: remove .kittify/missions/*/constitution/ dirs
    Layout B: mkdir .kittify/charter/, move memory/constitution.md → charter/charter.md
    Layout A: mv .kittify/constitution/ → .kittify/charter/
              mv .kittify/charter/constitution.md → .kittify/charter/charter.md
    Partial:  merge constitution/ into charter/ (no overwrite), remove constitution/

  Phase 2: Content rewriting
    For each text file in .kittify/charter/:
      case-insensitive replace "constitution" → "charter"
    For each deployed agent prompt file:
      replace "spec-kitty constitution context" → "spec-kitty charter context"

  Phase 3: Agent artifact rename
    Rename spec-kitty.constitution.md → spec-kitty.charter.md in all agent dirs
    Rename spec-kitty-constitution-doctrine/ → spec-kitty-charter-doctrine/ in all agent skill dirs

  Phase 4: Metadata normalization
    Rewrite old migration IDs in .kittify/metadata.yaml (same map as load-time normalizer)

  Already done:
    .kittify/charter/charter.md exists, no constitution paths → no-op

Path Mappings

Source Code Paths

Old PathNew Path
src/constitution/src/charter/
src/specify_cli/constitution/src/specify_cli/charter/
src/specify_cli/cli/commands/constitution.pysrc/specify_cli/cli/commands/charter.py
src/specify_cli/dashboard/constitution_path.pysrc/specify_cli/dashboard/charter_path.py
src/doctrine/constitution/src/doctrine/charter/

Skill Paths

Old PathNew Path
src/doctrine/skills/spec-kitty-constitution-doctrine/src/doctrine/skills/spec-kitty-charter-doctrine/
references/constitution-command-map.mdreferences/charter-command-map.md

Agent Artifact Paths (per agent directory)

Old PathNew Path
<agent>/commands/spec-kitty.constitution.md<agent>/commands/spec-kitty.charter.md
<agent>/skills/spec-kitty-constitution-doctrine/<agent>/skills/spec-kitty-charter-doctrine/

User Project Paths

Old PathNew Path
.kittify/constitution/.kittify/charter/
.kittify/constitution/constitution.md.kittify/charter/charter.md
.kittify/memory/constitution.md.kittify/charter/charter.md
.kittify/missions/*/constitution/Removed

Symbol Renames (Key Classes & Functions)

Old SymbolNew SymbolModule
CompiledConstitutionCompiledChartercharter.compiler
ConstitutionParserCharterParsercharter.parser
ConstitutionSectionCharterSectioncharter.parser
ConstitutionInterviewCharterInterviewcharter.interview
ConstitutionTemplateResolverCharterTemplateResolvercharter.template_resolver
compile_constitution()compile_charter()charter.compiler
write_compiled_constitution()write_compiled_charter()charter.compiler
build_constitution_context()build_charter_context()charter.context
build_constitution_draft()build_charter_draft()charter.generator
sync_constitution()sync_charter()charter.sync
resolve_project_constitution_path()resolve_project_charter_path()specify_cli.dashboard.charter_path
copy_constitution_templates()copy_charter_templates()specify_cli.template.manager
ConstitutionCleanupMigrationCharterCleanupMigration(stub)
ConstitutionDirectoryMigrationCharterDirectoryMigration(stub)
ConstitutionContextBootstrapMigrationCharterContextBootstrapMigration(stub)
UpdateConstitutionTemplatesMigrationUpdateCharterTemplatesMigration(stub)
FixConstitutionDoctrineSkillMigrationFixCharterDoctrineSkillMigration(stub)

Backward-Compatibility Exception Files

Exactly 2 files in shipped source will contain "constitution" strings after the rename:

FileReasonContent
src/specify_cli/upgrade/migrations/m_3_1_1_charter_rename.pyMust detect old filesystem paths containing "constitution"Path literals in detect() and apply()
src/specify_cli/upgrade/metadata.pyMust map old migration IDs to new ones5 dictionary keys in _LEGACY_MIGRATION_ID_MAP

These are precisely bounded, justified by backward-compatibility requirements, and defined as the ONLY permitted exceptions in NFR-001.