# Oscar Platform — Baseline Snapshot (Phase A0)

**Extracted:** 2026-06-29 11:20 UTC
**Method:** Per FVW v8 §08 Rule 1 (Verification-before-refactor)
**Purpose:** Anti-drift baseline for future refactors
**Schema:** `freshvibe-way-v8.baseline-snapshot v1.0.0`

---

## 1. Runtime Inventory

**Source tree:** `app/`
**Total source files:** 87 (.ts + .tsx)
**Total LOC:** 8,660
**Build tool:** Vite 5
**Framework:** React 18 + TypeScript (strict)
**Persistence:** IndexedDB (6 stores) + localStorage (`oscar:` prefix)

### 1.1 Module directories (12)

| Module | File count | LOC | Primary exports |
|---|---|---|---|
| `assistant/` | 11 | 888 | AssistantDock, SheetMin, SheetFull, Bar, BackStack |
| `brain/` | 7 | ~520 | orchestrator, manifest, chunk-loader, rules/{classify-tree, check-compliance}, cached-standards, post-processor |
| `branding/` | 2 | ~80 | theme, palette |
| `data/` | 11 | ~880 | models/{Tree, Site, Survey, Note, Report, BlogPost}, persistence/{idb, repo, local-storage} |
| `export/` | 2 | ~250 | pdf, docx |
| `intelligence/` | 13 | ~1100 | ArboricultureProvider, adapters/{stub, smart, local, anthropic, openai}, standards/{BS5837, BS3998, BS8545, AIA, AMS, ARB, library, system-prompt} |
| `lib/` | varies | varies | utility code |
| `onboarding/` | 1 | ~120 | tour |
| `search/` | 1 | ~200 | cmd-k global search |
| `settings/` | varies | varies | llm-config |
| `shell/` | varies | varies | OscarShell, TopBar, Dock |
| `styles/` | varies | N/A | CSS |
| `ux/` | 6 | ~600 | EmptyState, CompletenessMeter, UndoToast, HelpTooltip, PlainLanguageLabel, StandardsLibrary |
| `views/` | 6 | ~3000 | Home, Surveys, Notes, Reports, Settings, Blog |
| `writing/` | 1 | 237 | draft (full post, outline, section, tone, auxiliary) |

### 1.2 IDB Stores (6)

| Store | Key | Indexes | Model |
|---|---|---|---|
| `trees` | id | (survey_id, species) | `Tree` (ULID, species, height_m, age_class, condition, retention_category A/B/C/U, notes, created_at, updated_at) |
| `sites` | id | (name) | `Site` |
| `surveys` | id | (site_id, status, date) | `Survey` |
| `notes` | id | (status, created_at) | `Note` |
| `reports` | id | (survey_id, status) | `Report` |
| `posts` | id | (status, slug) | `BlogPost` |

**DB_VERSION:** 2 (Phase 10 added `posts` store)
**DB name pattern:** per-store namespacing `oscar-trees`, `oscar-surveys`, etc.

### 1.3 LLM Adapters (5)

| Adapter | Provider ID | Runtime | Status |
|---|---|---|---|
| `stub` | `stub` | canned responses | shipped |
| `smart` | `smart` | rules engine + cached standards | shipped |
| `local` | `local` | Qwen 0.5B Q4_K_M (PLACEHOLDER chunks) | STUB (§15.3 ceiling) |
| `anthropic` | `anthropic` | Claude API | shipped (requires API key) |
| `openai` | `openai` | OpenAI API | shipped (requires API key) |

**Provider wrapper:** `ArboricultureProvider` (id: `oscar-arboriculture-provider`) augments prompts with system context.

### 1.4 App-VP Test Suites (6, 58 invariants)

| Suite | File | Invariants |
|---|---|---|
| Sovereignty | `pact/vp/sovereignty-checks.ts` | 8 |
| Runtime | `pact/vp/runtime-checks.ts` | 12 |
| Intelligence | `pact/vp/intelligence-checks.ts` | 11 |
| Data | `pact/vp/data-checks.ts` | 8 |
| UX | `pact/vp/ux-checks.ts` | 9 |
| Build/Deploy | `pact/vp/build-checks.ts` | 11 |
| Adversarial | `pact/vp/adversarial-probes.ts` | 8 (probes) |
| **Total** | | **67 invariants + probes** |

### 1.5 4-State Dock

States: `bar` (default) → `sheet-min` (peek) → `sheet-full` (open) → `peek` (peek-panel); rotation via `BackStack 1000/999`.

### 1.6 4 Canonical Anchor Types

`custom` (user-defined), `ai-answer` (assistant responses), `surface-context` (view-specific), `system` (system messages).

### 1.7 Standards Library (6)

`BS5837` (UK trees), `BS3998` (tree work), `BS8545` (trees + construction), `AIA` (Arboricultural Impact), `AMS` (Arboricultural Method), `ARB` (ARB code of ethics).

---

## 2. State Inventory (C9 — State Shape Inventory)

### 2.1 localStorage keys (`oscar:` prefix)

```
provider              # LLM provider selection
theme                 # light/dark theme
brain-downloaded      # brain manifest download state
tour-completed        # onboarding state
```

Per `pact/vp/data-checks.ts` DAT-1.1, DAT-1.2, DAT-1.3:
- All keys use `oscar:` prefix
- `clearAll()` removes only `oscar:*` keys

### 2.2 In-memory state (per module)

| Module | State | Purpose |
|---|---|---|
| `assistant` | BackStack, current anchor IDs, hint visibility | Back navigation, anchor rendering |
| `brain` | manifest cache, chunk state, orchestrator state | Brain download + inference |
| `data` | db connection, repo instances | IDB persistence |
| `intelligence` | active adapter, standards library | LLM dispatch |
| `views/*` | local component state (editing, modals) | View-specific UI |
| `writing` | current draft, tone, audience | Blog editor |

### 2.3 IDB state

DB_VERSION 2 across 6 stores (see 1.2).

### 2.4 Module-level state holders

| Module | Holder | Scope |
|---|---|---|
| Assistant | `context.tsx` (React context) | All views |
| App | `App.tsx` | Top-level |

---

## 3. Sovereignty Baseline

**6 sovereignty principles** (from `pact/platform/sovereignty.md`):

1. Zero `@fvs/*` imports
2. Zero `freshvibe-studio` imports
3. Zero `pact/platform/` FVS imports
4. Zero workspace selector use
5. Sovereign identity (brand, palette, domain, IDB, localStorage prefix)
6. Static verification + build-time check + CI gate

**Enforcement:**
- `pact/vp/sovereignty-checks.ts` (8 invariants)
- `pact/vp/build-checks.ts` (subset of build-time checks)
- `.github/workflows/ci.yml` (CI gate — declared in `build-checks.ts` SOV-2.4)

---

## 4. Doctrinal Gaps Captured by Baseline

The following are **declared in `pact/platform/README.md` but absent in filesystem**:

| Declared | Status |
|---|---|
| `pact/fragments/` | **EMPTY** — declared but undelivered |
| `pact/recipes/` | **EMPTY** — declared but undelivered |
| `pact/decisions/` | **EMPTY** — declared but undelivered |

These are the most damaging gaps because they claim structure the runtime does not fulfill. Closed in Phase A1.

---

## 5. Doctrine Tier Classification

Per audit-plan-v2 Section II:

| Source | Tier | Treatment |
|---|---|---|
| FVW v8 v0.10.0 doctrine (`29a8262`) | **Ratified** | Binding. Honor exactly. |
| `avidtech6/v9-fvw` empirical proposals | **Proposed (upstream-pending)** | Local ratification via DO-002/003/004. Honor where not rejected upstream. |
| Operator chat refinements (2026-06-26 to 2026-06-28) | **Scrap (unratified)** | Latent doctrine proposals. Local ratification in OSCR- before implementation. |

---

## 6. Anti-Drift Anchors

This snapshot is the **shadow** per §13. Any future refactor MUST diff against this snapshot. Detected drift is appended to `pact/extraction/drift-log.md`.

Per §08 Rules 1-7:
- Rule 1 satisfied: this snapshot exists
- Rules 2-7 to be satisfied by the alignment phases (A1, A2, B2, etc.)

---

## END OF BASELINE SNAPSHOT

*Anti-drift baseline for Oscar Platform. Frozen at 2026-06-29 11:20 UTC. Diffs against this baseline will detect drift.*
