]> git.giacomolli.uk - onechat/commit
Run the tools of an agent and log each call
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 22:12:48 +0000 (19:12 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 22:12:48 +0000 (19:12 -0300)
commitf2d227db9c3b556c7b0e1cfe735ccc54311850e5
tree0bbd4945013012a80b279650a19e0ad9ec4cd7d5
parent4a605fa39078354654ae648e489c117c7a445197
Run the tools of an agent and log each call

The agent gets four more tools after zoom and date: shell, read, write,
and edit. Turns and compactions send all six, so they keep one cached
prefix. shell runs a command with bash as the user in the working
directory of the agent, with no input and no sandbox, in its own process
group, so an interrupt kills the command and its children. read, write,
and edit take a path relative to the working directory or an absolute
one, and edit replaces a text that occurs exactly once.

Each call goes to the log as a tool message, the log is flushed, and
only then does the tool run, so the log never misses an action outside
the agent. The result goes to the log as an echo message. An interrupt
before the flush logs that the tool did not run. A tool error is the
output, so the model sees it.

Each output keeps its first and last 15,000 characters, 30,000 in all,
with a mark of the cut bytes between them. shell and read keep only the
ends while they read, so a long output does not fill the memory.

Issue: 5daf23e
memory.go
prompt.go
prompt_test.go
tools.go [new file with mode: 0644]
tools_test.go [new file with mode: 0644]