ollama-coder

ollama-coder is an agent for Claude Code from PratikHotchandani22/claude-ollama-agents. It costs 67 tokens per session (696 once invoked), scanned A, original, MIT.

A code-writing agent that delegates larger coding tasks to a local Ollama language model. It reads relevant files, builds a task prompt, gets generated code, and writes the result to files.

In plain words
What is it for?
Use it to generate code, fix bugs, refactor files, and implement features. It can include existing files as context so generated code follows their patterns.
Why use it?
It moves the main code-generation work to a model running locally. The instructions are intended for tasks where more than five lines of code need to change.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter; reads .claude/ paths.

Good fit Use it to generate code, fix bugs, refactor files, and implement features. It can include existing files as context so generated code follows their patterns.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/pratikhotchandani22/claude-ollama-agents/ollama-coder
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/PratikHotchandani22/claude-ollama-agents

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ollama-coder

README.md
[![agentmods](https://agentmods.dev/badge/agents/pratikhotchandani22/claude-ollama-agents/ollama-coder/github.svg)](https://agentmods.dev/agents/pratikhotchandani22/claude-ollama-agents/ollama-coder)
Your own site
<a href="https://agentmods.dev/agents/pratikhotchandani22/claude-ollama-agents/ollama-coder"><img src="https://agentmods.dev/badge/agents/pratikhotchandani22/claude-ollama-agents/ollama-coder/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ollama-coder

Your own site · 80×15
<a href="https://agentmods.dev/agents/pratikhotchandani22/claude-ollama-agents/ollama-coder"><img src="https://agentmods.dev/badge/agents/pratikhotchandani22/claude-ollama-agents/ollama-coder.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 696 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00067 $0.00696
Opus 5 $0.00034 $0.00348
Sonnet 5 $0.00013 $0.00139
Haiku 4.5 $0.00007 $0.00070

Measured 11d ago against content hash 1ce9918892bf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

ollama-coder scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/ollama-coder.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ollama Coder Agent

You are a code generation agent. Your job is to write code by delegating to a local Ollama model via the streaming helper script, then writing the result to files.

How You Work

  1. Understand the task — Read any referenced files to understand context
  2. Build the prompt — Craft a clear, specific prompt for Ollama
  3. Call Ollama — Use the streaming helper script (visible output!)
  4. Extract and write — Take the generated code and write it to the correct files

Calling Ollama

Use this pattern to generate code:

python3 ~/.claude/scripts/ollama_stream.py --stats --agent ollama-coder \
  --model "qwen3.5:35b-a3b" \
  --prompt "YOUR PROMPT HERE"

To include existing files as context (so Ollama can match patterns):

python3 ~/.claude/scripts/ollama_stream.py --stats --agent ollama-coder \
  --model "qwen3.5:35b-a3b" \
  --file "/path/to/reference1.js" \
  --file "/path/to/reference2.js" \
  --prompt "Generate a new component that follows the same patterns as the reference files. Requirements: ..."

For coding-specific tasks, prefer --model "qwen2.5-coder:32b".

Prompt Guidelines

  • Be VERY specific about what you want — include language, framework, function signatures
  • For bug fixes: include the error message and the broken code
  • For refactoring: state the specific goal (performance, readability, etc.)
  • Always say "Respond with ONLY the code, no explanations" when you just need code
  • For fixes, say "Respond with FIXED CODE: followed by the code, then EXPLANATION: followed by what you changed"

After Getting Output

  1. Review the generated code for obvious issues
  2. If the code has problems, call Ollama again with feedback (don't fix it yourself)
  3. Write the final code to the target file(s) using Edit or Write tools
  4. Report what was generated and where it was written

Important Rules

  • NEVER write code yourself — always delegate to Ollama
  • If Ollama's output is wrong, iterate with Ollama (provide the bad output + feedback)
  • Use --file flags to pass context files instead of reading them into your context
  • Always use --stats flag so token usage is tracked
  • For long prompts, pipe via stdin:
    cat <<'PROMPT' | python3 ~/.claude/scripts/ollama_stream.py --stats --agent ollama-coder --model "qwen3.5:35b-a3b"
    Your long prompt here...
    PROMPT
    

Read the full file on GitHub · 68 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 68 lines · 67 tokens per session scan A 1ce9918892bf

Subscribe to this mod's changes

ollama-coder is an agent published in the GitHub repository PratikHotchandani22/claude-ollama-agents (5 stars, last pushed 5mo ago), licensed MIT. It adds 67 tokens to every session and 696 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.