veritas-kanban/docs/features/work-products.md
Brad Groux b502872b49
feat: add durable work product foundation
Summary:
- adds typed durable work product render contracts
- adds SQLite work_products, work_product_versions, and work_product_search storage
- adds create, list, refine, archive, restore, preview, and export APIs
- wires work products into task-scoped APIs and keyword search
- adds redacted preview/export behavior and SQLite regression coverage
- documents the work product API and SQLite schema

Verification:
- CI: Build
- CI: Lint & Type Check
- CI: Security Audit
- CI: Workspace Unit Tests
- ./node_modules/.bin/prettier --check README.md docs/SQLITE-SCHEMA.md docs/features/work-products.md shared/src/types/work-product.types.ts shared/src/types/index.ts server/src/schemas/work-product-schemas.ts server/src/storage/sqlite/migrations.ts server/src/storage/sqlite/work-product-repository.ts server/src/services/work-product-service.ts server/src/routes/work-products.ts server/src/routes/v1/index.ts server/src/routes/search.ts server/src/services/search-service.ts server/src/__tests__/storage/sqlite-work-products.test.ts
- pnpm --filter @veritas-kanban/server test -- sqlite-work-products
- pnpm typecheck
- pnpm lint:budget
- pnpm --filter @veritas-kanban/server test
- pnpm build
- pnpm audit --prod --audit-level=high
- git diff --check

Part of #403.
Part of #332.
2026-05-31 01:31:00 -05:00

2.4 KiB

Durable Work Products

Durable work products are generated outputs that should outlive a chat message or task comment: reports, handoff notes, evidence summaries, checklists, tables, and lightweight dashboards.

Model

Each work product stores:

  • typed render contract: text, markdown, summary, checklist, report, table, or dashboard
  • source provenance: task ID, run ID, agent, model, workspace, and source links
  • redaction metadata for previews and exports
  • bounded version history for refinements, regeneration, restore, and manual edits

The render contract is data-only. It does not execute arbitrary UI code.

API

curl -s -X POST http://localhost:3001/api/work-products \
  -H 'Content-Type: application/json' \
  -d '{
    "kind": "markdown",
    "title": "Release Readiness Packet",
    "taskId": "task_20260531_release",
    "sourceRunId": "run_abc123",
    "agent": "codex",
    "model": "gpt-5",
    "render": {
      "schemaVersion": 1,
      "kind": "markdown",
      "markdown": "## Summary\nReady for release after verification."
    }
  }'

Useful reads:

curl -s "http://localhost:3001/api/work-products?taskId=task_20260531_release"
curl -s "http://localhost:3001/api/tasks/task_20260531_release/work-products?view=preview"
curl -s "http://localhost:3001/api/work-products/{id}/versions"
curl -s "http://localhost:3001/api/work-products/{id}/export"

Refine an existing product without losing history:

curl -s -X PATCH http://localhost:3001/api/work-products/{id} \
  -H 'Content-Type: application/json' \
  -d '{
    "changeType": "refine",
    "changeSummary": "Add rollback notes",
    "render": {
      "schemaVersion": 1,
      "kind": "markdown",
      "markdown": "## Summary\nReady for release.\n\n## Rollback\nUse the signed rollback artifact."
    }
  }'

Restore an earlier version:

curl -s -X POST http://localhost:3001/api/work-products/{id}/versions/1/restore

Work products participate in keyword search through the work-products collection:

curl -s -X POST http://localhost:3001/api/search \
  -H 'Content-Type: application/json' \
  -d '{"query":"release readiness","collections":["work-products"],"backend":"keyword"}'

Redaction

Previews and exports default to redacted output unless a product explicitly sets redaction.exportDefault to full. Strict or sensitive products return a redacted placeholder in previews and exports.