๐Ÿช Hooks

March 19, 2026 ยท View on GitHub

Hooks enable automated workflows triggered by specific events during GitHub Copilot coding agent sessions, such as session start, session end, user prompts, and tool usage.

How to Contribute

See CONTRIBUTING.md for guidelines on how to contribute new hooks, improve existing ones, and share your use cases.

How to Use Hooks

What's Included:

  • Each hook is a folder containing a README.md file and a hooks.json configuration
  • Hooks may include helper scripts, utilities, or other bundled assets
  • Hooks follow the GitHub Copilot hooks specification

To Install:

  • Copy the hook folder to your repository's .github/hooks/ directory
  • Ensure any bundled scripts are executable (chmod +x script.sh)
  • Commit the hook to your repository's default branch

To Activate/Use:

  • Hooks automatically execute during Copilot coding agent sessions
  • Configure hook events in the hooks.json file
  • Available events: sessionStart, sessionEnd, userPromptSubmitted, preToolUse, postToolUse, errorOccurred

When to Use:

  • Automate session logging and audit trails
  • Auto-commit changes at session end
  • Track usage analytics
  • Integrate with external tools and services
  • Custom session workflows
NameDescriptionEventsBundled Assets
Dependency License CheckerScans newly added dependencies for license compliance (GPL, AGPL, etc.) at session endsessionEndcheck-licenses.sh
hooks.json
Governance AuditScans Copilot agent prompts for threat signals and logs governance eventssessionStart, sessionEnd, userPromptSubmittedaudit-prompt.sh
audit-session-end.sh
audit-session-start.sh
hooks.json
Secrets ScannerScans files modified during a Copilot coding agent session for leaked secrets, credentials, and sensitive datasessionEndhooks.json
scan-secrets.sh
Session Auto-CommitAutomatically commits and pushes changes when a Copilot coding agent session endssessionEndauto-commit.sh
hooks.json
Session LoggerLogs all Copilot coding agent session activity for audit and analysissessionStart, sessionEnd, userPromptSubmittedhooks.json
log-prompt.sh
log-session-end.sh
log-session-start.sh
Tool GuardianBlocks dangerous tool operations (destructive file ops, force pushes, DB drops) before the Copilot coding agent executes thempreToolUseguard-tool.sh
hooks.json