AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Run Pieces with Local LLMs via Ollama to Keep Proprietary Code Strictly On-Device

Elsa Duclos-Valois · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Developer tools have developed an uncomfortable habit: they want everything you write sent to someone else's cloud. For open-source experiments, that is a minor nuisance. For proprietary codebases under strict nondisclosure agreements, financial algorithms, or internal security tooling, sending raw source code to external API servers is an immediate compliance violation. At 365Finds, we evaluate AI developer tools under a simple rule of risk: once code leaves your local environment, you have lost control over its retention, telemetry, and inspection.

Pieces—formally known as Pieces for Developers—presents a different approach. The tool is structured around a local-first engine designed to capture snippets, track workflow history, and index context without mandatory cloud synchronization. Pairing Pieces with Ollama allows you to run large language models directly on your CPU or GPU, executing code completions and copilot queries entirely within localhost.

Setting this stack up properly requires understanding how Pieces OS partitions data, how Ollama manages model weights, and how current architectural shifts in Pieces affect local model selection.


The Foundation: Why Pieces OS Is Local-First

Most AI coding assistants operate as thin extensions connected to remote cloud backends. Pieces operates through a split architecture:

  1. Pieces OS: A background daemon running locally on your workstation. It indexes snippets, processes local vector embeddings, manages Long-Term Memory (LTM), and monitors workstream activity across IDEs (VS Code, JetBrains), browsers, and terminal windows.
  2. Authoritative Local Storage: All indexed data, snippet tags, OCR text, and conversation histories are written directly to your disk (~/.local/share/com.pieces.os/ on Linux, ~/Library/com.pieces.os/ on macOS, and %LocalAppData%\Mesh Intelligent Technologies, Inc\Pieces OS\ on Windows).
  3. Pieces Desktop / Copilot: The user-facing application and editor extensions that interface with Pieces OS via local sockets and ports.

Because Pieces OS manages memory locally, your source code does not leave the machine during snippet indexing or context generation. The only potential leakage point in standard Pieces setups is the copilot model runtime. If the model runtime targets cloud endpoints (such as OpenAI, Anthropic, or Google), prompt payloads travel over the network. Routing that inference layer to Ollama keeps the entire loop offline.


Step-by-Step Setup: Connecting Pieces with Ollama

Running on-device inference with Pieces relies on Ollama handling the local model server while Pieces OS supplies the developer context.

Step 1: Install and Launch Ollama

Ollama acts as the execution backend, bundling model runtimes and hardware acceleration (Metal on macOS, CUDA on NVIDIA, ROCm on AMD).

Confirm that the Ollama daemon is running by checking its version:

ollama --version

By default, Ollama serves an OpenAI-compatible REST API at http://localhost:11434.

Step 2: Pull Code-Optimized Local Models

For development tasks, general conversational models often produce sluggish or inaccurate syntax. At 365Finds, our testing prefers code-specialized models that balance parameter efficiency with structural precision:

Verify the pulled weights by running a quick test prompt:

ollama run qwen2.5-coder:7b "Write a Python context manager to measure function execution time."

Once verified, type /bye to return to your shell. The model remains registered and ready in Ollama's local registry.

Step 3: Configure Pieces Copilot Runtime to Local Mode

To direct Pieces away from cloud endpoints:

  1. Open the Pieces Desktop Application or your active editor extension (such as the Pieces VS Code plugin).
  2. Open the Copilot / Conversational Search panel.
  3. Locate the Active Model selector (typically at the bottom-left or within Settings > Copilot).
  4. Switch the runtime category from Cloud to Local / On-Device.
  5. Select your downloaded model from the local model list, or confirm the Ollama endpoint target (http://localhost:11434).

Once selected, Pieces OS passes user queries alongside indexed file snippets directly to Ollama via local HTTP requests. No external network requests are initiated during code analysis.


An Honest Complication: The Agentic Copilot Shift

Any practical guide must address a recent friction point: Pieces has experienced shifting availability for managed local model menus across recent desktop releases.

As Pieces evolved its Copilot from a single-turn conversational assistant into an autonomous, agentic system capable of executing multi-step tool calls, small local models (like 7B or 8B parameter variants) frequently failed to adhere to rigid tool-calling schemas. Hallucinated function outputs and truncated context windows caused pipeline failures. Consequently, Pieces temporarily pulled back direct local-model UI options in specific builds while re-engineering the local agentic runtime (documented in community support issue #1066).

If your installed version of Pieces Desktop has local model selection grayed out or removed, you do not need to abandon your privacy boundary. You have an immediate, fully functional alternative: The Pieces Model Context Protocol (MCP) Server.

The MCP Workaround for Complete Local Sovereignty

Pieces OS features a native MCP server that exposes your local Long-Term Memory, snippets, and project context to external tools. You can bind local developer clients (such as Continue.dev, Cline, or Cursor) to both the Pieces MCP server and your local Ollama instance:

  1. Enable the Pieces MCP Server inside Pieces Desktop Settings.
  2. Configure your local coding extension's configuration file to point to:
    • Context Provider: Pieces Local MCP endpoint.
    • Model Inference Provider: Ollama (http://localhost:11434/v1).

Under this configuration, Pieces OS continues gathering workflow context locally, while Ollama handles inference on your GPU. Cloud servers are excluded entirely.


Local Ollama vs. Cloud Runtimes in Pieces

Running entirely on-device involves distinct operational trade-offs:

Evaluation DimensionLocal Ollama StackCloud Model Runtimes (Claude / GPT-4o)
Code Privacy & Compliance100% on-device; zero outbound packets; NDA-safeData leaves network; subject to cloud data processing terms
Hardware DemandsRequires 16GB+ RAM; dedicated GPU or Apple Silicon unified memoryMinimal local resource consumption; runs on ultrabooks
Inference LatencyHardware-dependent; 20–60 tokens/sec on modern GPUs; slow on pure CPUFast, consistent API responses over high-speed networks
Complex Multi-File ReasoningModerate; 7B–14B models can struggle with multi-step architectural refactoringHigh; deep context windows and advanced agentic tool-use
Network DependencyCompletely functional offline and in air-gapped systemsCompletely dead without internet access
Token & Subscription CostZero ongoing inference costIncurs API token costs or paid subscription fees

The 365Finds Recommendation

365Finds recommends running Pieces alongside local Ollama models for any developer working with proprietary source code, regulated client data, or strict IP boundaries. The combination gives you automated workflow tracking without introducing third-party data collection risks.

For optimal local performance, deploy qwen2.5-coder:7b on machines with at least 16GB of unified memory or 8GB of dedicated VRAM. If your version of Pieces Desktop currently limits local runtime menus due to ongoing agentic upgrades, route your local context through the Pieces MCP server into an Ollama-backed editor extension. Local-first data governance remains the only reliable safeguard for sensitive engineering work.

References