AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Use Pieces to Capture and Manage Reusable Code Snippets Alongside GitHub Copilot

白川裕亮 · 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

GitHub Copilot writes code fast, but it forgets quickly. If you have spent months working with Copilot in Visual Studio Code or JetBrains, you know the frustration: it generates brilliant utility functions or tricky boilerplate on Monday, but by Thursday in a different repository, you are back to reprompting it from scratch. Copilot excels at local, in-file completions and active repository reasoning. It was never designed to be your permanent personal code library.

This is where Pieces fills the structural gap. At 365Finds, our preferred development setup does not force an "either/or" choice between generative AI and snippet management. We use Pieces as a persistent, cross-IDE context and snippet vault, and GitHub Copilot as the instant synthesis engine.

Here is how to set up, capture, and orchestrate reusable snippets between Pieces and GitHub Copilot—along with the architectural shifts you must understand to avoid outdated setups.


The Strategic Division of Labor

Before configuring any tools, understand why pairing them solves real engineering overhead:

CapabilityGitHub CopilotPieces
Primary StrengthFast in-editor code completions; contextual chat refactoringCross-IDE snippet indexing; OCR extraction; Long-Term Memory (LTM)
Context ScopeCurrent active file, open tabs, and repository workspaceCross-project, desktop apps, browser docs, terminal logs, and system clipboard
Asset DurabilityEphemeral; discarded once the session closes or context window flushesPermanent; indexed with tags, descriptions, language detection, and origin URLs
Integration InterfaceNative editor inline ghosts and Copilot Chat sidebarPiecesOS background service, Pieces Desktop, and Model Context Protocol (MCP)

At 365Finds, we look at GitHub Copilot as the active typist and Pieces as the organizational memory. If Copilot generates a nuanced regex parser, an asynchronous retry wrapper, or custom middleware that took twenty minutes to debug, leaving that code buried in a random Git commit is a waste of engineering time. Capturing it into Pieces converts ephemeral AI output into a permanent asset.


Step 1: Set Up PiecesOS and Understand the Architecture Shift

A crucial detail many guides miss: Pieces has sunsetted standalone IDE sidebar plugins across editors like VS Code and JetBrains. You no longer manage snippets through deprecated editor widgets. Instead, Pieces runs on an OS-level background architecture powered by PiecesOS and connects modern AI assistants through the Model Context Protocol (MCP).

  1. Install PiecesOS and Pieces Desktop: Download PiecesOS from the official Pieces website. PiecesOS runs quietly in your system tray or background services, handling local machine learning indexing, language parsing, and memory tracking.
  2. Enable Long-Term Memory (LTM): Open the Pieces Desktop App, open Settings, and confirm that the Long-Term Memory engine is toggled on. This gives Pieces the ability to track your workflow timeline and keep snippets contextualized.
  3. Verify the MCP Server: PiecesOS serves an MCP endpoint locally. In the Pieces Desktop App, navigate to Settings > Model Context Protocol (MCP) to verify that your local SSE server endpoint is active.

Step 2: Capture Snippets from Copilot and Daily Research

Once PiecesOS is running, capture code without interrupting your coding flow:

1. Capturing Copilot's Best Outputs

When GitHub Copilot provides a high-value implementation in your editor or Copilot Chat:

2. Capturing Multi-Source Code Across Your Workflow

Valuable code rarely originates only in your IDE. Pieces lets you capture:


Step 3: Connect Pieces to GitHub Copilot via MCP

The real synergy happens when GitHub Copilot Chat can directly read your Pieces snippet vault. Instead of manually copying snippets from Pieces Desktop and pasting them into Copilot prompts, you wire Pieces as an MCP context provider inside VS Code.

  1. Open your VS Code configuration settings or locate your mcp.json / workspace MCP configuration file.
  2. Add the Pieces local MCP server definition pointing to your local PiecesOS port (retrieved from Pieces Desktop MCP settings):
{
  "mcpServers": {
    "Pieces": {
      "type": "sse",
      "url": "http://localhost:39303/model_context_protocol/2025-03-26/mcp"
    }
  }
}

(Note: Check your Pieces Desktop MCP settings for your specific port number and endpoint version).

  1. Reload VS Code. In GitHub Copilot Chat, the Pieces toolset will register, allowing Copilot to query your saved snippets and workflow context directly.

Step 4: The Daily Workflow Loop

Here is the exact cycle 365Finds recommends using during production sprints:

  1. Query Existing Snippets via Copilot Chat: When tackling a recurring problem, ask Copilot: @pieces Find my standard JWT verification middleware and adapt it to our new Fastify route. Copilot retrieves the exact logic stored in Pieces and scaffolds the implementation directly into your current workspace.
  2. Refine with In-Line Copilot: Use GitHub Copilot’s inline ghost-text completions to adjust variable bindings, test cases, and framework specifics.
  3. Check for Drift: If you improved the pattern during implementation, update or replace the saved snippet in Pieces Desktop. A snippet repository only stays valuable if you discard outdated idioms.

365Finds Evaluation: Where the Setup Shines and Where It Frustrates

We like this combined workflow because it eliminates the duplicate prompt tax. Asking Copilot to "write a standard Redis connection pool with exponential backoff" three times a week yields three slightly different implementations. Pulling your verified snippet from Pieces ensures consistency across different microservices and projects.

However, the workflow requires deliberate discipline. If you dump every half-baked line of throwaway scratch code into Pieces, your snippet repository becomes noisy clutter. Furthermore, local MCP configurations can occasionally drop connection if PiecesOS restarts or if port bindings clash with other local servers.

Treat Pieces as your team-tested reference manual and GitHub Copilot as the fast hand on the keyboard. When you keep those responsibilities separated, generative speed stops coming at the cost of architectural consistency.

References