Skip to content

docs: ADR-0009 remote mode — one canonical instance, thin clients over Tailscale - #4

Merged
luiscota99 merged 2 commits into
mainfrom
docs/adr-0009-remote-mode
Oct 15, 2026
Merged

luiscota99 merged 2 commits into
mainfrom
docs/adr-0009-remote-mode

Conversation

@luiscota99

@luiscota99 luiscota99 commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds docs/decisions/0009-remote-mode.md (status: proposed). Decision document only — no code changes.

The ADR proposes the Personal AI Hub deployment shape: one canonical Engram instance (engram serve) on a tailnet-only Ubuntu VM, with thin clients (Claude Code hooks + CLI on Mac and Windows/WSL, a Pipecat voice agent, and per-device nodes) talking plain HTTP+JSON over Tailscale.

It decides, with rejected alternatives for each:

  1. Transport — HTTP+JSON over the tailnet (rejects MCP Streamable HTTP as the hook transport, and SSH-tunnelled stdio). MCP-over-HTTP for Claude Code's tool surface is deferred; its real cost under MCP 2026-07-28 is rewriting the ADR-0007 elicitation gate as a multi-round-trip result.
  2. Seam — client/server split at the hook+CLI boundary with a ten-endpoint Phase 1 API (recall, guard, checkpoint, resume, search, add, route, extract, read-only inbox, health); rejects a storage-backend abstraction under the 32 DB-touching modules (ADR-0001's deferral stays deferred); considers and defers Claude Code's native http hooks to Phase 2.
  3. Identity — portable project_key (normalized git remote) + host + profile on checkpoints; recall/guard/resume profile-scoped by default; code-set origin stamp on items, converging with the portable-brains plan's provenance column.
  4. Client vs server — what only the client can see (last_assistant_message from the Stop payload with transcript tail as fallback, git state, cwd) vs what only the server should compute (search, ranking, gates, ledger, embeddings, LLM). Voice agent gets a ~1 s search budget.
  5. Offline — Phase 1 degrades to "no context" and counts every failure; client enforces sub-second budgets because hook timeouts are whole seconds; Anthropic-hosted cloud sessions are out of scope; rejects a read-only snapshot and a write queue until the ledger shows a rate that hurts.
  6. Security — engram serve on 127.0.0.1 behind tailscale serve; authorization on Tailscale-App-Capabilities grants (works for tagged nodes), identity headers for attribution; no public port, no Funnel, no app tokens in Phase 1; VM disk and Drive snapshot encrypted.
  7. Schema — one v29 migration on the server; nothing persistent stays on clients except config.

Consequences name the four house invariants: local-first (no ENGRAM_REMOTE_URL → unchanged install), measured-not-vibes (every remote call is a ledger row, numeric acceptance gate), fail-closed governance, single-owner writes. They also list where the hub spec must change (read-only Drive snapshot on clients, SSE-proxy option, 768-fixed claim) and flag that engram-mcp's 2024-11-05 declaration is untested under Claude Code's v2 MCP runtime.

Revision 2 (2026-10-13)

Folded in a review against the hub spec (rev 64) and current vendor docs: Claude Code http hooks and the Stop payload's last_assistant_message, MCP 2026-07-28 statelessness, Tailscale Serve identity/capability headers, cloud-session network limits, and the spec's asks for route/auto_extract in .mcp.json, profile-scoped recall, and an inbox poller. See the second commit for the per-section list.

Test plan

  • Format matches ADRs 0006–0008 (# ADR 0009: …, Date:, Status: proposed, Context / Decision / Consequences)
  • 265 lines (target was ~250; the extra is the Phase 2 alternatives the review surfaced)
  • All cited src/... paths exist; function names, MCP tool names and line ranges re-verified
  • No Python touched, so no Cloak run needed

🤖 Generated with Claude Code

luiscota99 and others added 2 commits October 13, 2026 18:14
…r Tailscale

Decision document only; no code. Proposes the Personal AI Hub deployment
shape: `engram serve` on a tailnet-only Ubuntu VM, thin `engram` clients
(hooks, CLI, voice agent) over plain HTTP+JSON, seam at the hook/CLI
boundary rather than a storage-backend abstraction (ADR-0001's deferral
stays deferred).

Decides transport, seam + Phase 1 endpoint set, portable project identity
(project_key + host + profile on checkpoints, code-set origin stamp on
items), client-vs-server responsibilities, Phase 1 offline behaviour
(degrade to no context, counted in the ledger), tailnet-only security
with no app tokens, and the v29 migration + what stays local on clients.
Each decision lists the alternatives rejected. Consequences name the four
house invariants: local-first, measured-not-vibes, fail-closed
governance, single-owner writes.

Context verified against the code on 2026-10-13 (file:line refs cited).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Context now records two verified platform facts: Claude Code's `http`
hook handler (POST of the event JSON, whole-second timeouts, no project
id/hostname, `last_assistant_message` on Stop) and MCP 2026-07-28's
stateless design (no sessions/initialize; elicitation becomes MRTR).

Decisions updated:
- §1 MCP-over-HTTP rationale no longer cites session negotiation; the
  real Phase 2 cost is rewriting the ADR-0007 elicitation gate as MRTR.
- §2 adds `/v1/route`, `/v1/extract`, read-only `/v1/inbox` (the spec
  wants route/auto_extract in every .mcp.json and a plugin inbox poller);
  SessionStart hook as a resume client; checkpoint returns an empty body
  (Stop additionalContext would continue the turn); considers and defers
  native `http` hooks to Phase 2 with the three blockers named.
- §3 recall/guard/resume are profile-scoped by default; hard isolation is
  a second `engram serve` on a second DB path; voice call id = session_id.
- §4 turn summary comes from `last_assistant_message`, transcript tail is
  the fallback; voice agent ~1 s search budget, Pipecat processor shape.
- §5 client enforces sub-second budgets (hook timeouts are whole
  seconds); strict guard = `onFailure: "block"`; Anthropic-hosted cloud
  sessions are out of scope and fail open.
- §6 bind 127.0.0.1 behind `tailscale serve`; authorize on
  `Tailscale-App-Capabilities` grants (works for tagged nodes), identity
  headers for attribution; VM disk + Drive snapshot encrypted.
- Context names the per-device nodes as a fourth client kind.

Consequences add: the spec must change where it disagrees (read-only
Drive snapshot, SSE-proxy option, 768-fixed claim), and `engram-mcp`'s
2024-11-05 declaration under Claude Code's v2 MCP runtime is untested.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@luiscota99
luiscota99 merged commit a01a319 into main Oct 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant