Overview
Add a new built-in toolset, git, that gives an agent structured, read-only access to the working repository: status, history, branches, a commit's changes, and line-level authorship. It is implemented with go-git (already a project dependency), so it needs no git binary and is fully unit-testable.
Tools (all read-only):
| Tool |
Returns |
git_status |
current branch + changed files (staged / unstaged / untracked) |
git_log |
recent commits (hash, author, date, subject); limit + optional path |
git_branches |
local branches, with the current one marked |
git_show |
one commit's metadata + changed files with +/- line counts |
git_blame |
line-by-line authorship for a file |
Motivation
Coding agents constantly need git context — "what changed?", "what's the recent history?", "who last touched this line?". Today the only way is to call the shell tool with raw git commands, which has three drawbacks:
- The model must parse free-form porcelain text, which is error-prone.
shell is a powerful, stateful tool; git inspection should not require it, and should never risk a destructive command.
- It depends on a
git binary being installed in the environment.
A dedicated read-only toolset returns clean, structured output, is safe by construction, and works without shell or the git binary.
Use cases
- Before editing, the agent runs
git_status + git_diff-style review via git_show/git_log to understand the working state.
- "Summarize what changed in the last 5 commits" →
git_log(limit=5) + git_show.
- "Who introduced this line and why?" →
git_blame(path) + git_show(<hash>).
- Safe inspection in a hardened agent that deliberately does not enable
shell.
Proposed solution
New toolset type git in pkg/tools/builtin/git/, registered in
pkg/teamloader/toolsets/toolsets.go and documented in the built-in toolset catalog (pkg/teamloader/toolsets/catalog.go) — the catalog drift-guard test forces the catalog entry.
- Implemented with
github.com/go-git/go-git/v5 (already a direct dependency) - pure Go, no git binary required.
- The repository is opened at the agent's
WorkingDir (like filesystem), with DetectDotGit so a subdirectory still resolves the repo root.
- Read-only by design. No
add/commit/checkout — write operations are intentionally out of scope for v1 (they are stateful, overlap shell, and raise permission questions). Noted as possible future work.
Alternatives
shell + git — works, but returns unstructured text, requires the git binary, and exposes the full (writable, arbitrary-command) shell surface.
Related issues
No response
Additional context
go-git's porcelain differs slightly from the CLI in some edge cases (rename detection, a few .gitignore nuances); this is acceptable for read-only inspection. Working-tree line diffs and write operations are deferred to keep v1 focused and safe.
Overview
Add a new built-in toolset,
git, that gives an agent structured, read-only access to the working repository: status, history, branches, a commit's changes, and line-level authorship. It is implemented withgo-git(already a project dependency), so it needs nogitbinary and is fully unit-testable.Tools (all read-only):
git_statusgit_loglimit+ optionalpathgit_branchesgit_showgit_blameMotivation
Coding agents constantly need git context — "what changed?", "what's the recent history?", "who last touched this line?". Today the only way is to call the
shelltool with rawgitcommands, which has three drawbacks:shellis a powerful, stateful tool; git inspection should not require it, and should never risk a destructive command.gitbinary being installed in the environment.A dedicated read-only toolset returns clean, structured output, is safe by construction, and works without
shellor thegitbinary.Use cases
git_status+git_diff-style review viagit_show/git_logto understand the working state.git_log(limit=5)+git_show.git_blame(path)+git_show(<hash>).shell.Proposed solution
New toolset type
gitinpkg/tools/builtin/git/, registered inpkg/teamloader/toolsets/toolsets.goand documented in the built-in toolset catalog (pkg/teamloader/toolsets/catalog.go) — the catalog drift-guard test forces the catalog entry.github.com/go-git/go-git/v5(already a direct dependency) - pure Go, nogitbinary required.WorkingDir(likefilesystem), withDetectDotGitso a subdirectory still resolves the repo root.add/commit/checkout— write operations are intentionally out of scope for v1 (they are stateful, overlapshell, and raise permission questions). Noted as possible future work.Alternatives
shell+git— works, but returns unstructured text, requires thegitbinary, and exposes the full (writable, arbitrary-command) shell surface.Related issues
No response
Additional context
go-git's porcelain differs slightly from the CLI in some edge cases (rename detection, a few.gitignorenuances); this is acceptable for read-only inspection. Working-tree line diffs and write operations are deferred to keep v1 focused and safe.