How to add guardrails to an AI coding agent

Stack five layers: permission rules for which tool calls the agent may make; a sandbox for the files and network a command can reach; hooks that run your checks before the tool calls you choose; skills and commands that ask the agent to plan, test, and check its work before it says it's done; and a person who reviews before merge.

The five layers, at a glance

1. Permission rules: what the agent may try

Deny, then ask, then allow

Permission rules are enforced by Claude Code, not by the model. Instructions in your prompt or CLAUDE.md shape what Claude tries to do, but they don't change what Claude Code allows.

Claude Code docs: Permissions

How VS Code handles approvals

VS Code uses two security layers to help you control these actions: Approvals determine whether an action runs automatically or requires your confirmation. Sandboxing restricts the file system and network resources…

VS Code docs: Approvals

2. A sandbox: what a command can touch

Run AI coding agents in sandboxed environments: dev containers, restricted shells, virtual machines, or ephemeral cloud workspaces.

Use tool allowlists that restrict which commands the agent can execute.

Apply egress controls on the agent's runtime.

OWASP: Secure Coding with AI Cheat Sheet, Section 5

3. Hooks: checks that run before the tool calls you choose

A permission rule says which tool calls are allowed; Claude Code checks rules in the order deny, then ask, then allow. A hook runs your own script. A PreToolUse hook runs before a matching tool call, and if it exits with code 2, the call is blocked.

Claude Code docs: Permissions · Claude Code docs: Hooks

4. The process layer: skills and commands that shape how the agent works

What a skill is: an instruction set the agent loads for a task. It isn't enforcement; it works alongside layers 1–3

Not on their own. Instructions and skills shape what the agent tries, but they don't change what the tool allows. Pair them with permission rules, a sandbox and hooks, which apply whatever the model decides.

writing-plans · brainstorming · systematic-debugging · test-driven-development · requesting-code-review · receiving-code-review · verification-before-completion · using-git-worktrees

The engineering-discipline skills come from obra/superpowers by Jesse Vincent (MIT).

/team is not a bundle. It is part of the core install (/team ship, /team plan, /team review, /team verify) and needs no flag. /team ship runs 6 development stages and 7 verification gates, and it can declare where files should land, then fail if they did not. The check is structural (paths exist), not a judgement that the code does what the component promised. Design adapted from lak7/devildev (Apache-2.0); no upstream code was copied. See CREDITS.md.

Coco Super Intelligence README

State that survives /clear

Keep going after /clear. Decisions, phase state, and progress stay on disk.

Coco Super Intelligence README

5. Human review before merge

Require explicit developer approval before merging any AI-generated code.

OWASP: Secure Coding with AI Cheat Sheet, Section 14

Human review pauses the run so a person or policy can approve or reject a sensitive action.

OpenAI docs: Guardrails and approvals

Heliopause by Coco Research works this way too: setup prints its plan and waits for your yes before it changes anything outside ~/atlas-lab.

Install the process layer

Agent skills, slash commands and subagents for Claude Code, Cursor, Codex and other AI coding agents. One command installs them into the tool you already use. Coco's files and state stay on your machine. Your coding agent still uses its own model provider.

npx cocosuperintelligence

It installs the latest release, including the Super Intelligence bundle by default.

The remote bootstrap prints the commit and waits for you to type y before it runs install.sh.

A version check may contact GitHub once a day.

Open-core — most of the framework is Apache-2.0; the Super Intelligence board is proprietary.

Vendored components keep their own licences. See the Licence section of the README.

FAQ

What's the difference between a permission rule and a hook? A permission rule says which tool calls are allowed; Claude Code checks rules in the order deny, then ask, then allow. A hook runs your own script. A PreToolUse hook runs before a matching tool call, and if it exits with code 2, the call is blocked.
Should I use --dangerously-skip-permissions? It skips permission prompts. Claude Code's docs say to use it only in isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system.
Are skills enough to keep an agent safe? Not on their own. Instructions and skills shape what the agent tries, but they don't change what the tool allows. Pair them with permission rules, a sandbox and hooks, which apply whatever the model decides.
Does Coco Super Intelligence send my code anywhere? Coco's files and state stay on your machine. It adds no telemetry and no hosted service. Your coding agent still uses its own model provider. The CLI checks GitHub for a newer version at most once a day; COCO_NO_UPDATE_CHECK=1 turns that off.
What licence does Coco Super Intelligence use? Open-core — most of the framework is Apache-2.0; the Super Intelligence board is proprietary. Vendored components keep their own licences. See the Licence section of the README.
Does it work outside Claude Code? Yes. Run bash install.sh --adapter cursor, or the adapter for your tool. adapters/INDEX.md lists what each tool gets.

Sources