title: "Session Cost Tracking Hook" tested_with: claude-code: "1.0.x" last_updated: 2026-03-21 status: experimental difficulty: intermediate prerequisites: [04-hooks-and-commands]

Session Cost Tracking Hook

What This Config Does

Logs a notification when a session ends, reminding you to check token usage. Useful for building cost awareness without disrupting workflow.

The Config

Add to your .claude/settings.json:

{
  "hooks": {
    "Stop": [
      {
        "hook": "echo '💰 Session ended. Run /cost in your next session to review token usage.'"
      }
    ]
  }
}
# Adapt this by:
# - Replace the echo with a script that logs to a file for tracking over time
# - Example: echo \"$(date),session_end\" >> ~/.claude/cost-log.csv

Where to Put It

~/.claude/settings.json (user-level) so it applies to all projects.

How to Verify It Works

End a Claude Code session. You should see the cost reminder message.

Notes

  • This is a simple awareness hook. For automated cost tracking, see Module 09: Headless & CI/CD.
  • Token costs vary significantly by task complexity. Typical ranges: simple tasks $0.01-0.05, complex features $0.10-0.50, large refactors $0.50-2.00.