-- Linear task chains: a fixed, ordered sequence of native tasks with a WIP -- limit of exactly 1 -- only the task at the current position is ever -- unlocked/actionable. Completing it unlocks the next position; completing -- the last position marks the chain completed instead. CREATE TABLE task_chains ( id TEXT PRIMARY KEY, project_id TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'active', created_at DATETIME DEFAULT CURRENT_TIMESTAMP ); ALTER TABLE native_tasks ADD COLUMN chain_id TEXT DEFAULT ''; ALTER TABLE native_tasks ADD COLUMN chain_position INTEGER DEFAULT 0; ALTER TABLE native_tasks ADD COLUMN chain_unlocked BOOLEAN DEFAULT 0; CREATE INDEX IF NOT EXISTS idx_native_tasks_chain ON native_tasks(chain_id);