Do you have an ungolfed version? I was going to ask my LLM to make one.
https://gist.github.com/tosh/61aca9ffa9ea115fa4df332407d7a9a...
i'd move the headers out of the loop (u can prolly just hard-code it), and move context_usage to inside the if (and maybe hard-code it, too)
I had a tool description earlier but 'sh' as tool name seems to be sufficient, the agent behaviour was the same.
There might be performance gains if a description is added though, or worth trying different ways of telling the agent about what is available in the environment.
That said, the newer models are fairly good at driving a harness to explore the environment.