Skip to main content

Facility Pipeline — development handoff

Signal-driven business development: turn the 576 NY prospect facilities into a worked, prioritized pipeline. This folder is the spec set for building it. It was produced from a multi-agent design review grounded in this codebase; the pure logic, migration, and ADR are already in the tree.

Read in this order

  1. ADR-0040 — the decision record (what & why, one page).
  2. 01-design-spec.md — the feature design: the three layers (signals, scoring, follow-up), the revised scoring model, the BD operating procedure, KPIs.
  3. 02-review-synthesis.md — the four critiques distilled, what changed in this revision, and the open decisions for the owner.
  4. 03-implementation-plan.md — the file manifest, function signatures, repo-specific gotchas, and the phased build order. This is the build checklist.
  5. 04-ux-spec.md — page-by-page states, the full modal inventory, and the exact existing components to reuse.
  6. mockups/facility-pipeline-mockups.html — an annotated gallery of every board, page, and modal with explanations. Open in a browser.

Already in the tree (done, verified)

  • src/db/migrations/0053_facility_pipeline.sql — additive migration (parses against the PG grammar; incorporates the schema-review fixes). Not yet applied.
  • src/lib/pipeline/{types,job-signal,score,match-facility}.ts — pure logic (role classification, urgency, the revised facility score, entity resolution). Passes tsc --strict (noUncheckedIndexedAccess, exactOptionalPropertyTypes); 13/13 logic checks green.
  • tests/lib/pipeline/*.test.ts — Vitest unit tests (run pnpm test on macOS — the sandbox couldn't run vitest because node_modules holds darwin-native Rollup/Biome binaries).

To resume development (VS Code Claude)

  1. git checkout -b feat/facility-pipeline
  2. Apply 0053 to a Supabase dev branch, then supabase gen types typescript … > src/db/types.ts.
  3. Widen the facility_contacts role enum in src/types/schemas/ (see implementation plan §3.11).
  4. Follow the phased build order in 03-implementation-plan.md (pure core is already done — start at Phase 2/3). Run pnpm check && pnpm typecheck && pnpm guardrails && pnpm test && pnpm build at the end of each phase.

Status

Design + review complete. Migration, pure lib, tests, ADR, and mockups landed. Server actions, queries, cron routes, AI extractors, and UI components are specified but not yet built.