Skip to main content

Handbook Workflows

Overview

Handbook workflows fall into four groups:

  • Source preparation workflows parse, classify, and extract answers from source artifacts.
  • Source-context workflows turn cited uploaded-handbook evidence into durable, provenance-backed context memory.
  • Generation workflows create, review, revise, render, and promote handbook candidates.
  • Evaluation workflows run adherence, comparison, corpus-diff, and policy-review checks.
  • Lab/smoke workflows exercise a broader product path for validation and demos.

Runtime-registered workflows are loaded in packages/domain-handbook/src/loader.ts. Additional exported workflows exist for scripts/tests/direct callers.

Runtime-Registered Workflows

These workflows are currently registered by loadHandbookArtifacts() and therefore participate in generated runtime workflow routes when Handbook is enabled.

Runtime workflow keyProduct workflow IDRole
msba-generate-verified-answern/aRuns evidence-backed verified answer generation.
handbook-classify-documenthandbook.classify-document.v1Classifies document coverage, audience, level, scope, and tags.
handbook-compare-handbookshandbook.compare-handbooks.v1Compares same-scope/type handbook records.
handbook-diff-corpus-versionshandbook.diff-corpus-versions.v1Diffs corpus snapshots and tags affected handbooks.
handbook-extract-source-answershandbook.extract-source-answers.v1Extracts source answer rows and classification output.
handbook-extract-source-contexthandbook.extract-source-context.v1Synthesizes and persists source-context answers with evidence provenance.
handbook-generate-complete-handbookhandbook.generate-complete-handbook.v1Generates a candidate handbook from catalog, answers, policy evidence, and source refs.
handbook-promote-candidate-handbookhandbook.promote-candidate-handbook.v1Promotes a reviewed candidate to active.
handbook-product-flow-labhandbook.product-flow-lab.v1Runs the broad source-to-generation lab path.
handbook-prototype-candidate-chainhandbook.prototype-candidate-chain.v1Runs prototype candidate query/answer/assessment/release checks.
handbook-rag-validationn/aValidates RAG ingestion, processing evidence, and corpus query behavior.
handbook-render-documenthandbook.render-document.v1Renders document exports from section model artifacts.
handbook-review-candidatehandbook.review-candidate.v1Records warning acknowledgements and manual override approvals.
handbook-revise-candidate-sectionhandbook.revise-candidate-section.v1Creates copy-on-write section revisions.
handbook-run-policy-adherencehandbook.run-policy-adherence.v1Evaluates candidate/active handbook adherence against policy evidence.
handbook-run-policy-reviewhandbook.run-policy-review.v1Runs the deeper whole-handbook policy-review pipeline.
handbook-understand-source-documenthandbook.understand-source-document.v1Stores and parses source documents into normalized artifacts.

Use /handbook/routes.json in the active environment to see generated slugs and route availability.

Exported But Not Runtime-Registered

Exported workflowRoleCurrent exposure
handbook-ingestion-profileProfile-driven ingestion pipeline for MSBA policy and district handbook sources.Exported from package; used by scripts/tests/direct callers, not registered in loadHandbookArtifacts().
msba-pdf-to-verified-answerLegacy one-shot PDF-to-answer vertical path.Exported from package; not registered in loadHandbookArtifacts().

Functional Product Sequence

Source Preparation

WorkflowWhat it consumesWhat it produces
handbook.understand-source-document.v1source artifact refs, document kind, parsing optionsparsed document artifacts, pages, spans, quality, diagnostics
handbook.classify-document.v1parsed source artifacts and catalog contextcoverage, audience, level, school/building scope, tags
handbook.extract-source-answers.v1parsed source artifacts and question/answer extraction planprincipal/district answer-set artifacts and answer rows
handbook.extract-source-context.v1owner scope, uploaded handbook evidence, and requested source-context data pointsderived source-context artifact, answer ledger, and optional SQL projections

These workflows use the Source Artifact Store contract so later operations can reload source and derived artifacts by ref rather than by local path.

Source context is supplemental district/handbook evidence. It may fill product context or help a checklist reviewer understand uploaded wording, but it does not replace authoritative MSBA policy evidence.

Generation And Review

WorkflowWhat it does
handbook.generate-complete-handbook.v1Creates a candidate handbook instance, locks corpus snapshot refs, generates section artifacts, records lineage, warnings, and progress.
handbook.review-candidate.v1Records warning acknowledgements and manual override approvals.
handbook.revise-candidate-section.v1Writes a new section artifact and manifest entry while reusing unchanged section artifacts.
handbook.render-document.v1Produces DOCX/PDF-ready artifacts from section model and manifest data.
handbook.promote-candidate-handbook.v1Promotes a candidate to active, retires the prior active version, and supersedes sibling candidates.

Generated handbooks should be represented canonically as JSON section-model artifacts plus a section manifest. DOCX/PDF outputs are derived render artifacts.

Evaluation And Review

Workflow or runnerWhat it verifies
handbook.run-policy-adherence.v1Candidate or active handbook adherence against policy evidence.
handbook.compare-handbooks.v1Differences between same-scope/type handbook records.
handbook.diff-corpus-versions.v1Whether corpus changes affect existing handbook outputs.
handbook.run-policy-review.v1Whole-handbook review against selected MSBA policy evidence and checklist items.

Policy review is normally started through the Admin BFF job path so it can use durable job progress, retries, saved run projection, checklist results, reviewer actions, and exports.

Policy Review Sequence

The checklist pass evaluates every checklist item against the full indexed handbook. It is not limited to the current handbook segment being compared to policy.

Lab And Smoke Workflows

WorkflowPurpose
handbook.product-flow-lab.v1Operator-facing module simulator for the broad product path: source understanding, answer extraction, generation, review, promotion, export, adherence, comparison, and corpus review.
handbook.prototype-candidate-chain.v1Prototype-style candidate chain: ingest source, query candidate index, generate verified answers, assess quality, release weak candidates.
handbook-rag-validationRAG validation over PDF ingestion, processing evidence, and corpus query behavior.

These are useful for local product labs, deployed smoke tests, and demonstrations. Production-facing behavior should prefer leaf workflows and explicit job runners.

Operator Sequences

Prepare A Handbook For Review

  1. Upload or select the handbook PDF in the Admin Handbook Review Flow.
  2. Start a PDF preparation job with preparationMode: "reviewable-unit-v2".
  3. Wait for extraction, chunking, embedding, indexing, and verification to complete.
  4. Confirm the indexed handbook row appears in [HANDBOOK].[IndexedArtifactRegistry].
  5. Select the handbook and the authoritative MSBA policy set.
  6. Start policy review.

Generate A Handbook Candidate

  1. Understand the source document.
  2. Extract source answers and classification output.
  3. Generate a complete candidate handbook.
  4. Review warnings and manual override requirements.
  5. Revise individual sections when needed.
  6. Render DOCX/PDF artifacts.
  7. Promote the candidate only after review gates allow it.
  8. Run adherence, comparison, and corpus-diff checks as applicable.

Verification Ladder

LaneCommand
Domain contract and workflow testsnpm run test:handbook
Policy-review contracts and storesnpx vitest run packages/domain-handbook/tests/policy-review-run/policy-review-contracts.test.ts packages/domain-handbook/tests/policy-review-run/policy-review-run-store.test.ts
Policy-review pipeline and checklistnpx vitest run packages/domain-handbook/tests/policy-review-run/policy-review-pipeline-runner.test.ts packages/domain-handbook/tests/policy-review-run/policy-review-local-runner.test.ts
Runtime route mappingnpx vitest run tests/shared/unit/routes/domain-mapping.test.ts tests/shared/unit/routes/handbook-product-workflow-adapter-smoke.test.ts
Admin buildsnpm --prefix apps/admin-ui run build:server && npm --prefix apps/admin-ui run build:client

See docs/internal/handbook/product-workflow-testing.md for deployed smoke commands and current evidence.