The first time I let a local model drive Foundry unsupervised, it spent eleven turns trying to fix a fuzz test by renaming the test function. Not changing the logic. Renaming it. testFuzz_withdraw, then test_fuzz_withdraw, then testWithdrawFuzz, each time running the suite and reading the same compiler error with fresh optimism.

That experiment still turned into one of the more useful tools in my workflow, once I accepted what a small local model can and cannot do in an agent loop. The idea is simple: give qwen2.5-coder three tools (run forge tests, read a contract file, write a fuzz test) and point it at a target contract. It reads the code, writes property tests, runs them, reads the failures, and iterates. When it works, it surfaces broken invariants I would have gotten to eventually, but it gets there while I make coffee, and everything stays on my machine.

The three tools

Ollama supports function calling through its chat API. You describe tools in JSON schema, the model returns tool_calls, you execute and feed results back. Keep the toolset minimal, every extra tool is another way for a 7b model to get confused.

const tools = [