A Claude Code hook that auto-commits after every turn. Green squares don't grow themselves.
Your GitHub contribution graph is a lie of omission. You code all day with Claude, but your graph stays grey because nobody commits mid-conversation. This 5-line hook fixes that. Every time Claude finishes a response, it gets one instruction: commit now. That's it. Your graph goes from "does this person even code?" to "someone call a doctor."
@bcherny hit 266 contributions in a single day. I looked at my contribution graph and felt personally attacked.
The problem is simple: you're coding with Claude Code for hours, making real progress, but your GitHub graph doesn't know that. Commits pile up in your working tree. You push once at the end of the day. GitHub thinks you worked for 5 minutes.
This hook turns every Claude interaction into a commit. Is it useful for granular commit history? Sure. But let's be honest -- it's mostly about the green squares.
BEFORE (sad, grey, concerning)
Mon . . . . . . . . . . . .
Wed . . . . # . . . . . . .
Fri . . . . . . . . . . . .
AFTER (commitmaxxing)
Mon # # # # # # # # # # # #
Wed # # # # # # # # # # # #
Fri # # # # # # # # # # # #
Same amount of work. Different graph. Different you.
1. Download the hook:
mkdir -p ~/.claude/hooks
curl -o ~/.claude/hooks/commitmaxxing.sh \
https://raw.githubusercontent.com/longevityboris/commitmaxxing-hook/main/commitmaxxing.sh
chmod +x ~/.claude/hooks/commitmaxxing.sh2. Add to ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/commitmaxxing.sh",
"timeout": 15
}
]
}
]
}
}Done. Start a Claude Code session and watch the commits roll in.
The entire hook is 5 lines:
#!/usr/bin/env bash
cd "${CLAUDE_PROJECT_DIR:-$PWD}" 2>/dev/null || exit 0
git rev-parse --is-inside-work-tree &>/dev/null || exit 0
echo '{"hookSpecificOutput":{"hookEventName":"Stop","additionalContext":"You have uncommitted changes. Commit now with a descriptive message before continuing."}}'Stophook fires after every Claude response- Checks if you're in a git repo (exits silently if not)
- Injects a reminder into Claude's context: "commit now with a descriptive message"
- Claude commits because Claude knows git -- it just needs reminding
Started at 51 lines with merge conflict guards, detached HEAD checks, and porcelain status parsing. Then realized Claude already handles all of that. Deleted 46 lines.
- 5 lines of bash. No dependencies. No config. No nonsense.
- Works with any git repo. If you're in a git directory, it works.
- Smart exit. Silently does nothing if you're not in a repo.
- Descriptive commits. Claude writes the commit messages, and it's actually good at it.
- Granular history. Every change gets its own commit.
git logbecomes useful. - Green squares. The real reason you're here.
See CONTRIBUTING.md. The hook is 5 lines and we'd like to keep it that way.
MIT. Go turn your contribution graph radioactive.