How commits are stamped
1
Agent hooks record what each session edits
As an agent works, its hooks tell Terma which files each session touched. Terma keeps a local manifest per session.
2
prepare-commit-msg intersects staged files with those manifests
When you commit, Terma’s
prepare-commit-msg hook compares the staged files with every session’s manifest. Each session that touched a staged file gets one Agent-Session-Id / Agent-Tool trailer pair.3
post-commit retires the committed files
post-commit removes the committed files from the session manifests, so the next commit is not stamped for work that already landed, and records the commit for delivery to Terma.Commit message format
A commit with a session trailer
Agent-Session-Id is the agent’s own session id — the same id you see in the dashboard. Agent-Tool names the agent, followed by its version when the agent reports one. The trailers follow the standard Git trailer format, so git log --format='%(trailers)' and the GitHub API can read them without Terma.
Several sessions in one commit
A commit can contain work from several sessions — for example, Claude Code drafted a function and Codex wrote its tests. The hook adds one trailer pair per contributing session:A commit with two session trailers
Every commit is counted
post-commit records an event for every commit in the repository, stamped or not, so Terma can compare agent-assisted work with the rest. For a commit without a session, the event carries only its identity and size — SHA, remote URL, branch, file count, and line totals — never file names. See Privacy and security.
Fast, local, and safe
prepare-commit-msgreads local manifests only and makes no network call. It finishes in under 50 ms.- Events are appended to a local queue and delivered in the background after the commit, with retry and backoff.
- Every hook is guarded: a missing or broken
termanever fails a commit. TERMA_HOOKS=0turns terma’s hooks off for one shell or process.
Setting it up
Commit stamping is your team’s choice. An organization admin turns on Stamp commits with the agent session on Team settings → Data collection. Each developer runsterma setup once; there is nothing to commit.
With stamping on, the first agent session in a repository your team collects installs prepare-commit-msg and post-commit into that repository’s own .git/hooks (the shared one, so linked worktrees use them too). git neither tracks nor commits these files. A repository no agent has worked in, and a folder outside git, get nothing.
terma chains to hooks already there: an existing hook is renamed <name>.pre-terma and still runs first, unchanged. It keeps its veto — if it exits non-zero, the commit stops.
- pre-commit and lefthook work normally, because terma doesn’t set
core.hooksPath. - husky v9 sets the repository’s own
core.hooksPath, so git never reads.git/hooks. terma skips such a repository, andterma doctorreports that its commits are not stamped.
terma teardown leaves them too — with terma gone, they only run the hook each one displaced.
Trailers attribute work among colleagues; they are not proof of authorship. Anyone with commit access can write a trailer by hand.
Where attribution shows up
- The dashboard shows each session’s git activity, the pull requests agents contributed to, and a burn map of where agent work lands in your codebase. See Pull requests and Burn map.