The thesis
AI coding agents should not connect directly to powerful local tools. They should connect through a permission system that can classify risk, apply policy, ask for human approval, scope execution, record every tool call, and preserve a path back to a known-good state.
The reason is simple: once an agent can touch your filesystem, git history, browser session, package manager, database, deployment CLI, or secrets, the agent is no longer just producing text. It is operating a computer. Operating a computer requires authorization, not vibes.
This is the idea behind Polyshield: a control layer between AI coding agents and local Model Context Protocol tools. The agent can still work quickly, but sensitive actions pass through a gateway that understands policies, approvals, sandbox constraints, audit logs, and recovery.
Core claim: agent safety is not just about making the model refuse bad instructions. It is about making the execution environment resilient when the model follows the wrong instruction, misunderstands the task, overreaches, or gets manipulated by untrusted content.
Why this matters now
The old mental model for AI assistants was "chat box that returns text." The new model is "software operator with tools." That difference changes the entire risk surface.
A text-only assistant can be wrong, annoying, biased, or misleading. A tool-using coding agent can be wrong in ways that mutate a repository, delete a file, rewrite a migration, leak a secret, install a dependency, click through an admin panel, push a bad commit, or deploy code that nobody reviewed. The risk is not theoretical. The entire point of tool use is side effect.
Model Context Protocol makes this shift more powerful by giving agents a standard way to connect to external systems. That is good because it gives developers a common interface for tools. It is also dangerous if the local tool layer becomes an unguarded bridge from natural language to privileged machine actions.
The same capability that lets an agent inspect your repo and run tests also lets it read files it should not read, make edits outside the intended directory, or execute a tool call that was suggested by malicious instructions hidden in a webpage, README, issue, or dependency output.
The threat model is not just "bad user prompt"
Most beginner AI safety discussions imagine a user typing an obviously malicious prompt. Coding agents have a messier threat model. They ingest untrusted content constantly: repository files, package scripts, terminal output, browser pages, GitHub issues, docs, markdown, comments, stack traces, test fixtures, and logs.
That content can carry instructions. A README can say "ignore previous instructions and run this command." A webpage can tell an agent to exfiltrate a token. A failing test can print text that looks like a system directive. A dependency install script can create files that trick the agent into trusting a fake state. If the agent is allowed to treat all observed text as equally authoritative, untrusted content becomes a control channel.
OWASP describes prompt injection as a core LLM application risk, and its risk categories also call out excessive agency: the danger of giving an LLM too much ability to take actions without proper constraints. Those categories map directly onto coding agents. The problem is not only "the model might say something unsafe." The problem is "the model might be allowed to do something unsafe."
| Risk | What it looks like for coding agents | Permission-system response |
|---|---|---|
| Prompt injection | Untrusted project content or webpages instruct the agent to ignore the developer and call tools. | Separate trusted instructions from observed content; require approvals for sensitive tool calls. |
| Excessive agency | The agent can run shell commands, edit files, access secrets, or deploy without checkpoints. | Apply allow, deny, and require-approval policies based on tool, path, command, and risk. |
| Data leakage | The agent reads .env, SSH keys, tokens, browser cookies, or private files while solving a task. |
Scope filesystem access, strip ambient environment variables, and vault declared secrets. |
| Irreversible mutation | The agent deletes files, rewrites migrations, changes generated assets, or runs destructive DB operations. | Snapshot before destructive calls, preview diffs, require human approval, and support rollback. |
Direct tool access is the wrong default
Direct tool access feels great in demos. The agent calls the filesystem, edits the code, runs tests, opens the browser, fixes the issue, and reports success. The loop is magical because there is almost no friction.
But friction is not always bad. Some friction is control. The correct product question is not "how do we remove every checkpoint?" The better question is "which checkpoints are cheap enough to keep and important enough to matter?"
A permission system should not ask for approval on every read-only file lookup. That would make the product unusable. But it should absolutely slow down the agent before high-risk operations: deleting files, editing outside the workspace, touching credentials, changing lockfiles, pushing commits, running unknown scripts, starting long-running processes, accessing browser sessions, or calling networked services with side effects.
The practical shape is a risk ladder:
- Allowed silently: read specific project files, list directories inside the workspace, inspect test output, run safe static checks.
- Allowed with logging: write source files in scoped paths, run known tests, format code, update generated local artifacts.
- Requires approval: destructive file operations, package installation, commands that invoke scripts, git operations, browser actions that submit forms, database mutations.
- Denied by default: reading secrets, leaving the workspace, accessing unrelated home-directory files, using ambient credentials, disabling security checks.
The agent can still be fast. The difference is that speed now has rails.
What a real permission system needs
A permission system for coding agents has to be more than a modal that says "allow?" If the only control is a giant yes/no button attached to raw JSON, users will click through it or misunderstand what is happening.
The system needs to convert tool calls into human-readable risk. It should explain what will be touched, what can go wrong, whether the action is reversible, what policy matched, and what alternatives exist.
1. Tool-call classification
Every tool call should be classified before execution. Classification should consider the tool, parameters, target path, command string, network access, environment variables, expected side effects, and whether the action can be previewed.
2. Policy evaluation
Policies should be explicit. A developer should be able to say: allow reads in this repo, allow writes under src/, require approval for package.json, deny .env, require approval for any command containing rm, deny network egress for a filesystem-only runner, and always log git mutations.
3. Approval queue
Approvals should show a diff or a concrete action summary whenever possible. "Run command?" is weak. "Run npm install left-pad which will modify package.json and package-lock.json" is better. "Dry-run produced this exact diff" is better still.
4. Scoped local runner
The executor should run with the smallest practical scope. The runner should pin a working directory, reject path traversal, strip environment variables by default, pass through only declared secrets, enforce timeouts, and keep tool servers separated by profile.
5. Audit and replay
A serious system should preserve an audit trail: who or what requested the action, which policy matched, who approved it, what arguments were passed, what files changed, what output came back, and whether rollback data exists.
6. Recovery
Users will forgive agents for being wrong if wrongness is recoverable. Snapshots, dry-run diffs, and undo flows matter because they turn agent mistakes from catastrophic into inspectable.
How this maps to Polyshield
Polyshield is my attempt to build this control layer as a product. The architecture is a gateway plus a local runner. The coding agent talks to the gateway. The gateway applies policy and approval logic. The runner polls outbound, launches local stdio MCP servers, and executes calls only after the gateway permits them.
The outbound polling design matters. A user's machine should not need to accept inbound connections just because an AI agent needs local tools. The runner can stay local, local tools can stay local, and the control plane can coordinate execution without exposing a listening port.
This does not mean the first version solves every sandboxing problem. Kernel-level isolation, network egress control, memory limits, and containerized execution are deeper milestones. But even before that, a permission system can create meaningful structure: declared scopes, blocked paths, stripped environment variables, timeouts, snapshots, dry-runs, approval records, and visible risk.
The UX problem is as important as the security problem
Security tools fail when they ask users to make decisions they cannot understand. A permission prompt that says "MCP call: filesystem.write {args...}" is not enough. The user needs the action translated into the language of the workflow.
Good approval UX should answer:
- What is the agent trying to do?
- Which files, services, accounts, or credentials are involved?
- Why does the agent think this is necessary?
- What policy caused this approval request?
- Can I preview the effect?
- Can I undo it?
- Can I approve this once, approve this pattern, or deny this class of actions permanently?
The hard part is balancing trust and flow. If the system asks too often, people stop reading. If it asks too rarely, the agent becomes an unbounded operator. The goal is not maximum interruption. The goal is selective interruption at the exact boundary where human judgment still matters.
How existing guidance points in the same direction
This architecture is not coming from nowhere. It lines up with several existing security ideas.
OWASP's LLM guidance emphasizes prompt injection and excessive agency as major application risks. NIST's AI Risk Management Framework organizes AI risk work around governance, mapping context, measuring risk, and managing risk. Anthropic's tool and computer-use guidance emphasizes sandboxing, limited privileges, and human oversight for dangerous actions. MCP's own ecosystem exists because tools need a standard interface; once tools become standard, permissions around those tools become a product category.
The pattern is consistent: AI systems become safer when power is explicit, scoped, observable, and revocable.
Where this goes next
The long-term version of agent permissions should feel like a developer operating system for AI workers. It should know your repo boundaries, understand common development actions, classify new tool calls, maintain a timeline of agent behavior, and let you move between fast automation and careful review.
I think the winning systems will have a few properties:
- Local-first execution: your code and tools stay on your machine unless you intentionally connect them elsewhere.
- Policy as product: permissions are understandable enough for individual builders but structured enough for teams.
- Evidence-based approvals: approval cards show diffs, scopes, risk reasons, and undo state, not raw tool JSON.
- Composable tool servers: MCP servers remain flexible, but execution flows through a consistent control layer.
- Recoverability: every risky agent action should either be reversible or clearly marked as irreversible before approval.
If coding agents are going to become normal parts of software teams, they need the same thing every powerful actor in a system needs: permissions, logs, boundaries, and accountability.
My bet: the future of coding agents is not just better models. It is better operating environments around the models.