Implement the following plan:
Git hook demo
Context
Get a working demo of trace IDs being written to git notes on commit. Minimal: one shell script, no CLI changes.
What we're building
A post-commit hook script that:
- Queries
~/.traces/traces.db for traces whose directory matches the repo root
- Writes matching trace external IDs as git notes on the new commit under
refs/notes/traces
Branch: git-integration from main
New file: cli/hooks/post-commit
Shell script using sqlite3 (available on macOS by default, most Linux distros).
sh
Respects TRACES_EVENTSTORE env var if set (same as the CLI does). Falls through silently if no DB exists or no traces match -- should never block a commit.
Verification
- Create a new branch
git-integration from main
- Add the hook script
- Install it:
mkdir -p ~/.traces/hooks && cp cli/hooks/post-commit ~/.traces/hooks/ && chmod +x ~/.traces/hooks/post-commit && git config --global core.hooksPath ~/.traces/hooks
- Use an agent in a git repo where traces has recorded something, make a commit
- Run
git notes --ref=traces show HEAD -- should print the trace IDs
- Test that committing in a repo with no traces doesn't error
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/andrew/.claude/projects/-Users-andrew-code-traces-traces/3c299a07-84f9-42c8-819d-badac01387d5.jsonl