How to work with multiple projects in GitHub Copilot?
It's very common in software engineering to have multiple projects that combine to create one cohesive product for a user. This separates concerns and makes it easier to reuse elements across multiple products, or services within a product.
For example, you might have an account system whose job is to authenticate users. You might also have a game service, and a matchmaking service that both talk to the account system to authenticate users. Let's pretend that you want to build a whole new chat service. This chat service will need to talk to the account system to gather the user's username, and maybe information about whether incoming chat messages should be shown (if the user has the chatter blocked). This means that your new chat service needs to understand the account system. How can you give AI the context of that account system when building your chat service?
VS Code
With VS Code you can use Workspaces to achieve this.
- Open a blank VS Code window
- Navigate to
File>Add Folder to Workspace... - Browse to the first project you want to add
- Repeat for all subsequent projects you want to give the AI access to
- Chat in GitHub Copilot Agent mode like normal
When you chat with Copilot Agent mode in this context, it will have access to edit/view all the files in every folder you added to your workspace. This allows it to browse the entire context of how you are using different services, and all the pieces of how your project works together.
GitHub Copilot CLI
You can also use a similar feature with GitHub Copilot CLI. Sadly I don't think this is quite as streamlined because you still have one "main directory". With VS Code it feels like all the projects are on the same level, whereas with the CLI you have to pick one to start with.
- Pick a main directory
- Navigate to it in your command line
- Run
copilot - Type
/add-dirfollowed by the path to the project you want to add to your Copilot session - Repeat step 4 for each subsequent project you want to give the AI access to
- Chat in GitHub Copilot CLI like normal
Other Tools
Sadly one of the biggest drawbacks of this feature to me is the fact that it doesn't work with GitHub Copilot Cloud Agent or the desktop GitHub Copilot app (repo). I use the Cloud Agent a lot, and it makes it really easy to make progress on projects while on the go. I really hope GitHub adds support for working with multiple projects with these other platforms soon.

