[BUG] Session name auto-set on plan approval cannot be cleared by agent or removed on plan completion

Resolved 💬 4 comments Opened Mar 29, 2026 by ryanaolson33 Closed May 2, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When a user approves a plan via ExitPlanMode, the Claude Code runtime automatically sets the session name (status line label) by kebab-casing the plan's H1 title. This name is never cleared — not when the plan completes, not when the plan file is deleted, and not by any tool available to the agent.

The name is injected as JSONL entries into the session transcript:

[Agent]   Write tool → creates plan file ~/.claude/plans/<slug>.md
[Agent]   ExitPlanMode tool → submits plan for user approval
[User]    Approves the plan
[Runtime] {"type":"custom-title","customTitle":"sendit-production-refactor"}  ← INJECTED
[Runtime] {"type":"agent-name","agentName":"sendit-production-refactor"}      ← INJECTED
[Agent]   Starts executing

The name is derived from the plan's H1: # SendIt Production-Ready Refactor Plansendit-production-refactor. These entries are written to ~/.claude/projects/<project-hash>/<session-id>.jsonl on each session resume but never removed.

The agent cannot clear it — no tool, skill, or API is exposed. Only the user can fix it via /rename.

What Should Happen?

The session name should be cleared when the plan is completed or the plan file is deleted. Alternatively, expose a rename mechanism to the agent so it can clean up after itself.

Error Messages/Logs

Steps to Reproduce

  1. mkdir /tmp/test-plan-bug && cd /tmp/test-plan-bug && git init
  2. claude — start a new session
  3. Paste this prompt:

``
create a plan to add a hello-world.txt file to this repo. despite how simple the task is, i'm asking you to follow the instructions.
``

  1. Claude enters plan mode, writes a plan file, calls ExitPlanMode
  2. Approve the plan
  3. Observe: Status line now shows a kebab-cased version of the plan title (e.g., add-hello-world-file)
  4. Let Claude finish or cancel
  5. Delete the plan file: rm ~/.claude/plans/*.md
  6. Observe: Status line still shows the stale name
  7. Ask Claude to clear it — it cannot
  8. Only fix: /rename

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.87

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

The custom-title and agent-name JSONL entries are written by the runtime, not by the agent. They're injected between the user's plan approval message and the next assistant response. The agent has no tool to write these entries or overwrite them with empty values.

Suggested fixes (any one would work):

  1. Auto-clear session name when the plan file is deleted or plan completes
  2. Expose a rename tool to the agent
  3. Don't auto-set the session name from plan titles at all

View original on GitHub ↗

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