Repository navigation
Closed as duplicate
Closed as duplicate
Copy link
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists
Description
Preflight Checklist
- I have searched existing requests and this feature hasn't been requested yet
- This is a single feature request (not multiple features)
Problem Statement
Since some time, I miss the cost report on exiting. I wanted to bring it back ... but "according to Claude", currently, when exiting Claude Code, there is no way to automatically view the session cost report. Users must remember to manually run /cost before exiting, otherwise the cost information is lost when the session ends.
Proposed Solution
Add one of the following options:
Option 1: Pre-Exit Hook (Preferred)
Add a new hook event PreExit or Exit that runs before the Claude Code session terminates. This would allow users to execute commands like /cost automatically.
Example configuration:
{
"hooks": {
"PreExit": [
{
"hooks": [
{
"type": "command",
"command": "echo 'Session Cost Summary:' && claude-code /cost"
}
]
}
]
}
}Alternative Solutions
Auto-Display Cost Setting
Add a setting to automatically display the cost report when exiting to bring it back as it was few times ago :
{
"displayCostOnExit": true
}Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
As a user who tracks AI usage costs, I want to:
- Automatically see my session costs when I exit Claude Code
- Keep a record of costs without having to remember to run
/costmanually - Optionally save cost reports to a log file for tracking purposes
Additional Context
- The existing
Stophook runs after each agent response, not on application exit - Currently, there is no hook that runs when the user exits the CLI
- Cost data is only available during an active session, making it impossible to retrieve after exit
Alternatives Considered
- Shell alias wrapper - Not viable because cost data is unavailable after session ends
Stophook - Not suitable as it runs after every response, not on exit- Manual
/costbefore exit - Current workaround, but easy to forget
Benefits
- Improved user experience for cost-conscious users
- Better cost tracking and budgeting capabilities
- Consistent with user expectations for session summary information
- Could be extended to show other session statistics (duration, token usage, etc.)
Reacted by Jorge Gajon, Benjamin Cosman, Lucas Kuhn, Sean McKenna, Kirk Larsen, Zack Goodman, Henry Wilkinson, Tobias Munk, Xander Steenbrugge, Raed Atoui and 2 more
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists
Activity
github-actions commentedon Oct 10, 2025
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
github-actions commentedon Oct 14, 2025
This issue has been automatically closed as a duplicate of #2622.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code
mjaggard commentedon Oct 17, 2025
@claude @github-actions this is not a duplicate!
aiXander commentedon Oct 19, 2025
This feature should absolutely be restored. Transparency about costs/task is essential for me
github-actions commentedon Oct 26, 2025
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.