# Workflows — Codex (per FVW v8 §22 + §45 + §37.2)

**Module ID:** `oscar.workflows`
**Status:** Constitutional (per §45 + §37.2 + latent doctrine, locally ratified).

## C1 — Behaviour Inventory
- `app/src/workflows/WorkflowRunner.ts` (built-in workflows + runner)
- `app/src/workflows/WorkflowsView.tsx`
- `app/src/data/models/Workflow.ts`

## C2 — State Machine
Run: started → step-pending → step-running → step-complete | step-failed | step-skipped → all-done

## C3 — Side Effect List
- IDB writes to workflows store (DB v9)
- Run results in-memory (run history optional)

## C4 — Input Validation Contract
- Step.order unique within a workflow

## C5 — Failure Modes
- Step failure → continues to next step (skipped on required=false)

## C6 — User Simulation List
1. Open /workflows → see built-in list
2. Run "Survey a tree" → 4 steps simulated
3. Run "Write a blog" → 3 steps simulated
4. Run "Observe a site" → 4 steps simulated

## C7 — Reproducibility Test
Deterministic for built-in workflows.

## C8 — Shape Matrix
| Surface | Modes | Chips | States |
|---|---|---|---|
| Workflows list | view, run | run | running, idle |
| Workflow step | pending, running, complete | — | — |

## C9 — State Shape Inventory
### C9.1 localStorage
None
### C9.2 In-memory
- running: run_id | null
- custom: Workflow[]
### C9.3 IDB
- workflows store (DB v9)

---

## END OF WORKFLOWS CODEX

## §37.2 MULTI-DOMAIN (per plan)

ProjectType = tree | media | social | charity | home | admin (6 domains).
Each domain has 1 default workflow:
- tree → Survey a tree
- media → Photography log
- social → Social post
- charity → Fundraiser
- home → Home inventory
- admin → Admin task

3 built-in shipped in this phase (tree, writer, observer). Others added on demand.
