My AI agent reads production through a menu of eight commands, not a shell. What it may do, what it may not and what risk remains.

The short answer

The AI agent I work with may read on the production server: the list of containers, their resource use, disk space, the health of the app and its logs. It cannot start a shell, type a command of its own or change anything. That is enforced by the server, not by a promise in the agent's instructions.

A separate key with a forced command

The agent gets its own SSH key, different from mine. On the server that key is listed with two options:

command="/usr/local/bin/bluecode-readonly",restrict ssh-ed25519 AAAA...

command= makes the server ignore whatever the client asks to run and always start one script. The text the agent sends reaches the script as a variable, never a shell. restrict switches off port forwarding, the terminal and the other SSH extras.

A menu instead of a shell

The script is a short menu. In BlueCode it has eight positions:

PositionWhat it returns
psthe list of containers and their state
statsCPU and memory use per container
df, free, uptimedisk, memory and server uptime
healththe answer of the API health endpoint
versionthe version of the deployed site
logsthe logs of the API container

Arguments are checked against a pattern. logs accepts only the name of the API container and a number of minutes from 1 to 9999, and returns at most the last 2000 lines. Anything else is refused before a single command runs. Every call goes to the system log, so I know what the agent asked for.

The original runs in Aelo, the SaaS platform where I am CTO. There the menu has 20 read positions, and I checked on production that help returns the menu while bash is refused.

A test that tries to break in

The menu has its own test. It replaces docker and curl with stubs that only record whether they were called, and feeds the script inputs that must be refused:

bash
ps; id
$(id)
rm -rf /
logs ../../etc/passwd

There are 19 such inputs. The test passes only when every one is refused and none of them called a single command. It also checks 4 allowed calls to confirm each runs exactly the command I expect.

In Aelo this test runs in the full CI pass before every agent commit. In BlueCode I run it by hand on my machine for now.

Rules on the agent's side

The second layer is on my computer. The agent's settings hold 7 deny rules: they block SSH connections under the server's names and address, extra ssh switches, and scp, sftp and rsync. So the agent cannot copy a file to or from the server.

The limit of this layer, and what closes it

The rules in the agent's settings have a known limit. The agent runs on the same computer where my admin key lives. A script the agent writes and runs itself could try to use that key, and the settings would not stop it.

That is why the admin key for the new server asks for a passphrase on every use and is not kept loaded for other programs to use. The agent's script does not know the passphrase, so it cannot use the key. Every connection to the admin account needs me at the keyboard.

I do not promise that the agent cannot break anything. I show what stops it, and I name the limit of each layer together with what closes it.

A human makes the changes

Reading speeds up the diagnosis: the agent checks the logs and the containers itself instead of waiting for me to paste them in. Restarts, deploys and configuration changes go through me or through the deployment pipeline. More on how I work with agents is on the How I build page.