---
name: "SQLite shadow write for pipeline state via sqlx"
agent: "coder-opus"
---

# Story 489: SQLite shadow write for pipeline state via sqlx

## User Story

As a developer, I want pipeline state dual-written to SQLite (via sqlx) alongside the existing filesystem directories, so we have a database layer ready for CRDT integration without changing any existing behaviour.

## Acceptance Criteria

- [ ] Add sqlx with SQLite feature as a dependency
- [ ] Migrations embedded at compile time via sqlx::migrate! macro, run on startup
- [ ] Schema uses backend-agnostic SQL (TEXT, INTEGER, no vendor-specific types) so migrations work on both SQLite and Postgres
- [ ] Every move_story_to_X and pipeline state change writes to both .huskies/work/ directories AND SQLite
- [ ] Reads still come from the filesystem (SQLite is shadow-only)
- [ ] SQLite database stored at .huskies/pipeline.db
- [ ] pipeline_items table: id, name, stage, agent, retry_count, blocked, depends_on, created_at, updated_at
- [ ] All existing pipeline operations work unchanged from the user's perspective
- [ ] agent: coder-opus

## Out of Scope

- TBD
