Your agent hears CI fail.
You push to a pull request. GitHub’s checks fail, or it hits a merge conflict. The Claude session that opened it is told what is wrong, finds the cause, and fixes it. You are not the messenger.
CI fails after the agent stopped looking.
A pull request goes red minutes after the turn ends. Nobody tells the session, so you copy the error across by hand. This is the same push, with the hook on.
Five steps. It stops at the first one that says nothing to do.
When a turn ends, the hook climbs this ladder. Pick a situation:
Small on purpose.
Each figure is a property of the code in this repository, not a benchmark.
One gh pr list for all your open PRs, not one per branch.
Real script, real temp git repo, a stub gh. No network.
A failure is reported once per commit, so the hook cannot loop.
The hook timeout. A normal run takes about one second.
Two tools. Different moments.
The hook runs inside your session. The desktop app's Auto-fix watches from outside. Use both.
| backtogreen hook | Desktop app Auto-fix | |
|---|---|---|
| Fires when | A turn ends | CI fails, even while the session is idle |
| Wakes an idle session | No | Yes |
| Lives in | Your ~/.claude, any editor that runs Claude Code | The Claude desktop app |
| Setup | One installer | A switch per pull request |
| Good for | Catching red CI the moment you come back | Fixing it while you are away |
Two lines. Then it is on.
Needs python3 and the GitHub CLI signed in (gh auth login). Hooks load when a session starts, so open a new one afterwards.
~/.claude/skills/backtogreenthe skill: how a session fixes a red check on its own PR
~/.claude/hooks/failedci2claude.logone line per run: tells a silent hook from one that never ran
~/.claude/hooks/failedci2claude.seen.jsonwhat was already reported, so nothing repeats
pytest teststhe seven tests, run from the repository