Disclosure: Some links below are affiliate links. If you sign up through them, I may earn a commission at no extra cost to you.

Here’s a question I haven’t seen anyone ask about AI coding agents: what happens when the model is wrong — not just bad code, but malicious?

Every agentic tool today — Cursor, Claude Code, Codex, OpenCode — works the same way: the model proposes an action, and the tool trusts it. Maybe it asks for confirmation before running shell commands. But the model picks which commands to run. The model chooses which files to read. The model decides which npm packages to install. The model holds the keys.

I’ve been using these tools daily. I love what they can do. But the more I rely on them, the more this trust model bothers me. So when Clodex dropped two days ago — a TypeScript/Electron agentic IDE that explicitly treats model output as untrusted input — I had to dig into how it actually works. Not the marketing. The architecture.

This is what I found after reading through the Guardian policy engine, the execution layers, and running a real task through the approval flow.

The Core Idea: Guardian as a Policy Engine, Not a Prompt

Most tools tack safety on as a confirmation dialog. “The model wants to run git push. Allow?” That’s reactive. The model already chose the action.

Clodex flips the direction. The Guardian policy engine sits between the model and every execution layer — shell, network, filesystem, browser, SSH, Docker. It doesn’t ask the model what to do. It evaluates every action against a configurable policy before the execution fabric even sees it.

Here’s the conceptual flow:

Model output → Guardian policy check → [Allow / Deny / Escalate] → Execution layer

If the policy says deny, the action never reaches the execution layer. No prompt, no override, no model convincing you. Fail-closed by default.

The Policy Config — Where the Real Work Happens

I cloned the repo (requires Node 22.23.1+ and pnpm 10.30.3+), built it, and opened the Guardian configuration. This is what a domain-level policy looks like:

// Example Guardian policy — domain-level network rules
{
  network: {
    defaultAction: "deny",           // fail-closed
    rules: [
      { domain: "api.github.com", action: "allow", reason: "git operations" },
      { domain: "registry.npmjs.org", action: "allow", reason: "package install" },
      { domain: "*.local", action: "allow", reason: "local development" }
    ],
    auditLog: true,
    requireApproval: ["*.production.com", "10.*.*.*"]
  },
  shell: {
    defaultAction: "prompt",         // gate for human review
    sensitivePatterns: ["rm -rf", "chmod 777", "> /dev/"],
    maxConcurrent: 3
  }
}

Every domain-level action is explicit. Want to add pypi.org for Python packages? Add a rule. Want to block all external registry calls except npm? Set defaultAction: "deny" and whitelist only what you need.

This isn’t a security wrapper. It’s an architectural choice baked into the tool’s DNA.

Testing the Approval Flow on a Real Task

I created a task asking Clodex to refactor a utility module. Here’s what happened:

Task created @ 14:23:12
  → Model analyzes module (2 files, 187 lines)
  → Proposes: read utils/http.ts, create lib/http-client.ts
  → Guardian: read utils/http.ts → ALLOW (filesystem: local project scope)
  → Guardian: create lib/http-client.ts → ALLOW (same scope)
  → Model proposes: install axios for retry logic
  → Guardian: npm registry → ALLOW (whitelisted)
  → Model proposes: run npx eslint --fix on the new file
  → Guardian: shell execution → PROMPT (eslint in npx context)
  → I approve → agent continues

The key moment was the ESLint prompt. The model wanted to run code analysis — benign. But Guardian still flagged it because the shell policy defaulted to prompt for anything not explicitly whitelisted. That’s the right behavior. You don’t guess what’s safe. You define it.

How the Security Model Compares

Security Dimension Cursor / Claude Code Codex / OpenCode Clodex (Guardian)
Default trust model Trust model output Trust model output Untrusted input
Network policy None built-in None built-in Domain whitelist
Shell gate Confirm dialog Confirm dialog Configurable policy
Audit trail Session logs Session logs Append-only evidence log
Remote execution No native support SSH (basic) SSH + Docker runner
Fail-closed No No Yes — default deny
Policy as config ✅ JSON/TypeScript

The table undersells the difference. Cursor and Claude Code have been playing catch-up on safety. But adding a confirm dialog isn’t adding security. It’s adding friction. Clodex’s approach is the opposite: security first, convenience second. Every action needs an explicit policy decision before it happens.

What This Means for Self-Hosted Agent Runners

Here’s where Clodex gets interesting for VPS-backed development. The tool supports SSH and Docker runners natively — meaning you can offload agent execution to a remote machine and still enforce the full Guardian policy chain.

I tested the SSH runner setup:

# Configure SSH runner in Clodex
clodex runner add --type ssh --host dev-vm.example.com --user deploy
# Guardian policies apply remotely — same ruleset
clodex task run "audit all node_modules for known vulnerabilities"

The policy engine operates at the Clodex level, not the machine level. So your remote Droplet (affiliate link) or Vultr instance doesn’t need its own security config — the Guardian policies travel with the task.

This is the setup I’d recommend for teams running persistent agentic workflows. Spin up a DigitalOcean Droplet ($200 free credit) or a Vultr instance ($100 trial), attach it as a Clodex SSH runner, and let the Guardian engine handle what the model can and can’t do remotely.

Current Limitations — Worth Knowing

Clodex is two days old and in technical preview. The Guardian engine is documented but the policy config UI is not yet built — you edit JSON by hand. Node 22 is a hard requirement. The Electron app sits at ~180MB RAM idle. And AGPL-3.0 licensing means commercial teams should check compatibility before production use.

But the architecture is what matters here. The zero-trust pattern Clodex pioneers will — I’m convinced — become the standard for agentic development tools within 18 months. Because trusting the model by default is a design bug. And Clodex is the first tool to treat it like one.

Bottom line: If you’re building with AI agents and haven’t thought about what happens when the model makes a bad security call, Clodex’s Guardian architecture is worth studying. Not just as a tool — as a reference design for how safe agentic development should work.