Your AI Connector for VS Code
The rise of AI has introduced incredible potential for code generation, explanation, and debugging. However, if you're constantly trying to explain to the LLM what you want to get done and it keeps forgetting, and you have to repeat yourself to a different tool, it creates a never-ending cycle for your day to day tasks. This makes you lose valuable time!
Introducing Pieces as your go-to AI Connector, it eliminates this friction and remembers everything for you locally, it is privacy-focused and is built edge-first.
What sets Pieces Apart?
Pieces truly understands your project, your files, and your code, not just generic prompts, setting it apart from just another AI extension for VS Code.
We remember everything! The documentation you visited yesterday? We remember it. The code snippet you saw on StackOverflow? We saved it for you. Everything Hands-off, it just works for you!
Pieces is available directly in VS Code, which means no switching back and forth between apps.
This enables you to spend less time searching for answers or debugging, and more time building.
Connecting your code with context via Pieces in VS Code
Getting set up with Pieces means connecting your Visual Studio Code environment to a powerful AI Connector — Pieces that understands your development needs.
Step 1: Establishing the connection (installation & prerequisites)
To function as your AI connector, Pieces relies on a robust PiecesOS Agent and comes with a beautiful UI, Pieces Copilot. For our needs, we will get started with PiecesOS first.
Download & install PiecesOS: Available for Windows, macOS, and Linux.
Visual Studio Code: Ensure you have VS Code installed.
Add Pieces for VS Code Extension:
Open Visual Studio Code, go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X), search for "Pieces for VS Code," and click "Inst
Restart VS Code after installation to initiate the connection.
Sign-in or Sign-up: You can create a new Pieces account (or sign in to an existing one), and access cloud-enhanced features like advanced AI models, shareable links and more. Pieces offers a generous free tier for all your needs. All your Long-term memory data remains on-device. Read more about our security practices here.
Your Visual Studio Code is now connected, and you can start asking questions and using Long-term memory to bring in all the context from PiecesOS.
Pro Tip: You don't have to take any extra steps to make Pieces remember your work; you can just browse like you do, and Pieces will create memories for you automatically. You can look at the workstream activity to see what memories Pieces collects and also export them.
Step 2: Supercharging your Context with AI (PiecesOS)
PiecesOS is an OS-level agent that helps you build context over time and allows you to work worry-free, as it remembers everything for you. Its role as an AI connector is crucial for providing a rich, persistent context for your AI interactions. PiecesOS runs locally for maximum privacy for you and your data. Learn more about how your data is handled.
Saving AI-enhanced Context from your activity:
In the PiecesOS, select Enable Long-term memory.
Browse and do things you usually would. PiecesOS will start forming memories for you and begin collecting context and storing it on your device. You can also see the sources and disable or enable more sources.

Searching Your AI-Organised memory:
You can access this memory across your VS Code. (We support the majority of them) Or use the Pieces Desktop App to interact with your memories. You can simply ask, “What was I doing yesterday?”
or go more complex with your prompt and ask for something specific like “Give me the code snippet I was looking for yesterday to fix the getProfile function?”
Step 3: Activating your AI connector (using Pieces Copilot)
The Pieces Copilot is the heart of the AI connection within VS Code. It provides a direct channel to all the interactions, contextualised to your active development session.
It's an intelligent AI connector for VS Code designed for deep context.
Open the Pieces Copilot panel: This is your primary interface for all your conversations with Pieces. It has multiple models to choose from, like OpenAI o3, o4 Mini, GPT 4o, Anthropic Claude 3.7 Sonnet, Google Gemini 2 Flash and more!
2. Provide Context: This is where Pieces shines as an intelligent long-term memory tool.
Add files/folders as context: Drag and drop files, entire folders, or even your whole repository into the Copilot chat. This connects Pieces directly to your project's architecture and existing code, enabling it to provide far more accurate and relevant assistance, whether you're working on building a new feature or fixing bugs.
Leverage Long-Term Memory (LTM): With LTM enabled, the AI remembers past interactions, documents you've viewed, the package you were researching, discussions, and code snippets, allowing for richer, more informed conversations.
Prompt Guide: You can simply ask Give me the code snippet I was looking for yesterday to fix the getProfile function? Learn more about long-term context prompting here.

3. Direct Code Actions (right-click menu): Select a code snippet in your editor, right-click, and hover over "Pieces." This menu offers immediate, context-aware AI operations:
Modify selection with Copilot: Need to optimise, refactor, or transform selected code? This action sends your precise code to our Copliot for intelligent modifications, with complete context. Instantly improve code quality or adapt functions without manual rewrites, letting AI handle the heavy lifting.
Explain Selection with Copilot: Get a clear, concise explanation of any selected code, right within your IDE. The Copilot understands complex logic and breaks it down for you. Quickly grasp unfamiliar code, accelerate onboarding, and reduce time spent deciphering complex functions.
Comment Selection with Copilot: Automatically generate relevant inline comments for your selected code. The Copilot connects your code's function to human-readable comments, and you can also use it to generate documentation. Ensures consistent, high-quality documentation with minimal effort, improving code clarity for your team.
AI Quick Actions (CodeLens Style): Pieces integrates AI suggestions directly into your code view. Look for "AI Quick Actions" that appear near functions:
1) Pieces: Comment: Click to generate immediate, meaningful documentation for your functions.
2) Pieces: Explain: Get a quick breakdown of code logic and kick off a deeper AI chat for more details. Instant insights at the point of need, seamlessly integrated into your coding rhythm, right where your code is.

Why Pieces is the go-to AI connector you need for your VS Code workflow?
Pieces goes beyond simple AI features. It builds a genuine AI connection with your development environment by creating long-term memory of your work across your system, and enables you to use it via VS Code or MCP.
Maintain deep context: The AI doesn't work in a vacuum. By integrating with your active files, folders, and saved snippets, it gains an understanding of your project, which is especially beneficial for complex projects.
Streamlining AI Interaction: No more copying code to external websites. All your AI-powered tasks: from code generation to explanation, happen directly within Visual Studio Code, reducing friction and maximising flow state. This makes Pieces a reliable AI connector for VS Code compared to generic alternatives.
Empowering informed decisions: With AI insights readily available and truly contextual, you can make quicker, more confident decisions for your workflow.
Ready to experience AI as a seamless part of your building process? Add the Pieces for VS Code Extension and set up PiecesOS locally to make your code intelligent and powerful.