Data Model: State Model Cleanup Foundations

Entities

StateRoot (Enum)

Classifies where a state surface lives on the filesystem.

ValueDescriptionResolved Path
PROJECTProject-local config and workflow state<repo>/.kittify/
FEATUREPer-feature spec, status, and task state<repo>/kitty-specs/<feature>/
GLOBAL_RUNTIMEUser-global runtime assets and bootstrap cache~/.kittify/ (or $SPEC_KITTY_HOME)
GLOBAL_SYNCUser-global sync, auth, queue, and tracker state~/.spec-kitty/
GIT_INTERNALState stored under .git common-dir<repo>/.git/spec-kitty/

AuthorityClass (Enum)

Classifies the ownership and trust model for a state surface.

ValueDescription
AUTHORITATIVESingle source of truth for its domain. Loss means data loss.
DERIVEDCan be regenerated from authoritative sources. Safe to delete.
COMPATIBILITYWritten for backward compatibility. Not read as authority by canonical paths.
LOCAL_RUNTIMEMachine-local operational state. Never commit.
SECRETContains credentials or tokens. Must be outside repo.
GIT_INTERNALStored under .git/, not in working tree.
DEPRECATEDKept for migration but should be removed in a future version.

GitClass (Enum)

Classifies the Git boundary for a state surface.

ValueDescription
TRACKEDPart of the intended project record. Committed to Git.
IGNOREDMatched by .gitignore. Will not appear as untracked.
INSIDE_REPO_NOT_IGNOREDIn the working tree but not ignored. Can be accidentally committed.
GIT_INTERNALUnder .git/ common-dir. Not in commits.
OUTSIDE_REPOIn user home directory. Never in project repo.

StateFormat (Enum)

Serialization format of the state surface.

ValueDescription
JSON.json files
YAML.yaml / .yml files
TOML.toml files
JSONLAppend-only JSON Lines (.jsonl)
SQLITESQLite database files (.db)
MARKDOWN.md files (with or without YAML frontmatter)
TEXTPlain text (version stamps, PID files, scope markers)
LOCKFILEFile-based locks (.lock)
DIRECTORYDirectory presence is the state
SYMLINKSymlink target is the state

StateSurface (Frozen Dataclass)

A single entry in the state contract registry.

FieldTypeDescription
namestrUnique identifier (e.g., "project_config")
path_patternstrPath template (e.g., ".kittify/config.yaml", "kitty-specs/<feature>/meta.json")
rootStateRootWhich filesystem root this surface belongs to
formatStateFormatSerialization format
authorityAuthorityClassTrust/ownership classification
git_classGitClassGit boundary classification
owner_modulestrPython module that owns writes to this surface
creation_triggerstrWhat command/action creates this surface
deprecatedboolWhether this surface is deprecated (default False)
notesstrFree-text notes (e.g., "Git boundary decision deferred")

Constraints:

  • name must be unique across all surfaces
  • Frozen (immutable after creation)
  • No side effects at construction time

StateRootInfo (Dataclass)

Doctor output: information about a resolved state root.

FieldTypeDescription
namestrRoot identifier (e.g., "project")
labelstrHuman-readable label (e.g., "Project-local state")
resolved_pathPathActual filesystem path
existsboolWhether the directory exists on disk

SurfaceCheckResult (Dataclass)

Doctor output: check result for a single state surface.

FieldTypeDescription
surfaceStateSurfaceThe surface being checked
presentboolWhether the surface exists on disk
gitignore_coveredboolWhether .gitignore covers this path (repo-local only)
warning`str \None`

StateRootsReport (Dataclass)

Doctor output: aggregate report from check_state_roots().

FieldTypeDescription
rootslist[StateRootInfo]Info for each state root
surfaceslist[SurfaceCheckResult]Check results per surface
warningslist[str]Aggregate warnings
healthybool (property)True if no warnings

Relationships

StateRoot  ←──  StateSurface.root
AuthorityClass  ←──  StateSurface.authority
GitClass  ←──  StateSurface.git_class
StateFormat  ←──  StateSurface.format

STATE_SURFACES (tuple)  ──contains──►  StateSurface (many)

check_state_roots()  ──reads──►  STATE_SURFACES
                     ──produces──►  StateRootsReport
                                   ├── StateRootInfo (per root)
                                   └── SurfaceCheckResult (per surface)

GitignoreManager  ──derives──►  get_runtime_gitignore_entries()
                               ──reads──►  STATE_SURFACES

State Transitions

None. This feature defines a static contract and read-only diagnostics. No mutable state transitions are introduced.