Data Model: Frontmatter-Only Lane Management

Feature: 007-frontmatter-only-lane Date: 2025-12-17

Entity Overview

┌─────────────────┐      ┌─────────────────┐
│    Feature      │──────│  Work Package   │
│                 │ 1:N  │      (WP)       │
└─────────────────┘      └─────────────────┘
                                 │
                                 │ has
                                 ▼
                         ┌─────────────────┐
                         │      Lane       │
                         │   (enum field)  │
                         └─────────────────┘

Entities

Feature

A development feature tracked by Spec Kitty.

AttributeTypeDescription
idstringFeature identifier (e.g., "007-frontmatter-only-lane")
branchstringGit branch name
spec_pathpathPath to spec.md
tasks_dirpathPath to tasks/ directory (flat structure)

Location: kitty-specs/{feature-id}/

Constraints:

  • Feature ID matches branch name
  • One spec.md per feature
  • One flat tasks/ directory per feature

Work Package (WP)

A unit of work within a feature.

AttributeTypeRequiredDescription
work_package_idstringYesUnique ID (e.g., "WP01")
titlestringYesHuman-readable title
laneLaneYesCurrent workflow status
phasestringNoImplementation phase
assigneestringNoAssigned developer/agent
agentstringNoAI agent identifier
shell_pidstringNoProcess ID if running
subtaskslist[string]NoTask IDs within WP
activity_logtextNoHistorical lane changes
historylist[HistoryEntry]NoStructured history (legacy)

Location: kitty-specs/{feature-id}/tasks/WP##-description.md

File Format:

---
work_package_id: "WP01"
title: "Implement core functionality"
lane: "doing"
phase: "Phase 1"
assignee: ""
activity_log: |
  - 2025-12-17T10:00:00Z – agent-001 – lane=planned – Created
  - 2025-12-17T14:30:00Z – agent-001 – lane=doing – Started implementation
---

[Markdown content with implementation details]

Constraints:

  • work_package_id must be unique within feature
  • lane must be valid Lane enum value
  • File lives in flat tasks/ directory (never in subdirectories)

Lane (Enum)

Workflow status for a work package.

ValueDescription
plannedWork defined but not started
doingWork in progress
for_reviewImplementation complete, awaiting review
doneReviewed and accepted

Valid Transitions:

planned → doing → for_review → done
                      ↓
                   doing (rework)

Source of Truth: The lane: YAML frontmatter field in the WP file.

Not Used: Directory location (deprecated with this feature).

HistoryEntry (Embedded)

Legacy structured history entry (retained for backwards compatibility).

AttributeTypeDescription
timestampISO datetimeWhen change occurred
laneLaneLane at time of entry
agentstringAgent that made change
shell_pidstringProcess ID
actionstringDescription of action

Note: New implementations should use activity_log (text format) instead.

State Transitions

Lane Update Flow

Note: As of v0.11.1+, use spec-kitty agent workflow implement/review commands. This describes the underlying mechanism.

1. User/Agent invokes: spec-kitty agent workflow implement WP## (or legacy: tasks_cli.py update)
2. System locates WP file in flat tasks/ directory
3. System validates new lane value
4. System updates lane: field in frontmatter
5. System appends activity_log entry
6. System saves file (atomic write)

Migration Flow

1. User invokes: spec-kitty upgrade
2. System scans kitty-specs/ and .worktrees/*/kitty-specs/
3. For each feature with lane subdirectories:
   a. Read all WP files from planned/, doing/, for_review/, done/
   b. Move files to flat tasks/ directory
   c. Ensure lane: frontmatter matches source directory
   d. Remove empty lane subdirectories
4. System reports migration summary

Directory Structure

Before Migration (Legacy)

kitty-specs/007-feature/tasks/
├── planned/
│   └── WP01-setup.md
├── doing/
│   └── WP02-implement.md
├── for_review/
│   └── WP03-test.md
├── done/
│   └── WP04-deploy.md
└── README.md

After Migration (New)

kitty-specs/007-feature/tasks/
├── WP01-setup.md       # lane: "planned"
├── WP02-implement.md   # lane: "doing"
├── WP03-test.md        # lane: "for_review"
├── WP04-deploy.md      # lane: "done"
└── README.md

Validation Rules

Lane Field Validation

RuleError Message
Missing lane: field"Warning: WP {id} missing lane field, defaulting to 'planned'"
Invalid lane: value"Error: Invalid lane '{value}'. Valid lanes: planned, doing, for_review, done"

Legacy Format Detection

ConditionDetection
Directory exists: tasks/planned/ with .md filesLegacy format
Directory exists: tasks/doing/ with .md filesLegacy format
Directory exists: tasks/for_review/ with .md filesLegacy format
Directory exists: tasks/done/ with .md filesLegacy format
Only flat .md files in tasks/New format

API Contracts

Update Command

Command: tasks_cli.py update <feature> <wp_id> <lane> [--note "message"] (deprecated - use spec-kitty agent workflow implement/review)

Parameters:

  • feature: Feature ID (e.g., "007-frontmatter-only-lane")
  • wp_id: Work package ID (e.g., "WP01")
  • lane: Target lane (planned|doing|for_review|done)
  • --note: Optional activity log message

Behavior: 1. Validate lane value 2. Locate WP file in tasks/ 3. Update lane: frontmatter field 4. Append activity log entry with timestamp, agent, new lane 5. Return success/failure status

Output (success):

Updated WP01 to lane 'for_review'

Output (legacy format detected):

Error: Legacy directory-based lanes detected.
Run 'spec-kitty upgrade' to migrate to frontmatter-only lanes.

Status Command

Command: tasks_cli.py status [feature]

Parameters:

  • feature: Optional. Auto-detected from worktree if omitted.

Output:

Feature: 007-frontmatter-only-lane

PLANNED (1)
  WP01  Setup project structure

DOING (2)
  WP02  Implement core functionality
  WP03  Write unit tests

FOR REVIEW (1)
  WP04  Update documentation

DONE (0)
  (none)