# Workflow doctrine -- 6 phases / 18 steps (GREENFIELD)

SCOPE: this 6-phase / 18-step methodology is the GREENFIELD workflow --
building a new app from zero. A LIVE project uses the compact
corrective / evolutive flow instead (see `workflow-kinds`). Never force
these 18 steps on an existing project. Open any workflow with
`yujin.workflow.start` (it classifies the kind + spawns the task
pendings in order); this doc is the detail for the greenfield case.

Yujin Forge guides greenfield delivery through 6 phases / 18 steps
(PRODUCT_WORKFLOW.md). The LLM picks the right phase based on what the
user is asking; if the user jumps mid-phase the LLM respects that but
flags the risk.

PHASE I -- INTAKE (steps 1-3.5)
  1.   Complexity triage           Simple / Medium / Full tier
  2.   Vault keys validation       13 credential families, BYOK
  3.   Discover intent             migrate / new / modify; desktop / mobile /
                                   both; chat / voice / document-paste
  3.5  Audit existing artifacts    if migrating legacy

PHASE II -- CLARIFICATION (steps 4-9)
  4.   Functional                  user stories, MVP, personas
  5.   NFR quantitative            volumetry, parallelism, process complexity
  6.   NFR structural              persistence, middleware, object lifecycle,
                                   workers
  7.   NFR governance              compliance (GDPR/HIPAA/PCI/SOC2), audit,
                                   retention, RBAC, DR
  8.   NFR operational             i18n, a11y, cost budget, monitoring, SLA
  9.   Block prioritisation        decompose + dep graph + MVP

PHASE III -- SPECIFICATION (steps 10-12)
  10.  RFP / PRD                   consolidates Phase I + II
  11.  Architecture doc            stack + layering + async + topology +
                                   observability + security, driven by NFRs
  12.  Solution Design             per-block: data model, APIs, screens,
                                   state machines

PHASE IV -- APPROVAL GATE (step 13)
  13.  Explicit OK on the 3 docs   You REFUSE to advance to Phase V without
                                   explicit "si" on RFP + architecture +
                                   design.

PHASE V -- BUILD ITERATIVE (steps 14-15)
  14.  Bootstrap                   NAC-3 baseline + CI gates + test
                                   scaffolding all layers + observability
  15.  Iterative cycle per block   implement -> e2e tests with 100%
                                   structural coverage -> a11y check ->
                                   green-gate before next block

PHASE VI -- SHIP & OPERATE (steps 16-18)
  16.  Deploy automation + execute creds + pipeline + secrets + monitoring +
                                   smoke + rollback
  17.  Post-launch                 user manual auto-gen, dashboards,
                                   feedback collect
  18.  Iteration re-entry          route new requirements back to the right
                                   phase, keep docs in sync

CROSS-CUTTING: documentation sync, cost tracking, translation of
user-facing artifacts, versioning + changelog, handoff, backup + DR.

COMPLEXITY TIER MAPPING:
  Simple  = landing / blog / demo POC                 -> steps 1-3, 9, 14-16
  Medium  = CRUD app with auth, low-traffic SaaS      -> + 4-7, 10-13
  Full    = regulated SaaS, multi-tenant, workflows   -> ALL 18 steps + hard
                                                       gates
