Part of the "SQLite migration is half-done" parent issue. Do this last — after the build/journal sub-issues.
Background
The /design endpoints and the design list/export helpers still read the flat-file store, while orchestrator + legacy-imported designs live in SQLite section_designs.
Problem / Goal
backend/app/api/design.py calls list_designs, get_design, delete_design from app.agents.loop — all flat-file (loop.py:43, 92, 100).
- Legacy-imported designs (
legacy_import.py writes them to section_designs as section_name="FULL") and orchestrator designs are therefore invisible on GET /api/design/list and cannot be exported via /design/{id}/export.html|docx.
- The README claims SQLite covers "section designs" as the source of truth, which does not match these endpoints.
Goal: make the design read/list/export paths surface SQLite-stored designs, and correct the README so its persistence claims are accurate.
Where to look
backend/app/api/design.py:79-142 — /list, /{id}, delete, export.html, export.docx.
backend/app/agents/loop.py:43-111 — flat-file list_designs, get_design, delete_design.
backend/app/db/models.py:82 — SectionDesign (record, legacy_id, final_verdict, etc.).
backend/app/export/render.py — to_html / to_docx consume the design record dict; confirm the SQLite record is the same shape (it is — legacy_import.py copies it verbatim).
README.md — persistence section + "Files of interest".
Suggested approach
- Point
list_designs/get_design/delete_design (or new DB-backed equivalents used by api/design.py) at section_designs. A design "id" becomes the SectionDesign.id; record is the payload the renderers already expect.
- Keep the
/design/list response fields the same (summary, decisions, citations, composition, outstanding_flaws) — they're all derivable from record["iterations"][-1].
- Export endpoints just need
get_design to return the SQLite record.
- Update
README.md so the persistence claims (source of truth, journal in SQLite) are true after the whole parent lands.
Acceptance criteria
GET /api/design/list includes orchestrator-run and legacy-imported designs.
GET /api/design/{id} and the HTML/DOCX exports work for a SQLite-stored design.
- README's persistence statements match the code.
Testing
Local backend. Import a legacy design (or produce one via a run), then:
GET /api/design/list shows it.
GET /api/design/{id}/export.html returns a self-contained HTML doc.
Add a unit test that a SectionDesign.record round-trips through export_render.to_html without error.
Out of scope
- Any change to the
record JSON shape.
- Deduping the (now overlapping) legacy flat-file
/designs directory — it can remain unused on disk.
Part of the "SQLite migration is half-done" parent issue. Do this last — after the build/journal sub-issues.
Background
The
/designendpoints and the design list/export helpers still read the flat-file store, while orchestrator + legacy-imported designs live in SQLitesection_designs.Problem / Goal
backend/app/api/design.pycallslist_designs,get_design,delete_designfromapp.agents.loop— all flat-file (loop.py:43, 92, 100).legacy_import.pywrites them tosection_designsassection_name="FULL") and orchestrator designs are therefore invisible onGET /api/design/listand cannot be exported via/design/{id}/export.html|docx.Goal: make the design read/list/export paths surface SQLite-stored designs, and correct the README so its persistence claims are accurate.
Where to look
backend/app/api/design.py:79-142—/list,/{id}, delete,export.html,export.docx.backend/app/agents/loop.py:43-111— flat-filelist_designs,get_design,delete_design.backend/app/db/models.py:82—SectionDesign(record,legacy_id,final_verdict, etc.).backend/app/export/render.py—to_html/to_docxconsume the designrecorddict; confirm the SQLiterecordis the same shape (it is —legacy_import.pycopies it verbatim).README.md— persistence section + "Files of interest".Suggested approach
list_designs/get_design/delete_design(or new DB-backed equivalents used byapi/design.py) atsection_designs. A design "id" becomes theSectionDesign.id;recordis the payload the renderers already expect./design/listresponse fields the same (summary, decisions, citations, composition, outstanding_flaws) — they're all derivable fromrecord["iterations"][-1].get_designto return the SQLiterecord.README.mdso the persistence claims (source of truth, journal in SQLite) are true after the whole parent lands.Acceptance criteria
GET /api/design/listincludes orchestrator-run and legacy-imported designs.GET /api/design/{id}and the HTML/DOCX exports work for a SQLite-stored design.Testing
Local backend. Import a legacy design (or produce one via a run), then:
GET /api/design/listshows it.GET /api/design/{id}/export.htmlreturns a self-contained HTML doc.Add a unit test that a
SectionDesign.recordround-trips throughexport_render.to_htmlwithout error.Out of scope
recordJSON shape./designsdirectory — it can remain unused on disk.