# Oscar Platform — Workspace Recipe (Engine-Agnostic, per §34)

**Per FVW v8 v0.10.0 §11.1 + §34:** This recipe describes Oscar in engine-agnostic language. The implementation that satisfies this recipe is engine-specific (Sovereign SPA Mode).

---

## 1. What Oscar is

A sovereign arboriculture SPA. The app supports surveys, notes, reports, blog writing, and an AI assistant that classifies trees, drafts reports, and answers questions about UK arboriculture standards.

The assistant is powered by 1 of 5 LLM adapters (stub / smart / anthropic / openai / local). The Smart adapter (default) implements a 9-layer dispatcher — heuristic / web-search / data / history / classify / standard / how-to / off-topic / clarify — with a 4-part response format (claim + evidence + hedge + action).

## 2. The 12 modules (per §11)

| Module | Files | LOC | Purpose |
|---|---|---|---|
| assistant | 11 | 888 | 4-state dock + 9-layer Smart dispatcher + heuristics |
| brain | 7 | 520 | Rules engine + cached standards + manifest (STUB) |
| intelligence | 13 | 1100 | 5 LLM adapters + 6 standards + ArboricultureProvider |
| writing | 1 | 237 | Blog AI writing service |
| data | 11 | 880 | IDB persistence + 6 typed models + Repository pattern |
| views | 6 | 3000 | 6 views (Home, Surveys, Notes, Reports, Settings, Blog) |
| shell | varies | varies | OscarShell + TopBar + 5-chip Dock |
| ux | 6 | 600 | 6 UX components |
| export | 2 | 250 | PDF + DOCX export pipelines |
| search | 1 | 200 | Cmd+K global search (7 kinds) |
| onboarding | 1 | 120 | 5-step tour |
| settings | 1 | 122 | LLM provider config |

## 3. The 8 mandatory artefacts (§01)

| # | Artefact | Path |
|---|---|---|
| 1 | app-pact | `pact/platform/{app-pact,invariants,anti-drift,sovereignty}.md` |
| 2 | codex | `pact/codex/<module>.codex.md` (13 files) |
| 3 | fragments | `pact/fragments/oscar.*.md` (~80 files) |
| 4 | dna | `pact/dna/app.dna.json` |
| 5 | trace-atlas | `pact/trace-atlas/atlas.json` |
| 6 | overlays | `pact/overlays/*.md` |
| 7 | vp | `pact/vp/*.test.ts` (~140 invariants) |
| 8 | recipe | `pact/recipes/<module>/` (13 Recipe Books × 10 items) |

Plus `pact/extraction/` (3 baseline snapshots) and `pact/decisions/` (8 retroactive decisions).

## 4. Reconstruction procedure (engine-agnostic)

1. Read the 8 mandatory artefacts
2. Read `pact/recipes/recipe.md` (this file) for overview
3. For each module, read its `pact/recipes/<module>/recipe.md` + `codex.md` + `rules.md`
4. Read `pact/dna/app.dna.json` for identity
5. Read `pact/trace-atlas/atlas.json` for the 5-level chain
6. Implement per the declared mode (Sovereign SPA Mode per DO-001)
7. Run `pact/vp/*.test.ts` (~140 invariants)
8. Deploy per CF Pages

## 5. Implementation mode (Sovereign SPA Mode per §33.5)

| Property | Value |
|---|---|
| Framework | React 18 + TypeScript + Vite |
| UI library | None (vanilla CSS modules; **NO Mantine**) |
| State management | React hooks |
| Theme tokens | CSS custom properties |
| Persistence | IndexedDB (browser-only) + localStorage (`oscar:` prefix) |
| Container | Standalone (Cloudflare Pages) |
| FVW/FVS imports | **Zero** |

## 6. The contract

The contract is the 8 mandatory artefacts + the per-module Recipe Books + the constitution (Decisions + DNA).
The contract is **engine-agnostic**. The implementation is **engine-specific**.

A second implementation could rebuild Oscar in Svelte, SolidJS, or vanilla — by following the contract.

## 7. Reconstructability invariant test (§00)

To verify §00 compliance:
- Run `pact/scripts/verify-reconstructability.sh`
- PASS = the app is regenerable from the Recipe
- FAIL = drift detected per §08 Rule 7

