Code Engineering
Pure-Java unified diff between two files or two literal strings — no shell-out, no native binary.
diffLets the agent see the difference between a fresh draft and the existing file, or two versions in memory, without spawning git diff.
READ_ONLY. Output capped at 50 KB. The agent typically uses this to decide whether a proposed change is the change it intended — compose with file_edit/file_write for an edit → verify loop.
When a user asks:
Show me the diff between the current README and the draft I just wrote.
the agent calls the tool:
diff(file_a="README.md", file_b="README-draft.md", context=3)and gets back: @@ -12,7 +12,7 @@ - Status: alpha + Status: production ...
Real scenarios where agents put this tool to work.
Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/code/diff/DiffTool.java in the swarm-ai repository.