Prerequisites
To complete this Quick Guide, you’ll need:
-
The Pieces Desktop App installed and actively running on your device.
-
Long-Term Memory enabled in the Pieces Desktop App.
-
Optional—Pieces installed in a Python IDE, such as the VS Code Extension, or the JetBrains PyCharm Plugin.
In This Quick Guide
This Quick Guide will show you how to combine the Pieces Long-Term Memory with code context in a Pieces Copilot chat, demonstrating how you can use AI to help implement a feature in a Python app.
As a developer, a common daily task is to review a ticket in a tool like GitHub Issues or Jira, and then implement it in a codebase.
This often involves switching back and forth between the code and the ticket, which can affect your productivity due to constant context switching.
With Pieces, you can use the Long-Term Memory feature to remind you of the ticket details. You can then combine this with your code, allowing Pieces to guide you on how to implement the issue—all from within your IDE!
Review a GitHub Issue
The first step is to review the issue by letting Pieces capture it, and then ask the Pieces Copilot about it.
Review the GitHub Issue
Open the following GitHub issue in your browser. Slowly scroll through the comments on the issue, taking maybe 30 seconds or so to scroll through it.
You can use this issue as an example.
Ask Pieces About the Issue
In the Pieces Copilot, start a new chat, ensuring the Long-Term Memory (LTM) context is enabled, and use the following prompt:
Summarize the create a sign up page issue I was just reading
Pieces will respond with a summary of the issue:
Clone the Project
This issue refers to a SciFi store—a small web application written in Python and Flask for an upcoming retail store that sells themed sci-fi toys.
Clone the Project Repo
Navigate to the Sci-Fi Store folder
Inside the repo is a folder called scifi_store
.
If you are using an IDE like VS Code, or JetBrains PyCharm, open this folder in that IDE.
Use the Project as Context
The next step is to add the project as context to the Pieces Copilot chat. This allows you to link the project to the Long-Term Memory and ask questions about the code.
Adding the project as context to your Pieces Copilot Chat will look a little different depending if you’re using the Pieces Desktop App or an IDE with the respective Pieces plugin or extension installed—such as VS Code.
via Pieces Desktop App
From the Pieces Desktop App, select the Manage Conversation Context
button, then select Add Folders
.
From the Manage Copilot Context | Folders
dialog, select Add Folders
.
Select the scifi_store
folder in the repository you cloned in the previous step.
via VS Code with Pieces Installed
From the Explorer, right-click on the pane itself (not on a file or folder), and select Pieces
, then click Pieces: Add to Copilot Context
.
Prompt Pieces Copilot
Now that Pieces has both the issue from the Long-Term Memory and the project folder as context, you can ask Pieces to implement this issue.
Ask Pieces how to Implement the Issue
In the same Pieces Copilot chat, use this prompt (or one like it):
How can I implement this issue in this project?
Check the Response
The Pieces Copilot will now reason over your project, as well as the GitHub issue you were looking at.
The response will contain relevant instructions on how to implement this issue, such as code for the endpoint, the new page leveraging the existing app templates, and so on.
Review these code changes along with the original codebase.
🎉 Congratulations, you’ve completed the Using Pieces Copilot with Context Quick Guide! 🎉
Bonus—Try One Prompt
This Quick Guide showed 2 prompts—one to get the details about the issue, and another to get how to implement it.
This was done in 2 stages to illustrate the information available from the Pieces Long-Term Memory, but is unnecessary. You can do this in a single prompt!
Create a New Copilot Chat
Create a new Pieces Copilot Chat in the Pieces Desktop App, or in your IDE.
Add the Project Folder as Context
Add the scifi_store
project as context to this new Pieces Copilot Chat.
Prompt Pieces Copilot
Use this single prompt when interacting with Pieces Copilot;
How can I implement the create a sign up page issue I was just reading in this Python project?
Check the Response
The Pieces Copilot will now reason over your project, as well as the GitHub issue, and give you suggestions on how to implement it.