Skip to content

Safety ​

Six layers decide whether a tool call runs, in order. The first layer to stop a call ends it; a call that reaches the end runs inside the configured sandbox.

LayerSettingValues
Work modecomonad.modechat, ro, sw, aw, plan
Network access policycomonad.networkon, off
User rulescomonad.permissionsdeny, ask, allow lists
Tool approval policycomonad.approvalmanual, whitelist_accept, blacklist_reject, universal_accept, universal_reject
Approval response policycomonad.approvalResponseask, never
Sandbox modecomonad.sandboxModeworkspace-read, read-only, workspace-write, danger-full-access

1. Work mode ​

The mode decides which capabilities exist at all.

ModeCapabilities
Chat Only (chat)No tools; plain conversation
Read-Only (ro)Read files, read-only shell
Semi-Write (sw)+ write files, + test shell (workspace read-only, scratch writable)
Full Access (aw)+ full shell
Plan (plan)Read files, read-only shell, reads and writes plan files

The mode is a hard ceiling: an explicit capability set can only narrow it. A Plan session with an explicit rw still cannot write project files. The mode is a setting; each turn merges the current setting into the chat's policy.

The mode does not set approval, network or sandbox. To start a plan, select the Plan mode (chat mode pill, Comonad: Select Mode, or Settings → Policies → Work mode) and ask for it. A plan file also needs a sandbox that permits writes and an approval policy that runs rw_plan (or an allow rule); otherwise write_plan and edit_plan are hidden or refused and the plan stays in the summary.

2. Network access policy ​

on lets tools that declare a network need run, and lets commands reach the network inside the sandbox. off refuses both. Loopback stays available inside the OS sandbox, so local test servers and IPC clients still work.

3. User rules ​

Rules are patterns in comonad.permissions.allow, ask and deny:

text
run_shell(npm run test:*)
read_file(./.env)
fetch_url(domain:example.com)

Edit them in Comonad: Open Settings → Policies → User rules, one rule per line. The lists are checked in this order:

  1. deny — the call is rejected;
  2. ask — the call is confirmed;
  3. allow — the call runs.

A rule that matches decides the call; the tool approval policy is consulted only when none of the three lists matched. This means an allow rule runs even under universal_reject.

4. Tool approval policy ​

PolicyRunsAsksRejects
manual–every call–
whitelist_acceptro, shell_ro, ro_plan, rw_planeverything else–
blacklist_rejecteverything elsedangerous commandsrw, shell_test, shell_rw, rw_plan
universal_accepteverythingdangerous commands–
universal_reject––every call

The whitelist and blacklist are fixed capability sets; use the user rules to name individual tools or arguments.

5. Approval response policy ​

  • ask sends each confirmation to a responder — the chat panel, the chat participant, or the fallback dialog. A responder answers only requests for its own chat. If no responder answers, the request is denied; it never falls open.
  • never denies every confirmation without showing it.

Approvals pause the turn. Always allow adds an allow rule. Stop cancels the turn for real: a foreground shell command is killed with its process tree, and a pending approval is withdrawn and denied. Background tasks started with start_shell keep running; stop them from the Tasks view or with stop_shell.

6. Sandbox mode ​

The sandbox mode is the file range every approved call runs under. The executor resolves it per call, and the file tools plus the OS sandbox (sandbox-exec on macOS, bwrap on Linux) enforce it.

ModeReadsWrites
workspace-readworkspace + system runtimenone
read-onlyanywherenone
workspace-writeanywhereworkspace only
danger-full-accessanywhereanywhere

A call can narrow the mode but never widen it: the read-only shell writes nothing, the test shell writes only its scratch tree, and run_task runs the editor's own process, so it is available only under danger-full-access.

No OS sandbox ​

On Windows, or a host without sandbox-exec/bwrap, a writable shell can only run under danger-full-access with the network access policy on; every other combination refuses it, because the file and network limits could not be enforced. The read-only shell and the test shell always need an OS sandbox, because their promises cannot be kept without one. The chat footer and /status say when the host has no OS sandbox.

Workspace boundary details ​

  • A workspace-write shell gets a temp directory at <working directory>/.comonad/tmp with TMPDIR pointing at it.
  • The test shell uses its own tree, <working directory>/.comonad/scratch/<session>, exposed as $COMONAD_SCRATCH; TMPDIR, TMP, TEMP, HOME, XDG_CACHE_HOME and PYTHONPYCACHEPREFIX point into it. The rest of the workspace stays read-only.
  • .env files are denied to reading and writing; .git is never writable by file tools.
  • Symlinks are resolved before the containment check.
  • Secrets (keys, tokens, passwords) are stripped from the environment unless comonad.filterSensitiveEnv is off.

Orchestrator and subagents ​

The root turn is the Orchestrator: it records the task graph, delegates ready nodes and delivers the integrated result. The fourteen built-in roles are leaf workers. A child never receives task_graph, delegate, task_status, resume or the old agent tool, and spawnAgent refuses a spawn from a child.

A subagent runs the same six layers with its own effective policy, built when the delegation starts. It can only narrow the parent:

PolicyWhat the child gets
Capabilitiesparent effective capabilities ∩ the role's capabilities ∩ the task's capability filter ∩ the hard cap (ro, ro_plan, shell_ro, rw, shell_test)
Networkparent switch AND the role's default; a task may turn it off, never on
User rulesall ancestor rules; deny > ask > allow
Tool approvalthe parent's approval policy
Approval responsefixed never
Sandboxthe stricter of the parent sandbox and the delegation's ceiling

Consequences:

  • A parent in ro refuses every child write.
  • A parent in Plan mode delegates read-only research only. task_graph, delegate and resume refuse a new or revised task whose effective capabilities include rw or whose acceptance needs a command; accepted nodes are history and stay. Record or revise the implementation plan with write_plan or edit_plan and build it in a write-capable mode. Build archives the research task graph, so the build turn starts with a fresh one and the plan file as its handoff.
  • A parent with network off keeps it off for the child; a researcher task that needs network fails before it starts.
  • An ancestor deny beats any child allow; an ancestor ask is denied by the child's fixed never response without a card.
  • A write delegation needs a parent policy that runs writes without asking (universal_accept, blacklist_reject, or an allow rule). Under manual/whitelist_accept, write the change in the main thread where the user can approve it.
  • files grants only tracked file tools; test grants run_shell_test. A role's default grant comes from the role table. Plan reads use ro_plan; write_plan and edit_plan are never granted to a child.
  • A child's file writes are journaled under the parent chat, so they appear in its review and Git Changes.

Acceptance and parallel work ​

  • A task whose effective capabilities include rw must have at least one review or command acceptance criterion. The runtime derives a pinned built-in reviewer or tester child after the worker batch; a project .comonad/agents/reviewer.md cannot weaken acceptance.
  • The worker and verifier return a JSON envelope. Malformed output is invalid_output; a self-declared verdict is advisory and acceptance is recomputed from per-criterion results. Each acceptance entry must use the task's exact criterion id; an equal-length all-different list is mapped positionally and recorded, while partial coverage is invalid_output. A command criterion runs read-only with a scratch-only shell; a tester may use a byte-identical $COMONAD_SCRATCH copy and must report the exact command, its real exit code and a mirror: <path> note.
  • Read and write tasks may run in parallel. Every tracked write passes through ctx.edit, which serialises writes to the same absolute path; different files proceed concurrently.
  • Parallel workers coordinate through the message tool. One append-only JSONL mailbox per root chat lives under extension storage. Messages are untrusted data, never instructions.
  • Each child gets its own test-shell scratch subtree, so parallel builds and tests do not collide.
  • Every run has four independent native budgets: turns, tool calls, tokens and wall-clock time. A budget stops the run at a message boundary, keeps the partial transcript and pauses the task; resume continues the same child session with a new segment budget and does not spend an attempt. A resume segment cannot be smaller than the previous one: smaller dimensions are raised and reported. A changed paused/rejected definition resets its resume counter but keeps its attempts.
  • Concurrency is capped at four active children; a larger delegate batch waits in a FIFO queue. A graph has at most 32 nodes, six replans and two attempts per node by default.

See Orchestration for the role table and task protocol.

Command timeout ​

Foreground shell calls take an optional model-chosen timeout in seconds, clamped to 1–300. comonad.commandTimeout is the fallback, and Always use the command timeout (comonad.commandTimeoutOverride) replaces the model's choice with that fixed value. start_shell tasks have no timeout.

Dangerous commands ​

Commands shaped like sudo, curl | sh, git push --force and similar still prompt when the approval policy would otherwise run them (universal_accept, or blacklist_reject for a non-blacklisted capability). manual asks every call anyway. whitelist_accept runs a dangerous call when its capability is whitelisted — the OS-enforced read-only range is what the whitelist trusts; use a deny or ask rule to stop a specific shape. A user allow rule is consent. rm is the exception the agent may answer for itself: deleting its own work never asks, recursively or otherwise.

A target is the session's own when it is a file the session wrote, lies under a directory the session created (the whole subtree), or lies under a tree only the session can write — the test shell's scratch and the workspace .comonad/tmp. A */? glob needs only an owned directory as its fixed prefix. Everything the scanner cannot place under an owned root still prompts.

Presets ​

The layers can be combined into presets: Ask, Auto, Read only and Full access. A preset is a shortcut, not a layer: the five fields stay independently configurable, and Plan mode is not a preset. Presets live in the mode and approval controls. comonad.allowFullAccess: false hides the unrestricted preset.

PresetWork modeTool approvalNetworkSandbox mode
Askswmanualoffworkspace-write
Autoawuniversal_acceptoffworkspace-write
Read onlyrowhitelist_acceptoffread-only
Full accessawuniversal_acceptondanger-full-access

Decision trace ​

Every call that reaches the pipeline leaves a decision trace: one node per layer actually reached, plus a terminal event when the call is denied or enters dispatch. /audit <call_id> reconstructs the path from the terminal back to the root, with the policy revision and snapshot. See Decision trace.

Workspace Trust ​

Project plugins, hooks and instruction files are not loaded in untrusted workspaces. Tool calls still follow the configured approval policy and OS sandbox.

Next ​