---
title: "Continue an agent you already run — Dozable docs"
description: "You started Claude Code yourself, in a terminal, and it has been working for days: its conversation holds the whole history of the work, and maybe Remote Control is on."
url: https://dozable.com/docs/continue-an-agent-you-already-run
image: https://dozable.com/og-image.png
source: "Dozable manual"
updated: 2026-12-03
chapter: 49
---
# Continue an agent you already run

You started Claude Code yourself, in a terminal, and it has been working for days: its conversation holds the whole
history of the work, and maybe Remote Control is on. `doz agent new NAME --from claude:ID` moves it into Dozable as an
agent — a lasting identity with its own name in chat and its own token — without losing anything: Dozable then keeps it
running ([Keep an agent running](https://dozable.com/docs/keep-an-agent-running.md)), brings it back after a restart or a lost login
([After a restart or a lost login](https://dozable.com/docs/after-a-restart-or-a-lost-login.md)), and it can become a workspace's or a
group's manager — in its own session, never as a second copy.

```bash
doz agent new gm --from claude:0b7c1f2e-… --no-fence --dry-run   # what would happen; nothing changes
doz agent new gm --from claude:0b7c1f2e-… --no-fence             # move it; it is kept running
doz agent new gm --from claude:0b7c1f2e-… --no-fence --no-keep   # move it, but don't keep it running
```

## Kept running

A moved agent is **kept** by default: when it dies Dozable restarts it, and after a restart of your Mac or a new login
it comes back as itself — the same conversation, the same command. Keeping is your consent to that, so only someone who
may run it as it runs may keep it: you, an agent that runs as you (while `trust.agents_act_as_you` is on), or a trusted
agent. When an agent below that moves a conversation, the move still happens, but the agent is not kept, and the plan
says so and who may keep it (`doz sessions keep @mac gm` keeps it later). `--keep` insists: below that line it is
refused and nothing is done. `--no-keep` moves it unkept.

The id is the conversation's (Claude Code shows it with `/status`; `doz sessions find-conversation @mac --folder DIR`
lists a folder's). From inside Claude Code itself, `claude:self` names its own conversation.

## What stays the same

The agent sees nothing change:

| | after the move |
|---|---|
| its conversation | the same one, resumed by its id — never a copy or a fork |
| Remote Control | the same session and link: a phone with it open just carries on |
| its name | the same (a later `/rename` included) |
| its folder | the same |
| its command | the same flags; only how it picks its conversation changes (`--resume ID`) |
| its environment | the same variables, but the terminal's own (`TERM_PROGRAM`, `SHLVL`, …); `CHAT_URL` and `CHAT_TOKEN_FILE` are added |

It runs with **No fence**, as it did in your terminal, so `--no-fence` is required: it acts as you. Its variables are
kept in your login keychain, never in a file Dozable writes, and every restart starts it with them again.

## How the move goes

1. **The plan.** `--dry-run` shows the program that holds the conversation (its pid and terminal), the command Dozable
   will run, the folder, the variables carried and dropped, Remote Control, and what is lost. Without `--dry-run` the same
   plan is shown and you confirm it (`--yes` confirms without asking; it is required with `--json` or with no terminal).
2. **Waiting for its turn to end.** A turn is never cut. If it is working when you ask, Dozable says so at once
   ("gm isn't idle — waiting up to 60 s for its turn to end") and counts down. The moment it is idle, the move goes on.
   When the time runs out, the move is cancelled with nothing done, and the message says how to run it again with a
   longer wait. An agent the move made for it is removed again (one that existed before stays), so running it again
   makes it afresh. An agent at its prompt with a background task (a server it started, a Monitor) is idle: its turn
   is over, and the move goes ahead (the background task is in what it loses). `--timeout 5m` waits longer for one move (`agent.move_timeout` sets the default); `--quiet-wait` waits
   without the countdown lines; `--now` refuses rather than wait; `doz agent new gm --cancel` stops a move still waiting.
3. **Ending the terminal's copy.** Dozable sends it a hang-up — what closing its terminal window does — and Claude Code
   exits cleanly, its conversation saved. The terminal shows its prompt again and one line: "This conversation moved
   into Dozable as gm — doz attach @mac gm". If it does not end, Dozable asks once more (SIGTERM); if it still runs, the
   move stops there: nothing is started, and your conversation is intact. Dozable never kills it.
4. **Starting it in Dozable** as `@mac/gm` (`--session S` picks another name), resuming the same conversation.
5. **Checking** it holds the same conversation and the same Remote Control session.

Two programs never hold one conversation: if two already have it open, the move is refused, naming both, and nothing
changes.

`doz agent show gm` follows a move (and `--json` carries it as `move`). On a terminal the command follows it to its end;
`--no-wait` returns once Dozable has taken it, and so does a run with no terminal (a script) unless you give `--wait`.
An agent moving itself always returns once Dozable has taken it, `--wait` included (it says so): its own turn must end
before the move can go on, so waiting for the move would only wait on itself.

## An agent can move itself

Run from Claude Code's own tool shell, the command returns at once ("Accepted: gm moves into Dozable when this turn
ends and is kept running"), because its own turn must end first. The agent says what it did and ends its turn; Dozable then finishes the
move by itself — even if Dozable restarts in between. The moved agent reads what happened with `doz agent show gm`.

```bash
doz agent new gm --from claude:self --no-fence --yes --timeout 5m
```

## What is lost, and how to keep it

The terminal's copy ends, and with it:

- **programs it started** — a dev server, a bridge, a logger. Make each a service first: the plan lists them under
  "Make these services and schedules first", each with its `doz service add …` command ([Services](https://dozable.com/docs/services.md));
- **a self-paced `/loop`**, background Bash commands and Monitor tasks — make a loop a schedule first
  ([Schedules](https://dozable.com/docs/schedules.md));
- **text typed into the terminal and not yet sent** — Dozable can't see it.

Claude brings back by itself its conversation, its model, its permission mode, and its scheduled tasks that have not
expired.

## Remote Control

When the terminal's copy has ended, Claude reconnects the resumed conversation to the Remote Control session it records,
so the link stays the same. If Claude says the old session is gone, Dozable makes a new one (with
`mac.remote_control reconnect`) and the move says plainly that the link is new — open it again on the phone.

## When the start fails

If the resumed Claude exits at once (a flag it no longer accepts, say), the move says so with its last lines and the
exact command to run it by hand in a terminal (`cd ~/work/town && claude --resume … (with its variables FOO, …)` — the
variables are named, never shown). The conversation is intact: nothing deletes it. The agent stays.

## In a workspace or a group

The moved agent is one conversation in one session, and stays so. Make it a workspace's manager
(`doz workspace new town --folder ~/work/town --manager gm --manager-isolation unfenced`) or a group's
(`doz group new studio --manager gm`), and `start` **binds** the seat to its session: nothing new is started, chat
reaches it by its inbox as before, its Remote Control stays, and the workspace's brief arrives in it as the room's first
message. If its session has ended, `start` resumes it — the same conversation, with its own command and flags. A
workspace's seat must say the way it runs: one moved with `--no-fence` is named with `--manager-isolation unfenced`
(start says so if not). It is never added as a worker: that would be a second copy of it.

## What is refused, and why

- **Another place:** `--where` is `mac` only for now — a conversation started on this Mac can't move into a Sandbox and
  stay the same.
- **A fence:** `--no-fence` is required (see above).
- **Other programs:** only Claude Code for now. Codex, Gemini CLI, Antigravity, Grok Build, Cursor and the others are
  refused, each saying why ("not supported yet for gemini: Gemini CLI resumes only its newest or a numbered conversation,
  not one by id"). Nothing is ever moved with a loss.
- **A conversation Dozable already holds:** use `doz agent set NAME --session S` instead.
- **A background session** (Claude's own agent view), one run with `--print`, or one started from inside another
  Claude Code.
- **superadmin** with `--role` is a person's decision: run from an agent, it is refused, pointing to
  `doz permissions grant bot:gm superadmin --everywhere`.

An existing agent's name binds the move to it, its token, memory, grants and ceiling kept. A conversation nothing runs
now is simply started, resuming it (`-- claude …` gives the command to start it with).

`doz agent show gm` says where an agent came from: "created from a terminal session by you, 30 Nov 10:02" — or, for one
that moved itself, "by itself (a Claude Code agent, session 0b7c1f2e) for you".
