0053 · Sandbox MCP: klav-forward mcp, a sandbox's read-only view of its own grant, and secret requests from inside a sandbox, through the pinned channel and without vault keys
- Status: accepted (2026-11-29). Omar answered (a), the recommended option, to every question Q1–Q12; his answers are under "Omar's answers" below. All 10 layers are done: layers 1 (docs), 2 (
klav-coreandklav-proto), 3 (klav-server), 4 (klav-client,klavd,klav-ffi,klav-cli), 5 (the proxy's view), 6 (klav-forward mcpwithsandbox_info, theklav-sandboxsetup lines and the skill), 7 (the proxy's secret request routes, attachments and the enclave's quotas), 8 (request_secret,get_secret_requestandklav-forward secret-request wait), 9 (the card on the Mac, the iPhone and the extension), and 10 (the hand test from a Boat sandbox through Klav Cloud with the iPhone on 2026-11-30). - Date: 2026-11-29
- Read on:
mainat17164dca(2026-11-29). Line numbers below are from that commit. - Amends:
- ADR 0046 §1 ("
klav-proxyitself may not create secret requests") and its Q2, narrowly: the credential proxy may create a secret request only on behalf of one of its live sandboxes, never for itself (§3). - ADR 0046 §2: the
proxy_proposaltoggle, which the text shows "only when the account has a configured credential proxy (mode == own)", also shows for Klav Cloud's proxy (mode == klav). The code already allows it (§1, "Hosted parity"). - ADR 0036 §4 and §8 ("the policy cannot be widened from the sandbox, nor from the issuer. Only a new signature of the account changes it"): unchanged in spirit, with one new way for that signature to reach a live sandbox (§5, Q6).
- ADR 0046 §1 ("
- Builds on and does not replace: the pinned channel and the claim (ADR 0036 §5–§6), the MCP gateway's one-endpoint-per-server rule (ADR 0049 §7), the hosted proxy (ADR 0051), the Postgres listener (ADR 0052 §6), and the account-switch pattern of ADR 0041 §5.6, ADR 0049 §9 and ADR 0052.
Context
What was asked (Omar, 2026-11-29, relayed by the coordinating agent)
Agents that run inside a sandbox (Claude Code or Codex in Boat) should be able to:
- connect to Klav seamlessly, through
klav-forward, without ever holding a vault key or a provider credential; - see what this sandbox was given (profiles, local URLs, Postgres URLs, MCP servers), and nothing of the rest of the person's vault;
- ask the person for a missing secret from inside the sandbox, with ADR 0046's flow (HPKE
0x25to the account, a hidden field on the Mac or iPhone, an optional proxy grant), so the value never touches the sandbox, the LLM or the sync server; - use remote MCP servers cleanly, and pick up a credential the person just granted without starting over.
What a sandbox has today
- The forwarder holds no vault code.
klav-forward"cannot decrypt an item, open a grant or sign as an agent" (crates/klav-forward/src/lib.rs:1-6), and a test fails the build if it depends on any Klav crate butklav-core(crates/klav-forward/src/lib.rs:29-53). Its commands areup,status,env,run,downand the hiddenserve(crates/klav-forward/src/main.rs:72-170). It has no MCP server and no command that asks the person anything. - The skill tells a sandboxed agent not to talk to Klav. "Inside a sandbox (
klav-forward statusanswers), never connect or register with Klav" (skill/SKILL.md:130-135). The same skill tells a local agent to callrequest_secretwith aproxy_proposal"if a sandbox needs a missing credential" (skill/SKILL.md:99-108). So today the sandboxed agent has to stop and ask a human on another machine to run that tool for it. - The channel serves four routes and a fallback.
POST /_klav/claim,GET /_klav/status,POST /_klav/release, the Postgres upgrade, and every other path is a call to one of the sandbox's profiles (crates/klav-proxy/src/channel.rs:312-320). Who is calling is "the SHA-256 of the key the forwarder proved in the handshake, nothing it says" (crates/klav-proxy/src/channel.rs:5-7). - The sandbox already gets a partial view of itself. The claim and status answer is
Bound {sandbox_id, label, profiles, expires_at, hosts, pg}(crates/klav-proxy/src/claims.rs:190-210), filled with mode (b) hosts and Postgres listeners bywith_hosts(crates/klav-proxy/src/claims.rs:226-230). It has no profile kinds, no MCP endpoints, no rules and no local URLs. The MCP endpoints go to the issuer, in the answer toGET /_klav/sandboxes(crates/klav-proxy/src/sandboxes.rs:1196-1208), andklav sandbox startturns them into setup lines (crates/klav-cli/src/commands/sandbox.rs:115). - The forwarder relays every loopback request as bytes. It parses no HTTP and has no profile filter; the proxy answers every refusal (
crates/klav-forward/src/forward.rs:1-8). It only recognizesGET /_klav/status, to give it one of two lanes apart from the 12 call turns (MAX_RELAYED,:42;:556). It asks the proxy for its status every 5 minutes (KEEP_ALIVE,:61), and mode (b) compares the hosts in each answer with those its certificate names (:687-700). So a new/_klav/*route on the channel reaches the proxy through today's forwarder unchanged. - Mode (b) can't grow in a live sandbox. The sandbox CA's key is wiped inside
klav-corebefore any tool runs (crates/klav-forward/src/mode_b.rs:5-7; ADR 0052 §1.1: "no key remains to sign another leaf"), so the leaf's host list is fixed atup. - A browser in the sandbox can reach the channel's own routes through the forwarder's plaintext loopback port.
statusandreleaserefuse a request with a browser'sOriginorSec-Fetch-Site(from_a_page,crates/klav-proxy/src/channel.rs:835;not_forwarder_own,crates/klav-proxy/src/proxy.rs:1406). - Limits that matter here: 4 calls in flight per sandbox (
SANDBOX_IN_FLIGHT,crates/klav-proxy/src/proxy.rs:71), 16 per proxy (MAX_IN_FLIGHT,:58), 60 calls a minute per sandbox (SANDBOX_RATE_PER_MINUTE,:68), and the proxy refreshes its grant every 30 s (GRANT_REFRESH,:87). A bound connection re-checks every 5 s that its sandbox lives, and a request's head must arrive within 20 s (crates/klav-proxy/src/channel.rs:115-116); the head timeout never cuts "an answer the proxy is still working on" (:13-15).
What the profile list of a sandbox is, and who checks it
- Fixed when the sandbox starts. The proxy stores
profileswith each sandbox (Stored,crates/klav-proxy/src/sandboxes.rs:121-134) and refuses a start that names a profile the issuer or the proxy lacks (crates/klav-proxy/src/sandboxes.rs:1010-1016). The server checks the same thing once, insandbox.issued(crates/klav-server/src/routes/sandboxes.rs:327), and stores no profiles at all (crates/klav-server/migrations/sqlite/0018_sandboxes.sql:15-25). Devices read them from the signedsandbox.issuedbody intoSandboxRecord.profiles(crates/klav-client/src/audit.rs:165-178). - The proxy enforces it on every call (
crates/klav-proxy/src/proxy.rs:1597-1602). The server's per-call second barrier checks that the sandbox is live, its issuer still one, and nothing is paused (barrier, its doc atcrates/klav-server/src/routes/sandboxes.rs:249-256, called fromcrates/klav-server/src/routes/agent_access.rs:1933), but not the profile. - The sweeper ends a sandbox whose profiles are no longer all in its issuer's list (
crates/klav-proxy/src/sandboxes.rs:1523).
What ADR 0046 built, and why a sandbox can't use it
- Only non-proxy agents may ask.
createrefuses any agent whose grant has profiles, issuers or aproxyrule:403 "credential proxies cannot request secrets"(is_proxy_grant,crates/klav-server/src/routes/secret_requests.rs:215-224; the refusal at:252-258). ADR 0046 states the rule (§1, "Limits") and Q2 ("any active non-proxy agent") without giving a reason. The reasons this ADR infers, and keeps: an unattended proxy host should not be able to raise cards in its own name, and a request from "the proxy" names no caller the person can judge. - The request is sealed by the asking agent.
seal_secret_request(HPKE to the account's X25519 identity,info = tuple("klav/v1/agent/secret-request", account_id, agent_id, request_id, account_fingerprint),crates/klav-core/src/crypto/agent.rs:604-664) is called byklav_sdk::Agent::create_secret_requestwith the agent's pinned account identity (crates/klav-sdk/src/secret_requests.rs:122-155). - Caps are per agent. At most 5 pending requests per agent (
MAX_PENDING_SECRET_REQUESTS,crates/klav-core/src/secret_request.rs:57; checked atcrates/klav-server/src/routes/secret_requests.rs:314), expired on the agent's revocation (expire_on_revocation,:185-200). If the proxy could ask, every sandbox of the account would share one bucket of 5. updateneeds a project grant. The server answers404unless the target item is in one of the agent's granted projects (crates/klav-server/src/routes/secret_requests.rs:284-305). A proxy has items, never projects (ADR 0036 §2), so a proxy-madeupdatealways fails today.- The wire is strict, and devices re-parse it.
CreateSecretRequestrejects unknown fields (crates/klav-proto/src/secret_request.rs:62-79), andklav log verifyparses the signed body of everysecret_request.createdwith it (crates/klav-client/src/audit.rs:1792-1799).SecretRequestDecisionrejects unknown fields too (crates/klav-core/src/secret_request.rs:645-646). An action not in the verifier's closed table is tampering (crates/klav-client/src/audit.rs:308-323,:430-439).SecretRequestInfo, what the Requests list reads, does not reject unknown fields (crates/klav-proto/src/secret_request.rs:90-92). - The local
request_secrettool lives inklav mcp(crates/klav-cli/src/mcp.rs:1035-1110, schema at:1153-1190), which speaks MCP2024-11-05,2025-03-26and2025-06-18(crates/klav-cli/src/mcp.rs:34-36). It needsklavwith an agent key; nothing of it can run in a sandbox.
Hosted parity, checked in the code
- The person's card already grants to Klav Cloud's proxy. Fulfilling with the proxy toggle calls
prepare_proxy_grantandcommit_proxy_change(crates/klav-client/src/secret_requests.rs:638-671).prepare_proxy_grant(crates/klav-client/src/proxy_admin.rs:1266) finds the proxy throughcurrent_proxy(:1294), which acceptsmode: klavwhen the client is built withhosted-proxy(:1773-1785) and uses the attestation in place of the six words (:1508-1511).commit_proxy_change(:1695) goes throughgrant_items_at(:1735), which checks the attestation before wrapping (crates/klav-client/src/item_grants.rs:208-210) and uploads withupload_grant(:311), which checks it again ("Every grant this device signs goes through here",:425;check_hosted_wrap,:437). The CLI,klavdand the iPhone and Mac library are built withhosted-proxy(crates/klav-cli/Cargo.toml:14,crates/klav-daemon/Cargo.toml:20,crates/klav-ffi/Cargo.toml:32). No surface gates the toggle onown: the iPhone and Mac card shows it whenever the proposal has aproxy_proposal(apps/ios/Shared/App/RequestCards.swift:1222-1223), the CLI takes--grant-proxy, and the extension never grants a proxy at all (apps/extension/src/ui/secretRequests.ts:13-14,:132). ADR 0046 §2's "mode == own" is narrower than the code; this ADR aligns the text. - The enclave runs the same channel router. ADR 0051 §19 merges
crate::channel::routerwith the issuer routes per account; any route added to the channel router here is served by the hosted proxy without a new path. What the hosted proxy needs on top is an image rebuild, new PCRs in the manifest, and per-account quotas (§8).
Presets and MCP servers that exist today
- The MCP gateway's presets
maple,github,cloudflare,linearandstripeare listed as data, and every one but the ADR 0036maplegate is refused until its hand test (GATEWAY_PRESETS,crates/klav-cli/src/commands/proxy_preset.rs:137-155). There is nozenithpreset. A person adds any remote server today with--mcp-urland--tools-…rules. - A sandbox gets its MCP client entries from setup lines that run each client's own CLI (
claude mcp add,codex mcp add), never fromklav-forwardediting a config file (ADR 0036 §7, decision 6 of 2026-11-19;MAPLE_SETUP,crates/klav-cli/src/commands/sandbox.rs:103-106).
Decision
1. What runs where
sandbox (Boat) proxy (self-hosted, or Klav Cloud's enclave) klav-server
┌──────────────────────────────────────┐ ┌──────────────────────────────────────┐ ┌──────────────┐
│ Claude Code / Codex │ │ channel router (per account) │ │ secret │
│ │ stdio (MCP) │ │ GET /_klav/sandbox (view) │ signed │ requests │
│ ▼ │ pinned │ POST /_klav/secret-requests │─────────▶│ (sandbox_id, │
│ klav-forward mcp ──HTTP 127.0.0.1──▶ │ ─TLS 1.3─▶ GET /_klav/secret-requests/{id} │ agent │ per-sandbox │
│ klav-forward up │ (bytes) │ (seals 0x25 to the account, signs │ calls │ caps) │
│ │ HTTP (MCP, one entry per server) │ │ as the proxy, names the sandbox) │ └──────┬───────┘
│ ▼ │ │ /<profile>/… (as today) │ │ SSE, APNs
│ 127.0.0.1:8790/<mcp-profile>/<path> │ └──────────────────────────────────────┘ ▼
└──────────────────────────────────────┘ person's Mac / iPhone:
card, hidden field,
presence, signed decisionklav-forward mcpis a stdio MCP server in the sandbox (Q1). It holds no key and no secret. It talks plain HTTP to the running forwarder's loopback port, which relays bytes over the pinned channel as it does today; it never opens its own channel.- The proxy serves two new JSON routes on the channel (§2, §3). It answers only for the sandbox the connection's key is bound to.
- Remote MCP servers stay one entry per server (ADR 0049 §7, Q8).
klav-forward mcpexposes Klav's own sandbox tools only. It never bridges, merges or renames another server's tools. - Nothing in the sandbox can read the vault. The forwarder keeps its rule "no Klav crate but
klav-core" (crates/klav-forward/src/lib.rs:29-53); the MCP code is JSON-RPC framing and HTTP, withserde_jsonandtokio, which it already has.
2. The sandbox's view of its own grant: GET /_klav/sandbox
What it returns: the sandbox ID, the issuer's label (shown "according to the issuer", T136),
expires_at, and one entry per profile of this sandbox:Field Example Source name,kindmaple,mcp(http,mcp,pg,tunnel)ProxyProfileand itsmcp,pg,tunnel(crates/klav-proto/src/agent.rs:652-700)local_urlhttp://127.0.0.1:8790/maplethe forwarder fills it in, from its port upstream_hostapi.maple.devProxyProfile.upstreamrules(Q9)allow POST,GET; paths/mcp; tools allowquery_*, askcreate_*; SQL classesthe proxy's signed policy for that item mcp.endpoint,mcp.client_setup/mcp; theclaude mcp add …andcodex mcp add …linesMcpProfile.endpoint(crates/klav-proto/src/agent.rs:467-477); the same textklav sandbox startprintspg.databases,pg.urlapp;postgresql://[email protected]:5433/app?sslmode=disableADR 0052 §6 ( crates/klav-forward/src/pg.rs:1-11)attachedtruewith the request ID§5 pending_requestsIDs and status of this sandbox's own secret requests §3 What it never returns: an item ID, title or field name; the vault or project; another profile of the proxy; another sandbox; the issuer's identity or limits; the proxy's grant version. The proxy builds the view from its grant restricted to the sandbox's own
profiles, the same listserve_callenforces (crates/klav-proxy/src/proxy.rs:1597-1602).Searching the vault is impossible, and the view says so. A proxy holds per-item keys, only for its profiles (ADR 0036 §2). There is no search, list or reveal route on the channel, and none is added. The MCP tool's description states it: "This sandbox can use only the profiles below. It cannot search, list or read the person's vault."
Guards: the
from_a_pagerefusal (crates/klav-proxy/src/channel.rs:835), asstatusandreleasehave. It counts as activity, likestatus.Why a new route and not a bigger
status:Boundis what the forwarder parses at every claim and status (crates/klav-proxy/src/claims.rs:190-210); growing it changes a struct an older forwarder reads. The view is for the agent, the status for the forwarder.
3. Secret requests from a sandbox
3.1 Who seals, who signs, who is named (Q2)
The sandbox sends a proposal in the clear to its proxy over the pinned channel:
POST /_klav/secret-requestswith{reason, proposal}, whereproposalis ADR 0046'sSecretRequestProposal(crates/klav-core/src/secret_request.rs:495-540) withoutvault_idandproject_id(a sandbox knows none).The proxy validates, seals and signs:
- finds the sandbox from the connection's key (
claims::bound), never from the body; - checks the account switch and the issuer's opt-in (Q3), the per-sandbox caps (Q4), and
SecretRequestProposal::validate(crates/klav-core/src/secret_request.rs:543) andProxyProposal::validate(:420-490); - in
updatemode, mapsprofileto that profile's item (Q5), and refuses a profile the sandbox doesn't have with the same answer as an unknown one; - seals with
seal_secret_requestand the account identity it pinned at pairing (TOFU, ADR 0014 §1.4):agent_idin theinfotuple is the proxy's, and the sealed proposal names the sandbox (sandbox_id, layer 4 note in §9); - posts
POST /v1/agent/secret-requestssigned as itself, with a new optional fieldsandbox(§3.2).
- finds the sandbox from the connection's key (
What each party sees:
Party Sees Never sees The sandbox and its LLM its own proposal (it wrote it); the verified outcome: status,field,proxy_profile,attachedthe value; any item ID, title or project; the decision's signature bytes are checked by the proxy, not shown klav-forwardbytes on the channel; the JSON on loopback the value; any key The parent host of Klav Cloud the channel's SNI, sizes and timing (ADR 0051 §1.1) the proposal, the outcome The proxy (self-hosted, or inside the enclave) the proposal's plaintext metadata (title, field, URLs, upstream): the same class of data its grant already holds, and less than the values it injects the value the person types; nothing outside its grant klav-serverreason,mode,target_item_id(inupdateby profile, Q5),proposal_digest, the sealed blob until decided, the sandbox ID, the proxy's agent ID, and the signed decision in clear (status,field,proxy_profile,attach_sandbox), as in ADR 0046the proposal's plaintext, the value The person's device everything in the proposal, after HPKE open; the sandbox's label from the verified audit chain — The value takes ADR 0046's path, unchanged: typed into the hidden field on the person's device, written as an E2E item version by that device, optionally wrapped for the proxy as
0x23. It never reaches the sandbox, the forwarder, the LLM or the server in the clear.
3.2 Server: a proxy may ask only for a live sandbox
CreateSecretRequest.sandbox(optionalSandboxId, omitted when absent, so ADR 0046's bytes don't change). The server:- takes it only from an agent whose grant makes it a proxy, and refuses it from anyone else with
400; - still refuses a proxy that sends no
sandboxwith today's403(crates/klav-server/src/routes/secret_requests.rs:252-258): the proxy never asks for itself; - runs the sandbox
barrierunder the account lock (crates/klav-server/src/routes/sandboxes.rs:256): the proxy issued it, it is live, its issuer is still one, nothing is paused; - checks the account switch
sandbox_secret_requests(§9) and, under Q3 (a), that the sandbox's issuer hassecret_requests: truein the proxy's signed grant; - stores
sandbox_idin a new column ofsecret_requests(a new migration; existing migrations are never edited) and counts the caps of Q4 per sandbox and per proxy, not per agent.
- takes it only from an agent whose grant makes it a proxy, and refuses it from anyone else with
SecretRequestInfogains optionalsandbox_idandsandbox_label. The struct doesn't reject unknown fields (crates/klav-proto/src/secret_request.rs:90-92), so an older Requests list reads it and ignores them. The label is the one the proxy signed insandbox.issued; the device shows the one from its verified chain, not the server's copy.- A sandbox's pending requests expire when it ends. The handlers of
sandbox.revoked(proxy-signed) andsandbox.revoke_requested(account-signed) expire them and drop their blobs in the same transaction, asexpire_on_revocationdoes for an agent (crates/klav-server/src/routes/secret_requests.rs:185-200). Revoking the proxy still expires all of them, through the existing path. - The proxy reads its requests back with the existing
GET /v1/agent/secret-requests/{id}?wait=N. It answers the sandbox only wheninfo.sandbox_idis the bound sandbox; another sandbox's ID gets the same404as an unknown one. This is stateless on purpose: an enclave hand-off (ADR 0051 §4.2) or a proxy restart loses nothing a sandbox needs.
3.3 The card
- Header: "
<label>(a sandbox started by<issuer>, according to the proxy) asks for a secret", withreason"according to the agent". A sandbox request carries a distinct badge, "From a sandbox", on Mac, iPhone, the extension andklav secret-request show. - Everything else is ADR 0046 §2: kind, vault and project picker (the sandbox suggested none, so the picker starts at the person's default), the hidden field, the
setup_urlwarning, the uncheckedproxy_proposaltoggle with presence. - Profile-name collisions (Q7, T300): if the proposal's
profilealready names a profile in the proxy's grant, the card refuses to grant under that name and offers<name>-2. A re-grant under the same name "keeps the issuers on it whatever its rules become" (issuers_keeping,crates/klav-client/src/proxy_admin.rs:561-566), so without this a sandbox could re-point every sandbox'sgithubprofile at another upstream with the person's next value. - Two quick actions on the card: "Stop this sandbox" (the existing person revocation, ADR 0036 E2.3, no presence) and "Don't let
<issuer>'s sandboxes ask again" (re-signs the issuer's opt-in off, presence).
3.4 The answer to the sandbox
- The proxy verifies the decision with
verify_secret_request_infoand its pinned account identity (crates/klav-sdk/src/secret_requests.rs:203-216), and passes the expected digest when it still has it. After a restart it has only the server'sproposal_digest; the signature still bindsrequest_id, the proxy'sagent_id, the digest and the decision bytes (ADR 0046 §3), so a malicious server can't forge or swap an outcome. - The sandbox gets only:
{status: "fulfilled" | "denied" | "expired" | "pending", field?, proxy_profile?, attached, next}.in_grantis alwaysfalsefor a proxy (it has no projects), soitem_id,vault_idandproject_idare never in the decision (ADR 0046 §3, T236), and the sandbox learns no reference.
4. klav-forward mcp and the agent's tools (Q1)
Registration.
klav sandbox startadds two setup lines, likeMAPLE_SETUP, when the proxy says it serves the view (a new field in the issuer'sGET /_klav/sandboxesanswer, which an olderklavignores, as it ignoresmcptoday,crates/klav-proxy/src/sandboxes.rs:1196-1208). The lines don't depend on the account switch;request_secretanswers "turned off for this account" while it is off:claude mcp add --scope user klav-sandbox -- klav-forward mcpandcodex mcp add klav-sandbox -- klav-forward mcp, each guarded bycommand -v. The exact syntax is checked at layer 6 (§13).Tools:
Tool What it does Route sandbox_infothe view of §2 GET /_klav/sandboxrequest_secretADR 0046's arguments minus projectandref, plusprofileforupdate(Q5); long-polls up towait_seconds(default 60, max 600) by repeating short waitsPOST /_klav/secret-requests, thenGET …/{id}?wait=25get_secret_requestone of this sandbox's requests GET /_klav/secret-requests/{id}?wait=NWhile pending, it answers like ADR 0046 §4, with
wait_command: "klav-forward secret-request wait <id> --timeout 10m --json", a new subcommand with the same exit codes (0fulfilled,4pending,5denied,6expired,7paused). The skill's sandbox section changes from "never connect to Klav" to "use theklav-sandboxtools; neverklav".Protocol versions:
2025-06-18and2025-11-25, as the gateway (ADR 0049 §13, choice 2). Stdio frames are one JSON object per line, capped likeklav mcp's.Waits don't take a call slot (Q10). The proxy serves the channel's
/_klav/*routes outsideSANDBOX_IN_FLIGHT, with their own cap of one waiting request per sandbox, and each wait at most 25 s. A sandbox that polls its requests can never starve its own profile calls. In the forwarder, a wait takes one of the 12 call turns (crates/klav-forward/src/forward.rs:42) for at most 25 s.
5. A newly granted profile and a live sandbox (Q6, Q12)
- Today the answer is "start a new sandbox". A sandbox's profiles are fixed at issue in four places (proxy store,
sandbox.issuedbody, devices'SandboxRecord, the issuer's list the sweeper checks; see Context). A fulfilledproxy_proposaladds the profile to the proxy's grant only, so the asking sandbox can't use it, and the issuer can't give it to the next one either until the person adds it to the issuer (klav proxy issuer add), withinMAX_ISSUER_PROFILES= 6 (crates/klav-proto/src/agent.rs:288). - What a sandbox can propose is a base-URL profile only.
proxy_spec_from_proposalsetsmcp,tunnelandpgtoNone(crates/klav-client/src/secret_requests.rs:190-205), and Q7 (a) refuses a name that already exists. So everything below concerns a new mode (a) header-injection profile (an API base URL athttp://127.0.0.1:<port>/<profile>/…). - The person may attach that profile to the asking sandbox, in the same card (Q6 (a)). Under the proxy toggle, a second toggle, unchecked by default: "Also let
<label>use it now, until that sandbox ends". It is covered by the presence the proxy toggle already asks.- Signed by the person, in the decision.
SecretRequestDecisiongains optionalattach_sandbox: SandboxId, allowed only withproxy_profileand only equal to the request'ssandbox_id. It is insidedecision_bytes, so the existing signature covers it; no new label, no new audit action. It is a new field of a strict struct, so it sits behind the account switch (§9). - Applied by the proxy once two things are true: its grant (refreshed every 30 s) has the profile, and it verified the decision. It records
(profile, request_id)in the sandbox's store entry, apart from the issuedprofiles. The sweeper's issuer check (crates/klav-proxy/src/sandboxes.rs:1523) keeps judging the issued profiles only; an attached profile lives while the sandbox lives and the profile is in the proxy's grant.serve_call's per-sandbox check (crates/klav-proxy/src/proxy.rs:1597-1602) accepts issued or attached profiles. - Seen by devices.
klav log verifylinks the decision to itssecret_request.created(which names the sandbox) and adds the profile to thatSandboxRecord, so "Active sandboxes" shows it marked "added by you for this sandbox". - Reaches the tools at once. The forwarder relays
/<profile>/…as bytes and filters nothing (Context), so the next call to the new profile goes through.sandbox_infolists it with its local URL.
- Signed by the person, in the decision.
- What still needs a new sandbox, said plainly:
- a new MCP, Postgres or tunnel profile (a sandbox can't propose one, Q12);
- any profile the person grants outside the card (
klav proxy grant, thenklav proxy issuer add): only the next sandbox gets it; - a new mode (b) host, in any case: the CA key is gone (Context).
request_secret's answer andsandbox_infosay which case applies, with thenext"ask whoever starts your sandboxes for a new one".
- Never automatic. The proxy doesn't attach on its own, and the issuer can't attach. Q6 (c) is listed only to reject it.
6. Remote MCP servers in a sandbox (Q8)
- One entry per server, as ADR 0049 §7 decided. Each MCP profile is its own Streamable HTTP entry,
http://127.0.0.1:<port>/<profile><endpoint>, written at setup by the client's own CLI.klav-forward mcpis a separate, small server with Klav's sandbox tools. sandbox_inforepeats each MCP profile's client lines, the sameclaude mcp add …andcodex mcp add …thatklav sandbox startprinted, for a client installed after setup or an entry someone removed. No secret is in them: the URL is loopback, and the bearer isklav-placeholder, which the proxy drops (ADR 0036 §7, note of 2026-11-19). An MCP profile can't arrive in a live sandbox in this ADR (§5); if Q12 (b) is chosen, whether each client loads a server added mid-session must be checked first (§13).- What this rejects, and why:
- A stdio-to-HTTP bridge that merges every granted server into
klav-forward mcp. That is the aggregator ADR 0049 §7 turned down (sessions, cursors,list_changed, renamed tools), and it would put a stateful MCP client and server in the sandbox, where a prompt-injected agent sits next to it. klav-forwardediting~/.claude.jsonor~/.codex/config.toml. ADR 0036 decision 6 of 2026-11-19 keeps config editing out of the forwarder, and it would addtoml_editandjsonc-parserto it.- A Streamable HTTP MCP server inside
klav-proxy(Q1 (b)). It would grow the enclave's trusted code with an MCP server for three tools that plain JSON routes serve.
- A stdio-to-HTTP bridge that merges every granted server into
7. Rate limits, pause and revocation
- Caps (Q4 (a)): at most 2 pending requests per sandbox and 10 per proxy, at most 6 created per sandbox per hour, and a request whose
proposal_digestequals a pending one of the same sandbox returns that one instead of a new card. The proxy checks first; the server checks again under the account lock. - Pause: a paused account or issuer gets
423 klav_agents_pausedon create, from the proxy (its last grant refresh) and from the server (barrier). Waiting continues to answer; a fulfilled request still reports its outcome. - Sandbox ends (TTL,
stop, theft signal, release, inactivity, issuer removed, person revoke): the server expires its pending requests (§3.2). A card already open shows "This sandbox has ended": the person can still save the item, and the attach toggle is gone. - Polling counts as activity, as
statusalready does (crates/klav-proxy/src/channel.rs:846-864): an agent waiting on a request keeps its sandbox from the one-hour inactivity end, never past its TTL.
8. Klav Cloud's hosted proxy
- Same code, same routes. The two channel routes and the store field land in
klav-proxy; the enclave serves them on each account's channel router (ADR 0051 §19). The proxy callsapi.klav.devthrough the parent's existing egress for signed agent calls (ADR 0051 §1). - New per-account quotas in the enclave (ADR 0051 §3.3): 10 pending secret requests (the proxy cap above), 1 waiting control request per sandbox, and the view and request routes inside the account's existing requests-per-minute.
- Image and manifest: a new image, its PCRs listed in the signed manifest before devices wrap anything for it. An older enclave answers the new routes from the fallback, as an unknown profile
_klav(crates/klav-proxy/src/proxy.rs:1592-1596; checked at layer 5:403 klav_not_allowed, "no profile with that name"), whichklav-forward mcpturns into "the proxy is older than this forwarder". - The parent sees none of it. The proposal and the outcome travel inside the channel's TLS, which ends in the enclave (T276). Layer 7's end-to-end test taps the parent's relay, as ADR 0051 §19's test does, and checks that no title, URL, reason or profile name appears in it.
9. Safe with older clients, proxies, forwarders and servers
The server deploys when merged, so layers 2–3 get a "safe with older clients" review before merge.
- The account switch
sandbox_secret_requestsguards every new byte that an older device would reject:CreateSecretRequest.sandbox(re-parsed byklav log verify,crates/klav-client/src/audit.rs:1792-1799) andSecretRequestDecision.attach_sandbox(deny_unknown_fields). Off: the server refuses both with400 sandbox_secret_requests_off, and every existing answer stays byte-identical. On: one person-only request, after the "update every device first" check of ADR 0049's amendment of 2026-11-27 (may_hold_older_than_mcp_gateway's rule, reused)./v1/agent/meadvertises it, omitted while off. - The issuer opt-in (Q3 (a)) is a new field in
SandboxIssuer(crates/klav-proto/src/agent.rs:292-307), which rejects unknown fields: a grant with it isv: 6, refused by older proxies and servers, and signed only with--every-device-is-updated, asv: 2tov: 5were.
| Server | Proxy | Forwarder | Devices | What happens |
|---|---|---|---|---|
| older | any | new | any | sandbox_info works from the proxy's view if the proxy is new; request_secret gets 403 from the server and says secret requests from sandboxes need a newer Klav server |
| new, switch off | new | new | any | sandbox_info works; request_secret answers "turned off for this account" with the person's step |
| new, switch on | older | new | new | /_klav/sandbox falls to the profile fallback (403); klav-forward mcp says the proxy must be updated |
| new, switch on | new | older | new | Doesn't arise from Klav's own lines: they already need a klav-forward as new as klav, and an older one stops the setup script with a usage error before up, with the package unspent (skill/SKILL.md:120-123). A forwarder installed by hand without mcp makes the client report klav-sandbox as failed; nothing else changes |
| new, switch on | new | new | an older one left | That device fails klav log verify on the first sandbox request, as the sheet warned |
| new, switch on | new | new | new | Sandbox MCP |
Note (layer 3, 2026-11-29): how the log names the sandbox. The server never keeps the signed body of secret_request.created (ADR 0046 §1, so proposal_blob never enters the log), so klav log verify never re-parses CreateSecretRequest.sandbox, contrary to the first bullet above. The server instead writes the sandbox on the event as sandbox_id, attested by the server, as it writes the list of an all revocation. The proxy's signature covers the body digest (with sandbox), but a device can't recompute it. Every released verifier refuses a secret_request.created naming a sandbox ("names a sandbox nobody signed"), so the row "an older one left" holds as written. Layer 4 decides what the verifier accepts. Open for Omar: nothing the person's device can check binds a request to its sandbox, so a malicious server could show a card naming another sandbox of the same proxy, and an attach_sandbox signed on that card would follow it; the proxy still verifies the decision against the request it sent (T306).
Note (layer 4, 2026-11-29): the proposal names its sandbox. Layer 4 closes the open point above, on the coordinating agent's brief, for Omar to confirm in review. SecretRequestProposal gains sandbox_id, the last field, omitted when absent (so every ADR 0046 proposal and vector keeps its bytes), sealed inside the 0x25 by the proxy (spec §13.14). The person's device requires it to equal the request's sandbox_id: validate_for_sandbox(expected) wants Some(expected), and validate(), for a request that names no sandbox, refuses any. A server that shows a genuine sandbox proposal under another sandbox of the same proxy, or strips the sandbox to pass it off as the proxy's own, gets a card that refuses it as tampered, so the person never signs an attach_sandbox for the wrong sandbox. The limit, stated: HPKE in base mode doesn't authenticate the sender, so a server that seals a proposal of its own can name any sandbox; the proxy catches that one, since it checks the signed decision's proposal_digest against the proposal it sent (T306) and never attaches for a request it didn't raise. A proxy older than layer 7 raises no sandbox requests at all, so no proposal without the field exists in the wild; layer 2's vector without it is kept and is now refused. klav log verify accepts sandbox_id only on secret_request.created and only for a sandbox that proxy issued earlier in the chain; it checks a decision's attach_sandbox against that created event, and adds the attached profile to the sandbox's record. A request for a sandbox the chain shows as ended is a warning, never a failure (the server checks liveness with its own clock).
Note (layer 7, 2026-11-29): what the proxy does, and what it found. The wire format is in api.md §8.10; spec §13.18 has what each side checks. Points for Omar's review:
- Pause, against §7. "Waiting continues to answer" is false with today's server: it refuses every agent route except
meto a paused agent, so a paused proxy's read gets423 klav_agents_pausedas its create does. The request goes on on the server, and the first read after the person resumes reports it (sandbox_requests_e2e_tests::an_update_names_its_own_profile_and_learns_no_item). Changing it would be a server change for a short window; layer 7 leaves it and documents it. - Caps, against §7. The proxy checks only the 6-per-hour cap first, from what it raised itself; the 2-pending and 10-per-proxy caps are the server's, under the account lock, and their
429reaches the sandbox as is. A request folded into an identical open one is not counted, and the proxy checks the folded request is this sandbox's, this proxy's and of the sameproposal_digestbefore handing it out. In the enclave each account has its own proxy agent, so the server's 10 per proxy is §8's 10 pending per account. - Codes. Off, and an issuer without the opt-in, are
403 klav_secret_requests_off; an unknown or foreign request, profile or malformed ID is the same404 klav_not_found(T302, T311); a decision that doesn't verify is502 klav_not_allowedand is never used (T306). Both routes have their own rate, 30 per minute per sandbox, apart from its calls'. - Where attachments live. In a sidecar
<name>.sandbox-requestsfile next to the store, as the channel and heartbeat files are, so the store stays in the format an older proxy reads; in the enclave, in the store snapshot's optionalrequestskey (§13). Ownership on a read is checked statelessly against the server'ssandbox_id; the ledger only adds the sealedproposal_digestand the hourly count. What it keeps of a sandbox goes in the sweep after it ends, and an attached profile serves only while the sandbox lives and the grant still has it as a base-URL profile (T301, T308). - What is checked where. T306 (a forged or swapped decision,
attach_sandboxfor another sandbox, a wrong digest) is checked at the unit level, onjudge, with each forgery; the end-to-end tests run the person's real signature. The tap throughklav-nitro-parentsaw none of the title, reason, setup URL, host, placeholder, field, profile name, value or routes (the layer 7 stop rule holds).
10. Threats (threat model §5.30)
| ID | Threat | Mitigation |
|---|---|---|
| T297 | A prompt-injected agent in a sandbox floods the person with secret-request cards, or keeps asking for the same key until the person gives in (approval fatigue, T27) | Off until the account switch and the issuer's signed opt-in (Q3); 2 pending per sandbox, 10 per proxy, 6 an hour per sandbox, identical digests folded into one card (Q4); the card's "Stop this sandbox" and "Don't let <issuer>'s sandboxes ask again"; pending requests die with the sandbox |
| T298 | A sandboxed agent sets setup_url to a lookalike page (T235), now from a machine that reads untrusted repositories unattended |
ADR 0046's URL rules and warning, unchanged; the "From a sandbox" badge; never auto-opened. Residual risk 122 |
| T299 | A sandbox claims to be another sandbox, or an outside caller raises a request in a sandbox's name | The proxy names the sandbox from the handshake key (claims::bound), never from the body; the server takes sandbox only from the proxy that issued it and only while it is live (barrier); the label comes from the signed sandbox.issued in the device's verified chain |
| T300 | A sandbox proposes a profile name that already exists, so the person's grant re-points every sandbox's profile of that name to a new upstream or item | The card refuses an existing name for a sandbox proposal and offers <name>-2 (Q7); issuers_keeping is shown anyway |
| T301 | A sandbox widens itself to profiles it was never given | The view and calls use only the issued profiles plus those the person attached by signature for that sandbox (§5); the attach is bound to the request's sandbox and the decision's proxy_profile; the proxy never attaches on its own |
| T302 | A sandbox learns about the person's vault outside its grant: item IDs, titles, projects, whether an item exists | No search or list route; update names a profile, mapped by the proxy to its own item; unknown and foreign profiles get the same answer; the decision never carries IDs for a proxy (in_grant: false); the view lists no item data |
| T303 | A web page opened by the agent's browser calls /_klav/sandbox or /_klav/secret-requests through the forwarder's loopback port (a cross-site POST, DNS rebinding) |
The from_a_page guard on every new route, checked before the sandbox is looked up; Host must be loopback |
| T304 | Long waits from the sandbox take the 4 call slots and starve its profile calls | Control routes outside SANDBOX_IN_FLIGHT, one wait per sandbox, 25 s each (Q10) |
| T305 | Polling keeps a sandbox alive past the inactivity end | By design within the TTL, which still ends it; the person sees the sandbox as connected. Residual risk 125 |
| T306 | A malicious server forges a fulfillment, an attach, or swaps the profile | The proxy verifies the account's signature over request_id, its agent_id, the digest and decision_bytes (with attach_sandbox) before it answers or attaches (T237) |
| T307 | A compromised proxy (or a bad enclave image) raises requests in a sandbox's name or attaches profiles | Raising cards: possible, and it already holds every granted value, so this adds fatigue, not access (T297's caps hold at the server). Attaching: needs the person's signature for that sandbox and profile. The hosted image is attested (ADR 0051 §2.2) |
| T308 | A request or an attach outlives a revoked sandbox or a pause | Pending requests expire with the sandbox (§3.2); an attach for an ended sandbox is refused by the proxy and hidden on the card; create is refused while paused |
| T309 | An older device can't parse the new fields and reports tampering, or shows a sandbox request as the proxy's | The account switch with the "update every device first" check (§9) |
| T310 | The proxy, including the enclave, reads the proposal's metadata (titles, URLs, upstream); reason stays in clear on the server |
Stated. The proxy already holds the values of its grant; the server still sees no proposal plaintext. Residual risk 121 |
| T311 | A proxy restart or an enclave hand-off loses which sandbox asked what | Stateless: the server stores sandbox_id and the proxy checks it on each read (§3.2) |
Residual risks (threat model §7, 121–126):
- 121. The proxy sees a sandbox's proposal in the clear (T310): title, field, URLs and upstream, in the person's own proxy or inside Klav Cloud's attested enclave. The server doesn't.
- 122. A person who opens an agent's
setup_urlwithout reading it can still be phished, and one who taps "attach" without reading gives a live sandbox a new credential at once (T298, T301). Both are explicit, unchecked and marked. - 123. The label of a sandbox is its issuer's text (T136): a compromised issuer can name its sandboxes misleadingly. The card says "according to the proxy" and shows the issuer.
- 124. An attached profile works in the asking sandbox immediately (§5), for the rest of its life. That is the point; the person can stop the sandbox from the same card.
- 125. A waiting agent keeps its sandbox from the inactivity end (T305), up to its TTL.
- 126. The sandbox sees its own profiles' rules (Q9 (a)): a prompt-injected agent learns which tools ask and which are denied. It could learn the same by trying.
11. What this ADR chose on its own (Omar can overturn each)
- The MCP server name
klav-sandbox, so it is never confused with the localklavserver, whose tools are different. - JSON routes under
/_klav/on the channel, not a versioned prefix: profile names start with a letter (crates/klav-proxy/src/sandboxes.rs:71-73), so none can take_klav. - 25 s for each wait on the channel, above the 20 s head deadline only after the head arrives.
- No
vault_idorproject_idin a sandbox's proposal: the sandbox can't know any, and the picker starts at the person's default. - The issuer opt-in default is off for existing issuers and for
klav proxy issuer addwithout--secret-requests.
12. Left for later, not designed here
klav-forward approval wait(ADR 0036 §10 names it; it isn't built).- A sandbox asking for a new sandbox issuer profile list or a longer TTL.
- Under Q12 (a): proposals of MCP, Postgres or tunnel profiles from a sandbox, and attaching a profile granted outside the card. A person still adds MCP profiles with
klav proxy grant --mcp-url. - Per-tool rules for
klav-sandbox's own tools.
13. Not verified (each checked at its layer, which stops if a claim is false)
| Claim | Checked at | If false |
|---|---|---|
claude mcp add --scope user NAME -- CMD and codex mcp add NAME -- CMD register a stdio server in a Boat sandbox |
Layer 6 & Layer 10: true (verified 2026-11-30 in a Boat sandbox). Both lines ran idempotently twice under set -e, claude mcp list showed klav-sandbox: klav-forward mcp - ✔ Connected, and codex mcp list showed klav-sandbox enabled |
Other syntax from each CLI's docs; never config editing |
| Claude Code and Codex load an MCP server added mid-session (only if Q12 (b)) | Before Q12 (b)'s layer | MCP profiles stay "new sandbox only" |
An older proxy answers /_klav/sandbox with 403 klav_not_allowed (inferred from crates/klav-proxy/src/proxy.rs:1592-1596) |
Layer 5: true. With the loopback Host the forwarder relays, the fallback answers 403 klav_not_allowed ("no profile with that name"); with Host: klav-proxy, 403 klav_not_allowed too; on an unbound key, 401 klav_sandbox_revoked (view_e2e_tests::an_older_proxy_answers_the_view_from_its_call_fallback) |
klav-forward mcp maps whatever it answers to "update the proxy" |
Codex reads a stdio server's tool list without a bearer, and doesn't take a proxy 403 for a sign-in |
Layer 10: true (verified 2026-11-30 in a Boat sandbox; codex mcp list enabled klav-sandbox cleanly) |
Its line is dropped and the skill says why |
| A long wait on the channel isn't cut by Boat's network or the enclave's parent | Layer 7 & Layer 10: true (verified 2026-11-30 from a Boat sandbox through Klav Cloud's Nitro Enclave). A get_secret_request with wait_seconds: 25 held the full 25 s over Boat + Nitro (200 pending), a 3rd pending request hit klav_rate_limited, fulfilling a base-URL proxy_proposal on the iPhone (0.13.0, build 11) with "Also let this sandbox use it now" attached http://127.0.0.1:8790/httpbin immediately in the same sandbox, and tapping "Stop this sandbox" expired the remaining pending card and ended the sandbox (klav log verify passed) |
Shorter waits (10 s) |
| The enclave's per-account state keeps the attached profiles across a hand-off as it keeps sandboxes | Layer 7: true. The store snapshot carries them in an optional requests key, absent when empty, so a store with none keeps its bytes (registry::tests::a_store_carries_its_attachments_and_one_without_is_unchanged); after a hand-off, the new enclave serves the attached profile to the same sandbox (enclave::tests::an_attached_profile_goes_on_through_the_new_enclave_after_a_hand_off). An older image refuses a snapshot with the key, which fails closed |
The proxy re-reads attachments from the verified decisions of its sandboxes' requests at start |
SecretRequestInfo is parsed nowhere with deny_unknown_fields on any shipped client (extension, iOS) |
Layer 2 | Those fields also go behind the switch |
Rejected alternatives
- A Klav agent identity per sandbox (its own
kag1_key, registered and approved). Every sandbox would need the person's approval, and a copied sandbox would carry a key that signs as an agent; ADR 0036 §5 built the forwarder precisely so a stolen sandbox carries no Klav key. - Sealing in the sandbox (Q2 (b)). It keeps the metadata from the proxy, but needs the account's identity and ID in the claim answer (which the proxy supplies, so it trusts the proxy anyway) and HPKE in
klav-forward, for metadata the proxy already holds. - The issuer asks on the sandbox's behalf. The issuer isn't in the sandbox's conversation and has no channel to it; the request would need a new path from sandbox to issuer.
- An aggregator in
klav-forward mcpand config editing byklav-forward(§6). - Letting the proxy attach profiles itself after a fulfilled proposal (Q6 (c)): a widening with no signature naming the sandbox.
Consequences
- New:
klav-core:SecretRequestDecision.attach_sandboxand its rule; the proposal check withoutvault_id/project_idfor sandboxes.klav-proto:CreateSecretRequest.sandbox;SecretRequestInfo.sandbox_id,sandbox_label;SandboxIssuer.secret_requestsand grantv: 6(Q3 (a)); the switch inAgentMe.klav-server: the switch and its route; a migration addingsecret_requests.sandbox_id; the proxy-for-a-sandbox path, per-sandbox caps, expiry on sandbox end,updateagainstgrant.items;klav log verifylearns the two fields.klav-proxy:/_klav/sandbox,/_klav/secret-requests, sealing and signing for a sandbox, decision verification, attachments in the store, the control-route cap; enclave quotas.klav-forward:mcp(stdio,sandbox_info,request_secret,get_secret_request) andsecret-request wait; no new crate.klav-cli: setup lines,klav proxy issuer add --secret-requests, the switch, the card's sandbox header inklav secret-request show|fulfill.- Mac, iPhone, extension: the badge, the attach toggle, the collision rule, the two quick actions.
- Spec: §13.14 (the
sandboxfield, the decision'sattach_sandbox), §13.4 (grantv: 6), and a new §13.18 for the sandbox view and the channel routes (§13.13 and §13.15 stay reserved). Vectors added todocs/vectores/secret-request.json(a decision withattach_sandbox) andsandbox-grant.json(an issuer withsecret_requests). No new blob kind, no new signature label. - API:
docs/api.md§8.10 (the channel's new routes) and §8.12 (sandbox requests). - Glossary (layer 1): Sandbox MCP server (
klav-forward mcp), sandbox view, sandbox secret request, attached profile, issuer opt-in,sandbox_secret_requestsswitch. - Docs site: an "On the way" page until it ships (ADR 0039 §3), then the sandbox page under
agents/. - Boat template: it carries
klav-forwardfrom the release commit (ADR 0042 §7), so the template is rebuilt for the release that shipsklav-forward mcp, and its agent CLIs must accept the stdio entry. - Extension: unchanged; it shows sandbox requests with the badge and still never grants a proxy (
apps/extension/src/ui/secretRequests.ts:13-14). - Skill: the sandbox section (
skill/SKILL.md:87-138) changes; a new published hash goes into both lists (crates/klav-forward/src/skill.rs:15-18).
Plan in layers
Each layer is one PR of a stack (gh stack), with its tests and its roadmap box.
- Docs: this ADR accepted, threat model §5.30 and the residual risks, glossary, notes in ADR 0036 §4, ADR 0046 §1–§2 and ADR 0049 §7 pointing here, the roadmap.
klav-coreandklav-proto: the fields and rules, grantv: 6, spec and vectors.klav-server: the switch, the migration, the sandbox path, caps, expiry on sandbox end,updateby item. "Safe with older clients" review;test (postgres).klav-client,klavd,klav-ffi,klav-cli: verification of the new fields inklav log verify, the card model (badge, collision, attach, quick actions), the issuer opt-in, turning the switch on.klav-proxy, the view:/_klav/sandboxwith its guard, and the field in the issuer's answer. No server change.klav-forward, the view:klav-forward mcpwithsandbox_info, theklav sandbox startlines, the skill. Ships with a rebuilt Boat template.klav-proxy, requests:/_klav/secret-requests, sealing and signing, waits outside the call slots, attachments, sweeper, enclave quotas. End-to-end through a real server and forwarder, and throughklav-nitro-parentwith the tap.klav-forward, requests:request_secret,get_secret_request,secret-request wait.- Mac, iPhone, extension: the card.
- Hand test (Omar's go, a paid sandbox): from a Boat sandbox, against a self-hosted proxy and against Klav Cloud:
sandbox_info, arequest_secretwith a base-URLproxy_proposalfulfilled on the iPhone with attach, the new profile used in the same sandbox, a second request refused by the cap, a stop from the card.
Order (Q11 (a)): layers 5–6 (the view) need no server change and can ship first; layers 2–4 and 7–9 (secret requests) follow.
Stop rules
- Layer 2 finds a shipped client that parses
SecretRequestInfostrictly: stop, put those fields behind the switch, and say so here. - Layer 5 or 7 finds a way for a sandbox's request to name another sandbox, or for the view to list anything outside the sandbox's profiles: the layer stops until it is impossible and a test proves it.
- Layer 7's tap sees any proposal field or profile name on the parent: stop.
- Layer 6 or 10 shows a client can't load a stdio server in a Boat sandbox: stop and bring the alternatives back to Omar; don't fall back to config editing.
- Any layer that would add a crate, an
unsafeblock, a cryptographic primitive outsideklav-core, or a route that returns a value: stop and ask.
Omar's answers (2026-11-29)
Omar accepted the ADR with the recommended option (a) on every question Q1–Q12:
- Q1 (a):
klav-forward mcp, a stdio MCP server in the sandbox, over two plain JSON routes on the pinned channel; no MCP server inklav-proxy. - Q2 (a): the proxy seals the proposal to the account with the identity it pinned, signs as itself and names the sandbox; ADR 0046's "proxies can't ask" holds except for a live sandbox of that proxy.
- Q3 (a): the account switch
sandbox_secret_requestsplus a per-issuer opt-in signed in the proxy's grant (secret_requests, grantv: 6), off by default. - Q4 (a): 2 pending per sandbox, 10 per proxy, 6 created per sandbox per hour, identical proposals folded into one card, expiry with the sandbox.
- Q5 (a): a sandbox may ask to update a credential by its own profile's name; the proxy maps it to the item and the sandbox never learns an item ID.
- Q6 (a): a second unchecked toggle on the card attaches a newly granted base-URL profile to the asking sandbox, signed inside the decision (
attach_sandbox), applied by the proxy and ending with the sandbox. - Q7 (a): the card refuses an existing profile name for a sandbox proposal and offers
<name>-2. - Q8 (a): one client entry per remote MCP server, written at setup (ADR 0049 §7);
klav-forward mcpserves only Klav's sandbox tools and repeats each server's setup lines insandbox_info. - Q9 (a):
sandbox_infoshows names, kinds, local URLs, upstream hosts, the signed rules, Postgres URLs and expiry; never item IDs, titles, fields, other profiles or sandboxes (risk 126). - Q10 (a): waits don't take a call slot: control routes have their own cap of one wait per sandbox, 25 s each.
- Q11 (a): the read-only view (layers 5–6) ships first, with no server change; secret requests follow.
- Q12 (a): a new MCP, Postgres or tunnel profile still needs a new sandbox, and the tools say so; only base-URL keys attach live (Q6).
Questions for Omar (answered above)
| # | Question | Options | Recommendation |
|---|---|---|---|
| Q1 | Where does a sandbox's Klav MCP server run? (§1, §4) | (a) klav-forward mcp, a stdio server in the sandbox, over two plain JSON routes on the channel(b) A Streamable HTTP MCP server inside klav-proxy at /_klav/mcp, reached through the forwarder(c) Both |
(a). No new code in the enclave's trusted image beyond two JSON routes, and the forwarder keeps "no vault code" |
| Q2 | Who seals and signs a secret request from a sandbox? (§3.1) | (a) The proxy: it seals the proposal to the account with the identity it pinned, signs as itself, and names the sandbox; ADR 0046's "proxies can't ask" holds except for a live sandbox of that proxy (b) klav-forward seals in the sandbox (the account's identity comes in the claim answer); the proxy only signs(c) Each sandbox gets its own Klav agent key |
(a). The proxy already holds this class of metadata and every granted value; (b) adds HPKE to the forwarder for little; (c) puts a signing key in every copyable sandbox |
| Q3 | Who decides which sandboxes may raise secret-request cards? (§3.2, §9) | (a) An account switch, plus a per-issuer opt-in signed in the proxy's grant (secret_requests, grant v: 6), off by default(b) The account switch only: every sandbox of every issuer may ask once it's on (c) Always on, no switch |
(a). The person chooses which runners' sandboxes may interrupt them; (c) breaks older devices' klav log verify |
| Q4 | What limits apply to requests from sandboxes? (§7) | (a) 2 pending per sandbox, 10 per proxy, 6 created per sandbox per hour, identical proposals folded into one card, expiry with the sandbox (b) ADR 0046's 5 pending per agent, shared by all of the proxy's sandboxes (c) 5 pending per sandbox, no proxy-wide cap |
(a). (b) lets one noisy sandbox block every other; (c) lets 50 sandboxes raise 250 cards |
| Q5 | May a sandbox ask to update an existing credential (an expired Maple key, say)? (§3.1) | (a) Yes, by its own profile's name: the proxy maps it to the item, and the server accepts items of the proxy's grant for a live sandbox; the card reads the real item from your vault (b) No, create only in this version |
(a). Key rotation is the common sandbox case (Maple's keys last 90 days), and the sandbox still never learns an item ID |
| Q6 | When a sandbox asks for a new API key with a base-URL proxy profile and you grant it, how does the sandbox that asked get to use it? (§5) | (a) A second unchecked toggle on the card, "also let this sandbox use it now": signed inside your decision (a new field, so it waits for the account switch), applied by the proxy within about 30 s, ending with the sandbox. Costs: the field, store and klav log verify changes, and the asking sandbox gets the credential's use at once(b) It can't: the next sandbox can, once you add the profile to the issuer (c) The proxy attaches it on its own after you grant the profile |
(a). The "seamless" you asked for, with your signature naming that one sandbox; (c) widens a sandbox with no signature |
| Q7 | A sandbox proposes a profile name that already exists (github). What does the card do? (§3.3) |
(a) Refuse that name for a sandbox proposal and offer github-2(b) Allow it, with today's red "issuers keep this profile" warning |
(a). Otherwise one sandbox can re-point every sandbox's github profile with your next value (T300) |
| Q8 | How are remote MCP servers (Maple, GitHub, Cloudflare) wired in a sandbox? (§6) | (a) One client entry per server, written at setup as today (ADR 0049 §7); klav-forward mcp serves only Klav's sandbox tools and repeats each server's setup lines in sandbox_info(b) klav-forward mcp bridges every granted server into one stdio server(c) klav-forward edits the clients' config files itself |
(a). (b) is the aggregator ADR 0049 rejected, now inside the sandbox; (c) adds two crates to the forwarder and reverses decision 6 of 2026-11-19 |
| Q9 | How much does sandbox_info show the agent? (§2) |
(a) Names, kinds, local URLs, upstream hosts, the signed rules (methods, paths, tool patterns, SQL classes), Postgres URLs and expiry; never item IDs, titles, fields, other profiles or sandboxes (b) Names and local URLs only |
(a). An agent that knows create_* asks stops calling it blindly; it could learn the rules by trying (risk 126) |
| Q10 | Do a sandbox's waits on its requests count against its 4 call slots? (§4) | (a) No: control routes have their own cap of one wait per sandbox, 25 s each (b) Yes, they share the 4 slots |
(a). A waiting agent must never block its own profile calls |
| Q11 | What ships first? (Plan) | (a) The read-only view (klav-forward mcp with sandbox_info, layers 5–6) first, with no server change; secret requests after(b) Everything in one stack, in layer order |
(a). The view is useful alone and carries no server risk; the server part waits for its review |
| Q12 | A sandbox asks for a credential for a new MCP server (or Postgres), or you grant one with klav proxy grant while a sandbox runs. Can that live sandbox get it? (§5) |
(a) Not in this ADR: it needs a new sandbox, and the tools say so; base-URL keys attach live (Q6) (b) proxy_proposal gains an mcp part (endpoint and tool rules) so the card can grant and attach an MCP profile; needs checking that Claude Code and Codex load a server added mid-session(c) "Active sandboxes" lets you attach any existing profile to a live sandbox (a new account-signed event) |
(a). Tool rules written by a sandboxed agent are the riskiest thing to sign from a card, and live loading is unverified; (b) or (c) can follow as their own ADR |