# Triad — v0.2 Plan

**Three data layers for a personal knowledge system, mapped onto the WaterStorage framework.**

---

## The Triad

```
            ☁️  CLOUD
            (zo.pub / shared archive)
              ▲
              │ sync (push/pull, scheduled + on-event)
              │
🏠 LOCAL ─────┤
(your Zo)     │
              │ handshake / pointer
              ▼
🍪 COOKIEBLOB
(tenchimedia.com, semi-persistent scratch)
```

| Layer | Physics | Lifetime | Trust | Speed |
|---|---|---|---|---|
| **Local** (`/home/workspace/`) | Yours-only, no auth, root access | Until you delete it | Full trust | Instant |
| **Cloud** (zo.pub / equivalent) | Public, addressable, no auth | Until collection removed | Public-but-attributed | Network latency |
| **Cookieblob** (tenchimedia.com) | Browser-side, name+value pairs, httpOnly + JS-readable | Per visitor, until cleared | Visitor's | Instant (in-browser) |

Cookieblob is the **unusual** one — it's a public-cookie layer that lives on a WordPress domain. Browsers, ad networks, and the wider web have been using cookies as a state layer for 30 years. We're not inventing it; we're naming it.

---

## WaterStorage mapping

The triad IS the **streamlines phase** of the framework. Three media with three different physics, organizing how information flows between them without any one of them being in control.

| Phase state | Where in the triad |
|---|---|
| **Ocean** | Local raw signals (new files, edits, transcripts, anything that arrives) |
| **Evaporation** | Local-to-cloud sync pipeline (`zopub sync` and equivalents) |
| **Clouds** | The shared ambient knowledge — what's been published to zo.pub |
| **Rain** | A specific zo.pub URL being read by another agent |
| **Soil Surface** | The browser visiting tenchimedia.com, hitting a room, loading cookieblob |
| **Streamlines** | The triad itself — local, cloud, cookieblob as concurrent modes of the medium |
| **Creeks/Rivers** | Structured routes: search, retrieval, fetch |
| **Lakes/Reservoirs** | Domain-organized: course-foundation-v2, cascade-current, etc. |
| **Groundwater** | The deep patterns — the recurrent language, the rules, the architecture itself |
| **Return** | Outcomes from interactions closing the loop back into Local |

---

## What we're building in v0.1

### Stage 1 — The triad scaffold

Create the folder structure and the AGENTS.md that names the terrain.

### Stage 2 — A sample triad entry

One piece of data that lives across all three layers:
- A **file** in `Local/Triad/`
- A **zo.pub publish** of that file (Cloud)
- A **cookieblob room** at tenchimedia.com that points at both (Cookieblob)

### Stage 3 — A working room

A CookieBlob room (we've built these before for the Archive Tree / Tenchi games) that demonstrates the triad pattern: load a cookieblob, see what's on cloud, see what's local.

### Stage 4 — A first archive artifact

Something worth keeping across all three layers — a heartbeat, a state file, a fossil.

---

## Why this matters

The triad is the **streamlines phase of a personal knowledge system**. Without it, you have either:
- Local only → no public surface
- Cloud only → no private master
- Cookieblob only → no durable storage

The triad gives all three. The cookieblob is the visitor's seat. The cloud is the public mirror. The local is the master copy.

This is the **shape** of an open-ended personal system — anything you put in can find its home across the three media without losing coherence.

---

## Ground rules (compression of WaterStorage v1.1 for the triad)

1. Local is the master. Cloud is a public surface of local. Cookieblob is the visitor-side hand.
2. The terrain is the triad. Information lands where its physics fits.
3. Don't fight the layers. Don't try to make cookieblob durable, or cloud private, or local public.
4. Streamlines = the protocol. Not a thing, a way the three media carry each other.
5. Creeks before lakes. Most things don't need a zo.pub collection. Most cookieblob payloads are short.
6. Polluted triad (local + cloud + cookieblob drifting apart) takes time to recover.

---

## Open questions — and v0.1 answers

- **What's the protocol for sync?** One direction covered by `zopub sync` (Local → Cloud). Reverse direction (Cloud → Local) is a manual `zopub sync <coll> <localdir>` after delete. Cookieblob direction: browser export → local file → script to apply.
- **What's the cookieblob coordinate system?** Local file `triad-room-<name>.html` ↔ Cloud mirror at `zo.pub/tenchi/triad/<filename>` ↔ embedded iframe on `tenchimedia.com`. The room file is the unit; the iframe is the embed.
- **What's the visitor's first move?** Land on the room page → three cards visible (Local / Cloud / Cookieblob) → pick a phase state → note travels through Cookieblob → can be exported as JSON → local copy can ingest it.
- **What's a fossil?** A specific kind of triad entry worth keeping across all three for a long time. v0.1 candidate: the WaterStorage v1.1 framework itself.

## Stage 5 — Next pulse (open)

- A second triad entry beyond the framework (e.g., a heartbeat fossil, a Cascade ring)
- A `triad-pull.py` that re-stages cloud state into local
- A `triad-cookieblob-export.py` that reads a cookieblob export and applies it to local
- A 9-cell dashboard page at `tenchimedia.com/cookieblob-room` that shows all three layers' current state at a glance
- Verification that the room file at `zo.pub/tenchi/triad/triad-room-waterstorage.html` loads correctly in an iframe on `tenchimedia.com`

## How to inspect the v0.1 build

1. **Local:** `ls -R /home/workspace/Triad/`
2. **Cloud:** open `https://zo.pub/tenchi/triad` — 4 files: `AGENTS.md`, `PLAN.md`, `water-storage-v1.1.md`, `triad-room-waterstorage.html`
3. **Cookieblob:** open `zo.pub/tenchi/triad/triad-room-waterstorage.html` directly in a browser (the embed on tenchimedia.com is a follow-up task)

---

*Triad v0.1 — Heat Dome Day 2026-06-29*
*Stage 1 starts now.*

## v0.2 — Smoke
## v0.2 status (2026-06-29, late pulse)

- CookieBlob room upgraded to v0.2: now a full state-of-mind tracker with visitor identity, notes, atomic save/load, safe DOM construction.
- `triad-push.py` and `triad-smoke-test.py` both shipped — smoke test passes 16/16 checks.
- Manifest schema confirmed: `{collection, files: {name: sha}, history, last_pushed}`. Streamline protocol uses sha-256 (truncated to 16 chars) for diff detection.
- Cloud: https://zo.pub/tenchi/triad — 4 files live.
- All three layers reachable and verified. The cycle closes.
