Zero-exfiltration local workflow Fact-checked · 2026-11-23

Local Private Coding Agent Stack: Open Hosts + Ollama/vLLM + Scoped Context

When proprietary code cannot leave your workstation or internal network, pair an auditable open-source coding host with local Ollama, LM Studio, or private vLLM inference—while avoiding the small-context tool-calling traps that break local setups.

Setup time
~20 minutes (requires local GPU or private LAN inference)
Risk posture
Maximum data privacy · Code stays local; retain write confirmations for local safety
Cost profile
Zero per-token cloud API bills (self-hosted hardware only)
Use this stack when
  • Strict IP, NDA, or air-gapped environments where source snippets may not hit third-party model APIs.
  • Teams running capable local GPU workstations or internal vLLM endpoints who want repeatable coding loops.
Skip this stack if
  • Low-RAM laptops running tiny quantized models that cannot sustain 16k–32k tool-calling contexts.
  • Massive multi-repo architectural migrations requiring frontier cloud reasoning.

Architecture & flow

Open coding host (local)Ollama / vLLM serverlocalhost OpenAI-compatible APISource code and prompts remain on your workstation or private LAN

Stack layers & catalog tools

Layer 2 · Local / private inference server

Source: OpenCode setup guide

Serves open-weight coding models locally or on your private LAN with adequate context length (16k–32k+).

Wiring & protocols: Exposes local /v1/chat/completions without outbound internet routing.

Commonly backed by Ollama, LM Studio, or vLLM.

Layer 3 · Tight local context & repo mapping

Source: Aider LLMs & RepoMap docs ↗

Prevents drowning smaller local context windows in whole-repo file dumps.

Wiring & protocols: Uses local tree-sitter repo maps (Aider) or local-only context tools rather than cloud vector stores.

Aider builds an automatic local RepoMap with no extra background daemon required.

Find companion SKILL.md packs on FollowSkills.com → Discover compatible MCP servers on FollowMCP.com →

Wiring & hardening steps

1. Point OpenCode to localhost Ollama and raise `num_ctx` to 16k–32k

OpenCode docs specifically warn that tool calling fails on local models when Ollama defaults to a small context window—raise num_ctx to 16k–32k first.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": { "baseURL": "http://localhost:11434/v1" },
      "models": { "qwen3-coder": { "name": "Qwen3 Coder" } }
    }
  }
}

2. Audit telemetry and disable outbound search MCP servers

Even with a local LLM, web-search MCPs or telemetry hooks can send queries or snippets outbound. Keep only local filesystem and test MCPs enabled.

3. Work in small, reviewable branch commits

Smaller local models drift faster on wide multi-file tasks. Keep edits scoped to one module per branch and review diffs before merging.

git checkout -b local-task && aider

Common traps & fixes

Trap Default 4k–8k Ollama context sizes silently dropping tool definitions or mid-turn history.
Fix Raise num_ctx to 16k–32k and disable unused MCP extensions that bloat tool schemas.
Trap Assuming local LLM = air-gapped while an IDE extension or search MCP still calls external APIs.
Fix Unset cloud API keys in the workspace environment and restrict MCP servers to local tools.
Trap Giving a local model a 20-file refactor in one prompt.
Fix Start in read-only Plan mode to lock down the exact file list, then implement one module at a time.

Pre-flight safety checklist

  • Provider endpoint points strictly to 127.0.0.1 / localhost or your private LAN URL with num_ctx ≥ 16k.
  • Cloud provider keys are unset in the shell so the host cannot silently fall back to public APIs.
  • Outbound telemetry and remote web-search MCP servers are disabled.
  • Edits run on a dedicated branch with approval gates or diff review before merging.

FAQ

Why do tool calls fail more often with local models?

Coding hosts send multiple tool schemas plus file context on every turn. If your local server defaults to 4k–8k context (common in Ollama), schemas get truncated—raise num_ctx to 16k–32k.

Which open-source hosts work cleanly with local models?

OpenCode, Aider, Cline, Codex CLI (via ollama/lmstudio providers), and goose all support local OpenAI-compatible servers.

Why should I trim MCP servers on a local setup?

Every enabled MCP tool consumes context tokens and increases schema confusion—load only the minimum tools required for the current task.

Agent Workflow Stacks

Was this page helpful?