Skip to main content
A cloud session runs on a machine nobody signs into, and the machine is reclaimed when the task ends. CC Safety Net reaches it through the repository, the environment’s setup script, or the container image. Each works with the standard package.

What a cloud VM changes

The VM is disposable, but a cloud session pushes to your real remote, so git push --force lands on a branch your teammates pull, and git reset --hard loses the session’s uncommitted work. An environment set up for infrastructure work can also use a working cloud identity to run terraform destroy or aws s3 rm, which the official rulebooks block. A deny layer committed to the repository applies in every session that clones it.

Claude Code cloud and self-hosted sessions

Claude Code on the web reads settings, including hooks, from files committed to the repository. Two pieces make a cloud session enforce your policy.
1

Commit the project policy

Commit .cc-safety-net/policy.json and any project rulebooks under .cc-safety-net/rules/. The session clones them with the repository. This is the same configuration team setup commits for developer machines.A cloud session starts with no user policy file of its own, so the built-in defaults apply wherever the project file is silent. Set the session’s preset in the project file instead of relying on whatever preset a member has locally.
2

Get the hook into the session

There are two ways, depending on whether the environment has a setup script.An environment setup script, or the image behind a self-hosted environment, runs the ordinary install:
A target flag makes the install non-interactive, so it needs no terminal to confirm in and runs headless.Without a setup script, commit the hook entry itself as .claude/settings.json:
hook --coding-cli is the canonical hook entrypoint, the same one the installed plugin invokes. It costs an npx spawn on every tool call, so prefer the setup script when the environment has one.
Both forms fetch from the network at install or invocation time. An environment without network access needs the package in its image instead. CC Safety Net writes the audit log to the session’s home directory, so the log disappears with the VM. A session also gives no sign when the hook is missing. Confirm it once per environment by asking a session to run a command your policy denies and checking that it is blocked. npx -y cc-safety-net@latest explain "git reset --hard" shows the verdict your configuration gives without running the command.

Amp Orb threads

Amp needs no per-container step. npx -y cc-safety-net@latest install --amp publishes the plugin to your Amp account, so it also covers threads that run remotely, including Orbs. The plugin carries a snapshot of your user policy for machines with no policy file. Re-run the install after you edit your user policy. See Amp Code policy snapshot.

Devcontainers and container images

For a container you build yourself, run the install at build time. This Dockerfile works:
Two build-time requirements come out of that ordering:
  • git and ca-certificates must be present. The Claude Code install adds a plugin marketplace, which clones over HTTPS. Slim base images ship with neither.
  • Install the agent CLI first. The installer drives the agent’s own plugin commands, so a build that installs CC Safety Net before the agent fails.
For a devcontainer, the same command is a postCreateCommand:
Leave out the process.env.CI guard from team setup. Here the agent runs in the container, so it needs the install.

What stays human-approved

You can automate installing protection but not relaxing it, in a cloud VM or on a laptop. An agent can draft a policy proposal but cannot run policy apply. See Agents cannot run policy apply.
  • Team setup covers the committed project policy and rulebooks in full.
  • Policy documents the merge between user and project scope.
  • Official rulebooks are the AWS, Terraform, gcloud, and Azure denials worth committing where cloud credentials are live.
  • Installation has the per-agent install details for every supported CLI.
Last modified on October 22, 2026