hooks-session-end-issue-hook
Original:🇺🇸 English
Translated
Configure a Stop hook that surfaces unfinished todos before a session ends and suggests creating GitHub issues for deferred work. Use when you want unfinished Claude Code session tasks automatically flagged for GitHub issue creation at session end.
2installs
Added on
NPX Install
npx skill4agent add laurigates/claude-plugins hooks-session-end-issue-hookTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →/hooks:session-end-issue-hook
Configure a hook that checks for unfinished todos at the end of each Claude response. If any pending or in-progress todos exist when you try to end the session, Claude is prompted to create GitHub issues for them before the conversation closes.
StopTodoWriteWhen to Use This Skill
| Use this skill when... | Use |
|---|---|
| You want unfinished todos deferred to GitHub issues | Configuring other hook types (PreToolUse, SessionEnd, etc.) |
| Preventing tasks from being forgotten at session end | Need general hooks knowledge or debugging |
| Projects with active issue trackers on GitHub | Understanding hook lifecycle events |
| Teams that rely on GitHub issues for work tracking | Writing custom hook logic from scratch |
Context
Detect current state:
- Settings file: !
find .claude -maxdepth 1 -name 'settings.json' - Existing Stop hooks: !
jq -r '.hooks.Stop // empty' .claude/settings.json - gh auth: !
gh auth status - jq available: !
jq --version
Parameters
| Flag | Default | Description |
|---|---|---|
| off | Skip checking |
Execution
Step 1: Check prerequisites
Verify that is installed — the hook requires it to parse the session transcript. Report if missing.
jqUnless is passed: verify is installed and authenticated (). Report the auth state so the user knows whether GitHub issue creation will work when the hook fires.
--no-verifyghgh auth statusStep 2: Locate hook script
The hook script ships with the hooks-plugin. Determine its path:
- If is set: use
${CLAUDE_PLUGIN_ROOT}${CLAUDE_PLUGIN_ROOT}/hooks/session-end-issue-hook.sh - Otherwise: look for the script relative to this skill's location ()
../../hooks/session-end-issue-hook.sh - Last resort: ask the user for the absolute path to the installed hooks-plugin
Report the resolved path to the user.
Step 3: Configure .claude/settings.json
.claude/settings.jsonRead existing if it exists. Merge the Stop hook — preserve all existing configuration.
.claude/settings.jsonIf a hook pointing to already exists, report that the hook is already configured and skip to Step 4.
Stopsession-end-issue-hook.shIf other Stop hooks exist, add alongside them (both will run).
Configuration to merge under the key:
hooksjson
{
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/session-end-issue-hook.sh\"",
"timeout": 15
}
]
}
]
}Use (15 seconds) — transcript parsing is fast. Create directory if it does not exist.
timeout: 15.claude/Step 4: Finalize
Report a summary of what was configured, including:
- Path to the hook script
- Location of
.claude/settings.json - Whether auth is ready
gh
Post-Actions
After configuring the hook:
- Suggest committing to share the hook with the team
.claude/settings.json - Remind the user that the hook fires at the end of every Claude response — it is silent when all todos are completed and only blocks when pending todos exist
- If is not authenticated, remind the user to run
ghso GitHub issue creation works when the hook firesgh auth login
How the Hook Works
When the hook fires at the end of a Claude response:
- It reads the session transcript from
transcript_path - Finds the last call — the final state of the todo list
TodoWrite - Extracts any todos with or
status: "pending"status: "in_progress" - If none exist → silently exits (no interruption)
- If any exist → outputs a block decision with the list of pending todos and suggested commands
gh issue create
Claude then has the opportunity to create the issues or ask the user what to do with the deferred work.
Agentic Optimizations
| Context | Approach |
|---|---|
| Quick setup, skip auth check | |
| Full setup with auth verification | |
| Test the hook manually | |
Quick Reference
| Item | Value |
|---|---|
| Hook event | |
| Settings location | |
| Timeout | 15 seconds |
| Trigger condition | Pending or in-progress todos in last TodoWrite call |
| Silent when | All todos completed or no TodoWrite calls in transcript |
| Issue label | |