← All tools

Code Engineering

Git (read-only)

Whitelisted read-only git operations — status, diff, log, branch, blame, show, ls-files, tag.

git

Overview

The agent's window into git history. Pair with file_edit / file_write for the edit half of the loop.

How it works

READ_ONLY. Allowed subcommands: status, diff, log, branch, blame, show, ls-files, rev-parse, remote, tag, describe. Argv tokens containing shell metacharacters (`;`, `&&`, `||`, `|`, backtick, `$(`, `>`, `<`) are rejected before exec. No shell interpolation — tokens are passed individually through ProcessBuilder.

Example

When a user asks:

Show me the last 5 commits touching UserService.

the agent calls the tool:

git(subcommand="log", args="-5 --oneline -- src/.../UserService.java")

and gets back: 8cf4075 fix: NPE on logout flow c1a23e4 feat: add SSO callback ...

What it's good for

Real scenarios where agents put this tool to work.

Understand recent activity on a file before editing it
Trace 'why is this here' via git blame as part of root-cause analysis

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/code/git/GitTool.java in the swarm-ai repository.

Open git on GitHub →