ccd_session_mgmt archive_session: bulk archive forces per-session prompts
Summary
The \mcp__ccd_session_mgmt__archive_session\ tool is unusable for bulk cleanup because it forces a per-session confirmation prompt that can't be allowlisted, and \--permission-mode bypassPermissions\ actively disables it. A typical quarterly tidy-up of the Code sidebar means clicking through 30+ identical prompts — friction high enough that users either avoid the tool entirely or resort to direct filesystem manipulation of the session metadata files.
Repro
- Accumulate ~50 sessions in the Claude Code desktop sidebar (~10 projects over a couple months — normal usage for a power user).
- Ask Claude to triage them (recent activity, umbrella linkage, etc.) and archive the ones that are clearly done.
- Watch Claude fire ~30 \
archive_session\calls in parallel. - Click "Allow" 30 times. No "Allow always for this tool" option appears, so adding \
mcp__ccd_session_mgmt__archive_session\to \settings.json\\allow\has no effect on subsequent calls.
Why the current behavior exists (acknowledged)
The tool stops the session's process and cleans up its worktree, both destructive enough that silent batching is genuinely risky. The tool description explicitly says: "ALWAYS prompts the user for confirmation and is unavailable in unsupervised (auto / bypass-permissions) mode."
So this is by design. The proposal below preserves the safety reasoning.
Proposal
Offer a tiered confirmation model based on what the archive will actually touch:
| Session state | Suggested treatment |
| ---------------------------------------- | ------------------- |
| Not running, no worktree | Allowlist-eligible. Show "Allow always for safe sessions" once per sweep. |
| Not running, has worktree | Prompt per session (current behavior is correct — worktree removal is destructive). |
| Running | Prompt per session, with the running-process kill called out in the prompt body. |
Alternatively / additionally:
- Batch confirmation tool: a sibling tool \
archive_sessions_batch(session_ids: string[], confirm_token: string)\that prompts ONCE with a summary ("archive these 28 stopped, non-worktree sessions?") and acts on confirmation. The \confirm_token\parameter forces Claude to surface the full list to the user before the call. - "Auto-archive on PR close" already exists — the same pattern (an opt-in policy that lets the harness archive without per-session prompt) could be extended to "auto-archive sessions stopped for more than N days with no worktree."
Adjacent UX gap
There is no built-in stale-detection UI. Users have to ask Claude (or write their own scripts) to even identify archive candidates. A \Sessions → Archive completed\ action in the desktop sidebar that opens a checklist of suggested candidates (criteria: not running, no worktree, last activity > N days, optionally cross-referenced with PR state) would solve this for non-Code users who never invoke the MCP tool directly.
Workaround (not recommended for shipping users)
The metadata is plain JSON under \~/Library/Application Support/Claude/claude-code-sessions/<app>/<workspace>/<session_id>.json\ with a top-level \isArchived: bool\. Flipping it directly works for stopped, non-worktree sessions; a small shell script wrapping that with safety checks (skip already-archived, skip worktree-based, refuse running) is what I ended up using. This works but is undocumented surface area; a documented config or batch tool would let users stop relying on it.
Severity
Annoying-but-not-blocking. The behavior actively trains users away from keeping their sidebar tidy, which then makes the sidebar less useful, which then reduces the value of session persistence. Worth fixing.
Environment
- Claude Code 2.1.143
- macOS 26.5, Claude desktop app
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗