diff --git a/AGENTS.md b/AGENTS.md
index 036e71ee..01144123 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -67,6 +67,9 @@ Before you commit, run `npm run format`, `npm run typecheck`, `npm test` and `np
- `src/server/grouping.ts`: the lead agent sorts a new conversation into the user's sidebar groups and names it in a few words, in one run (`AutoGrouper`; naming on unless Settings → Lead agent or `RELAY_CHAT_TITLES=off` turned it off, `SettingsStore.chatTitles`; a title the user typed meanwhile stays), and suggests how to organize the groups (`buildOrganizePrompt()`, `decideOrganize()`; the ones the user takes checked by `checkReorganize()` and applied together by `Store.reorganize()`).
- `src/server/leadDrafts.ts`: the lead agent's drafts for the editors that are not a conversation's team (`LeadDrafts`, `orchestrator.drafts`): a template (`buildTemplatePrompt()` in `planner.ts`), team checks (`checksDraft.ts`: the project read first, read-only; the list checked rule by rule), a schedule (`scheduleDraft.ts`: in the browser's time zone, only the accounts set up) and the sidebar's group suggestions; one read-only, fresh run each, in the project or an empty folder of its own, a new request for the same editor stopping the last; nothing saved, the editor shows the answer in the shared box (`components/LeadAsk.tsx`) until the user saves it. `src/shared/scheduleProposal.ts`: a schedule a member proposes in its reply (`{…}`, taken out by the orchestrator's `takeSchedule()` into a `schedule` part, a card the user creates it from, `POST /api/conversations/:id/messages/:messageId/schedule`, or opens in the form, `fromProposal`).
- `src/server/memory.ts`: long-term memory (`LongTermMemory`, `orchestrator.memory`), off by default (`MemorySettings.enabled`): notes agents save with `` / `` blocks in their replies (parsed in `src/shared/memory.ts`, taken out by the orchestrator's `takeMemory()` into a `memory` part), one row each in `memories`; the pinned notes in every briefing (`longTermSection()` in `prompt.ts`), the others recalled by matching words in the turn prompt once per session (their ids in `seen` as `memory:`); nothing an agent does deletes a note, and the user's own notes change only when they say; the lead agent tidying the notes in the background (`buildTidyPrompt()`, `applyTidy()`). Settings → Labs → Long-term memory (`components/LongTermMemory.tsx`, in `LabsCard`; `src/web/memory.ts`), `/api/memory…` ([Architecture → Long-term memory](docs/architecture.md#long-term-memory)).
+- `src/server/handoffs.ts`, `src/server/fixedCommands.ts`, `src/shared/handoffs.ts`: secrets and fixed commands ([Architecture → Secrets and fixed commands](docs/architecture.md#secrets-and-fixed-commands)): the reply blocks (``, ``, ``: `splitHandoffs()`, pure) taken out of a finished reply into cards that wait for the user (`takeHandoffs()` in the orchestrator); a working directory's secrets (`HandoffStore`, `settings.handoffs`: values in the credential store, one entry per folder, never the database, the UI or an agent; names, commands and pins in `app_settings` key `handoffs`); a fixed command's pin (`takePin()`, `PIN_PATTERN`: its folder's code and configuration, a snapshot under `refs/harness-relay/commands/`) and its run (`runFixedCommand()`: always Harness Relay's own sandbox, its hosts only, its secrets in a file of the run's own folder (`RELAY_SECRETS_FILE`), never in its environment or command line, its output masked: `maskValues()`), from its card (Try it), the outbox (`FIXED_COMMAND_TOOL`) or a schedule (`schedules.command`, run first: `runScheduledCommand()`); the relay sandbox's run folders kept from the other CLIs (`agentProtectedReads()` in `protect.ts`); the cards `src/web/components/HandoffCards.tsx`, Settings' `HandoffsSettings.tsx`.
+- `src/server/interactive.ts`, `askpassShim.ts`: interactive commands ([Architecture → Interactive commands](docs/architecture.md#interactive-commands)): an agent's `` block becomes a card the user starts (never an agent, never from an automation's run), run with the user's rights outside every sandbox through the fixed shell script, in an empty folder of its own unless the user picks the working directory (its configuration files listed first), an environment without `CI`; its output masked, what is typed sent as typed; a password helper (`SUDO_ASKPASS`, `SSH_ASKPASS`, `GIT_ASKPASS`) that asks the card over the gateway's socket with a token of its session (`ToolGateway.askpassGrant()`); the output reaches the team only when the user sends it.
+- `src/shared/steps.ts`, `src/web/steps.ts`, `components/StepsCard.tsx`: a card of steps ([Architecture → Turn scheduling](docs/architecture.md#turn-scheduling-modes), "Steps for the user"): an agent's `` block (`splitSteps()`, pure and tolerant) taken off a finished reply by the orchestrator's `takeSteps()` into a `steps` part that asks the user as `[ASK_USER]` does; `tickStep()` and `answerSteps()` (the answer posted as the user's message, `stepsAnswerText()`, the asking agent first).
- `src/server/agents/`: one adapter per CLI. `claude.ts` (stream-json), `codex.ts` (`codex app-server`), `grok.ts` (ACP), `cursor.ts` (ACP, `cursor-agent acp`: no OS sandbox, so below full access every command asks, but those on a Cursor team's auto-run allowlist; a private config folder per run, with its settings and deny rules), `antigravity.ts` (ACP, `agy acp`: no sandbox, so below full access every command asks, and a refusal ends its turn; settings of its own per run, in the folder `--cli_dir_name` names; the account's home through `--gemini-dir`), `copilot.ts` (ACP, `copilot --acp`: its own sandbox below full access, with its policy checked before each turn, and a refusal ends its turn; a run home of its own per turn, with Harness Relay's settings, the account's sign-in state and links to its sessions (`session-state`, and except on Windows `session-store.db`, where AgentsView reads their token counts); a project's own hooks asked about before it starts), `muse.ts` (ACP, `muse acp`: its own OS sandbox below full access (on Windows only once Muse's own elevated setup has run), under a permission profile of Harness Relay's (from `:ask-me`, with deny rules for the protected paths) in a config folder of its own per run (`XDG_CONFIG_HOME`), its approval judge off and no workspace trusted below full access; a session resumed only with the permission and protected paths it was made with, since Muse keeps them; the account's home through its XDG folders), `acp.ts` (the JSON-RPC peer, and the ACP helpers Grok, Cursor, Antigravity, Copilot and Muse Code share: prompt blocks, MCP servers, permission answers, content text), `index.ts` (registry). The open agents ([docs/open-agents.md](docs/open-agents.md)): `opencode.ts`, `goose.ts`, `cline.ts`, `openhands.ts` (ACP, through the generic turn in `acpTurn.ts`), `pi.ts` (JSONL RPC, with its gate extension `piGate.js`), and what they share around their process in `open.ts`.
- `src/server/db.ts`, `store.ts`, `settings.ts`, `secrets.ts`: SQLite and migrations (and the lock one server holds its data folder with, `lockDataDir`), persistence, provider settings, each CLI's accounts (a home and an API key of their own; agents and the lead agent name theirs; Cursor's besides the default one sign in with an API key only, since Cursor keeps one sign-in per computer user: `CURSOR_SHARED_SIGN_IN`; Antigravity's too, with a Gemini API key, since agy keeps its Google sign-in in the system keyring, and Muse Code's, with a Meta API key, since muse keeps its Meta sign-in in the macOS login keychain: `keyOnlyAccount()`) and child-process env (including the CLIs' own homes), API keys in the OS keyring, or without one in the database encrypted with the key in `secrets.key` (`openSecretStore()`; the key file a protected path, withheld from the Files panel and downloads).
- `src/server/ports.ts`: Harness Relay's ports (8787 for `npm start` and the desktop app, 8789 and Vite's 5173 for `npm run dev`, `PORT` over either); `scripts/dev.ts`: `npm run dev`, which takes the first free port of the twenty from 8789 or 5173 when that one is in use (`scripts/dev/ports.ts`: free at both loopback and both wildcard addresses) and hands both to the server and Vite (`PORT`, `RELAY_DEV_WEB_PORT`: Vite's proxy and `strictPort`, the sign-in link, the session cookie's name, `relayPorts()`; kept from agents' CLIs, `devRunVars()`), then runs them with concurrently (`scripts/dev/concurrently.ts`).
@@ -89,7 +92,7 @@ Before you commit, run `npm run format`, `npm run typecheck`, `npm test` and `np
- `src/server/runCode.ts`: `run_code`, offered only while Settings → Labs has one of its modes on (off by default, one at a time; `SettingsStore.labs()`, `GET`/`PUT /api/labs`, the environment's `RELAY_RUN_CODE` or `RELAY_RLM` until changed there; `GatewayTool.offered()`; the card `src/web/components/LabsSettings.tsx`, its logic `src/web/labs.ts`): an agent's JavaScript that calls the turn's other gateway tools as functions (`relay.()`), its runner (`RUN_CODE_RUNNER_SOURCE`, `node -e`, no file) in Harness Relay's own sandbox, read-only with no network in every permission (`sandboxedRunner()`), its calls over its own stdio through the `GatewayScope` the gateway gives a `scoped` tool (each decided by its tier as the turn's own, an act's card saying code asked), its limits (`RUN_CODE_LIMITS`: calls, calls that ask or use the outbox, time with the user's answering not counted, memory, output, runs at once), its result as a `` block of data. RLM mode (Labs' second mode, with its sub-model as `/` on a model connection, or through a CLI account as `cli:[:][/]`, `cliSubModel.ts`): a `state` kept as JSON for the rest of the turn across its runs (one run at a time in a turn), and `llm_query()`, a question to that sub-model which the server asks (`llmQuery.ts`), within its budget (`RLM_LIMITS`: questions a turn, a few at once, their size, the state's size, longer runs).
- `src/server/llmQuery.ts`: RLM mode's sub-model, the only inference request the server makes itself: one plain completion with no tools, on a model connection of Settings (`llmTarget()`: an API backend's own host, or an endpoint's base URL; `llmRequest()`: Anthropic's Messages, else Chat Completions; `llmComplete()`: through `pinnedSend()`, following no redirect, an endpoint on one of Harness Relay's own ports refused, an answer of 4 MB at most, a refusal told in the backend's own words, never with the key).
- `src/server/cliSubModel.ts`: RLM mode's sub-model through a CLI, as one of the user's accounts and on its plan (`cli:[:][/]`, `parseCliSubModel()`): each question one turn of Claude Code, Copilot or Muse Code (`SUB_MODEL_CLIS`, the CLIs whose runs can have no tool at all) with `RunOptions.toolless`, which each of their adapters honours (`claudeToolless()`, `copilotToolless()`, `museToolless()`: no tool, MCP server, skill or hook of their own nor Harness Relay's, no session kept), read-only, every permission it asks for refused and a run that starts a tool all the same stopped, in an empty folder of its own in Harness Relay's own temporary folder with an empty `.git` (`questionDir()`: no sandbox lets a command write there), nothing of the question on a command line, a model of the user's own endpoints refused (`connectionModel()`), `max_tokens` asked for in the system prompt (`askThroughCli()`, `subModelAsker()`); its cost added to the reply's (`withSubModelTokens()`).
-- `src/server/gateway.ts`, `gatewayShim.ts`, `outbox.ts`: Harness Relay's own tools (browser, mail, calendar, Drive/Docs, GitHub, Obsidian, Slack posting and Teams), for every CLI (Grok, Muse Code, Goose, Cline, OpenHands and Pi in full access only, `GATEWAY_FULL_ACCESS_ONLY`) through one MCP server, `relay`: OpenCode, Codex and Copilot connect to its loopback HTTP endpoint with the turn's token in a header (`GATEWAY_OVER_HTTP`); the program the other CLIs start (`gatewayShim.ts`, a copy of it written for each turn beside its token in `data/tmp`) passes each call over a local socket with its turn's token; a call's tier (`read` runs, `act` is asked about below full access, `send` waits for explicit confirmation in the outbox, including each Google Docs or Obsidian note creation or edit); the outbox (`outbox` table). `src/server/browser/`: the browser tools, a headless Chromium of Harness Relay's own per conversation, driven over its debugging pipe (no port), every connection through a proxy of its own (`proxy.ts`, loopback only, a password per browser) that connects only to addresses it checked, opening only http and https and asking about each new host below full access. `src/server/connectors/`: the mail and calendar tools (IMAP, SMTP, MIME and CalDAV of Harness Relay's own, no library), for the accounts in Settings, passwords in the credential store; Microsoft Graph's calendars (`graph.ts`), one calendar however it is reached, with its password or through an account that signs in with OAuth (`calendar.ts`, `calendarBackend()`; CalDAV's `CalDavAuth`), and one place for a mail account's servers and sign-in, for the tools, Test, the mail trigger and IDLE (`mailLogin.ts`, `mailLogin()`: its password, or its OAuth account's provider's own servers and a token for mail over SASL XOAUTH2, a refused token renewed once).
+- `src/server/gateway.ts`, `gatewayShim.ts`, `outbox.ts`: Harness Relay's own tools (browser, mail, calendar, Drive/Docs, GitHub, Obsidian, Slack posting and Teams), for every CLI (Grok, Muse Code, Goose, Cline, OpenHands and Pi in full access only, `GATEWAY_FULL_ACCESS_ONLY`) through one MCP server, `relay`: OpenCode, Codex and Copilot connect to its loopback HTTP endpoint with the turn's token in a header (`GATEWAY_OVER_HTTP`); the program the other CLIs start (`gatewayShim.ts`, a copy of it written for each turn beside its token in `data/tmp`) passes each call over a local socket with its turn's token; a call's tier (`read` runs, `act` is asked about below full access, `send` waits for explicit confirmation in the outbox, including each Google Docs or Obsidian note creation or edit); the outbox (`outbox` table). `src/server/browser/`: the browser tools, a headless Chromium of Harness Relay's own per conversation, driven over its debugging pipe (no port), every connection through a proxy of its own (`proxy.ts`, loopback only, a password per browser) that connects only to addresses it checked, opening only http and https and asking about each new host below full access. `src/server/browser/handover.ts`: taking over the chat's browser (`browser_hand_over`): an agent hands a page that needs the user (a sign-in, a CAPTCHA) to them, as a window of the same browser on the computer Harness Relay runs on (the same launch arguments but `--headless=new`) or a screencast in the chat (`components/HandoverCard.tsx`, `src/web/handover.ts`), and hears only how it ended. `src/server/connectors/`: the mail and calendar tools (IMAP, SMTP, MIME and CalDAV of Harness Relay's own, no library), for the accounts in Settings, passwords in the credential store; Microsoft Graph's calendars (`graph.ts`), one calendar however it is reached, with its password or through an account that signs in with OAuth (`calendar.ts`, `calendarBackend()`; CalDAV's `CalDavAuth`), and one place for a mail account's servers and sign-in, for the tools, Test, the mail trigger and IDLE (`mailLogin.ts`, `mailLogin()`: its password, or its OAuth account's provider's own servers and a token for mail over SASL XOAUTH2, a refused token renewed once).
- `src/shared/apps.ts` defines catalog IDs, official MCP servers and draft readiness states. `connectorAccounts.ts` handles connector account names. In `src/server/connectors/`, `apps.ts` supplies app tools and GitHub account status, `driveDocuments.ts` and `obsidian.ts` prepare and apply reviewed edits, and `messaging.ts` routes reviewed posts to Slack (`slack.ts`) or Teams. `hostedApps.ts` checks hosted Claude and Codex connections, `codexHostedProfile.ts` verifies the Codex profile tool and its results, and `draftAvailability.ts` checks which apps the composer can offer. The client uses `src/web/draftApps.ts`, `draftAppStatus.ts` and `useDraftApps.ts` for selection, caching by permission and rechecking before submission.
- `src/server/appDependencies.ts` manages prerequisite installation jobs. `githubInstall.ts`, `browser/install.ts` and `connectors/teamsRuntime.ts` install GitHub CLI, the browser and PowerShell, respectively. `portableInstall.ts` verifies and publishes portable archives.
- Common apps lists ten services in four named regions on one page (Mail and calendar, Team messaging, Documents and notes, Development and browsing). Mail and Calendar have separate rows for their accounts. Seven built-in groups use the assistant selector on the service row. The eighth, Slack posting, shows **Assistants who can draft messages** inside **Send from Relay** after setup. Slack offers hosted Claude and Codex connections for the user's account (`src/web/components/HostedAppLinks.tsx`). Drive connects directly through Google OAuth. Gmail, Google Calendar and Drive share the Google desktop client configured in **Common apps → Account sign-in settings (OAuth 2.0)**. Outlook uses the Microsoft client in the same panel. Each provider lists its connected accounts and their granted uses. Disconnecting an account here removes its shared sign-in. The Mail and Calendar rows remove individual resources. The Tool library tab contains MCP servers, Skills, Memory, Hooks and Default team checks. A saved shared Slack grant can renew with its original client ID.
@@ -99,7 +102,7 @@ Before you commit, run `npm run format`, `npm run typecheck`, `npm test` and `np
- `src/server/usage.ts`: each account's plan usage, asked of its CLI without a prompt in that account's home (Claude Code's `get_usage` control request, Codex's `account/read` and `account/rateLimits/read`, Grok's `_x.ai/billing` over ACP, `muse usage --json`, Copilot's `account.getQuota` on its headless server `copilot --headless --stdio` (`Content-Length` framing), Antigravity's `/usage` and `/credits` in print mode; Cursor's plan only, from `about`), kept a while by `ProviderService.usage()` and shown in each account's box in Settings (`components/UsagePanel.tsx`, its pure logic in `src/web/usage.ts`); none, without asking, for an account on a key its provider bills by use (`BILLED_KEY_ENV`).
- `src/server/appPreviews.ts`, `previewTarget.ts`, `previewFiles.ts`: one-click app previews, entry and npm script detection, worktree selection, bounded snapshots and a credentialed origin per session. `previewDocker.ts` detects a usable local engine for the Docker setup dialog. `previewRuntime.ts`, `previewDockerPackages.ts` and `previewDockerWire.ts` run npm builds and Node.js backends in offline Linux containers. `previewContainer.ts` runs any project with a `Dockerfile` or compose file: `previewCompose.ts` turns the file into a plan and the compose model Relay runs (an allowlist, host access refused, mounts copied, one internal network), `previewTar.ts` sends the snapshot to `docker build`, and `previewEngine.ts` attaches to the main service's terminal through the Engine API (the panel's `components/PreviewTerminal.tsx`, xterm.js). Preview-origin requests are routed separately from the Relay API, and static responses use a public asset allowlist. [App preview runtime](docs/developer-guide.md#app-preview-runtime)
- `src/server/publish/`: publishing a previewed app to the user's own Render and Neon accounts, only on the user's request ([Architecture → Publishing an app](docs/architecture.md#publishing-an-app)): `plan.ts` (pure: a preview's mode and files to Render's service, the databases and the variables, `databaseEnv()`; a compose file through the preview's own parser), `render.ts` and `neon.ts` (their APIs over `http.ts`'s bounded `hostJson()`: the key in `Authorization` alone, no redirect, only their hosts, stand-ins only on this computer: `RELAY_RENDER_API_URL`, `RELAY_NEON_API_URL`), `git.ts` (a private repository through gh, the snapshot pushed as one `git fast-import` commit from a bare repository in `data/tmp`; `RELAY_PUBLISH_GIT_DIR` for the end-to-end tests' stand-in repositories), `initdb.ts` (a compose file's `.sql` init scripts run once on Neon by `psql` in a container of Relay's own, the address on stdin), `store.ts` (the keys in the credential store as `publish.render` and `publish.neon`, the rest in `app_settings` key `publish`), `index.ts` (`AppPublisher`: each publish a job of steps the panel polls, updates, unpublishing); `AppPreviews.publishSource()` hands it the preview's files again, refused when their digest changed (`previewDigest()`). The UI: `src/web/publish.ts`, `components/PublishDialog.tsx`, `components/PublishSettings.tsx` (Settings → Publish to the cloud).
-- `src/server/files.ts`: browsing a chat's working directory and agents' worktrees (inside the folder only, never `.git`), and what a folder's ZIP download holds; `zip.ts` writes that ZIP file as it is sent.
+- `src/server/files.ts`: browsing a chat's working directory and agents' worktrees (inside the folder only, never `.git`), and what a folder's ZIP download holds; `zip.ts` writes that ZIP file as it is sent; `fileEdit.ts`: changing files from the Files panel (a text file saved over the version it was loaded at, a new file, an upload: `PUT …/files/text`, `POST …/files/upload`), only in a working directory where edit mode would be allowed, never through a link, written at once (a temporary file renamed over it), and refused while a run may be writing in that folder (`Orchestrator.writingIn()`); `src/shared/fileNames.ts` the names it takes.
- `src/server/writeGuard.ts`: the team checks' protected paths for a member's turn (`RunOptions.guard`), which each adapter has its CLI refuse writing as far as it allows ([Sandboxing → The team's protected paths](docs/sandboxing.md#the-teams-protected-paths)): whether a path is one, as absolute globs, as sandbox-runtime's globs (macOS), and what matches now by name.
- `src/server/hooks.ts`, `hookShim.ts`: the team checks' hooks for a member's turn (`RunOptions.hooks`, `TurnHooks`): commands run before and after its CLI's own tool calls, as a check's commands run, for the CLIs whose adapter can ask (`HOOK_PROVIDERS`: Claude Code through its hook callbacks, Pi through its gate, Codex, Copilot and Muse Code through the hook program `hookShim.ts`, which reaches the server over the gateway's socket, `ToolGateway.hookProgram()`); a member on another CLI is told about in its reply ([Architecture → Team checks](docs/architecture.md#team-checks), "Hooks").
- `src/server/protect.ts`: what agents below full access may not reach (the browsers' folders, the database, and in a GitHub codespace its token files and gh's sign-in; Harness Relay's own folder in edit mode), handed to each CLI's sandbox by its adapter (to Copilot's as its policy's denied paths; to Cursor, which has none, as deny rules for its own file tools; to Antigravity, which has none either, as refusals when it asks to read or write one; to Muse Code as deny rules in its permission profile, which its file tools follow too).
@@ -138,6 +141,8 @@ The server can start agents with write access, so keep its defences intact (see
- The server binds to `127.0.0.1`. Agent replies cannot make the browser load remote content (images are links; local media goes through the media endpoint's path checks). Keep it that way.
- An open agent's process starts only through `startOpenProcess()` (`src/server/agents/open.ts`): below full access it runs in the relay sandbox, which fails closed. Never run one around it. Model keys go to the CLI in environment variables (only the run's own backend's), never into the config files its adapter writes; everything a run writes goes in the conversation member's own state folder (`home(root, state)`, `/private/`); the files that decide what the CLI does when it starts are its `configPaths`, read-only in the sandbox. A sandbox opening (`localPorts`, `connectPorts`, `allowPty`, `allowUnixSocketsInTmp`, `allowTlsTrustd`, `quietlyDeniedHosts`) is asked for by one adapter for its own CLI only, and documented in `docs/open-agents.md` and `docs/sandboxing.md`.
- Harness Relay's own tools (`src/server/gateway.ts`) reach the server only over the gateway's socket, with a token made for one turn and kept in a file under `data/tmp`, or over its loopback HTTP endpoint (`GATEWAY_OVER_HTTP`), with the token only in the CLI's memory (given over its stdin, in its session's MCP servers), never through the HTTP API, an environment value or a command line. A CLI joins `GATEWAY_OVER_HTTP` only once `scripts/mcp-headers-check.ts` shows that it writes an MCP server's headers to no file. Their credentials stay in the server. Calls that reach other people and proposed Google Docs or Obsidian note writes (tier `send`) wait in the outbox (`src/server/outbox.ts`). Only the user's explicit confirmation (`POST /api/conversations/:id/outbox/:itemId`) sends the message or writes the approved text. What a tool returns from elsewhere (a page, a mail) is given to agents as data, never instructions.
+- A secret the user gives on an agent's card (`src/server/handoffs.ts`) is kept only through `SecretStore` and goes only to the fixed commands that name it: in a file of their run's own folder in Harness Relay's own sandbox (`RELAY_SECRETS_FILE`, `src/server/fixedCommands.ts`), never into a message, the database as it is, the UI, an agent's environment, a command line or a log; a fixed command's output is masked (`maskValues()`) before it goes anywhere. A fixed command runs only in Harness Relay's own sandbox, whatever the conversation's permission, reaching only its own hosts, and only while its pin holds (the code in its folder as the user saved or approved it); never run one around `runFixedCommand()`, nor let an agent's block run one without the user's click. Keep the relay sandbox's run folders in the other CLIs' protected reads (`agentProtectedReads()`).
+- An interactive command (`src/server/interactive.ts`) starts only on the user's click on its card, never from an agent or an automation's run, through the fixed shell script with the command line in the environment, an environment of `checkEnv()`'s kept variables without `CI` (never the server's), in an empty folder of its own unless the user picks the working directory; what is typed hidden and the folder's secrets are masked in its output, which reaches the agents only when the user sends it. A browser handed to the user (`browser_hand_over`, `src/server/browser/handover.ts`) keeps every launch argument and rule of the chat's browser but `--headless=new`, and gives the agent only how it ended. Files panel writes (`src/server/fileEdit.ts`) go only into a conversation's working directories where edit mode is allowed, never through a link, never while a run writes in that folder.
- `run_code` (`src/server/runCode.ts`, only while Settings → Labs has one of its modes on) runs an agent's code only in Harness Relay's own sandbox (`sandboxedRunner()`), in every permission, full access included: read-only, no host allowed and none asked about, no opening, an environment of the server's locale and time zone only, and no run where that sandbox cannot start. Its runner reaches the server only over its own stdin and stdout, never with a token, and its calls go only through the `GatewayScope` it is given, so each is decided by its tier as the turn's own call would be, and never reaches `run_code` itself or another `scoped` tool. Never give it a token, the network, a writable working directory or the server's environment, nor let it call a tool around `ToolGateway.call()`. In RLM mode its `llm_query()` questions come over the same stdio and the server asks the sub-model itself (`llmQuery.ts`): a plain completion with no tools, sent only to its model connection's own host through `pinnedSend()` with no redirect, the key never leaving the server, within `RLM_LIMITS`; or, through a CLI (`cli:[:][/]`), a turn of Claude Code, Copilot or Muse Code only (`SUB_MODEL_CLIS`) with `RunOptions.toolless`, read-only, in an empty folder of its own (`cliSubModel.ts`); never let the sub-model take tools or `run_code`, and add a CLI to `SUB_MODEL_CLIS` only once its toolless run was seen to offer the model no tool at all (`scripts/cli-check.ts`'s `toolless` scenario).
- The browser tools' Chromium (`src/server/browser/session.ts`) connects only through its own proxy (`proxy.ts`), which checks the address each connection goes to: never start it without `--proxy-server` and `--proxy-bypass-list=<-loopback>`, nor let anything it loads reach the network another way. Its page scripts run in an isolated world, and its environment is `launchEnv()`'s (`browserEnv()`'s, and on Linux its config and cache folders in its profile, where its crash reports go), never the server's, nor may it write in the user's own browsers' folders.
- Two routes take something else instead of a browser's sign-in. A schedule's webhook (`POST /api/hooks/:id`) takes its own token: keep it hashed (`schedules.hook_hash`, compared in constant time) and its body an `` block of data. The OAuth callback (`POST /api/oauth/callback`, in `OPEN` in `app.ts`) takes a sign-in's state (an account's, or a library MCP server's own), since the provider's redirect brings no key and, in the desktop app, comes to the system browser: keep the state random, made for one sign-in a signed-in browser started, good once and for minutes, compared as a hash, with the PKCE verifier kept in the server, and its answer to how that sign-in went.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 369da26a..e37b09ee 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -70,6 +70,8 @@ Fork the repository (or create a branch if you have write access), branch off `m
- The server binds to `127.0.0.1`, and agent replies must not make the browser load remote content (images are shown as links; local media goes through the media endpoint's path checks).
- An open-source agent's process starts only through `startOpenProcess()` (`src/server/agents/open.ts`), which puts it in Harness Relay's own sandbox below full access and fails closed. Model keys reach the CLI in environment variables (only the run's own backend's), never in the config files its adapter writes, and everything a run writes goes in the conversation member's own state folder (`home(root, state)`). A sandbox opening is asked for by one adapter for its own CLI only, and documented in [docs/open-agents.md](docs/open-agents.md) and [docs/sandboxing.md](docs/sandboxing.md).
- Harness Relay's own tools (`src/server/gateway.ts`) reach the server only over the gateway's socket, with a token for one turn kept in a file under `data/tmp`, or over its loopback HTTP endpoint, with the token only in the CLI's memory (a CLI gets it so only once `scripts/mcp-headers-check.ts` shows it writes the token to no file), never through the HTTP API. Their credentials stay on the server. Put outgoing messages and invitations, Google Docs writes and Obsidian note writes in the outbox. Show the destination and proposed content, and perform the action only after the user confirms that preview. Two routes take a proof of their own instead of a browser's sign-in: a schedule's webhook, its token (kept hashed), and the OAuth callback (`POST /api/oauth/callback`), the state of a sign-in a signed-in browser started (once, within minutes, compared by hash).
+- A secret the user gives on an agent's card is kept only in the credential store and goes only to the fixed commands that name it, in a file of their run's own folder: never into a message, the database as it is, the UI, an agent's environment, a command line or a log. A fixed command runs only in Harness Relay's own sandbox, reaching only its own hosts, only while the code in its folder is as the user saved or approved it, and only when the user clicks; its output is masked before it goes anywhere.
+- An interactive command starts only on the user's click on its card, never from an agent or an automation's run, with an environment of its own (never the server's), in an empty folder unless the user picks the working directory; its output reaches the agents only when the user sends it, with what was typed hidden masked. A browser handed to the user keeps every rule of the chat's browser and tells the agent only how it ended. The Files panel writes only into a conversation's working directories, never through a link, never while a run writes there.
- `run_code` (`src/server/runCode.ts`, only while Settings → Labs has one of its modes on) runs an agent's code only in Harness Relay's own sandbox, in every permission: read-only, with no network and none of the server's environment. Its calls reach the server only over the runner's own stdin and stdout, never with a token, and each is decided by its tier as the turn's own call of that tool would be. In RLM mode, the server asks the sub-model itself (`src/server/llmQuery.ts`): a plain completion with no tools, sent only to its model connection's own host, the key never leaving the server; or through a CLI account (`src/server/cliSubModel.ts`), only Claude Code, Copilot or Muse Code, whose runs it gives no tool at all (`RunOptions.toolless`). The sub-model never gets tools, and a CLI joins that list only once its toolless run was seen to offer none (`scripts/cli-check.ts`'s `toolless` scenario).
- An OAuth account's refresh token lives in the credential store and its access tokens in memory only; tokens go only to their provider's hosts (a token for mail only to its provider's own mail servers, over TLS or STARTTLS), never follow a redirect, and never reach the UI or a CLI. A tool library MCP server's own sign-in keeps its tokens the same way, and gives its access token to a CLI only in that server's headers for one turn, for the server's own host over https (plain http to this computer only); for a server elsewhere its requests reach only addresses on the internet, checked and pinned, and against a mix-up the redirect's `iss` is checked and a sign-in page off its authorization server's origin opens only once the user confirmed it.
- The browser tools' Chromium connects only through its own proxy (`src/server/browser/proxy.ts`), which checks the address each connection goes to: never start it without that proxy, nor let anything it loads reach the network another way. Its page scripts run in an isolated world, and it gets only the environment `launchEnv()` gives, never the server's; it writes nothing in the user's own browsers' folders (on Linux its config and cache folders are in its profile).
diff --git a/CONTRIBUTING.zh-TW.md b/CONTRIBUTING.zh-TW.md
index 337014c1..a495b923 100644
--- a/CONTRIBUTING.zh-TW.md
+++ b/CONTRIBUTING.zh-TW.md
@@ -70,6 +70,8 @@ npm run dev # API 在 :8789(檔案變更時重啟)+ 介面在 http://
- 伺服器只綁定 `127.0.0.1`,而且 agent 的回覆不能讓瀏覽器載入遠端內容(圖片以連結顯示;本機媒體要經過媒體端點的路徑檢查)。
- 開源 agent 的程序只能透過 `startOpenProcess()`(`src/server/agents/open.ts`)啟動:完全存取以外,它會把程序放進 Harness Relay 自己的沙箱,沙箱無法啟動就不執行。模型的金鑰以環境變數交給 CLI(只有這次執行的模型來源那一把),絕不寫進轉接器寫的設定檔;一次執行寫入的一切都放在對話成員自己的狀態資料夾(`home(root, state)`)。沙箱的開口只由一個轉接器為它自己的 CLI 申請,並寫在 [docs/open-agents.zh-TW.md](docs/open-agents.zh-TW.md) 與 [docs/sandboxing.zh-TW.md](docs/sandboxing.zh-TW.md)。
- Harness Relay 自己的工具(`src/server/gateway.ts`)只能透過 gateway 的 socket 連到伺服器,用只給一回合、存在 `data/tmp` 底下檔案中的權杖;或透過它的本機 HTTP 端點,權杖只留在 CLI 的記憶體中(要等 `scripts/mcp-headers-check.ts` 確認某個 CLI 不會把權杖寫進任何檔案,它才能這樣拿到),絕不經過 HTTP API。憑證留在伺服器中。要送出的訊息或邀請,以及 Google 文件和 Obsidian 筆記的寫入,都要放進待送出匣。顯示目的地與內容,等使用者確認該份預覽才執行。有兩條路由用自己的證明代替瀏覽器登入:排程的 webhook 用它的權杖(只存雜湊),OAuth 回呼(`POST /api/oauth/callback`)用已登入的瀏覽器開始的那次登入的 state(只能用一次、幾分鐘內有效、以雜湊比對)。
+- 使用者在 agent 的卡片上提供的密鑰只存在憑證儲存區,而且只交給列出它的固定指令,放在它這次執行自己資料夾裡的檔案:從不進入訊息、從不以原樣存進資料庫,也從不送到介面、agent 的環境變數、指令列或記錄檔。固定指令只在 Harness Relay 自己的沙箱裡執行,只連得到它自己的主機,只在資料夾裡的程式碼和使用者儲存或核准時一樣時才執行,而且只在使用者按下按鈕時執行;它的輸出在送到任何地方之前都會遮蔽。
+- 互動指令只在使用者按下卡片上的按鈕時才啟動,從不由 agent 或自動任務的執行啟動,環境是它自己的(從不用伺服器的環境),除非使用者選了工作目錄,否則在空資料夾裡執行;它的輸出只有在使用者送出時才給 agent,隱藏輸入的內容會遮蔽。交給使用者的瀏覽器沿用對話瀏覽器的所有規則,只讓 agent 知道它怎麼結束。檔案面板只寫入對話的工作目錄,從不經過連結,也從不在有執行正在那裡寫入時寫入。
- `run_code`(`src/server/runCode.ts`,只在「設定 → 實驗室」開啟其中一種模式時才有)只在 Harness Relay 自己的沙箱裡執行 agent 的程式碼,所有權限都一樣:唯讀、沒有網路,也沒有伺服器的任何環境變數。它的呼叫只能透過 runner 自己的 stdin 與 stdout 連到伺服器,絕不使用權杖,而且每個呼叫都和這一回合自己呼叫那個工具時一樣依等級決定。RLM 模式下,由伺服器自己詢問子模型(`src/server/llmQuery.ts`):沒有工具的單純補全,只送到那個模型連線自己的主機,金鑰絕不離開伺服器;或透過 CLI 帳號問(`src/server/cliSubModel.ts`),只限 Claude Code、Copilot 或 Muse Code,它們的執行完全沒有工具(`RunOptions.toolless`)。子模型絕不會有工具,一個 CLI 只有在它沒有工具的執行被證實完全不給模型工具之後,才能加進這個名單(`scripts/cli-check.ts` 的 `toolless` 情境)。
- OAuth 帳號的更新權杖存在憑證儲存區,存取權杖只放在記憶體;權杖只送到它服務的主機(郵件權杖只透過 TLS 或 STARTTLS 送到它服務自己的郵件伺服器),絕不跟隨重新導向,也絕不交給 UI 或 CLI。工具庫 MCP 伺服器自己的登入也這樣保存權杖,而且只在一回合裡、放在那台伺服器的標頭把存取權杖交給 CLI,只給伺服器自己的主機,走 https(純 http 只限這台電腦);別處伺服器的登入請求只連網際網路上的位址,先查過並固定連到查過的位址;為了防止混淆攻擊,會檢查重新導向的 `iss`,不在授權伺服器來源上的登入頁面也要使用者確認後才打開。
- 瀏覽器工具的 Chromium 只透過它自己的 proxy(`src/server/browser/proxy.ts`)連線,proxy 會檢查每個連線要去的位址:絕不能不帶那個 proxy 啟動它,也不能讓它載入的任何東西用別的方式連上網路。它在網頁中執行的腳本在 isolated world 中執行,它只拿到 `launchEnv()` 給的環境變數,絕不是伺服器的;它也不在使用者自己瀏覽器的資料夾裡寫任何東西(在 Linux 上,它的設定與快取資料夾都在它的設定檔裡)。
diff --git a/README.md b/README.md
index 04a39b08..0fa57481 100644
--- a/README.md
+++ b/README.md
@@ -56,13 +56,13 @@ These twelve examples are just a starting point. Bring your curiosity and a task
- **The lead agent writes it for you**: say in a sentence what you want, and it writes a template, the team checks (reading the project first) or an automation for you to review and save; it also names new chats and suggests how to organize your groups, and agents propose an automation as a card when you ask for something to be done later or again. ([Lead agent](docs/user-guide.md#lead-agent), [proposed automations](docs/user-guide.md#automations))
- **Agents talk to each other**: roundtable, parallel or relay, and `@mentions` to address one of them. ([Conversation rules](docs/user-guide.md#conversation-rules))
- **Safe editing with git**: each working directory (up to eight per chat) becomes a git repository, each reply shows the files it changed with a diff, in parallel mode every agent works in its own worktree, and a chat started while another one changes the same folder works in a worktree of its own. ([Reviewing and applying changes](docs/user-guide.md#reviewing-and-applying-changes), [Two chats in one folder](docs/user-guide.md#two-chats-in-one-folder))
-- **You stay in charge**: a permission per chat (read-only, edit, approve for me, full access), approvals in the chat for anything beyond it (with approve for me, the lead agent approves what it judges safe and asks you about the rest), agents that ask you rather than guess, and messages you can send while they reply. ([Approvals](docs/user-guide.md#approvals), [chatting](docs/user-guide.md#4-chat))
+- **You stay in charge**: a permission per chat (read-only, edit, approve for me, full access), approvals in the chat for anything beyond it (with approve for me, the lead agent approves what it judges safe and asks you about the rest), agents that ask you rather than guess, or give you steps to tick off, a card for a secret that keeps it out of the chat and away from the agents, given only to a script Harness Relay runs itself in its own sandbox, a sign-in command you run from its card, the chat's browser handed to you to sign in to a site, and messages you can send while they reply. ([Approvals](docs/user-guide.md#approvals), [secrets and fixed commands](docs/user-guide.md#secrets-and-fixed-commands), [chatting](docs/user-guide.md#4-chat))
- **Everything live**: replies, reasoning, plans and tool activity stream in; Mermaid diagrams, images and the files agents make show in the chat; copy, edit, retry or branch from any reply. ([Copying, editing and retrying](docs/user-guide.md#copying-editing-and-retrying), [branching](docs/user-guide.md#branching-a-conversation))
-- **Harness Relay's own tools**: a browser of its own, mail and a calendar for the agents of every CLI (Grok's, Muse Code's, and the open-source agents' but OpenCode's, in full access only), through one MCP server; what reaches other people waits in an outbox until you send it. Microsoft 365, Outlook.com and Google calendars and mail sign in in the browser (OAuth), their tokens kept from the agents. ([Harness Relay's tools](docs/user-guide.md#harness-relays-tools-browser-mail-and-calendar))
+- **Harness Relay's own tools**: a browser of its own, mail and a calendar for the agents of every CLI (Grok's, Muse Code's, and the open-source agents' but OpenCode's, in full access only), through one MCP server; the browser comes to you when a page needs you (a sign-in, a CAPTCHA), in a window or in the chat, and what reaches other people waits in an outbox until you send it. Microsoft 365, Outlook.com and Google calendars and mail sign in in the browser (OAuth), their tokens kept from the agents. ([Harness Relay's tools](docs/user-guide.md#harness-relays-tools-browser-mail-and-calendar))
- **Automations**: send the team a message when you run one, at set times (a review of yesterday's commits every weekday at 9:00), when something happens (a new mail, an event about to begin, a pull request or a failed CI run, a file; Harness Relay checks it itself), or when a program on this computer calls its webhook; an automation can track a goal across days until an agent says it is reached, and tries a failed run again. ([Automations](docs/user-guide.md#automations))
- **App previews** let you try an app from a reply or Files with one click, and open by themselves when the team makes one. Relay opens static HTML directly, detects the npm script to build a frontend or run a backend, or runs a `Dockerfile` or compose file in any language in Docker, showing its page or, for a terminal program, its terminal. You can copy errors to your chat draft. [Previewing an app](docs/user-guide.md#previewing-an-app)
- **Publishing to the cloud**: once a preview works, publish it in one click to your own free Render (sites and backends) and Neon (PostgreSQL) accounts, through a private GitHub repository of yours. [Publishing an app](docs/user-guide.md#publishing-an-app)
-- **Files, voice and sharing**: attach files and screenshots, browse the working directory, dictate with voice input that stays on your computer, and share a chat as Markdown or a link. ([Browsing files](docs/user-guide.md#browsing-files), [voice input](docs/user-guide.md#voice-input), [sharing](docs/user-guide.md#sharing-a-conversation))
+- **Files, voice and sharing**: attach files and screenshots, browse the working directory and edit or upload files there (from a phone too), dictate with voice input that stays on your computer, and share a chat as Markdown or a link. ([Browsing files](docs/user-guide.md#browsing-files), [voice input](docs/user-guide.md#voice-input), [sharing](docs/user-guide.md#sharing-a-conversation))
- **Organised**: groups, pinned chats at the top, search, each chat's status in the sidebar, notifications and sound, as push notifications on a phone, and a bell that keeps every notification, the same in every browser. ([Groups](docs/user-guide.md#groups), [pinned chats](docs/user-guide.md#pinned-conversations), [search](docs/user-guide.md#search), [notifications](docs/user-guide.md#notifications-and-sound), [notification inbox](docs/user-guide.md#notification-inbox))
- **Apps and tools** lets you connect common apps, choose which assistants can use them, and review proposed messages, Google Docs edits and Obsidian note changes in the outbox. [Connect common apps](docs/user-guide.md#common-apps)
- **The agents' own features**: per account, each CLI's own subagents and Claude Code's workflows on or off; a subagent's steps shown under the step that started it; a message sent straight into the speaking member's running turn; context windows for your own models; a member's own limit. ([Subagents and workflows](docs/user-guide.md#subagents-and-workflows))
diff --git a/README.zh-TW.md b/README.zh-TW.md
index 11032e5d..8ce0b644 100644
--- a/README.zh-TW.md
+++ b/README.zh-TW.md
@@ -54,15 +54,15 @@
- **每個問題都有自己的團隊**:首席 agent 從你的範本挑選或設計團隊(角色、模型、推理強度、發言順序),你確認後才開始;團隊回答完,它會審閱回覆,標出需要你注意的地方。([自動組隊](docs/user-guide.zh-TW.md#自動組隊)、[範本](docs/user-guide.zh-TW.md#範本)、[首席 agent 審閱](docs/user-guide.zh-TW.md#首席-agent-審閱))
- **agent 之間互相溝通**:圓桌、平行或接力三種模式,也能用 `@` 指定成員。([對話規則](docs/user-guide.zh-TW.md#對話規則))
- **用 git 安全地改檔**:每個工作目錄(一個對話最多八個)都會成為 git repository,每則回覆都列出它改了哪些檔案並附上 diff,平行模式中每個 agent 在自己的 worktree 工作,另一個對話正在修改同一個資料夾時開始的對話也在自己的 worktree 裡工作。([檢視與套用修改](docs/user-guide.zh-TW.md#檢視與套用修改)、[兩個對話同一個資料夾](docs/user-guide.zh-TW.md#兩個對話同一個資料夾))
-- **由你掌控**:每個對話有自己的權限(唯讀、可編輯、替我核准、完全存取),超出範圍的動作在對話中請你核准(替我核准時,首席 agent 先放行它認為安全的,其餘才問你);agent 不確定時先問你而不亂猜;團隊回覆時你也能插話。([核准](docs/user-guide.zh-TW.md#核准)、[對話](docs/user-guide.zh-TW.md#4-對話))
+- **由你掌控**:每個對話有自己的權限(唯讀、可編輯、替我核准、完全存取),超出範圍的動作在對話中請你核准(替我核准時,首席 agent 先放行它認為安全的,其餘才問你);agent 不確定時先問你而不亂猜,或給你一張可以逐項勾選的步驟清單;要密鑰時用卡片,值不進聊天也不交給 agent,只交給 Harness Relay 在自己的沙箱裡執行的腳本;需要登入的指令由你從卡片上執行;要你親自登入網站時,對話的瀏覽器會交給你;團隊回覆時你也能插話。([核准](docs/user-guide.zh-TW.md#核准)、[密鑰與固定指令](docs/user-guide.zh-TW.md#密鑰與固定指令)、[對話](docs/user-guide.zh-TW.md#4-對話))
- **團隊檢查**:在可編輯與完全存取的對話中,為整個團隊設定受保護路徑、commit 格式、`npm test` 這類指令,以及應用程式要能在預覽中開啟。Harness Relay 會自行檢查成果,可以把沒通過的自動交回團隊,也會在支援的工具呼叫前後執行 hook。([團隊檢查](docs/user-guide.zh-TW.md#團隊檢查))
- **首席 agent 替你撰寫**:用一句話說想要什麼,它就寫好範本、團隊檢查(會先查看專案)或自動任務,讓你看過再儲存;它也會替新對話命名、建議群組怎麼整理;你請團隊之後再做或定期做某件事時,agent 會用卡片提議一個自動任務。([首席助理](docs/user-guide.zh-TW.md#首席助理)、[提議的自動任務](docs/user-guide.zh-TW.md#自動任務))
- **一切即時呈現**:回覆、推理、計畫與工具動作即時串流;Mermaid 圖表、圖片與 agent 做出的檔案直接顯示在對話中;任何一則回覆都能複製、編輯、重試或分支。([複製、編輯與重試](docs/user-guide.zh-TW.md#複製編輯與重試)、[分支對話](docs/user-guide.zh-TW.md#分支對話))
-- **Harness Relay 自己的工具**:給每個 CLI 的 agent(Grok、Muse Code 與 OpenCode 以外的開源 agent 只在完全存取時)一個它自己的瀏覽器、郵件與行事曆,透過同一個 MCP server;會送到別人那裡的東西在待送出匣等你送出。Microsoft 365、Outlook.com 與 Google 的行事曆與郵件在瀏覽器中登入(OAuth),權杖不會交給 agent。([Harness Relay 的工具](docs/user-guide.zh-TW.md#harness-relay-的工具瀏覽器郵件與行事曆))
+- **Harness Relay 自己的工具**:給每個 CLI 的 agent(Grok、Muse Code 與 OpenCode 以外的開源 agent 只在完全存取時)一個它自己的瀏覽器、郵件與行事曆,透過同一個 MCP server;網頁需要你本人時(登入、CAPTCHA),瀏覽器會交給你,用視窗或在對話中操作;會送到別人那裡的東西在待送出匣等你送出。Microsoft 365、Outlook.com 與 Google 的行事曆與郵件在瀏覽器中登入(OAuth),權杖不會交給 agent。([Harness Relay 的工具](docs/user-guide.zh-TW.md#harness-relay-的工具瀏覽器郵件與行事曆))
- **自動任務**:在你執行它、到了設定的時間(例如每個平日 9:00 審查昨天的 commit)、某件事發生時(新郵件、即將開始的行程、pull request 或失敗的 CI、檔案;由 Harness Relay 自己檢查),或這台電腦上的程式呼叫它的 webhook 時,把訊息傳給團隊;自動任務可以跨天追蹤一個目標,直到 agent 回報已達成,失敗的執行也會重試。([自動任務](docs/user-guide.zh-TW.md#自動任務))
- **應用程式預覽**:從回覆或「檔案」按一下就能試用應用程式,團隊做出應用程式時也會自動打開。Relay 直接開啟靜態 HTML、依 npm 指令建置前端或執行後端,或在 Docker 中執行任何語言的 `Dockerfile` 或 compose 檔,顯示它的網頁,終端機程式則顯示它的終端機。遇到錯誤時,可以把錯誤文字加入聊天草稿。[預覽應用程式](docs/user-guide.zh-TW.md#預覽應用程式)
- **發布到雲端**:預覽沒問題後,一鍵發布到你自己的 Render(網站與後端)和 Neon(PostgreSQL)免費帳號,經由你 GitHub 帳號裡的私人儲存庫。[發布應用程式](docs/user-guide.zh-TW.md#發布應用程式)
-- **檔案、語音與分享**:附加檔案與截圖、瀏覽工作目錄、用只在你電腦上執行的語音輸入說話,並把對話分享成 Markdown 或連結。([瀏覽檔案](docs/user-guide.zh-TW.md#瀏覽檔案)、[語音輸入](docs/user-guide.zh-TW.md#語音輸入)、[分享對話](docs/user-guide.zh-TW.md#分享對話))
+- **檔案、語音與分享**:附加檔案與截圖、瀏覽工作目錄並在其中編輯或上傳檔案(用手機也行)、用只在你電腦上執行的語音輸入說話,並把對話分享成 Markdown 或連結。([瀏覽檔案](docs/user-guide.zh-TW.md#瀏覽檔案)、[語音輸入](docs/user-guide.zh-TW.md#語音輸入)、[分享對話](docs/user-guide.zh-TW.md#分享對話))
- **井然有序**:群組、釘選在最上面的對話、搜尋、側邊欄上每個對話的狀態、通知與提示音(手機上是推播通知),以及收著每一則通知的鈴鐺(每個瀏覽器都一樣)。([群組](docs/user-guide.zh-TW.md#群組)、[釘選](docs/user-guide.zh-TW.md#釘選的對話)、[搜尋](docs/user-guide.zh-TW.md#搜尋)、[通知與提示音](docs/user-guide.zh-TW.md#通知與提示音)、[通知收件匣](docs/user-guide.zh-TW.md#通知收件匣))
- **App 與工具**可連結常用 App、選擇能使用它們的助理,並在待送出匣審核要發出的訊息、Google 文件與 Obsidian 筆記的變更。[連結常用 App](docs/user-guide.zh-TW.md#常用-app)
- **agent 自己的功能**:每個帳號開關各 CLI 自己的 subagent 與 Claude Code 的 workflow;subagent 的步驟收在啟動它的那一步底下;訊息直接送進正在發言的成員進行中的回合;你自己模型的上下文長度;成員自己的上限。([Subagent 與 workflow](docs/user-guide.zh-TW.md#subagent-與-workflow))
diff --git a/docs/architecture.md b/docs/architecture.md
index 0d025a0f..870ca936 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -60,6 +60,7 @@ flowchart LR
| `src/server/reviewer.ts` | Lead review: what the lead agent reads of the team's replies since its last review, its prompt, and turning its JSON reply into a review (`src/shared/review.ts`: finding the words it quotes, shared with the chat) |
| `src/server/grouping.ts` | Sidebar groups: the lead agent sorts a new conversation into one of the user's groups by its first message, in the background (`AutoGrouper`) |
| `src/server/memory.ts` | Long-term memory: what replies' `` and `` blocks do to the notes, the user's changes, what a turn is given, and the lead agent tidying the notes in the background (`LongTermMemory`; the blocks and the choice of notes in `src/shared/memory.ts`); see [Long-term memory](#long-term-memory) |
+| `src/server/handoffs.ts`, `src/server/fixedCommands.ts` | Secrets and fixed commands: a working directory's secrets (values in the credential store, names in `app_settings`) and fixed commands, a command's pin, its run in Harness Relay's own sandbox with its secrets in a file and its output masked (the reply blocks in `src/shared/handoffs.ts`); see [Secrets and fixed commands](#secrets-and-fixed-commands) |
| `src/server/prompt.ts` | Role briefing (system prompt), per-turn prompt, `@mention` parsing, `[PASS]` detection |
| `src/server/approvals.ts` | Rule keys for "always allow in this conversation" and matching them |
| `src/server/commands.ts` | Reads a shell command line into the programs it runs (chains, substitutions, `sh -c` / `eval`, `env` / `sudo`, reserved words and compound commands such as `if` / `while` / `for`, git's global options): approval keys, the publish check of Grok, Copilot and the open agents |
@@ -106,7 +107,7 @@ For every agent the conversation also keeps **agent state**:
**Branch conversation** (the branch icon under an agent's reply, `POST /api/conversations/:id/messages/:messageId/branch`, `Orchestrator.branch()`) makes a new conversation that goes on from that reply on its own:
- It holds a copy of every message up to and including the reply, each with a new id (message ids are rows of their own), written with the conversation in one transaction (`Store.create()`). The team, the settings, the "always allow" answers (`allowRules`) are copied as they are now, not as they were at that reply: a member who left since cannot be retried there, and later "always allow" answers carry over. It goes into its family's sidebar group (`Store.placeBranch()`, with `group_source = 'user'`, so the lead agent does not sort it; see [Sidebar groups and search](#sidebar-groups-and-search)). Its title is **Branch · ** (`t().branchTitle`) until the first user message posted there names it, as a new chat is named after its first question (`nameAfter()`: only while the title is still that, in either language, `isBranchTitle()`, so a name the user gave it stays). An edit that leaves no copied message ends the branch; still called that, it is called "New chat" again (`truncateFrom()`), so the edited message names it. The schedule and the queue are not copied.
-- A question the reply asked stays open in the branch (`branchPause()`), whatever the user answered in the original since, so it can be answered another way. Branched where the original waits now, the branch copies its `pause`; otherwise the agent that asked (in parallel mode, with the round's other askers up to it) answers first, followed in roundtable mode by the members after it in the round, and in later rounds by the members the question was for. As in the original, the answer is no new question: the lead agent designs no team for it.
+- A question the reply asked stays open in the branch (`branchPause()`), whatever the user answered in the original since, so it can be answered another way. Branched where the original waits now, the branch copies its `pause`; otherwise the agent that asked (in parallel mode, with the round's other askers up to it) answers first, followed in roundtable mode by the members after it in the round, and in later rounds by the members the question was for. As in the original, the answer is no new question: the lead agent designs no team for it. A steps card the branch waits on loses the original's answer (its ticks stay), so it is answered there again.
- Attached files are copied into its own `data/attachments//` (a copy-on-write clone where the filesystem can make one; a file already gone is skipped), and the commits behind the copied replies' file changes are kept under its own `refs/harness-relay//`, so their files and diffs outlive the original. Isolated (parallel-mode) results cannot be applied there, and the images and files those replies link to are read from the worktree they were made in (`replyWorktree()`: the one holding the turn's branch, in the conversation the reply was written in: any its copied messages came from, and further up for a branch of a branch), never from the branch's own worktree for that agent; once the original is deleted, with its worktrees, they are not found.
- It is a branch of the conversation the reply was written in (`branchOrigin()`). That is the original for a reply written there; but up to a branch's branch point, its messages were copied, so branching from a reply there (the branch point included) makes a branch of the conversation the reply was copied from, or of one further up for a branch of a branch, as if it had been branched there: it is listed under that one in the sidebar, says **Continued from** that one, and is called **Branch · **, by its title now (`Store.titleOf()`; for one deleted since, the title the sidebar shows for it). The branch is worked out again once the attached files are copied, in the same step as it is saved (unless the original's messages up to the reply changed meanwhile): deleting waits only for branches made from the conversation itself, so one it comes from that was deleted meanwhile is known as deleted, with its `via`. So after B is branched from A, a branch from a reply B copied from A is A's branch, not B's.
- `conversation.branch` (`ConversationBranch`: the id of the conversation it was branched from, its title then, and `afterId`, the last copied message here; `earlier`: where the copied messages before those were written, when they were copied from further up, as parts of their own, nearest first, each with its conversation, title and last message here) is stored as JSON in `conversations.branch`. Branching from a reply in one of the `earlier` parts makes a branch of the conversation that part names; only the parts before the reply come along. A part whose last message is not in the conversation cannot be placed and is left out. ChatView shows **Continued from ** after the chat's title in the header (each takes the room it needs; when both need more, each gets half, and one needing less leaves the rest to the other, both ending in …) and as a line after `afterId`, linking to the original while the conversation list has it (with its title now), and its title then once it is deleted. The line is an element between messages, which a shared page skips (`messageElements()`, as it takes one element per message); shared pages leave both out. Retrying or editing a copied message moves `afterId` back to the last copied message left (`branchAfterCut()`), and a part that loses all its messages goes: with nothing left of the conversation it was branched from, it is a branch of the one further up, by that one's title now (and while still called **Branch · **, called after that one). Once no copied message is left, `branch` is removed.
@@ -179,7 +180,9 @@ Only one run per conversation can be active at a time; different conversations c
**Steering** (`settings.steer`, off by default; Team settings' box, `PUT /api/conversations/:id/steer`, switched at any time, also while the team replies). With it on, a message sent while members work goes into their running turns instead of the queue (`Orchestrator.steerOrQueue()`, `steerInto()`), as the mode and the members' CLIs allow (`STEER_PROVIDERS`): in roundtable and relay mode into the turn of the member speaking now (the members after it get it before their own turns, as any message); in parallel mode into every turn of the round at once, only while all of them are still running and each can take one (`Run.round`), so that the round sees the same messages. A runner whose CLI can take one gives the orchestrator a way to send it once its prompt is out (`RunOptions.onSteer`, see [CLI adapters](#cli-adapters)) and takes it back as its turn ends. The message goes in as a chat block (`buildSteerPrompt()`); once a turn took it, it is posted in the chat after the reply it went into, marked `queued` (it joined a discussion under way) and `steered` (the members whose turns took it, `messages.steered`; the chat shows **Sent into @X's turn**), and it counts as seen by those members once their turns end well (a turn that fails offers it again, as it does its prompt's messages). It waits in the queue as before when steering is off, it has attached files, a message already waits in the queue (the chat keeps the order they were sent in), it @mentions only other members, the run is not the team's turns (the lead agent designs or reviews, a design waits for confirmation, a fix or failed team checks hold the queue, a check's command runs), or the CLIs refuse it or their turns end in between. Messages go one at a time per conversation, in the order they were sent. In parallel mode, a member of the round whose turn ended just before the message reached it gets it with its next turn's messages. A schedule's messages are never steered; one the user steered into a run a schedule started means they are here, as a queued one does (approvals are asked again). Retrying the reply a message went into deletes the message too, as it does every message after the reply.
-**Questions to the user.** The briefing tells agents to ask instead of guessing when a good answer depends on something only the user knows, and to end such a reply with `[ASK_USER]` on its own line (`src/shared/ask.ts`; the UI hides the marker while the reply streams). When a turn ends, `takeAsk()` removes the marker from the message and marks it `asked`, and the run stops there: `pauseFor()` saves where (`conversation.pause`, a `RunPause` in `conversations.pause`, sent to the browser with the `conversation` event). Roundtable stops at once and keeps the rest of the round; parallel lets the round finish, then keeps the agents that asked; relay keeps the rest of the queue and the handoffs left. While the team waits, messages in the queue do not start a run. The next run (`takePause()`) picks up from there: the agents that asked speak first, told on that turn that the user replied (`TurnInfo.answered`), then the rest of the round (or relay queue) and the remaining rounds. Continue with nothing to post skips the agents that asked. A reply that @mentions anyone else, an edit or retry (`truncateFrom()` clears the pause), a team design or a changed mode starts afresh instead. The user's reply is an answer, not a new question, so [auto team](#auto-team) designs no team for it. The conversation list reports `asking` for the sidebar.
+**Questions to the user.** The briefing tells agents to ask instead of guessing when a good answer depends on something only the user knows, and to end such a reply with `[ASK_USER]` on its own line (`src/shared/ask.ts`; the UI hides the marker while the reply streams). When a turn ends, `takeAsk()` removes the marker from the message and marks it `asked`, and the run stops there: `pauseFor()` saves where (`conversation.pause`, a `RunPause` in `conversations.pause`, sent to the browser with the `conversation` event). Roundtable stops at once and keeps the rest of the round; parallel lets the round finish, then keeps the agents that asked; relay keeps the rest of the queue, with the teammates the asking reply @mentioned added to it (a reply that gives the user steps and hands off to a reviewer: the reviewer speaks once the user has answered; a branch from such a reply waits the same way, `branchPause()`). While the team waits, messages in the queue do not start a run. The next run (`takePause()`) picks up from there: the agents that asked speak first, told on that turn that the user replied (`TurnInfo.answered`), then the rest of the round (or relay queue) and the remaining rounds; in relay mode the handoffs count afresh from `maxHops`, as for a new message, since the user stepped in. Continue with nothing to post skips the agents that asked. A reply that @mentions anyone else, an edit or retry (`truncateFrom()` clears the pause), a team design or a changed mode starts afresh instead. The user's reply is an answer, not a new question, so [auto team](#auto-team) designs no team for it. The conversation list reports `asking` for the sidebar.
+
+**Steps for the user.** For what only the user can do outside Harness Relay (a sign-in, a developer console, a payment, a device), the briefing tells agents to end the reply with the steps in a block on lines of its own, ``, one numbered step a line, ``, as plain text (never in code), never for questions (those keep `[ASK_USER]`) and never asking for a secret. It is plain text, so every CLI can write it at every permission. When a turn ends, `takeSteps()` takes the last such block off the reply's last text part (`splitSteps()` in `src/shared/steps.ts`, pure and tolerant: numbers, bullets and task boxes before the steps, an unmarked line or deeper bullet going on the step before it, Markdown marks or a backtick around the tags on their own lines, the closing tag at the end of the last step's line, or missing when the block's first line is a numbered or bulleted step; but only what is plainly a block: an opening tag at a line's start followed by nothing or a step's number or bullet, never prose that names the tag; a closing tag inside inline code closes nothing; a fence counts only when it holds the block alone and ends the reply, so an example of the syntax stays code; a block among other code, running across a fence, with no step, more than 30 steps or 8,000 characters stays as text, as written) into a `steps` part (`{ type: 'steps', items: StepItem[], answer?: StepsAnswer }`, kept in `message_parts` with the steps' words in `text`, which search reads), after `takeAsk()` (a marker before or after the block is taken too) and before a `