feat(costs): Wire up gt costs record to Stop hook
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>
This commit is contained in:
@@ -35,6 +35,17 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"matcher": "",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "gt costs record"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user