Skip to content

A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.

TypeScript

docs(odd): plan connector hardening now and the keychain proxy later

Alan Buscaglia35166011932a
diff --git a/odd/tasks/gentle-dot.md b/odd/tasks/gentle-dot.md
index dc73a38..607ee44 100644
--- a/odd/tasks/gentle-dot.md
+++ b/odd/tasks/gentle-dot.md
@@ -77,6 +77,8 @@ Branch: `feat/gentle-dot` · Delivery strategy: `single-pr` (user choice, L7; fo
- **S24 — Computer control (last item).** User (L43): "un item mas al final de todo, que haga como codex y que permitas controlar tu computadora, que pueda manejar tus aplicaciones y tal".
- Acceptance (draft, to be refined before implementation): the assistant can see the screen and operate apps (screenshots, mouse, keyboard, opening and switching apps) after the user grants macOS Accessibility and Screen Recording permissions, with an in-app guide for granting them. Safety: a visible "in control" state on the rose, a global panic shortcut that stops control instantly, approval per control session plus mandatory confirmation for risky actions (send, pay, delete, submit), an optional allowlist of apps, and a clear note when the selected model cannot use images. Likely delivered as a built-in MCP connector behind the S18 approval guard. Linux support follows S13's limits (Wayland restricts input injection and screen capture to portals).
+- **S25 — Connector enforcement outside the agent's reach (stage 2, before publishing to other users).** Decided in L48. The daemon proxies MCP traffic: connector tokens live in the OS secure store (macOS Keychain, with an equivalent on Linux and the VPS), the engine sees only local proxy URLs, and enabled state, mode, and approvals are enforced by the daemon, not by files or an in-engine hook. Subagent child processes are covered too.
+
## Tasks
| ID | Specs | Route | Status | Commit / evidence | Scope |
@@ -102,6 +104,8 @@ Branch: `feat/gentle-dot` · Delivery strategy: `single-pr` (user choice, L7; fo
| T19 | S22 (+ design §4/§6/§7 refresh) | delegated writer (context backstop) | done | `225596d`; parent re-ran 260 tests, typecheck, lint + real-engine handoff probe | Single continuous chat: hide conversations, transparent session rotation, recent-only history |
| T20 | S23 | delegated writer, after T17 (the runtime refused it in parallel: test surface overlap with T17's `packages/daemon/test/**`) | done | `823363e`, follow-up `400ec73`; parent re-ran 235 tests, typecheck, e2e 12/12 | Global Engram, project gentle-dot |
| T21 | S24 | explore → spec → implement (last) | pending | — | Computer control with permissions guide, panic stop, and approvals |
+| T22 | S18 (hardening, L47 B1/B2) | delegated writer | in progress | — | Option A: authoritative in-memory connector state with revert, credential reads blocked, path-independent bash checks, full approval preview, redirect manual, private Engram stop, onboarding overlap fix |
+| T23 | S25 | explore → spec → implement (stage 2) | pending | — | Daemon-side MCP proxy with Keychain tokens |
| T9 | S1–S6, S9–S12 | delegated verifier (high risk: process supervision, auth) | done | L24 + L31 | Full verification: unit, integration, Playwright, `@real-agent`, `tauri build` + launch, manual macOS checklist with observed results |
Environment notes: Node v24.14.1 and pnpm are present. `cargo` is on PATH but `rustc` is not, so T7 must first install or repair the Rust toolchain (rustup) and asks before installing. Xcode is present.
@@ -155,4 +159,5 @@ Environment notes: Node v24.14.1 and pnpm are present. `cargo` is on PATH but `r
- **L45 (2026-10-08, T18a finding):** The T18a writer found `rotation.test.ts` flaky in full runs (4/4 runs on a clean `git archive HEAD` copy, each time a different rotation test timing out; 3/3 in isolation). The likely cause is a T19 race in bridge.ts: when the prompt response and `agent_settled` arrive in one stdout chunk, `rotateWhenIdle` runs while `sending` is still 1, so rotation is skipped until the next run settles. In production this only delays rotation to the next run, but it is a real defect. Decision: fix in T18a, test first, with a single in-flight rotation flag and at least 3 full runs. The parent's two earlier green full runs were luck.
- **L46 (2026-10-08, T18a evidence):** Commit `e49bd9d`. Catalog: Notion, Linear `https://mcp.linear.app/mcp` (verified), and Atlassian v2, with curated read-only lists (fail closed). The daemon is the only writer of `mcp.json` (`exposure: direct`, read-only mode as `toolExposure {"*":"hidden", curated:"direct"}`, validated with the engine's own `validateMcpServerConfig`), restored by hash in a new supervisor `prepareSpawn` hook before every spawn. The guard policy JSON travels in the engine env (`GENTLE_DOT_CONNECTOR_POLICY`); missing or malformed means everything asks. Sign-in runs the engine CLI `mcp login` as a child process; the daemon completes a pasted redirect only after validating origin, path, and state, and cancel kills the CLI by PID. The approval guard (`-e`, `tool_call` hook) asks with a preview and blocks writes to control files; the real-engine probe found and fixed a `/var` vs `/private/var` bypass (realpath compare). Tray "New conversation" only with conversations on. The L45 rotation race was fixed test-first (`rotationDeferred`, 14/14 ×3; the writer reported 6 green full runs). RED → GREEN per layer; e2e written after the code. Parent re-ran: 312 tests twice, typecheck, cargo 42/42. Risks reported: bash blocking is textual, the agent can read `mcp-auth.json`, separate sign-in queues for models and connectors, and the browser may open twice. Parent-observed UI defect: the onboarding banner overlaps the first chat message. Risk tier high (security) → an independent adversarial verifier is running.
- **L47 (2026-10-08, T18a adversarial verification):** 2 BLOCKERS, reproduced with the real engine (scratch copy, fake model/MCP/CLI, temp HOME). B1: with one bash call from `<data>/workspace`, the agent edited `../agent/mcp.json` and `../connectors.json` (enabled, recomputed sha256 or deleted hash), ran `kill $PPID`, and the supervisor restarted it; `prepareSpawn` trusted the altered registry and `notion-search` ran without a card on a connector the user had disabled (catalog-only; sends still ask after the mode flip). B2: `read ../agent/mcp-auth.json` (the guard checks only write/edit) and `cat` returned the token to the model. Root cause: textual bash blocking (`approval-guard.ts:113-119`) and an integrity hash stored in the same agent-writable file. Passing: write asks/decline blocks/no UI blocks; read-only hides write tools; curated-list fail-closed; malformed policy asks; sign-in redirect validation against all variants; one flow at a time; clean logs; mcp.json valid and restored; rotation 3/3 at HEAD vs 2/3 failing at baseline; typecheck, lint, e2e 16/16, cargo 42/42. Advisories: gentle-pi subagent children do not load the guard (subagent tools not exposed today); project `.pi/mcp.json` and session_start re-reads bypass the restore; the preview shows at most 6 fields × 160 chars; orphaned private Engram; `fetch` follows redirects; the guard loads only with `agentHome`. Fundamental limit: the agent runs as the user with unrestricted bash, so file-based protections cannot be airtight.
-- **Next step:** user decision between hardening now (A) and a daemon-side MCP proxy with Keychain tokens (B); then the correction batch, T18b, T14, T21.
+- **L48 (2026-10-08, user decision):** "A ahora, B después (Recomendado)". T22 hardens now (residual risk documented: an agent tricked into using unrestricted bash can still read what the user's account can read). T23/S25 adds the daemon-side MCP proxy with Keychain tokens as stage 2, before publishing to other users.
+- **Next step:** T22 (running); then T18b, T14, T21; T23 before any public release.