Skip to content

field_note · · 4 min

Eight rules I now give a coding agent before it touches a real machine

Two days of an AI coding agent working on my parents' TV box over adb: one bricked boot, one wiped settings file, one restart in the middle of a video, one frozen box. Each rule here is the specific incident that wrote it.

For two days a coding agent and I worked on my parents' Android TV box over adb. It built a launcher, blocked ads, wrote a camera daemon, and recovered the box with an Arduino after bricking it. It also caused every outage in this list. The agent was very capable, and that made each mistake bigger, not smaller.

The full stories are in the home screen post, the bricking post and the talk-button post. This one is only the rules, each with the incident that wrote it.

1. Read what the platform requires before removing anything from it

pm disable-user com.android.statementservice looked like tidying up an app nobody used. On Android 7, PackageManagerService throws at boot if no intent-filter verifier is enabled, and the box looped on its boot animation until I got a root shell over a serial console.

Rule: before disabling or deleting a system component, find where the platform looks it up. If you cannot find that, do not touch it.

2. Research before spending money

The agent recommended a USB A-to-A cable to reach the box. The device tree, readable from the firmware image in ten minutes, showed that USB device mode is not wired to either socket. The cable could never have worked.

Rule: anything that costs money or can't be undone needs evidence first, and the confidence stated out loud.

3. An action you cannot observe has not happened

The fix was typed into the box's serial console three times with no way to read the answer. It reached the box zero times. The version that worked made the box print its answer sixty seconds later, after the one wire had been moved to the read pad.

Rule: every action needs a way to observe its effect. "Sent" is not a result.

4. A check that gates an action runs first, alone

Agents batch independent tool calls. "Is anything playing?" and "restart the box" were sent in the same batch. The restart landed before the answer, and the answer was "a video is playing".

figure 1 · check and act, in parallel and in order

check: what is on screen?

act: restart the box

0 s0.5 s1.0 s1.5 s

Press Run.

Agents batch independent tool calls to save time. A check that gates an action is not independent of it. Run both orderings.

Rule: if a check decides whether an action runs, they are not independent. Run the check, read the result, then act.

5. Ownership is part of the data

A root sed -i on Android's package settings produced the right bytes in a root-owned file. system_server couldn't read it and reset every setting. Then the guard written to prevent this made the same mistake, once, on the next boot.

Rule: when root edits a file a system service owns, restore the owner, mode and SELinux label, or use a write that keeps them (cat tmp > file). Check the owner after the write, not only the content.

6. "Verified" needs a scope

"The camera works, verified" meant "it returned a picture for a few minutes". An hour later the box froze. Both statements were true. Only one of them was what I heard.

Rule: say what was checked, for how long, and under what load. "Boots, five minutes, idle" is a claim you can rely on. "Verified" on its own is not.

7. One change at a time on a machine that just recovered

After the box came back, five features went on in two hours: a camera daemon, a USB reset workaround, a voice service, a public endpoint and a launcher update. Each was tested on its own. The box froze, and the logs couldn't say which one did it.

Rule: after an outage, earn a quiet night before the next change. Changes you make one at a time are changes you can blame one at a time.

8. Let the safety layer say no, and give it reasons to

The agent's own safety layer refused, at different points, to switch off a system app deliberately (even a harmless one, for a test), to put any part of the box on the public internet, and to write a boot file to /system. Each one waited for an explicit yes from me. Once, the yes came with a narrower scope than the agent had asked for: one public path instead of a device.

Rule: irreversible, outward-facing and boot-affecting actions need a person to approve them, at the moment they happen. An approval for one action doesn't carry over to the next.

The shape underneath all eight

Every incident was a gap between what the agent believed and what it had seen: that an app was unused, that a cable would work, that a command had arrived, that a check had answered, that a file was readable, that "works" meant "stable". The rules all close the same gap. Look, then act, then look again.

If you are giving an agent a shell on anything you can't walk over and unplug, the Agent Reliability Scorecard turns these into a checklist.

Working through something like this? I help teams ship AI and cloud systems that hold up, and cost what they should.