agent-session-hooks

v2026.09.24

Explains how startup scripts run at the start of agent sessions and inject context. Use when an agent session reports a failing hook (e.g. validate-session-branch-name.sh, validate-session-worktree-name.sh, validate-session-commit-signing.sh, validate-session-gh-authentication.sh, validate-session-skills.sh), or when adding a new startup check.

GitHub
Install command
npx skhub add jimmypaolini/agent-session-hooks
Markdown
SKILL.md

Agent Session Hooks

Startup checks run at the start of every agent session and inject their failure as additional context. Fix what they report before writing any code — each one names the problem and the command that repairs it.

When to Use This Skill

  • When an agent session fails at startup due to a hook.
  • When you need to understand how the session gets context about branches, worktrees, git signing, GitHub authentication, or missing skills.
  • When you need to add a new check that should run for every agent session.

Architecture

ScriptChecks
validate-session-branch-name.shBranch follows <type>/<scope>-<description>; directs the agent to the rename-branch skill
validate-session-worktree-name.shWorktree directory follows lowercase kebab-case naming and ignore conventions
validate-session-commit-signing.shcommit.gpgsign, user.signingkey, and a GPG signing smoke test
validate-session-gh-authentication.shThe active gh account plus Projects access
validate-session-skills.shEvery skill declared in skills-lock.json is present; directs the agent to codebase:install-skills

Each script is registered twice, once per harness, and both registrations point at the same file:

HarnessRegistration
Claude CodeSessionStart entries in .claude/settings.json
GitHub CopilotsessionStart entries in .github/hooks/*.json

Adding a New Check

When adding a check: put the script under scripts/git/, emit through scripts/git/emit-session-hook-context.sh so both harnesses can read it, and register it in both places.

Why the credential checks resolve the session's own token and signing configuration rather than the hook shell's, and why a hook can fail but never hang, is in ADR 0010.

Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

MIT

Source path

.agents/skills/agent-session-hooks

Default branch

main

Latest commit

5ac136d

Tree SHA

9af071d