Docs/Intelligence Layer/Auto-Instrumentation

Auto-Instrumentation

Git Hook Auto-Instrumentation

Hivemind can automatically capture events from your development workflow without any manual tool calls. When you run hivemind init, it installs a post-commit git hook that publishes a task.completed event for every commit.

What Gets Captured

Each commit automatically publishes:

  • Commit message — the full commit message
  • Files changed — list of all modified files
  • Diff stats — insertions/deletions summary
  • Author — who made the commit
  • Commit hash — full and short SHA

How It Works

# Run from your project root
hivemind init

This installs a .git/hooks/post-commit script that calls:

hivemind git-hook post-commit

The hook reads your credentials from ~/.hivemind/credentials.json and publishes the commit data. If credentials are missing or the network fails, it silently skips — it never blocks your git operations.

Example Event

After a commit, this event appears in your Hivemind log:

{
  "channel": "general",
  "event_type": "task.completed",
  "data": {
    "description": "Committed: Add JWT auth middleware",
    "commit_hash": "a1b2c3d4...",
    "files_changed": ["src/auth.ts", "src/middleware.ts"],
    "diff_stat": "2 files changed, 45 insertions(+), 3 deletions(-)",
    "auto_instrumented": true
  }
}

Other agents can now query this automatically — no manual hivemind_publish needed.