How commit trailers work
When you rungit commit, Terma’s prepare-commit-msg hook fires automatically. The hook reads the local spool manifest — a file written by the harness as the session ran — and intersects the set of files staged for the commit against the files each session touched. For every session that overlaps with the staged files, the hook appends an Agent-Session-Id and Agent-Tool trailer pair to the commit message.
If the commit contains only your own edits with no AI session overlap, the hook exits without modifying anything. Merge commits and squash commit messages are never touched.
The hook reads local manifests only and makes no network calls, so it completes in under 50 milliseconds regardless of network conditions.
Commit message format
A commit with AI attribution looks like this:Example commit with session trailers
git log --format and tools like GitHub’s API can parse them without any Terma-specific tooling.
Multiple sessions in one commit
A single commit can incorporate work from several AI sessions — for example, if you used Claude Code to draft a function and then used Codex to write the tests in the same branch. In that case, the hook appends one trailer pair per contributing session:Commit with multiple session trailers
Codebase burn map
Once attribution data accumulates across commits, Terma builds a codebase burn map: a repository-level view showing AI activity by file. The burn map highlights:- Hotspots — files re-read by agents in session after session, often a sign of ambiguous interfaces or missing documentation
- Retry loops — areas where agents repeatedly attempted the same edit, indicating brittle or unclear code
- Concentrated activity — files that account for a disproportionate share of total token spend
Change context
For every merged pull request or commit, Terma surfaces:- The AI sessions that contributed to it
- Total tool calls and token cost across those sessions
- Attribution score (proportion of changed lines touched by an attributed session)
- Review rounds and CI retry counts
- Links back to each originating session for full replay
Predicting coverage
Before any real commit lands, you can check how much of your activity Terma will be able to attribute. Runterma doctor to verify the full chain end to end and get a predicted coverage percentage based on what is currently connected:
terma install wires the prepare-commit-msg hook by opening a pull request against your repository. Once merged, all subsequent commits from connected sessions are automatically annotated.