EndConversation tool behavior
The EndConversation tool ends the current session. Claude uses it only in two situations:
- as a last resort against sustained abusive input, after attempts to redirect the conversation have failed and after a clear warning in an earlier message
- when you explicitly ask to see the tool demonstrated and confirm that you want the session to end
General frustration, profanity, or a task going badly don't qualify, and neither do requests for harmful content, which Claude declines instead of ending the session. Claude Code follows the same approach as claude.ai, which can end a rare subset of chats.
After Claude ends an interactive session, the session locks. New prompts and most commands return Claude ended this conversation. Start a new session (or /clear) to continue., and only /clear, /resume, /help, /exit, and /feedback still run. Claude Code records the end in the session's transcript, so resuming an ended session restores the lock; the session's history isn't deleted.
Resuming an ended session in non-interactive mode with the -p flag errors and exits with code 1, so a script doesn't read the ended run as a success.
The tool never prompts for permission, and PreToolUse hooks don't run for it. While any other tool remains, you can't block it either: deny and ask rules naming EndConversation have no effect, and neither --disallowedTools nor a --tools list can remove it. The exemption is deliberate: the tool does nothing except end the conversation, never reading or modifying files or data, and a safeguard of this kind holds only if the session it applies to can't turn it off. When your deny rules remove every other tool and also match EndConversation, as "*" does, Claude Code removes it too rather than leaving it as the only tool, unless an allow rule names EndConversation explicitly. A deny list that removes every other tool without matching EndConversation leaves it in place.
Subagents never get the tool. Background tasks that share the main conversation's tool list see it, but calling it there ends nothing.
The tool appears only when all of the following hold:
- Version: Claude Code v2.1.213 or later.
- Model: the session's model is Claude Opus 4.8, Claude Sonnet 5, Claude Fable 5, or a later version of one of those families.
- Surface: an interactive terminal session, including a
claudesession in an IDE's integrated terminal, which is how the JetBrains plugin runs it. Other surfaces don't include the tool, such as:- non-interactive
-pruns - sessions through the Agent SDK TypeScript and Python packages
- the VS Code extension panel, which bundles its own CLI
- GitHub Actions
- Claude Code on the web
- non-interactive
- Startup mode: not a
--baresession. Bare mode loads only shell and file tools, so the tool is never registered there. - Provider: not available on Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform, or Microsoft Foundry, or on sessions signed in through a cloud gateway.