claude-code - 💡(How to fix) Fix ccd_session_mgmt archive_session: bulk archive forces per-session prompts

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Root Cause

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.

Fix Action

Fix / Workaround

Workaround (not recommended for shipping users)

RAW_BUFFERClick to expand / collapse

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

  1. Accumulate ~50 sessions in the Claude Code desktop sidebar (~10 projects over a couple months — normal usage for a power user).
  2. Ask Claude to triage them (recent activity, umbrella linkage, etc.) and archive the ones that are clearly done.
  3. Watch Claude fire ~30 `archive_session` calls in parallel.
  4. 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 stateSuggested treatment
Not running, no worktreeAllowlist-eligible. Show "Allow always for safe sessions" once per sweep.
Not running, has worktreePrompt per session (current behavior is correct — worktree removal is destructive).
RunningPrompt 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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING