Files
awesome-copilot/docs/README.hooks.md
Imran Siddique 4a4b9343d5 feat: add governance-audit hook — threat detection for Copilot sessions
Add real-time governance audit hook that scans prompts for threat signals:
- 5 threat categories: data exfiltration, privilege escalation,
  system destruction, prompt injection, credential exposure
- 4 governance levels: open, standard, strict, locked
- Append-only JSON audit trail (logs/copilot/governance/audit.log)
- Session summary with threat counts at session end
- Privacy-aware: logs decisions and metadata, never prompt content

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 13:29:41 -08:00

2.0 KiB

🪝 Hooks

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 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
Name Description Events Bundled Assets
Governance Audit Scans Copilot agent prompts for threat signals and logs governance events sessionStart, sessionEnd, userPromptSubmitted audit-prompt.sh
audit-session-end.sh
audit-session-start.sh
hooks.json
Session Auto-Commit Automatically commits and pushes changes when a Copilot coding agent session ends sessionEnd auto-commit.sh
hooks.json
Session Logger Logs all Copilot coding agent session activity for audit and analysis sessionStart, sessionEnd, userPromptSubmitted hooks.json
log-prompt.sh
log-session-end.sh
log-session-start.sh