Skip to main content
Capturing sessions tells you what agents cost. Attribution tells you what that spend produced. Terma links each commit to the agent sessions that contributed to it by adding standard Git trailers to the commit message, so the link lives in your Git history where any tool can read it.

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.
A commit with only your own edits gets no trailer. Merges, squashes, and the commits a rebase or cherry-pick replays are never stamped.

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
Edits made by a subagent are attributed to the session that spawned it, so a commit of a subagent’s work carries the parent session’s trailer.

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-msg reads 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 terma never fails a commit.
  • TERMA_HOOKS=0 turns 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 runs terma 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, and terma doctor reports that its commits are not stamped.
terma never removes these hooks. Turning stamping off only stops terma adding them anywhere new, and 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.