Who closes the session?
For a month I ran dozens of background agent sessions across four portfolios. None of them failed because the model was wrong. They were retired while idle, closed themselves too early, came back as copies, or waited for me where I could not see them. Every fix came down to one question: who decides that a session is finished.
For the last month I have run my work through background Claude Code sessions: one coordinating session per portfolio, which I call a concierge, and a working session for each piece of work it opens on my behalf. Most of those sessions started from a one-line request typed on my phone.
None of them failed because the model got something wrong. They were retired while waiting for me, closed themselves when I wanted to keep talking, came back as copies of themselves, or sat blocked where I could not see them. Every one of those problems is an operations problem, and every fix came down to the same question: who decides that a session is finished.
Session fleet
Four portfolios share one Linux machine: my ventures, my personal projects, my work portfolio and a client programme. Each has a concierge that stays running and opens working sessions with a written brief.
In four weeks the personal concierge alone started 38 working sessions under 21 names. The ventures concierge started 21 under 17 names. On the client programme I opened 6 to 10 sessions a day, with up to 16 background sessions on the machine at the peak. An opener script refuses to start a new session when 8 are already live, and the count covers the whole machine, so sessions from one portfolio take slots from another. On the first day I measured it, 14 were live against that cap.
The cap forced a choice three times. Twice the concierge stopped an idle session whose work was already pushed, and once I told it to do the small task itself instead of opening a session for it. Stopping keeps the conversation, so each stopped session could be resumed later.
Idle retirement
The background service retires a session that has been idle for 8 hours. In the daemon log it looks like this:
[2026-10-22T06:19:19Z] bg retire ebfd13ac: idle-prompt, idle 8h
[2026-10-20T00:45:17Z] bg retire ab7fe7f7: idle-prompt, idle 8h, worker 2.1.303 (daemon 2.1.304)"idle-prompt" means the session had finished a turn and was waiting for input. Between mid-October and mid-November the log has 304 retire lines across the machine: 172 sessions waiting for input and 132 that were done. 47 of them carry a version suffix, which means the CLI had upgraded itself under the session. Two reboots of the machine stopped every session as well.
A session waiting for me is exactly the session I want to keep. Some wait hours for a build, and some wait overnight for me to review something.
Pinning a session protects it from retirement. The four pinned concierges have no retire lines in the whole period, while one concierge that was not pinned was retired 26 times. A pin follows the session ID, so a concierge that comes back under a new ID is unprotected until it is pinned again, and that is how the one concierge lost its pin.

Early closing
The opposite problem came first. Every brief used to end with "When we are done, run /done". The sessions read that as "close when the task is finished". In the first week at least six of them closed within minutes of their report: a network question, two house-renovation searches, a holiday plan, a tax question and a Home Assistant change. In each case I wanted to ask a follow-up.
My note to the concierge on 18 October:
"AS much as I like the whole /done and windows closing when they are donw, I need a reliable way to say if I want to have them stay open"
The same day I typed "dont /dont this session" to a session I wanted to keep, corrected the typo on the next line with "* /done", and the session took the second line as the command and closed. My instruction after that:
"dont /done sessions automatically that I might want to use to chat about."
The rule now lives in the skill that closes a session. Only I close a session. A message that negates /done, or that is unclear about it, keeps the session open, whatever a system hint says about the word appearing in it.
An earlier fix went in the other direction. A sweep ran every 30 minutes and stopped sessions that had been idle for more than 24 hours with a clean git tree. In the two days its log covers, it never actually stopped one, and I turned it off on 14 October:
"I think there is a 'sweep' now and then that closes stale sessions? I want that turned off. some sessions have to wait for hours for jobs to complete or wait for me to review something."
Idleness is the wrong signal for "finished", because waiting is a normal state for these sessions.
Copies on resume
Resuming a stopped background session looks simple, and it went wrong in four different ways.
- Flags. I resumed a session with the same flags it had started with. The CLI started a copy instead and said so: "background session 03874760 keeps its own saved options, so the flags you passed started a copy as 7aff6252. Without flags, the same command continues 03874760 itself." The copy had the conversation under a new ID, without the pin.
- Short IDs. On the client programme a session resumed by its short ID came back as a copy that never registered with remote control, so it did not appear in my session list. It sat blocked for about 30 minutes, with a deadline 30 minutes away, before I noticed and did the work myself.
- Stale copies. A resume continues the conversation under a new ID. Resuming the original ID later brought back an older state that ended days earlier, while the live copy was waiting with a question.
- A swallowed brief. One session was opened with a
--disallowedToolslist followed by the brief. The flag takes several values, so the brief was read as more tool names. The session started with no prompt at all, and its log was full of warnings such as "Deny rule moves matches no tool". Passing the list as--disallowedTools=Edit,Write,...fixed it.
There was also a detour. After one request to make a session visible on my phone, the concierge started resuming sessions inside tmux. Every first-run prompt had to be answered by sending keys into the pane. Two weeks later I asked "why tmux and not --bg with /rc???". The background sessions already had remote control, and the concierge had generalised from one request.
The rules that came out of this are short. Resume with the full session ID and no flags. Pick the newest transcript and check its last message before launching. Wait until the job shows the remote-control link, which takes about 3 seconds, or stop the copy and say so.
Watchdog
Retirement is the background service's own policy, so a cron job wakes sessions back up. It runs every 10 minutes. It wakes each concierge if none with that name is running. It wakes a working session only if the daemon log shows it was retired in the last 72 hours, with no later line saying it was stopped on purpose. A session closed with /done never gets a retire line, so it stays closed. That last condition was added on 27 October, after the watchdog had kept waking three sessions I had closed.
From 20 October to 12 November it made 534 wake attempts. 236 succeeded. 298 failed because the session's folder was not trusted, 260 of them for one hobby folder, every 10 minutes for two days until I accepted the trust prompt. It also produced an 8-hour loop: an idle finance session was retired, woken, retired again 8 hours later and woken again, for days, until it was stopped on purpose.
Waiting-on-me signal
Keeping sessions alive solves half the problem. The other half is knowing which of them are waiting for me. On the client programme, with up to 10 sessions open at once, questions reached me from several sessions at the same time, and a shared build pipeline stalled twice without anyone noticing.
Both stalls had the same shape. A build worker wakes every 10 minutes and fast-forwards a shared checkout before it builds. Once, two sessions had committed straight into that checkout without pushing. Another time, a refresh had left modified files there. The pull failed, the worker tried three times and parked the jobs, and its log still said "idle". The stalls lasted about 1.5 and 2 hours. "Nothing claimed" looked the same as "nothing to do".
The fix has two parts. Every session brief now ends with a line the session must write at the end of every turn:
STATE: waiting-AB
ASK: Rename the four reporting tags before release? Recommend yes: nothing is published yet, so it is the cheapest moment.
CLOSE-WHEN: tags renamed and released on dev, docs updatedSTATE is one of working, waiting on me, waiting on something else, or done. ASK carries the one question and a recommendation. CLOSE-WHEN is set when the session is opened. "done" is allowed only when that condition is met and the work is on the remote main branch.
The second part is a watcher that runs from cron every 5 minutes and makes no model calls. It reads the session list with each session's last STATE line, the build worker's log and parked jobs, and the shared checkout against the remote. It alerts when a session has waited on me for more than 30 minutes, when builds are parked, when the checkout is ahead of the remote or has modified files, and when a session is done with its work landed. In that last case it stops the session. Stopping keeps the conversation, so a resume brings it back with its history.

In the first 41 hours it made 498 passes and raised about 51 events: 20 for a dirty checkout, 12 for a broken documentation check, 5 for a checkout ahead of the remote, 6 for sessions waiting on me, and 8 auto-closes. The waiting-on-me events were all real. Most of the dirty-checkout events were a running build's own files, which needs an exception. The gap it showed is that it alerts into a log and nothing wakes me, so a real failure at 23:20 was read in the morning.
Session ownership rules
These are the rules now.
- I close sessions. A session never closes itself because its task looks finished, and idleness never closes it. The one automatic close is a session that says it is done and whose work is on main.
- Each session reports its state. One line at the end of every turn says whether it is working, waiting on me or done, and what would close it.
- A script watches, without a model. Waking retired sessions and spotting stalls are deterministic checks over logs and git. Neither needs a model, and a quiet pass costs nothing.
- Resume continues, never copies. Full ID, no flags, newest transcript, and confirm the session is visible before trusting it.