Code Engineering
Whitelisted read-only git operations — status, diff, log, branch, blame, show, ls-files, tag.
gitThe agent's window into git history. Pair with file_edit / file_write for the edit half of the loop.
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.
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 ...
Real scenarios where agents put this tool to work.
Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/code/git/GitTool.java in the swarm-ai repository.