Sandboxing AI Coding Agents: Starting with Basic Hygiene

AI coding agents can read files, modify code, and execute commands on our behalf. An incorrectly worded instruction or an inadvertently approved permission request could allow an agent to modify files outside the intended project.
Coding agents such as Claude Code, Codex CLI, and OpenCode provide permission controls, with native sandboxing support varying by agent and platform. Each has its own configuration. When switching between agents, it is hard to transfer over the setup. We need an agent-independent sandbox that is also easy to get started with.
Getting started with nono
I came across nono when I was looking for a lightweight sandbox. It provides a common interface over operating-system sandboxing mechanisms such as Seatbelt on macOS among many other features. See the nono CLI documentation for installation and platform requirements.
With nono and Codex CLI installed, we can check if the setup is able prevent unauthorized access. If the profile pack for Codex is not installed, install it first with nono pull nolabs-ai/codex, as described in the nono CLI README.
nono run --profile nolabs-ai/codex --allow-cwd -- codex --no-daemon
My most common use case for a sandbox is to allow agents read and write access with my current working directory only. The --allow-cwd grants access to the current working directory at the access level configured by the profile. The --no-daemon ensures Codex runs without its shared background server so that it does not bypass the sandbox.
Now even if we ask Codex to create a file directly in our home directory, outside the project and outside any paths granted by the profile, nono will prevent the operation because the destination is outside the permitted filesystem paths. This makes it safe to use the coding agent without worrying about access to all files on our machine.
Adding granular restrictions
The working directory level access is broad. What if we wanted to give specific read and write permissions at a folder level. For example, in spec-driven development, I often need the agent to only touch spec files when I am specifying a feature and only the code when it is implementing my spec. To achieve this we can define two nono profiles within our repository.
.nono/spec-only.json
{
"meta": {
"name": "spec-only",
"version": "1.0.0",
"description": "Write access to spec only"
},
"workdir": { "access": "read" },
"filesystem": {
"allow": ["$WORKDIR/openspec"]
}
}
.nono/code-only.json
{
"meta": {
"name": "code-only",
"version": "1.0.0",
"description": "Write access to code only"
},
"workdir": { "access": "read" },
"filesystem": {
"allow": ["$WORKDIR/src", "$WORKDIR/tests"]
}
}
We can launch Codex using our specification profile from the repository root:
nono run \
--profile .nono/spec-only.json \
--extends nolabs-ai/codex \
--allow-cwd \
-- codex --no-daemon
This allows Codex to read the entire repository but, within the repository, only modify files under openspec. Similarly, within the repository, the code profile grants write access only under src/ and tests/. Inherited profiles also grant access to agent configuration, caches, and other runtime paths.
We can also test these profiles using the dry run command instead of running a coding agent every time.
nono run --profile .nono/code-only.json --extends nolabs-ai/codex --allow-cwd --dry-run -- codex
This allows us to preview the access.
Capabilities:
────────────────────────────────────────────────────
r+w /Users/username/.codex (dir)
r+w /Users/username/.agents (dir)
r+w /Users/username/.config/nono/profile-drafts (dir)
r+w /Users/username/Library/Keychains (dir)
r+w /Users/username/projects/intent-driven-template/src (dir)
r+w /Users/username/projects/intent-driven-template/tests (dir)
r /Users/username/.config/nono/packages (dir)
r /Users/username/.config/nono/profiles (dir)
+ 47 system/group paths (-v to show)
deny 3 sensitive paths kept blocked inside your grants (-v to show)
net outbound allowed
────────────────────────────────────────────────────
dry-run sandbox would be applied with above capabilities
The inherited nolabs-ai/codex profile grants read and write access to ~/.codex/ and ~/.agents/ so Codex can use its configuration, session data, and shared agent skills.
Reusing profiles across agents
We can reuse the same nono profile with Claude Code also, with the nolabs-ai/claude pack installed:
nono run \
--profile .nono/spec-only.json \
--extends nolabs-ai/claude \
--allow-cwd \
-- claude
Our project-specific grants remain the same even when switch coding agents. The inherited runtime permissions can differ, so review those when changing the base profile.
Because these profiles use $WORKDIR-relative paths, we can check them into version control and share them with other developers. Run the commands from the repository root so $WORKDIR resolves to the intended project.
In these examples, we have only looked at file and folder access. We an also control commands execution and net access.
Beyond kernel-enforced boundaries
The kernel-enforced boundary using nono is a good starting point for protecting our development machines against inadvertent mistakes. However, it does not eliminate our dependence on locally installed tools, dependencies, and configurations. Nor is it this sufficient justification for run agents with dangerously skipped permissions.
For greater autonomy, we need to consider disposable, reproducible execution environments with stronger separation from the host. Containers and microVMs (https://www.docker.com/products/docker-sandboxes/) offer different ways to achieve this. And we can use our nono profiles with the containers for more granular control: https://alwaysfurther.mintlify.app/cli/internals/containers#decision-flowchart. We will explore these approaches in the next article.
The takeaway here is sandboxing hygiene should be part of how we work with AI coding agents, and tools such as nono make it easier to establish a consistent baseline.
Video Walkthrough
References
Read the full article on intent-driven.dev →
Originally published on intent-driven.dev on October 31, 2026