Dev.to AI 🤖 Ai 👁 0 📖 1 min read

Delegating to Claude Code Without Babysitting It: Sessions, Handoffs and Approval Gates

Running an AI coding agent as a one-off chat is easy. Running it as a delegated worker — where a session can disconnect, hit a rate limit, or be resumed hours later by a different process — needs a protocol, not a prompt

Running an AI coding agent as a one-off chat is easy. Running it as a delegated worker — where a session can disconnect, hit a rate limit, or be resumed hours later by a different process — needs a protocol, not a prompt.

This is the structure I use every day.

Sessions are state, prompts are not

Every task gets a stable task ID. A mapping file records task ID → session ID and status, and the wrapper resumes the existing session by default instead of starting a new one. A fresh session is created only when the task is genuinely new. This one rule removed most "the agent forgot everything" failures.

Handoffs are files, not messages

Finished work is handed over as one Markdown file per handoff, named with a timestamp and topic, in a watched inbox folder. Past handoff files are never edited. A watcher picks up new files and routes them. Anything that needs human approval — sending, publishing, deleting, paying — is named in the handoff but never executed by the file itself. A handoff is information, not authorization.

Approval gates are part of the template

Every delegation prompt carries the same standing lines: stop before sending, publishing, deleting, or paying; report instead. The definition of done is "verified by running it yourself", not "the code was written". Rate limits are handled by recording the task and resuming at the reset time, not by retrying in a loop.

The kit

I packaged the wrapper template, the handoff protocol (English/Japanese) and the setup guides as a starter kit, with a bonus pack of 30 copy-paste prompts in the bundle:

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.