Data Model: Constitution Interview Compiler and Context Bootstrap

Feature: 054 | Date: 2026-03-09

This feature extends existing constitution artifacts rather than introducing a new database-backed domain. The key design work is the shape of interview input, compiled references, and action-scoped context metadata.


Entity: InterviewAnswers

Location: .kittify/constitution/interview/answers.yaml

Purpose: Canonical maintainer input to spec-kitty constitution generate.

Core fields

FieldTypeRequiredNotes
missionstringyesExpected mission key, typically software-dev
profilestringyesInterview profile such as minimal or comprehensive
selected_paradigmslist[string]yesValidated against shipped paradigm catalog
selected_directiveslist[string]yesValidated against shipped directive catalog
available_toolslist[string]yesValidated against shipped tool catalog/runtime tool registry rules
template_setstringyesValidated against shipped template catalog with filesystem fallback
answersmap[string, string]yesInterview question responses
local_supporting_fileslist[LocalDoctrineFileDeclaration]noExplicit project-local doctrine support files declared by the maintainer

Example

mission: software-dev
profile: minimal
selected_paradigms:
  - test-first
selected_directives:
  - 003-decision-documentation-requirement
  - 010-specification-fidelity-requirement
available_tools:
  - git
  - pytest
template_set: software-dev-default
answers:
  project_type: existing-cli
  team_size: small
local_supporting_files:
  - path: docs/governance/project-planning.md
    action: plan
    target_kind: directive
    target_id: 003-decision-documentation-requirement

Validation rules

  • Shipped doctrine selections are validated against the shipped-only doctrine catalog by default.
  • _proposed/ doctrine artifacts do not participate unless a caller explicitly opts into curation-mode catalog loading.
  • local_supporting_files[*].path must be an explicit file path, not a directory or glob.
  • Local files may be declared without a target, but when target_kind + target_id identify a shipped concept, the local file is additive only and triggers a warning on conflict.

Entity: LocalDoctrineFileDeclaration

Declared in: answers.yaml Materialized in: references.yaml

Purpose: Describes one project-local doctrine support file that participates in generation/context without becoming authoritative over shipped doctrine.

FieldTypeRequiredNotes
pathstringyesExplicit project-relative or absolute file path
actionenum(specify,plan,implement,review) or nullnoNull means global; otherwise action-scoped
target_kindenum(directive,paradigm,tactic,styleguide,toolguide,procedure,template_set) or nullnoOptional doctrinal concept the file supplements
target_idstring or nullnoOptional shipped concept ID the file supplements
relationshipenum(additive)derivedAlways additive in this feature
warningstring or nullderivedPresent when the declaration overlaps a shipped concept

State rules

  • A declaration with action: null participates in all action contexts.
  • A declaration with an action participates only in that action's context retrieval.
  • If target_kind and target_id match a shipped artifact, shipped content remains primary and the declaration is surfaced with a warning.

Entity: CompiledReferences

Location: .kittify/constitution/references.yaml

Purpose: Generated manifest used by constitution context for runtime scoping and output reporting.

Proposed shape

mission: software-dev
template_set: software-dev-default
selected_paradigms:
  - test-first
selected_directives:
  - 003-decision-documentation-requirement
selected_tools:
  - git
  - pytest
references:
  - id: "DIRECTIVE:003-decision-documentation-requirement"
    kind: directive
    summary: "Record material decisions and their rationale."
  - id: "LOCAL:docs/governance/project-planning.md"
    kind: local_support
    path: docs/governance/project-planning.md
    action: plan
    target_kind: directive
    target_id: 003-decision-documentation-requirement
    relationship: additive
    warning: "Local support file overlaps shipped directive 003-decision-documentation-requirement; shipped content remains primary."

Rules

  • Shipped doctrine entries stay concise and do not copy full prose.
  • Local support files are represented explicitly so generate --json can surface them via library_files.
  • references.yaml is the runtime bridge between interview declarations and action-scoped context retrieval.

Entity: ActionIndex

Location: src/doctrine/missions/software-dev/actions/<action>/index.yaml

Purpose: Declares which shipped doctrine artifacts are eligible for a given action.

action: plan
directives:
  - 003-decision-documentation-requirement
  - 010-specification-fidelity-requirement
tactics:
  - requirements-validation-workflow
paradigms:
  - test-first
styleguides: []
toolguides:
  - efficient-local-tooling
procedures: []

Retrieval rule

For each artifact type:

eligible_ids = action_index[type] intersect project_selected_ids

Action-scoped local support files are then appended if their action matches the requested action or is null.


Entity: ContextState

Location: .kittify/constitution/context-state.json

Purpose: Tracks whether a given action has already received bootstrap-depth context.

{
  "specify": {"loaded_at": "2026-03-09T10:00:00Z"},
  "plan": {"loaded_at": "2026-03-09T10:05:00Z"}
}

State transitions

  • Missing action key -> first call defaults to depth 2 bootstrap mode.
  • Present action key -> subsequent calls default to depth 1 compact mode.
  • Explicit --depth overrides bootstrap-derived default without changing the declaration model.

Output Files Affected by This Feature

FileProduced byPurpose
.kittify/constitution/constitution.mdgenerateHuman-readable selection manifest
.kittify/constitution/references.yamlgenerateRuntime reference manifest including local support declarations
.kittify/constitution/governance.yamlsyncExisting sync output
.kittify/constitution/directives.yamlsyncExisting sync output
.kittify/constitution/metadata.yamlsyncExisting sync output
.kittify/constitution/context-state.jsoncontextBootstrap state tracking

agents.yaml remains absent. Generated library/ materialization remains removed.