19 lines
1.3 KiB
Markdown
19 lines
1.3 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Repository purpose
|
|
|
|
Personal work-log / scratch repo. Primary function is serving as a testbed for `.claude/` hooks (Aptabase token-usage tracking) rather than containing application code. There is no build, lint, or test suite.
|
|
|
|
## Hook architecture
|
|
|
|
All automation runs through a single Go binary at `.claude/hooks/token-usage/claude-hook.exe`, dispatched by subcommand from `.claude/settings.json`:
|
|
|
|
- `UserPromptSubmit` → `claude-hook.exe session-context` — injects job-history context into the prompt (visible as the "Job History Context" system reminder).
|
|
- `Stop` → `claude-hook.exe stop-record` — records session end.
|
|
- `PostToolUse` (matcher `Bash`) → `claude-hook.exe aptabase-commit` — detects git commits and flushes token-usage events to Aptabase.
|
|
|
|
Each hook reads the Claude Code JSON event from stdin via a tempfile. Config/state lives in `.claude/hooks/token-usage/aptabase.json`. The `.exe` binary is checked in and is the authoritative source — there is no Go source in this repo.
|
|
|
|
When modifying hook behavior, edit `.claude/settings.json` to adjust dispatch, but the actual logic changes must happen in whatever external project builds `claude-hook.exe`. |