Add Claude Code Stop hook that automatically records session costs when sessions end. The hook calls `gt costs record` which now can derive the session name from GT_* environment variables (GT_RIG, GT_POLECAT, GT_CREW, GT_ROLE). Changes: - Add deriveSessionName() to infer tmux session name from environment - Add Stop hook to settings-autonomous.json and settings-interactive.json - Add unit tests for deriveSessionName function When a Gas Town session ends, the Stop hook fires and records the session cost as a bead event. Costs then appear in `gt costs --today` output. Closes: gt-ntzhc 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
52 lines
936 B
JSON
52 lines
936 B
JSON
{
|
|
"enabledPlugins": {
|
|
"beads@beads-marketplace": false
|
|
},
|
|
"hooks": {
|
|
"SessionStart": [
|
|
{
|
|
"matcher": "",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash ~/.claude/hooks/session-start.sh && gt nudge deacon session-started"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PreCompact": [
|
|
{
|
|
"matcher": "",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash ~/.claude/hooks/session-start.sh"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"UserPromptSubmit": [
|
|
{
|
|
"matcher": "",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "gt mail check --inject"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"Stop": [
|
|
{
|
|
"matcher": "",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "gt costs record"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|