Tracked under ADR 0002 — Phase C. Detail: implementation plan §C1. Subsumes Issue #14.
Problem
The flat data/workflow_store.json snapshot has no versioning, no per-persona isolation, no Project/Article concept, and no way to fork sessions on edit. It is a process-global mutex-protected map that gets serialized as one blob (internal/infrastructure/repository/memory/workflow.go). Every Phase B and Phase A2/A3 feature needs durable, queryable history. Continuing on JSON forces a second migration later.
Scope
- New package
internal/infrastructure/repository/sqlite using modernc.org/sqlite (pure Go, no CGO) — preferred — or mattn/go-sqlite3 if CGO is acceptable. Decision documented in PR.
- Schema migrations under
internal/infrastructure/repository/sqlite/migrations/0001_*.sql, applied at boot via a tiny in-process migrator.
- Tables (minimum):
personas
author_sources
writing_style_guides (versioned per persona)
projects
articles
brief_sessions
brief_answers (with parent_answer_id for fork-on-edit)
drafts (versioned per article)
persona_id is NOT NULL on every guide and answer to prevent cross-persona contamination.
- Default DB path:
data/note_maker.db (gitignored).
- First-boot importer: if the JSON file exists, import it and rename to
data/workflow_store.json.imported.{timestamp}.
Acceptance criteria
Out of scope
- Multi-user / multi-tenant (still single-user local).
- Cloud sync.
- A web admin UI for the DB (CLI-only inspection is enough).
Closes
Tracked under ADR 0002 — Phase C. Detail: implementation plan §C1. Subsumes Issue #14.
Problem
The flat
data/workflow_store.jsonsnapshot has no versioning, no per-persona isolation, no Project/Article concept, and no way to fork sessions on edit. It is a process-global mutex-protected map that gets serialized as one blob (internal/infrastructure/repository/memory/workflow.go). Every Phase B and Phase A2/A3 feature needs durable, queryable history. Continuing on JSON forces a second migration later.Scope
internal/infrastructure/repository/sqliteusingmodernc.org/sqlite(pure Go, no CGO) — preferred — ormattn/go-sqlite3if CGO is acceptable. Decision documented in PR.internal/infrastructure/repository/sqlite/migrations/0001_*.sql, applied at boot via a tiny in-process migrator.personasauthor_sourceswriting_style_guides(versioned per persona)projectsarticlesbrief_sessionsbrief_answers(withparent_answer_idfor fork-on-edit)drafts(versioned per article)persona_idisNOT NULLon every guide and answer to prevent cross-persona contamination.data/note_maker.db(gitignored).data/workflow_store.json.imported.{timestamp}.Acceptance criteria
go test ./...passes against both the in-memory and SQLite implementations.brief_answers.parent_answer_id.Out of scope
Closes