Skip to main content

Draft Workbench

The Draft Workbench lives at web/drafts.html.

It creates approval-gated client deliverable drafts from the scoped Supabase spine:

POST /api/deliverable-drafts

Inputs include project, deliverable type, date range, evidence limit, optional title, assumptions, and an optional authoring profile key. The route gathers recent project sources and documents, contract obligations, and SOW guardrails, then creates:

  • A deliverable_drafts row.
  • deliverable_evidence citation rows.
  • A pending approvals row.

Authoring profiles turn legacy client-specific agent instructions into governed data. A profile can define the required SOW section order, standing facts, banned client-facing terms, source collection rules, canonical export targets, revision-history behavior, and known out-of-scope items. BGMP's legacy SOW agent maps to a profile such as bgmp-lead-to-cash-sow, with full-transcript source rules, client-facing language checks, the May 19 phase-start fact, and the single canonical Drive filename.

The page also shows an admin document inventory from:

GET /api/document-inventory

The inventory flags restricted SOWs/agreements that are indexed but have no extracted obligations, failed or unsupported documents, and files whose source modified time is newer than their index time.

Product memory: the Draft Workbench does not produce theater. Inventory is a working queue, not a status exhibit. Rows must offer useful actions such as selecting a source into the evidence pack, opening the stored file, reindexing stale or failed sources, and focusing SOW generation on selected contract/SOW evidence.

Drafts are never published directly. Generated SOW and readout drafts keep two bodies:

  • client_body: the copy eligible for approval and client release.
  • evidence_pack_body: internal evidence, session ledger, revision history, and source-system provenance.

Approval uses client_body as the approval body. When a SOW or readout is approved, the portal deliverables row stores the approved client body and links back to the source draft. The evidence pack stays on the lead-only draft record. A later deliverable_release approval can make the deliverable visible in the portal.

The SOW quality gate blocks client release when client-facing copy contains internal source-system language, recording/session-ledger sections, unresolved commercial terms, missing change-control language, missing client responsibilities, restricted evidence leakage, or promises that conflict with known out-of-scope guardrails.

Canonical export plans are stored in draft metadata and approval payloads. They describe the intended provider, file name, folder path, overwrite-in-place behavior, and revision-history items, but approval still does not send or overwrite external files by itself.