Skip to content

Workspace Trust ​

A workspace's tasks are code someone wrote: you, a teammate, or whoever published the repo you just cloned. Workspace trust records whose code you trust, so Mochi checks with you before running anything from a workspace you haven't vouched for, and coding agents can't run it at all.

Trust is kept on your machine. A repo can't declare itself trusted.

Trust a workspace ​

When you add a workspace in the desktop app, Trust this workspace is offered alongside discovery. It starts checked for a folder you picked, and unchecked for a Git repository. You can change it any time in Settings → Workspace trust.

From a terminal:

sh
mochi trust list
mochi trust set my-project trusted
mochi trust set scratch restricted

What trust changes ​

Who starts the runTrusted workspaceAny other workspace
You, in the desktop appRunsAsks first: Trust and run, Run once, or Cancel
You, in a terminalRunsRuns. Typing the command is your confirmation
A coding agentRunsRefused, with the command that trusts the workspace
Mochi's chatFollows your chat approval settingsOffers Trust and run

Trust covers the tasks a workspace defines. It doesn't govern commands an agent writes itself; the agent's own approval settings handle those.

Rules for specific tasks ​

Rules fine-tune a workspace's trust. allow lets matching tasks run in a workspace you haven't trusted. ask requires a check for matching tasks in one you have.

sh
mochi trust rule add scratch allow 'build *'
mochi trust rule add api ask 'deploy *'

A pattern is an optional verb and a task name, and * matches anything. The first matching rule wins. To see what would happen for one task:

sh
mochi trust check deploy api:prod-db

Worktrees and unregistered workspaces ​

Mochi also runs tasks from a workspace you never registered, such as a Git worktree or a fresh clone, when you work inside it. Trust for these works the same way. You name the workspace by its path instead of a registered name:

sh
mochi trust set ~/src/api-hotfix trusted

A worktree whose own trust isn't set takes its main checkout's trust and rules. Trust the main checkout once and every worktree of it is covered. A worktree's own state, if you set one, wins. Its own rules are checked before the ones it inherits.

Any other unregistered workspace starts out unknown. Both of these are defaults you can change:

sh
mochi trust default                           # show both
mochi trust default worktrees off             # worktrees inherit nothing
mochi trust default unregistered restricted   # or trusted, or unknown

When an agent is refused ​

An agent can't answer a prompt, so the run is refused instead of waiting. The refusal names the one command that allows it, so when you tell the agent to trust the workspace, it can run that command itself and try again. Under --output json the command is in the error's details.fix.