Treat code passed to codemode as untrusted when a model wrote it. That code can call every action of every loaded plugin with the connections you configured, and actions that write, send, or delete run without asking for approval.
Codemode has no sandbox. Plugins run inside the codemode process, and the worker thread that runs code can load Node.js modules. Project trust controls which project plugins load, but it does not limit what loaded code does.
Safety comes from limiting what the codemode process can reach: the plugins it loads, the credentials it holds, and the files, processes, and network available to its operating-system user.
| Code | Runs in | Can reach |
|---|---|---|
Code passed to codemode exec or execute() |
A worker thread with an empty environment | Loaded actions, and Node.js modules through require |
Plugin modules and their execute functions |
The host process | Everything the process can: files, child processes, the network, and the host environment |
| Package installation | npm and git child processes |
The network and the package folders. Install scripts do not run |
The worker thread keeps the host's environment variables and the channel to the host away from calling code, and it stops runs that exceed their time or memory limit. It is not a security boundary: code can read files and start processes through require("node:fs") and require("node:child_process").
To run untrusted code, run codemode inside a container, virtual machine, or other operating-system sandbox, and give that environment only the credentials and network access the task needs.
Project trust controls whether codemode loads code from a project's .codemode folder. It prevents a folder from running plugin code the first time a command runs inside it.
A project is a .codemode folder other than ~/.codemode. Your own folder never needs trust.
Codemode requires trust before it loads these resources from a project:
- plugin files and folders under
.codemode/plugins/ - plugins listed in
.codemode/plugins.json - packages recorded in the project's
.codemode/config.json, including installing them - MCP servers in the project's
.codemode/config.jsonand.codemode/mcp.json, including starting them
Without trust, codemode imports and starts none of them. It reports what was skipped and continues with everything else.
These load regardless of project trust:
- the project's connections and settings in
.codemode/config.json, which are data - plugins, packages, and MCP servers in your own
~/.codemodefolder - the bundled plugins
Run codemode trust inside the project, or name its directory:
codemode trust
codemode trust ~/work/billing
codemode trust --revokeThree commands record trust for you, because each is an explicit decision about that project:
codemode inittrusts the.codemodefolder it creates.codemode install --localtrusts the project it installs into.codemode mcp add --localtrusts the project it adds a server to.
Decisions are stored by the real path of the .codemode folder, with symbolic links resolved, in:
~/.codemode/trust.json
Codemode does not prompt for trust. A command in an untrusted project runs without the project's plugins until you trust it.
Codemode.fromProject() and discoverPlugins() read the same trust.json from their userDir, so a host and the command-line interface agree by default. Pass trust to decide another way:
const codemode = await Codemode.fromProject(projectDir, {
trust: (projectRoot) => approvedProjects.has(projectRoot),
});PackageManager and McpManager read no folder they were not given. Without a trust option each refuses the project scope. Pass the same function to the managers and to discovery so that a project's plugin files, packages, and MCP servers follow one decision.
Use isProjectTrusted() and setProjectTrusted() to read and record decisions in a user folder.
The command-line interface stores connections as plain text in .codemode/config.json, in a file readable only by your account.
- Keep secrets in environment variables, or keep
config.jsonout of version control. - Use narrowly scoped, short-lived credentials, and separate credentials for unattended runs.
- Prefer plugins that declare their credential. Codemode sends a declared credential only to the HTTPS targets in the declaration, and keeps provider error text out of error messages. See Credentials.
- When embedding codemode, keep credentials in the host and sign requests through a credential broker, so the process that runs plugin code never holds them. See Sign requests in the host.
A connection belongs to the plugin source it was made for, which prevents another plugin from inheriting it by name. It does not stop code in the same process from reading config.json directly.
A package's plugins run with the same permissions as any other plugin.
codemode install imports a package's plugin modules to build the summary it shows, before it asks for confirmation. Install scripts do not run.
Review a package's source before installing it, and a project's .codemode/plugins/ folder before trusting it. Pin an exact version or a commit when a package must not change underneath you. See Packages.
A local MCP server is a program that runs with the permissions of the codemode process. Codemode gives it a short list of environment variables and its entry's env, not the rest of the environment, and does not sandbox it.
An HTTP server receives the headers its entry names and whatever the code sends it. Its tools' descriptions, its instructions, and its results are text from the server, which reaches an agent through discovery and can try to steer it.
A tool's read or write label comes from the server's own annotations. Treat the tools of a server you do not know as writes.
Review a server's command or URL before adding it, and a project's mcpServers and mcp.json before trusting the project. See MCP Servers.
These practices do not replace isolation, but they reduce exposure:
- Add connections only for the plugins a task needs.
codemode execloads a bundled plugin only when a connection names it. - Install the
codemode-node,codemode-bash,codemode-powershell, andcodemode-duckdbpackages only where code should run scripts, commands, or SQL on the machine. - Audit what ran. Every action carries a
readorwritelabel, and the SDK reports each action call toonActionafter it settles. - Review generated code before running it against an account that matters.