I want AI coding agents to work on my projects, not have unrestricted access to my computer. While building Tillerly, I needed a way to restrict what agents could read, write, and execute without preventing them from completing real engineering tasks. I addressed this by combining local sandboxing, isolated workspaces, and explicit permission policies.

Why is running AI coding agents locally a privacy concern?

A developer's computer contains much more than source code. It contains personal documents, SSH keys, API credentials, private repositories, and configuration files.

An AI coding agent with broad filesystem access could read information unrelated to its task and include it in requests sent to an external LLM.

Depending on the provider and privacy settings, that information could be retained or used for model training.

For me, the problem was not simply whether I trusted the AI provider. It was why an agent needed access to that information in the first place.

If an agent is fixing a bug in one repository, why should it be able to read my personal documents or credentials?

Why did I choose sandboxing over prompt instructions?

I considered three approaches:

  • Prompt instructions: tell the agent which files and directories it should avoid.
  • Full container isolation: execute agents inside dedicated containers.
  • Restricted local execution: enforce filesystem, command, and network restrictions on the developer's machine.

Prompt instructions are easy to introduce, but they cannot guarantee that an agent will respect its boundaries.

Containers offer stronger isolation when properly configured, but introduce additional complexity around existing development environments, dependencies, and local tools.

I chose restricted local execution because I wanted agents to work with the developer's existing environment while limiting unnecessary access.

The trade-off is that filesystem and execution policies require careful design and validation.

How did I implement the sandbox?

While building Tillerly, my independent developer tool currently in free beta, I separated orchestration from execution through a dedicated local process called the Runner.

The Runner prepares the execution environment and applies policies before starting an agent.

The implementation combines several mechanisms:

  • Dedicated Git worktrees for implementation tasks.
  • Write restrictions around authorized working locations.
  • Read restrictions for sensitive files, including credentials and private configuration.
  • Sandboxed execution of development commands.
  • Network restrictions enforced through a local proxy.
  • Role-specific permissions for each agent.

Git worktrees allow agents to work on separate tickets without interfering with the developer's active checkout. However, they are not a security boundary by themselves.

The Git worktree documentation explains the workspace isolation mechanism, while Claude Code's sandboxing documentation covers filesystem and network restrictions.

Together, workspace isolation and sandboxing address different parts of the problem.

What happens when an agent needs additional permissions?

Restricting everything creates another problem: the agent might not be able to finish its work.

It may need to run a development tool, execute a test suite, or connect to an additional service.

Instead of granting unrestricted access, I introduced explicit permission requests.

Developers can authorize additional capabilities within predefined limits. Commands permitted to run outside the sandbox also require confirmation on the developer's machine.

This means an agent cannot simply decide to expand its own permissions.

It must ask.

The same architectural principle appears in Stack & Skill's guide to building reliable RAG pipelines, which recommends enforcing data access restrictions before information reaches the model rather than relying on model instructions.

How did this approach work in practice?

The resulting architecture allows agents to modify assigned code, execute development checks, and prepare changes for human review within a controlled environment.

Developers can inspect execution logs, understand why an operation was denied, and decide whether additional access is necessary.

The approach does not guarantee complete isolation from every possible security threat. Local tools, permitted operations, and external integrations still require careful evaluation.

However, access restrictions are now part of the execution architecture rather than something entrusted entirely to the agent's instructions.

What did I learn from building this?

Running an AI agent locally does not automatically make it private or secure.

Developers need to control what information an agent can access before that information potentially reaches an external model.

The most important principle I took away from building this system is simple:

Give agents access to the task, not the entire machine.

I'm continuing to explore this problem as an independent developer, and I'm interested in hearing how others balance agent autonomy, privacy, and developer control.

Disclosure: I am the creator of Tillerly.

AI assistance: ChatGPT assisted with research, drafting, and editorial refinement. The architectural decisions described in this article are based on my experience building Tillerly.