<!-- SOLIDIVISM · part 34 -->
..., epistemology: Epistemology }  // NEW: accessor only
│
└── Epistemology (new module, separate closure)
    ├── Registry (entity CRUD, versioning)
    ├── Ledger (append-only events)
    ├── Inquiry (sixfold queries, recursion, resumable)
    ├── Persona (contemplate, reflect, self-examine)
    ├── Graph (causal edges, trace, why, whatIf)
    └── Persistence (localStorage, server sync)
```

**Boundary rule:** Epistemology NEVER modifies 3D scene. It only observes and records. The 3D module NEVER depends on Epistemology. If Epistemology fails, 3D continues.

### Persistence Mechanism

**Write path:**
```
Event occurs → Persona.contemplate() → InquiryEngine.query() →
  Ledger.record(event) → Registry.update() → Graph.link() →
  localStorage.setItem() (debounced: max 1/sec)
```

**Read path:**
```
Solidivism.epistemology.inquire(id) → Registry.resolve(id) →
  InquiryEngine.expand(id, depth) → return tree
```

**Sync path (session end):**
```
window.addEventListener('beforeunload', () => {
  Epistemology.syncToServer();  // POST full ledger
});
```

### Migration Strategy

**Step 0: Backup**
- Copy `foundation.js` → `foundation.js.pre-epistemology-20261008`
- Copy `index.html` → `index.html.pre-epistemology-20261008`
- Verify backups with `node --check`

**Step 1: Add Epistemology Module (no 3D changes)**
- Append Epistemology closure to foundation.js (after Solidivism closure)
- Add `epistemology: Epistemology` to return object
- Add `Epistemology.init()` call in index.html after `Solidivism.init()`
- **Test:** Existing demo works identically (screenshot comparison)

**Step 2: Backfill Known Entities (offline script)**
- Run Node script to generate registry entries from investigation transfer
- Persons, agents, code versions, buildings, instructions, events, evidence
- Mark confidence levels honestly (many "medium" due to compaction)
- **Test:** `registry.resolve()` returns correct entities

**Step 3: Instrument addBuilding (backward compatible)**
- Add optional 7th parameter: `entityId`
- If provided, link mesh to existing entity; if not, create new
- Record `building.create` event
- **Test:** Existing calls (6 args) work; new calls (7 args) link correctly

**Step 4: Deploy to staging**
- Deploy to `epistles.xyz/solidivism-staging/` (new path, not live)
- Run verification tests (below)
- King tests on iPhone
- **Only then:** consider live deployment (requires explicit authorization)

### Rollback Procedure

| Phase | Rollback Action | Time | Data Loss |
|-------|----------------|------|-----------|
| Step 1 | Remove Epistemology.init() call; 3D unaffected | < 1 min | None (ledger in localStorage persists) |
| Step 2 | N/A (offline, no live change) | — | — |
| Step 3 | Revert addBuilding signature; registry entries harmless | < 5 min | None |
| Full | Restore `foundation.js.pre-epistemology-20261008` | < 5 min | Ledger entries since deploy (in localStorage, recoverable) |

**Rollback trigger:** Any verification test fails, OR King reports 3D regression, OR FPS drops >10%.

### Verification Tests

**T1: Non-regression (visual)**
- Before: screenshot live world
- After Step 1: screenshot staging world
- Pass: pixel-identical (or documented differences)

**T2: Non-regression (functional)**
- Before: walk into building, verify collision blocks
- After Step 1: same test
- Pass: identical behavior

**T3: Entity creation**
```javascript
const id = Solidivism.epistemology.registry.create("TEST", "test-entity");
const resolved = Solidivism.epistemology.registry.resolve(id);
assert(resolved.id === id && resolved.type === "TEST");
```

**T4: Event recording**
```javascript
const before = Solidivism.epistemology.ledger.count();
Solidivism.epistemology.ledger.record({ action: "test", /* minimal */ });
assert(Solidivism.epistemology.ledger.count() === before + 1);
```

**T5: Inquiry with safeguards**
```javascript
const tree = Solidivism.epistemology.inquire("solidivism:building:forge", 2);
// Verify: has who/what/why, includes confidence levels, marks unknowns as null
assert(tree.why.confidence !== undefined);
assert(tree.gaps instanceof Array);
```

**T6: Causal distinction**
```javascript
// Create test verified edge (with all required fields)
const edge = {
  from: "test:A", to: "test:B", relation: "CAUSED",
  causalType: "verified",
  testConditions: { /* ... */ },
  alternativeExplanations: [/* at least 2 */],
  limitations: [/* at least 1 */]
};
Solidivism.epistemology.graph.addEdge(edge);
// Verify: rejected if missing required fields
assert.throws(() => {
  Solidivism.epistemology.graph.addEdge({ from: "a", to: "b", causalType: "verified" });
  // Missing testConditions, alternatives, limitations
});
```

**T7: Observer separation**
```javascript
const obs = Solidivism.epistemology.observe({
  observer: "test-browser",
  instrument: "screenshot",
  environment: "test-env",
  subject: "test-building",
  result: "visible"
});
// Verify: stored as separate entities, not conflated
as