Collect
Collect local git activity from the Git CLI and send it to Autographical.
Once installed, it runs automatically as a git hook on every commit (and other git events), capturing the activity and sending it to Autographical in the background without slowing git down.
Data collected
Events are produced by the corresponding git hook. Every event carries hostname, cwd (absolute working directory path), gitBranch, and gitRemoteUrl so it correlates with other connectors (e.g. Claude Code sessions running in the same checkout).
| Hook | Event type | Captures |
|---|---|---|
post-commit | GitCommitCaptured | sha, subject/body, author + committer, parents, files changed, shortstat |
post-merge | GitMergeCaptured | merge commit details plus the squash flag |
post-rewrite | GitRewriteCaptured | amend / rebase, old→new sha pairs, latest commit |
post-checkout | GitCheckoutCaptured | previous and new sha, branch name (branch switches only) |
pre-push | GitPushCaptured | remote name and URL, local/remote ref+sha tuples |
Installation
Homebrew (macOS, Linux)
brew install autographical/tap/autographical-git-collectDirect binary download
Pre-built binaries for darwin / linux / windows on amd64 and arm64 are
attached to every GitHub release .
Pick the version and platform from the releases page, then download,
extract, and put the binary on your $PATH:
# Set to the version + platform you want (see the releases page).
VERSION=0.1.0
OS=darwin # darwin | linux | windows
ARCH=arm64 # arm64 | x86_64
# Download and extract (use the .zip asset on windows).
curl -L "https://github.com/autographical/git-collect/releases/download/v${VERSION}/autographical-git-collect_${VERSION}_${OS}_${ARCH}.tar.gz" -o agc.tar.gz
tar xzf agc.tar.gz
# Install into ~/.local/bin and make sure it's on your PATH (bash).
mkdir -p ~/.local/bin
mv autographical-git-collect ~/.local/bin/
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrcThen register the hooks. Two modes:
Global — every repo on this machine
autographical-git-collect installWrites hook stubs to $XDG_DATA_HOME/autographical/git-hooks/ (defaults to ~/.local/share/autographical/git-hooks/) and sets git config --global core.hooksPath at that directory. Executable hook stubs belong under XDG_DATA_HOME rather than XDG_CONFIG_HOME — the latter is for inert configuration, the former for runnable user data.
Pass --skip-config to leave core.hooksPath alone and print the command to set it yourself.
Local — just this repository
cd /path/to/repo
autographical-git-collect install --localWrites stubs into the current repository’s .git/hooks/ directory. Does not touch any git config, so other repos are unaffected. Use this when you want collection on a single project rather than machine-wide.
Removal
autographical-git-collect uninstall # global
autographical-git-collect uninstall --local # current repoUninstall only removes files carrying our marker, so any unrelated hooks in the target directory are left in place.
Repo-local hooks (husky, lefthook, etc.)
When core.hooksPath is set (global mode), git ignores each repo’s own .git/hooks/ directory. To avoid silently disabling project-local hooks, the collector chains to them: after capturing its event, it looks up <git-dir>/hooks/<name> directly and, if executable, runs it with the original arguments, buffered stdin, stdout/stderr, and exit code.
For pre-push the order is reversed: the local hook runs first, and GitPushCaptured is only emitted on a zero exit — so a rejected push is never recorded as if it happened.
Configuration
Ingest token
The binary needs an ingest token to authenticate with Autographical. Create one in your Autographical user settings .
The token is resolved from the first available source:
- Environment variable —
AUTOGRAPHICAL_INGEST_TOKEN - Config file —
ingestTokenin~/.config/autographical/config.json
If no token is configured the binary silently no-ops (git operations are unaffected).
Config file example (shared with the Claude Code plugin):
{
"ingestUrl": "https://ingest.autographical.ai",
"ingestToken": "your-token"
}Ingest URL
Configure an ingest URL based on your Autographical deployment: Cloud, Cloud alternate data region, or self-hosted.
Defaults to Autographical Cloud US data region (https://ingest.autographical.ai).
Override with:
AUTOGRAPHICAL_INGEST_URLenvironment variableingestUrlin~/.config/autographical/config.json
Filesystem layout
All paths sit under a shared autographical/ namespace so sibling collectors co-locate cleanly:
| Purpose | Default | Notes |
|---|---|---|
| Shared config | ~/.config/autographical/config.json | Shared with the Claude Code plugin |
| Hook stubs (global) | ~/.local/share/autographical/git-hooks/ | $XDG_DATA_HOME if set; executable, so not under .config/ |
| Hook stubs (local) | <repo>/.git/hooks/ | Git’s default; no config change needed |
| Debug log | ~/.cache/autographical/git-collect/log.jsonl | $XDG_CACHE_HOME if set |
Debugging
Set AUTOGRAPHICAL_DEBUG=1 to log dispatch decisions and errors to the debug log above. Errors are always logged; debug entries are gated on the env var.