Skip to content

GitHub Copilot Hooks

Passive time tracking for GitHub Copilot's agent mode.

Setup

Create .github/hooks/hooks.json in your repository:

{
  "hooks": [
    {
      "event": "preToolUse",
      "command": "python -m opentime.hooks.copilot"
    },
    {
      "event": "postToolUse",
      "command": "python -m opentime.hooks.copilot"
    },
    {
      "event": "agentStop",
      "command": "python -m opentime.hooks.copilot"
    }
  ]
}

What Gets Recorded

  • preToolUse / postToolUse → Tool call timing
  • agentStop → Conversation turn end

Database: ~/.opentime/copilot.db (configurable via OPENTIME_DB_PATH)

Agent hooks are in public preview

Copilot agent hooks require VS Code with Copilot agent mode enabled. See VS Code docs for setup.