Karthik Kamalakannan

Design Founder & CEO of Skcript.

Bulk Delete Archived Claude Code Sessions

There is no bulk delete for archived sessions on Claude Code. Here is a quick console script to clear them all.

3 min read

I was cleaning up my Claude Code account and realized I had about 30 archived sessions sitting in the sidebar. The web UI at claude.ai/code lets you filter by status—Active, Archived, or All—but there’s no bulk delete. Just a tiny trash icon on each row.

I wasn’t going to click that 30 times.

If you click the filter icon next to “All projects” and set Status to Archived, you’ll see all your old sessions. Open the browser console (Cmd+Option+J on Mac, Ctrl+Shift+J on Windows) and paste this:

(async () => {
  let deleted = 0;
  console.log(`🗑️ Starting cleanup...\n`);
  while (true) {
    // Dismiss any confirmation dialog first
    const deleteBtn = document.querySelector('button[class*="bg-red"]')
      || [...document.querySelectorAll('button')].find(b => b.textContent.trim() === 'Delete');
    if (deleteBtn) { deleteBtn.click(); await new Promise(r => setTimeout(r, 800)); }

    const rows = document.querySelectorAll('.group.relative.grid');
    if (rows.length === 0) {
      console.log(`\n✅ Done! Deleted ${deleted} sessions.`);
      break;
    }
    const name = rows[0].textContent.trim().substring(0, 60);
    const trashBtn = rows[0].querySelector('button');
    if (!trashBtn) { console.log('⚠️ No trash button found. Stopping.'); break; }
    trashBtn.click();
    deleted++;
    console.log(`[${deleted}] ❌ ${name}`);
    await new Promise(r => setTimeout(r, 1200));
  }
})();

Each session row in the sidebar has a group relative grid class with a single button inside it—the trash icon. The script clicks the first one, waits 1.2 seconds for the UI to catch up, and repeats until the list is empty.

The list lazy-loads, so if you have a lot of sessions, scroll down to load more and run it again.

Under the hood, each click fires a DELETE /v1/sessions/{session_id} request. No API keys or tokens needed—the script runs in the context of your already-authenticated browser session.

Took me longer to figure this out than to actually run it.