Roo Code Tutorial: Setup, Custom Modes, and Ollama

Updated 3 min read

AI coding assistants streamline daily development, but running unconstrained models can quickly drain API credits or execute risky terminal actions. Roo Code provides fine-grained permission controls, support for local inference, and custom modes directly inside Visual Studio Code. This guide walks you through setting up a workspace with reproducible safety guardrails, custom roles, and local model backends.

Watch the video on YouTube

Before you start

  • VS Code installed on your system
  • A clean Git installation and basic terminal familiarity
  • An API key (Anthropic, OpenRouter, Gemini) or Ollama for local inference

Finding the Official Roo Code Extension

Roo Code originated as a fork of Cline and remains published under the identifier rooveterinaryinc.roo-cline on the Visual Studio Code Marketplace. When searching through extensions, verifying this identifier ensures you avoid third-party wrappers or conflicting forks that might cause configuration issues.

Note that direct web links to the Marketplace entry can occasionally change or report temporary outages during platform migrations. You can install the extension directly inside the editor or by passing the verified extension identifier to the editor command-line runner.

marketplace.visualstudio.com
  1. wait for “Roo Code”
  2. scroll 600px
  3. hover “Overview”

Preparing a Clean Git Repository

Roo Code takes snapshots of your workspace whenever it edits files or runs commands, enabling one-click rollbacks if an unexpected modification occurs. These checkpoints rely heavily on Git to track state and render accurate diffs.

Initialize your repository and commit all baseline code before launching agent prompts. Running Roo Code with uncommitted modifications can obscure the agent changes and break rollback reliability.

TerminalNot verified in our test run
# Create project directory
mkdir -p ~/roo-demo && cd ~/roo-demo
# Initialize git repository
git init
# Create sample python file
printf 'def add(a, b):
    return a + b
' > math_utils.py
# Establish clean git baseline
git add . && git commit -m 'Initial baseline commit'
# Confirm working tree is clean
git status

Setting Up Ollama for Local Inference

Sending minor queries or debugging logs to frontier cloud models will rapidly consume your API balance. By routing non-destructive modes to a local inference engine, you can handle simple documentation checks and code explanations without running up a bill.

You can run the install script below to deploy Ollama, start the local daemon in the background, and pull a lightweight model such as qwen2.5:1.5b. Roo Code can then connect to the local OpenAI-compatible endpoint directly from its settings panel.

TerminalNot verified in our test run
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Start Ollama server in background
pgrep -x ollama >/dev/null || (nohup ollama serve > /tmp/ollama.log 2>&1 &)
# Allow server initialization
sleep 3
# Pull lightweight local model
ollama pull qwen2.5:1.5b
# Verify model is available locally
curl -s http://localhost:11434/api/tags | grep -o '"name":"[^"]*"'

Creating Project-Specific Modes

Roo Code ships with built-in modes like Architect, Code, and Ask. In addition to these defaults, you can define specialized project roles by creating a .roomodes file in the root of your project directory.

This JSON configuration allows you to establish specific system prompts and restrict tool access. For example, a dedicated test-writing mode can be granted read and write access strictly for unit test directories while preventing unwanted changes to core application files.

Configuring Model Context Protocol Tools

The Model Context Protocol enables Roo Code to communicate with external tools, such as web fetching utilities, databases, and container runtimes. Workspace-level integrations are configured within your project using a .roo/mcp.json file.

Adding targeted tools through this protocol allows Roo Code to inspect documentation or query local environments without requiring unrestricted shell access. Each declared tool adheres to a clear schema so the assistant can invoke operations predictably.

Guardrails and Safe Execution Rules

Automated agents should never be granted unchecked terminal privileges. Roo Code allows you to review and confirm individual shell executions while permitting benign read-only operations automatically.

Pair strict execution boundaries with deliberate model selection. Keep frontier models reserved for high-level architectural decisions and route lower-stakes implementation or query tasks through economical cloud tiers or your local Ollama setup.

Wrap-up

You now have a structured Roo Code environment with Git checkpoints, a local Ollama fallback to rein in token costs, custom project modes, and Model Context Protocol tooling. By setting explicit execution boundaries and mapping models to the right tasks, you can automate routine coding safely without risking unexpected modifications or high API bills.

FAQ

Why is the extension identifier rooveterinaryinc.roo-cline?

Roo Code originated as a community fork of Cline and retains its legacy publisher and extension identifier on the Visual Studio Code Marketplace.

How does Roo Code track rollbacks?

Roo Code creates checkpoints by snapshotting workspace files and Git state whenever tasks are initiated, allowing you to restore code with a single click.

Where are custom modes defined?

Custom modes are defined in a .roomodes JSON file placed in the root of your workspace, allowing you to customize system prompts and restrict available tools.

Sources

Subscribe for more tested tutorials