codr is (technically) an open-source competitor to Anthropic's Claude Code and other cli coding agents, written entirely in base R*.
It can actually cause serious issues with your system including loss of data!
It was written "the old fashioned way" without LLMs - which just means I followed the great python tutorial/example from Mihail Eric.
*(Base R and some Ollamar for connecting to LLMs and jsonlite to make parsing easier.)
Quite simply because it was fun and I wanted to learn how these cli agents work. Also it's ridiculous to write one in R, so all the more reason to do it.
But if you really know what you are doing and want to try it out, here is a quick setup:
- You need to have a working installation of Ollama
- You need to have downloaded the model you want to use via Ollama. I found that models <=4b are not that good at following precise instructions and might therefore break the tool calls. "qwen3.5:9b" seems to be working fine.
- You need to have a working installation of R and the R packages ollamar and jsonlite
- Download the
codr.Rscript. - Specify the model you have setup and want to use in the
OLLAMA_MODEL_NAMEvariable at the top of the script. - Run the agent either through the terminal via
Rscript codr.Ror via the RStudio/Positron Console:
source("codr.R")- You can now start chatting with the agent and request things like "What does the Rscript file in this directory do?", "What files are in the project?", "Write a README.md file for the R project in this directory", etc.
This is the initial release. Roughly 300 lines of "hand written" base R and only three tools for the assistant to use: reading files, listing dir content, and creating/modifying files. But with this toolset, the agent can now start to implement features to itself - "AGI" has basically just been achieved 😉.
