# Inside the Git Hooks: Tagging Every AI Agent Commit (Part 3)

DevFeed: [Inside the Git Hooks: Tagging Every AI Agent Commit (Part 3)](<https://devfeed.tech/articles/inside-the-git-hooks-tagging-every-ai-agent-commit-part-3-25424.md>)

Original publisher: [Read original article](<https://jonnyzzz.com/blog/2026/06/26/inside-the-git-hooks-for-ai-agents/>)

Author: Eugene Petrenko

Published: 2026-06-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [Eugene Petrenko](<https://devfeed.tech/sources/eugene-petrenko.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [hooks](<https://devfeed.tech/topics/hooks.md>), [AI Agent](<https://devfeed.tech/topics/ai-agent.md>), [observability](<https://devfeed.tech/topics/observability.md>), [Security](<https://devfeed.tech/topics/security.md>)

Tags: [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [ai-coding](<https://devfeed.tech/tags/ai-coding.md>), [capture](<https://devfeed.tech/tags/capture.md>), [commit](<https://devfeed.tech/tags/commit.md>), [eugene-petrenko](<https://devfeed.tech/tags/eugene-petrenko.md>), [git](<https://devfeed.tech/tags/git.md>), [git-hooks](<https://devfeed.tech/tags/git-hooks.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [jonnyzzz](<https://devfeed.tech/tags/jonnyzzz.md>), [provenance](<https://devfeed.tech/tags/provenance.md>), [repo](<https://devfeed.tech/tags/repo.md>), [sandbox](<https://devfeed.tech/tags/sandbox.md>), [tag-41199d53f463](<https://devfeed.tech/tags/tag-41199d53f463.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

## AI overview

This third-part tutorial explains a best-effort Git hook layer for AI agents running inside a sandbox. The hooks stamp session IDs on commits, preserve the tags through amend, rebase, and squash, and capture restorable copies of pushed changes while continuing to run repository-local hooks.

## Source excerpt

Part 3 -- the build for the lighter solution. How a set of git hooks stamps a session id on every commit an AI Agent makes, survives squash and rebase, and captures each push -- all best-effort, all inside the sandbox.