{"slug":"code","name":"A coding helper","kind":"recipe","what":"An AI coding agent in your Terminal that reads your project, edits files and runs commands, with changes you can undo.","page":"https://insidethemachine.ai/do/code","status":"partly-ran","status_label":"Partly checked: some paths were run, the rest only checked against docs","status_note":"The under-32 GB path (Aider) was run end to end on an Apple M4 Mac with 16 GB on 2026-10-15. The OpenCode path is checked against the docs only.","wrapper":"The wrapper scripts are generated from the site data. Every .sh passed bash -n and shellcheck and ran in plan mode on Linux (Debian 13). Every .ps1 passed the PowerShell parser and chat.ps1 ran in plan, verify and rollback mode under PowerShell 7 on Linux with Windows calls mocked. Not run on macOS or real Windows.","wrapper_tested":null,"sh":"https://insidethemachine.ai/install/code.sh","ps1":"https://insidethemachine.ai/install/code.ps1","md":"https://insidethemachine.ai/install/code.md","json":"https://insidethemachine.ai/install/code.json","one_liner":"curl -fsSL https://insidethemachine.ai/install/code.sh | bash","one_liner_windows":"irm https://insidethemachine.ai/install/code.ps1 | iex","actions":{"install":"curl -fsSL https://insidethemachine.ai/install/code.sh | bash","plan":"curl -fsSL https://insidethemachine.ai/install/code.sh | bash -s -- plan","verify":"curl -fsSL https://insidethemachine.ai/install/code.sh | bash -s -- verify","rollback":"curl -fsSL https://insidethemachine.ai/install/code.sh | bash -s -- rollback --yes"},"env":{"ITM_RAM":"memory in GB instead of detecting it","ITM_MODEL":"ollama tag to use instead of the pick"},"model_by_memory_gb":{"8":"qwen3.5:4b","16":"ornith-1.5:9b","24":"gemma4:12b","32":"qwen3.8:27b","48":"qwen3.8:27b","64":"qwen3.8:27b","96":"qwen3.8:27b","128":"qwen3.8:27b","192":"qwen3.8-flash-next:125b-a6b","256":"qwen3.8-flash-next:125b-a6b","512":"qwen3.8-flash-next:125b-a6b"},"low_memory":{"under_gb":32,"why":"Under 32 GB, the models that fit cannot use tools well, and OpenCode needs tools. So this path uses Aider, which does not need them.","install":[{"title":"Install Ollama","lines":[{"k":"run","c":"curl -fsSL https://ollama.com/install.sh | sh"}]},{"title":"Download a coding model","lines":[{"k":"ollama","c":"ollama pull $MODEL"}]},{"title":"Give the model more room","lines":[{"k":"you","c":"OLLAMA_CONTEXT_LENGTH=8192 ollama serve","why":"starts a server that keeps running; run it in its own window"}]},{"title":"Install Aider","lines":[{"k":"mac","c":"brew install uv"},{"k":"run","c":"uv tool install --force --python python3.12 --with pip aider-chat@latest"}]},{"title":"Start it in your project","lines":[{"k":"you","c":"export OLLAMA_API_BASE=http://127.0.0.1:11434","why":"sets a variable in your own shell"},{"k":"you","c":"cd /path/to/your/project","why":"needs your own file, folder or model name"},{"k":"you","c":"aider --model ollama_chat/$MODEL","why":"interactive; run it yourself"}]}],"verify":[{"run":"ollama --version","expect":"a version number"},{"run":"ollama list | grep -F \"${MODEL%%:*}\"","expect":"your model is in the list"},{"run":"aider --version","expect":"a version number"}],"rollback":[{"k":"run","c":"uv tool uninstall aider-chat"},{"k":"ollama","c":"ollama rm $MODEL"}]},"platforms":{"macos":{"install":[{"title":"Install Ollama","lines":[{"k":"run","c":"curl -fsSL https://ollama.com/install.sh | sh"}]},{"title":"Download a coding model","lines":[{"k":"ollama","c":"ollama pull $MODEL"}]},{"title":"Give the model a long memory","lines":[{"k":"you","c":"OLLAMA_CONTEXT_LENGTH=64000 ollama serve","why":"starts a server that keeps running; run it in its own window"}]},{"title":"Install OpenCode","lines":[{"k":"run","c":"curl -fsSL https://opencode.ai/install | bash"}]},{"title":"Start it in your project","lines":[{"k":"you","c":"cd /path/to/your/project","why":"needs your own file, folder or model name"},{"k":"you","c":"ollama launch opencode","why":"interactive; run it yourself"}]}],"verify":[{"run":"ollama --version","expect":"a version number"},{"run":"ollama list | grep -F \"${MODEL%%:*}\"","expect":"your model is in the list"},{"run":"opencode --version","expect":"a version number"}],"rollback":[{"k":"run","c":"rm -rf ~/.opencode"},{"k":"ollama","c":"ollama rm $MODEL"}]},"linux":{"install":[{"title":"Install Ollama","lines":[{"k":"run","c":"curl -fsSL https://ollama.com/install.sh | sh"}]},{"title":"Download a coding model","lines":[{"k":"ollama","c":"ollama pull $MODEL"}]},{"title":"Give the model a long memory","lines":[{"k":"you","c":"OLLAMA_CONTEXT_LENGTH=64000 ollama serve","why":"starts a server that keeps running; run it in its own window"}]},{"title":"Install OpenCode","lines":[{"k":"run","c":"curl -fsSL https://opencode.ai/install | bash"}]},{"title":"Start it in your project","lines":[{"k":"you","c":"cd /path/to/your/project","why":"needs your own file, folder or model name"},{"k":"you","c":"ollama launch opencode","why":"interactive; run it yourself"}]}],"verify":[{"run":"ollama --version","expect":"a version number"},{"run":"ollama list | grep -F \"${MODEL%%:*}\"","expect":"your model is in the list"},{"run":"opencode --version","expect":"a version number"}],"rollback":[{"k":"run","c":"rm -rf ~/.opencode"},{"k":"ollama","c":"ollama rm $MODEL"}]},"windows":{"install":[{"title":"Install Ollama","lines":[{"k":"run","c":"irm https://ollama.com/install.ps1 | iex"},{"k":"you","c":"$env:OLLAMA_CONTEXT_LENGTH=64000; ollama serve","why":"starts a server that keeps running; run it in its own window"}]},{"title":"Download your model","lines":[{"k":"ollama","c":"ollama pull $MODEL"}]},{"title":"The rest of the recipe","lines":[{"k":"note","c":"Install Ollama with this PowerShell command, or the installer from ollama.com/download. On Linux, the install command above works as it is. After that, every ollama command on this page is the same. In PowerShell, start Ollama with a long memory like this. OpenCode runs on Windows too; see opencode.ai/docs. Aider's page has its Windows steps. Steps: https://insidethemachine.ai/do/code"}]}],"verify":[{"run":"ollama --version","expect":"a version number"},{"run":"ollama list","expect":"your model is in the list"}],"rollback":[{"k":"ollama","c":"ollama rm $MODEL"}]}}}