Guided-flow engine — status, ship checklist, backlog (ADR-0169)
Consolidated handoff after the build + live-dogfood + polish arc.
- Status: built · live-verified · gated off · ready for review/rollout
- Date: 2026-07-04
What’s built (13-commit stack on feat/…, all gated off)
Section titled “What’s built (13-commit stack on feat/…, all gated off)”| PR | Slice |
|---|---|
| #376 | Vertical persona template gallery + ADR-0167/0168 + CONTEXT glossary + moat/positioning |
| #377 | ADR-0169 engine design |
| #378 | toolsEnabled enforcement (legacy-default → inherit-all fallback) |
| #379 | Engine core — state machine + updateFlow tool |
| #380 | personas.flow column + migration 0072 + guidedFlows flag + prompt guidance |
| #381 | Activation in /api/chat + real-DB integration test |
| #382 | Completed-flow meter (audit-derived) |
| #383 | Persona flow API (self-serve config) |
| #384 | Tenant usage endpoint |
| +fixes | dogfood/polish fixes (below), the /flow-test demo page |
Runs only when guidedFlows (default false) is on AND a persona has a flow AND the turn is conversation-backed. Merging changes nothing until enabled.
What’s verified (live, on demo)
Section titled “What’s verified (live, on demo)”Drove the flow end-to-end on app-demo.puccha.ai / demo-kb: elicits (asks use-case + team size) → recommends the right package, consistently (Team ฿7,900, no drift to Growth) → full formatted reply → completes + bills once (metered=1, one flow.completed audit). Grounded in real pricing, never invents.
5 bugs the dogfood found (unit/integration tests mock tool calls, so all were invisible), all fixed
Section titled “5 bugs the dogfood found (unit/integration tests mock tool calls, so all were invisible), all fixed”toolChoice:'none'(retrieve-then-read) suppressedupdateFlow→ flow stalled at eliciting.- Haiku wouldn’t call
updateFlow→ imperative front-loaded guidance. - Haiku won’t emit a structured Draft → server-side completion (deliver a substantive reply in
drafting= flow complete). - Cross-turn package drift (Growth vs Team) → consistency anchor (recommend from collected slots + prior recommendation).
- Replies truncated on low-
maxTokensplans → floor output budget at 1200 for active flows. Plus polish: crisper turn-1 elicitation; card-like markdown rendering on the test page.
⚠️ Ship checklist (order matters)
Section titled “⚠️ Ship checklist (order matters)”- Apply migration
0072to dev ✅ / uat ⬜ / prod ⬜ — BEFORE the code deploys.resolvePersonaSELECTs theflowcolumn, so any env running the code without the column has broken chat. CI does not run migrations. - Merge #376/#377/#378 (independent) + the chain #379 → #380 → #381 → #382 → #383 → #384 in order.
- Verify chat is unchanged post-deploy (everything’s gated off).
- Enable
guidedFlowsfor a tenant (flag-version data for Business+, or a per-tenant override) + give a persona aflow(runbook SQL) → dogfood → promote. - Remove/keep the
/flow-testroute — it’s non-prod-gated (404s in prod) but is demo-only; drop it before it’s permanent.
Runbook with exact SQL: guided-flow-dev-enablement.md. Onboarding + worked example: guided-flow-onboarding-playbook.md.
Phase-2 backlog (none block a demo)
Section titled “Phase-2 backlog (none block a demo)”- Structured
Cardsystem — typeddraftfields per draftKind + native renderers (widget cards, LINE Flex). Hard part: Haiku’s unreliable structured output → likely needs draft schema + validation + retry, or a second extraction step, or Sonnet for the draft step. (Today: draft = text summary; test page renders markdown.) - Turn-1 elicitation — Haiku still prepends a greeting before asking; acceptable but could be crisper.
maxTokens-for-flows — done (floor 1200); revisit per draftKind.- Persona config UI form — thin client on the flow API (#383); needs live visual QA.
- Completed-flow add-on billing — wire
countCompletedFlows(#382/#384) intoPLAN_METAallowance/overage + the usage tile. - External-API tools (live availability/booking) — deferred
httpTool+tenant_integrations; a later ADR.
Demo environment note
Section titled “Demo environment note”app-demo.puccha.ai currently runs this unmerged branch (deployed --branch=main so login works). Demo’s nightly reset clears data, not deployed code — redeploy main to restore demo when done testing.