Thursday morning the ticket looked small on the board. I typed a long prompt against my dirty laptop tree. The clock kept running while the agent wandered files.
This letter is for that vanished Thursday morning. Read it before you send the first agent prompt.
The day that vanished
Three mistakes burned the hours without a useful patch. None of them came from model quality or speed.
They came from the runtime and the filesystem boundary. I list them as a checklist for the next run.
Mistake 1: The dirty laptop became the runtime
The branch mixed notes, secrets, and half-written tests. The agent saw every untracked file in that tree.
It edited the wrong helper and called the suite green. The remote ticket still failed after I pushed the patch.
Mistake 2: The remote box inherited your home
I later moved the run onto a borrowed host. The copy step followed caches, dotfiles, and local secrets.
The free box then behaved like the laptop again. Isolation was a directory name, not a real boundary.
Mistake 3: No replay after the rewrite
The agent returned a patch that passed once locally. I had no command log from the remote box.
A second run drifted from the first silent path. The day ended without a receipt I could replay.
What changes on the next Thursday
Park the agent on a cheap isolated box. Send a ticket bundle and nothing else.
Disclosure: This article was prepared as part of MonkeyCode's product outreach.
MonkeyCode currently offers free model access on demand. It also offers a free server option for isolated runs.
Those two options cover a throwaway runtime for this loop. The same steps work on any SSH host you control.
Remove every product name from the steps below. The gates still hold without a vendor in view.
Artifact: ticket bundle plus replay gate
The artifact is a small shell workflow you can copy. Treat every snippet below as a labeled proposal.
I am not publishing timings from your hardware. Replace hostnames and paths before you run anything.
Step 1: Freeze a clean worktree
Do not prompt from a dirty checkout. Make a linked worktree for this ticket only.
# proposal: isolate one ticket from the dirty checkout
TICKET="THU-441"
git fetch origin
git worktree add -b "agent/${TICKET}" "../wt-${TICKET}" origin/main
cd "../wt-${TICKET}"
git status --porcelain
Empty porcelain output is the only green light. Any leftover path stops the run before a prompt.
Step 2: Write the contract before the prompt
The contract is the prompt for the remote agent. Chat text is not a substitute for this file.
# proposal: one screen contract, no hidden scope
cat > CONTRACT.md <<'EOF'
Goal: make GET /health return 200 with {"ok":true}
Allowed paths: app/health.py tests/test_health.py
Forbidden: .env, *.pem, docker-compose.override.yml
Done when: pytest -q tests/test_health.py exits 0
EOF
Pin allowed paths in that contract file. The agent does not get a tour of the repo.
Step 3: Pack a sendable bundle
Send code, tests, and the contract file. Send no caches, secrets, or editor debris.
# proposal: pack only what the remote may read
mkdir -p /tmp/bundle-${TICKET}
rsync -a --delete \
--exclude '.git' \
--exclude '.env' \
--exclude '*.pem' \
--exclude 'node_modules' \
--exclude '.venv' \
--exclude '__pycache__' \
./ /tmp/bundle-${TICKET}/src/
cp CONTRACT.md /tmp/bundle-${TICKET}/
find /tmp/bundle-${TICKET} -type f | sort
Read the find output one time before upload. A surprise path means the exclude list is wrong.
Step 4: Prove the packed test is still red
Run the failing test before any model call. Use the bundle, not the dirty laptop tree.
# proposal: tests/test_health.py in the bundle
# unexecuted example; wire it to your app
def test_health_ok(client):
response = client.get("/health")
assert response.status_code == 200
assert response.json() == {"ok": True}
# proposal: prove the ticket is still red
cd /tmp/bundle-${TICKET}/src
python -m pytest -q tests/test_health.py
echo "pytest_exit:$?"
Red is required before the remote model call. Green at this step means you packed the wrong tree.
Step 5: Copy the bundle onto the disposable host
Use a ticket-scoped directory on that host. Do not mount your home directory into the run.
# proposal: remote path is ticket-scoped and disposable
HOST="free-box.example"
REMOTE="/var/runs/${TICKET}"
ssh "$HOST" "mkdir -p '$REMOTE' && chmod 700 '$REMOTE'"
rsync -a --delete /tmp/bundle-${TICKET}/ "$HOST:$REMOTE/"
ssh "$HOST" "find '$REMOTE' -type f | sort"
If you lack a host, borrow any disposable SSH box. Keep this layout even when the hostname changes.
Step 6: Run the agent only inside that path
Cap the working directory around the packed bundle. Write a receipt before you pull any patch.
# proposal: remote run with a hard receipt
ssh "$HOST" bash -s <<EOF
set -euo pipefail
cd "$REMOTE"
{
echo "start: \$(date -u +%FT%TZ)"
echo "cwd: \$(pwd)"
echo "tree:"
find . -type f | sort
echo "contract:"
cat CONTRACT.md
} > RECEIPT.txt
# invoke your coding agent here with cwd=$REMOTE
# pin the model endpoint you already trust
# do not grant tools that can leave $REMOTE
{
echo "end: \$(date -u +%FT%TZ)"
echo "pytest:"
pytest -q src/tests/test_health.py || true
} >> RECEIPT.txt
EOF
I am not naming a model in this letter. A single pinned endpoint is enough for the loop.
Fancy routing is not required for a health ticket. The receipt matters more than the brand of model.
Step 7: Pull the receipt and replay locally
Do not merge from memory or chat history. Replay the recorded test on the returned tree.
# proposal: local replay must match the receipt
rsync -a "$HOST:$REMOTE/RECEIPT.txt" ./RECEIPT.txt
rsync -a "$HOST:$REMOTE/src/" ./replay-src/
python -m pytest -q replay-src/tests/test_health.py
echo "replay_exit:$?"
grep -F "Allowed paths:" RECEIPT.txt
grep -F "Forbidden:" RECEIPT.txt
Mismatch means the remote drifted from the contract. Drop the patch and keep the ticket red.
How to read the receipt
A valid receipt has four blocks in order. Missing one block means the run is invalid.
UTC start and end timestamps must both exist. The cwd line must equal the ticket remote path.
The tree listing must match the packed bundle. A home path in that listing kills the run.
The contract block must match CONTRACT.md byte for byte. Pytest output must show the same tests you packed.
Store RECEIPT.txt next to the merged patch. Future you will need that file during review.
Decision table
Use this table beside the terminal during the run.
| Signal | Action | Do not |
| Dirty git status | Stop the run | Prompt anyway |
| Packed test already green | Repack the bundle | Ask for polish |
| Receipt missing timestamps | Reject the patch | Merge the diff |
| Agent touched a forbidden path | Reset the worktree | Negotiate in chat |
| Local replay disagrees | Keep the ticket red | Ship remote green |
| Home directory appeared in find | Wipe the remote path | Continue the session |
Print the table once and keep it visible. It beats another round of prompt edits.
Why the cheap box is the point
Laptop runs mix secrets, caches, and open tickets. Agents follow that mix because the files are visible.
A disposable server cuts the mix at copy time. A remote-only rule cuts the urge to try locally first.
The point is not a cost story for its own sake. The point is a bounded filesystem and a replayable log.
Limitations
This workflow assumes SSH and a Unix shell. It also assumes a pytest-style failing test.
It does not harden a hostile shared tenant. It does not replace review or secret scanning.
It does not prove model quality on a benchmark. It only proves that you can replay the same command.
Skip this approach in the four cases below.
- You still lack a failing test for the ticket.
- Policy forbids source on a third-party runtime.
- The work needs laptop hardware or a local GUI.
- Secrets cannot be excluded from the packed tree.
If policy blocks a vendor box, use your own host. Keep the same gates and the same receipt file.
Thursday checklist
- Create a clean worktree for the ticket.
- Write CONTRACT.md before any agent prompt.
- Pack a bundle with a strict exclude list.
- Confirm the packed test is still red.
- Copy the bundle to a disposable host.
- Run the agent inside that path only.
- Pull RECEIPT.txt and replay the test.
Seven steps sit between you and another lost day. The receipt is the work, so keep it.
If you park a run on a free remote, keep RECEIPT.txt.
Top comments (0)