agentleFS
OpenxIntelligenceOpenxIntelligence/Coding-Agent-Skills/local-models/SKILL.md

local-models

Skill4 starsChanged 26 days agoMITView on GitHub

Use when needing free, private, or fast AI assistance for support tasks like explaining code, analyzing logs, research, or drafts. Routes to local Ollama models (devstral, qwen3-coder, llama4, llama3.2) for zero-cost operations. NOT for writing/editing code - Claude handles all coding.

  • Installs packages

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not using aliases (slower workflow)

    line 163
  2. Distinctive:

    When to use which model

    line 198

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Local Model Integration (Ollama) - December 2025

When This Skill Activates

  • User asks to "use local model" or "use ollama"
  • Privacy-sensitive analysis needed (credentials, internal code)
  • High-volume repetitive tasks (many quick queries)
  • Offline work required
  • User wants free/zero-cost assistance
  • Research or explanation tasks
  • Draft generation before Claude refinement

Critical Rule: Claude Does ALL Coding

Local models = Support tasks ONLY Claude (Opus/Sonnet) = ALL code writing/editing

Local models assist with understanding, not implementation.

Available Models (M3 Max 64GB)

ModelSizeBest ForAlias
gpt-oss:120b65GBDeep reasoning, architecturereason
llama4:scout67GBMultimodal, imagesvision
qwen3-coder:30b18GBLong-context (256K)deep
devstral:24b14GBCode review (68% SWE-Bench)code
gpt-oss:20b13GBQuick reasoningthink
llama3.22GBUltra-fast Q&A (<2s)ask

Performance Optimizations (Active)

Environment variables configured in ~/.zshrc:

OLLAMA_FLASH_ATTENTION=1    # Faster inference
OLLAMA_KV_CACHE_TYPE=q8_0   # 47% memory savings
OLLAMA_METAL=1              # Apple Silicon GPU
OLLAMA_MAX_LOADED_MODELS=3  # Keep models hot
OLLAMA_NUM_PARALLEL=4       # Parallel requests
OLLAMA_KEEP_ALIVE="10m"     # Avoid cold starts

Task Routing

Use Local Models For:

TaskModelAlias
Explain this codellama3.2ask
Analyze logs (large)qwen3-coder:30bdeep
What does this error meanllama3.2ask
Research architecturegpt-oss:20bthink
Review image/screenshotllama4:scoutvision
Draft documentationllama3.2ask
Code understandingdevstral:24bcode

Claude Handles (NOT Local):

  • Writing new code
  • Editing existing code
  • Bug fixes
  • Test generation
  • Refactoring
  • Any file modifications

Quick Aliases (Terminal)

# Direct aliases
ask "What is dependency injection?"       # llama3.2 (<2s)
code "Explain this function"              # devstral:24b (68% SWE-Bench)
think "Quick comparison"                  # gpt-oss:20b
deep "Analyze this large codebase"        # qwen3-coder:30b (256K)
reason "Design a caching architecture"    # gpt-oss:120b (best reasoning)
vision                                    # llama4:scout (multimodal)

# Functions
ask_ai "Quick question"                   # Pipe to llama3.2
code_ai "Code explanation"                # Pipe to devstral
think_ai "Reasoning task"                 # Pipe to gpt-oss:20b
analyze_ai file.py "Review this"          # File + qwen3-coder

# Smart Router (auto-selects model)
ollama-router.py "your query"             # Routes to optimal model

Within Claude Conversation

Say: "Use local model to explain this" or "Ask ollama about..."

Claude will:

  1. Route to appropriate local model via Bash
  2. Get response
  3. Integrate into conversation

Advanced: Intelligent Routing

For automatic model selection based on task complexity:

# Install RouteLLM (optional)
pip install routellm

# Routes simple→local, complex→cloud automatically
# 85% cost reduction while maintaining quality

Advanced: Semantic Caching

For repeated similar queries:

# Install GPTCache (optional)
pip install gptcache

# 10x cost reduction, 100x speed on cache hits

Cost Comparison

ApproachCost per 1K queries
Cloud API (Sonnet)~$15
Cloud API (Opus)~$75
Local Models$0
With RouteLLM~$2.25 (85% savings)
With GPTCache~$0.10 (99% savings)

Model Selection Guide

Need speed?        → llama3.2 (2GB, <1s response)
Need context?      → qwen3-coder:30b (256K tokens)
Need code insight? → devstral:24b (68% SWE-Bench)
Need reasoning?    → gpt-oss:20b
Need vision?       → llama4:scout

Privacy Benefits

Local models keep sensitive data on your machine:

  • API keys and credentials
  • Internal business logic
  • Proprietary algorithms
  • Customer data analysis

Cloud Models via Ollama (Optional)

Access cloud-scale models through Ollama:

ollama run deepseek-v3.1:671b-cloud    # Best reasoning
ollama run qwen3-coder:480b-cloud      # Best coding

Anti-Patterns

  • Using local models to write production code (quality risk)
  • Skipping local for simple explanations (cost waste)
  • Using llama3.2 for complex reasoning (wrong tool)
  • Using large models for simple Q&A (slow, wasteful)
  • Not using aliases (slower workflow)

Verification

# Check models
ollama list

# Check running models
ollama ps

# Test quick response
ask "Hello"

# Test code model
code "def fib(n): pass"

Monitoring

# Memory usage
ollama ps

# Model details
ollama show devstral:24b

# GPU utilization (Activity Monitor → GPU History)

Detailed Model Guide

See ~/.claude/skills/local-models/MODEL_GUIDE.md for:

  • Detailed use cases per model
  • Performance overlap zones
  • When to use which model
  • Chaining strategies
  • Decision flowchart

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.