C.W.K.
Stream
Lesson 03 of 04 · published

The Three-Tier Connection

~11 min · three-tier, connection, tailscale, endpoint

Level 0Cold Draft
0 XP0/33 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"The brain lives at one desk. So the connection setting has to answer: where is the brain right now?"

The Brain Lives at Dad's Desk

Because Rekindle has no brain of its own, margin-Pippa and CMD+K die the moment Dad leaves the machine the cwkPippa backend runs on. That's not a bug — it's the honest consequence of 'no own brain.' The fix isn't to grow a local brain; it's a runtime Pippa connection setting that answers one question: where is the brain reachable from here? Three tiers cover the real situations.

Tier                Target                 Brain                What works
------------------  ---------------------  -------------------  --------------------
This Mac            localhost              full cwkPippa        CMD+K + margin iframe
Office (Tailscale)  office host, PIN-gated  full cwkPippa (remote) same, PIN-gated
Offline             local Ollama           persona-only fallback CMD+K + native chat

Three Tiers, One Identity

The crucial thing: the two online tiers change where the brain is, not who it is. "This Mac" points the REST+SSE client and the embed iframe at localhost. "Office" points them at the office machine over Tailscale (the private mesh VPN), gated by a remote-PIN session token so the remote brain isn't open. Same cwkPippa, same binding, same Pippa — only the endpoint moves. Switching tiers is re-pointing a client, not swapping a personality.

Endpoint Moves, Identity Doesn't

This is the clean way to make a thin client usable away from its brain: keep the brain singular and make its location a runtime setting. When Dad is at his desk, localhost; when he's traveling, the office over Tailscale with a PIN; when there's no network at all, the offline fallback (next lesson). The design lets 'no own brain' survive contact with real life — you don't compromise the single-brain rule to get remote access, you just teach the client where to knock.

Code

The connection tier re-points the endpoint, not the identity·typescript
type ConnMode = "this-mac" | "office" | "offline";

// Two ONLINE tiers just choose where the same cwkPippa brain is reached.
function endpointFor(mode: ConnMode, officeHost: string): string {
  switch (mode) {
    case "this-mac": return "http://localhost:8000";        // brain at the desk
    case "office":   return `http://${officeHost}`;         // brain over Tailscale, PIN-gated
    case "offline":  return "http://localhost:11434";       // local Ollama fallback (next lesson)
  }
}

// this-mac and office are the SAME Pippa, same bind — only the URL differs.
// The remote tier additionally carries a PIN-session token so it isn't open.

External links

Exercise

You have a tool that depends on a service running on your home machine. Design its connection tiers for: at home, traveling, and no network. For each, name the endpoint and the gate (if any). Then state the invariant all tiers must preserve — the thing that stays the same no matter where the client connects.
Hint
At home = localhost, no gate needed. Traveling = the home host over a private VPN, gated by a token/PIN. No network = a scoped local fallback. The invariant: it's the same brain/service identity throughout; only the location (and its gate) changes per tier.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.