Build a working coding agent in R from three tools
Author builds a functional coding agent in R starting from three tools, then adds tools to make it safer and more efficient.
Done with a custom-built or unnamed agent
- What they did
- The author uses R's ellmer package to build a Claude-backed agent from three plain R functions: read file, write file and run shell command. Each function returns a string to the model, and a short system prompt tells it to read before editing and to run tests. He then adds list and search tools, a path check that keeps access inside the project directory, and a targeted edit tool.
- How it went
- The three-tool agent can find a function, read the existing tests, write a new test and run the suite, though the author says it falls well short of Claude Code. The shell tool stays risky, and the author defers fuller security coverage to a later post.
- Worth knowing
- Wrap every file tool in the path check, not just search. The unrestricted shell tool can still bypass it, so don't treat the project-directory check as full protection.
Try it yourself with Claude Code
Help me build a small coding agent in [language, e.g. R] from three tools: read a file, write a file, and run a shell command. Wire them to [LLM provider] in a simple loop and test it on a small task in [path to scratch folder]. Then suggest and add tools that make it safer and more efficient, such as confirmation before running commands. Finish when it completes the test task end to end.
Discussion on Bluesky · Jun 19, 2026
Five of these in your inbox every morning
The best things people got an AI agent to do, each with the prompt to try it.
More like this
- Claude
Build a C compiler with a team of parallel agents
Anthropic's engineering write-up on tasking Opus 4.6 agent teams with building a C compiler.
- Custom agent
Add agentic forgetting to an agent's memory
Someone implemented a rudimentary version of Tim Kellogg's agentic forgetting approach and reports it works impressively even in its simplest form.
Hand narrow code changes to Devin for pull requests
A team used Devin for a month on small fixes like chart formatting and API edge cases, with tests and PRs; a complex full-stack task went poorly.
Migrate toolchain, architecture and site design with Claude Code
A developer had Claude Code switch a monorepo to oxlint/oxfmt, restructure the architecture and redesign a site, validating in a loop; the redesign took days instead of weeks.
Build and deploy a Game of Life simulation site
In a vendor launch demo, Devin built an interactive Game of Life website, added requested features step by step, and deployed it to Netlify.
Resolve a Slack-reported issue with a coding agent
A Codex agent resolved an issue passed to it in about 40 minutes, and an ops agent verified the fix back in Slack.