[FEATURE] Inverse of background mode: archive agent from Agent View without destroying data

Resolved 💬 3 comments Opened May 14, 2026 by leolower Closed Jun 15, 2026

Problem

The Agent View accumulates background sessions indefinitely. The only built-in way to remove an entry is Ctrl+X twice, which is destructive:

  • Deletes ~/.claude/sessions/<pid>.json
  • Deletes ~/.claude/jobs/<id>/
  • Deletes the worktree directory on disk
  • Leaves the git branch as prunable

The transcript JSONL survives, so claude --resume <uuid> technically works — but only if you wrote the UUID down beforehand, since the picker reads from sessions/ which is gone. In practice, users lose the easy path back to their conversation just to keep the list tidy.

Asymmetry

Claude Code can send a session into background mode, but has no command to take it out. There is no /foreground, /fg, /attach, /unbg, no claude agents foreground <id>, nothing in claude agents --help to mutate state.

Proposal

Add a non-destructive command that removes a session from the Agent View while preserving everything:

  • /fg (slash command inside a focused agent)
  • claude agents foreground <id> (CLI)

Behavior: flip kind: "bg" → normal in sessions/<pid>.json, or move the file to an archive dir. Keep jobs/<id>/, the worktree, and the transcript untouched. Resume continues to work — including via the picker filtered by name — because the session metadata survives.

Use case

Sessions where work is "done from the user's perspective" but still hold valuable context (decisions, exploration history, debugging trail). Today the choice is: keep them forever in the Agent View, or destroy the searchable mapping (name → UUID) just to clean up.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗