Agent Access relay
Agent Access is not the Evolu CRDT sync path. It is a separate/api/context relay path that must prove its own privacy boundary.
The safe contract is:
settings-agent-access-panel.js. It builds a private one-paste command:
<client> values are hermes, openclaw, claude-code, claude-desktop, cursor, cline, and codex. The gbsetup_v1_... payload is base64url JSON containing the Agent Access token, Agent Context key, gateway URL, selected client, version, and creation timestamp. Installers and logs must redact the setup payload; never print the blob after --setup.
Capabilities
| Value | Purpose | Must not be used for |
|---|---|---|
| Sync owner write key | HMAC proof that the browser controls the Sync owner | Encrypting Agent Access context or leaving the browser |
GETBASED_TOKEN | Bearer authorization for reading from the relay | AES key material or storage namespace |
GETBASED_AGENT_CONTEXT_KEY | Local AES-GCM decryption key for MCP clients | Relay authorization or server-side storage lookup |
Browser write shape
The context gateway keeps the legacy top-levelcontext string field for compatibility. The string must contain encrypted-envelope JSON, not plaintext context.
Envelope shape
Version 2 envelopes use a random raw 256-bit Agent Context key. There is no v2 salt because no token/password KDF is involved.MCP read/decrypt behavior
getbased-mcp fetches the relay with:
data.context, detects encryptedContext.version === 2, and decrypts locally with GETBASED_AGENT_CONTEXT_KEY. Wrong or missing keys must fail closed. The MCP may retain legacy plaintext/v1 decrypt compatibility only for rollout, not as the expected path.
Wearable daily-series section
Agent Access always receives the compact wearable summary when wearable context is enabled. The Settings → Agent Access panel can also sync a daily-series window: off, 7 days, 30 days, or 90 days. That preference is stored with the profile asagentAccessWearableSeriesDays and travels through encrypted Sync.
When enabled, the browser pushes a separate machine-readable section for MCP clients, shaped as wearables-series-{N}d: one metric per line, daily values oldest → newest, — for missing days, and source labels in parentheses. The hosted relay still stores only the encrypted context envelope; the MCP decrypts and exposes the section locally.
Clean-slate deployment note
If an old context gateway ever stored plaintext summaries, do not migrate those files into the owner-bound layout. Delete the legacy context store and require fresh browser pushes from updated clients. The fixed relay is intentionally fail-closed for old clients that do not send owner proof.Verification gates
Before marking Agent Access ready:- Run relay unit tests for signature validation, stale timestamp rejection, owner quota, profile limits, and token limits.
- Run browser/app tests proving the POST body contains
context: JSON.stringify({ encryptedContext }), not plaintext. - Run MCP tests proving v2 decrypt works with
GETBASED_AGENT_CONTEXT_KEYand wrong-key/token-alone decrypt fails. - Run a live relay E2E against the deployed gateway:
- insert or create a disposable owner;
- POST an encrypted sentinel;
- fetch the relay payload directly;
- prove the sentinel is absent from the serialized relay response;
- prove the envelope has
version: 2,keyDerivation: raw-256-bit-key,iv,ciphertext,keyId, and no salt; - prove
getbased-mcpdecrypts locally with the right key; - prove wrong key fails closed;
- delete/revoke the test token mapping.