Github Copilot @workspace – New Development Experience

Github Copilot Workspace Agent

Github Copilot team introduced the new Copilot feature that should dramatically change the development experience. They introduced agents.

At the moment there are 3 main agents available: @workspace, @terminal and @vscode. In this article I want to review the @workspace agent. In my opinion this one is a real game-changer for nearest future. It is intended to simplify the way you collaborate with your AI assistant.

More context => Better Copilot suggestions

Previously Github Copilot team did a great job and the tool started suggesting more and more quality suggestions as you write.

Recently they introduced Github Copilot Chat that changed the way you interact with your AI assistant. You are now able to communicate directly with Copilot the same way as you do with ChatGPT and other LLMs. You now have a Chat UI integrated into your IDE where you can ask questions, provide the instructions or get the detailed code snippets to add into your codebase.

And the main secret of getting the quality suggestions is by providing as much context as you can.

Read about writing efficient Copilot prompts

By the “context” I mean pretty much everything/. To write the good and relevant code you need to know the following:

  • what the code must do
  • programming language
  • framework and libraries that are utilised
  • workspace and modules structure
  • infrastructure around your modules that can be used
  • styleguides, linting rules
  • the overall code style that is used by the developers in the team
  • internal and external APIs to work with

and dozens of other factors around the actual piece of code that should be written.

So the only way you could share the context of your workspace to Github Copilot was to tell it via the chat and to open the relevant files in the editor so that Copilot could see them. And despite you already can ask it to generate any kind of code knowing only this – the main issue here is the development experience. You need to always keep in mind which context Copilot currently has and what’s you still need to share to proceed. You need to write the same parts of prompts again and again. You need to know which files to keep opened and thus make them readable by your AI assistant.

But from now on the things changed.

Github Copilot @workspace agent

We all now have access to the new Github Copilot Chat feature – the workspace agent.

Its main intention is to make Copilot look for the needed context on its own. Yes. Without your involvement.

Now to use it you need to do only one simple action – to start your prompt with “@workspace”. And that’s it!

Calling Github Copilot workspace agent

After receiving the prompts like this – Copilot behaves differently. It doesn’t start responding right away, but instead it analyzes the current workspace files and directories split into a chunk of steps.

  1. Scans the files/directories names to understand which of them are potentially relevant to provide a response.
  2. Reads the files contents. Sometimes the whole files, sometimes only parts of them (due to the token memory limits).
  3. Creates a context from everything it was able to collect.
  4. Starts responding combining the context from the prompt and the one it was able to gain.

As humans we sometimes miss to share the crucial details, sometimes we are too lazy to describe the whole picture that we see. And this is exactly why @workspace agent appeared. Copilot fills all the gaps on its own.

Comparison of Copilot responses with and without @workspace

Let’s see how it works in a real example.

Let’s say I am assigned to add feature in an existing repository that I’ve never seen before.

And of course I need to somehow start the project. Again, I am new to the project and readme file is outdated (which happens surprisingly often 😀)

I will now use Github Copilot to assist me with it.

Without using @workspace agent

The prompt:

how do I start the current project?

The result:

Here we see that Copilot kindly tries to help us. But its answer is extremely abstract and in the end it tells us that the instruction it provided is only its guess.

No surprise here as far as it never had any access to our filesystem and cannot guess in which exact project we are located at the moment.

Now let’s use the new @workspace agent with exactly the same prompt.

Using @workspace agent

The prompt:

@workspace how do I start the current project?

The result:

Aha!

It now responded very differently:

  1. The response took longer as far as there was a pre-analysis phase.
  2. The response is extremely correct now.
  3. The response is fully relevant to our project.

I believe it’s a real game changer and I bet you also see the difference now.

We no more need to type the context to the input. No more need to keep the contextually relevant files opened for each separate question.

Copilot collects the context on its own. And for us, this means that we have even more acceleration in working with code than before.

So what is the workspace agent most suitable for?

Github Copilot @workspace – Use Cases

Knowing your workspace makes it much easier to assist you with the following types of prompts:

Look around the workspace

  • @workspace Tell me about the current workspace structure
  • @workspace How do I run this app?
  • @workspace What is the automated testing tech stack used here?
  • @workspace Where is the docker-compose.yml for production located?

Add the new functionality

  • @workspace How do I add a new route in the frontend application?
  • @workspace Guide me how to create a new REST endpoint here
  • @workspace Generate code for a new microservice that will be responsible for the notifications
  • @workspace Create a new lazy-loaded page with a path “/faq”.

Fix the issues

  • @workspace when I access the /orders/:id route – I see a 404 error. what could be its root cause?
  • @workspace the calculations in the PriceTiers component is incorrect but the unit tests show the correct calculations. what’s wrong?
  • @workspace my server responds with “413 Content too large” when I request the /subscriptions endpoint. please investigate and fix.

Refactor / restructure

  • @workspace how can I restructure my React components to be split by domains?
  • @workspace how do I make my Angular Products module lazy-loaded?
  • @workspace how can I split my environment variables located in /server/env into dev and production?
  • @workspace what are the potential performance bottlenecks of the UserAuthentication controller?

And of course, this list is not exhaustive and is limited by your imagination only 😉

Github Copilot @workspace – Weaknesses

Despite the extraordinary potential – at the moment of writing this article the workspace agent is barely usable. It is now in early beta and too damp for stable use.

  1. Performance. There is definitely no sense to use workspace agent if the question that you ask is not related to the current workspace you are in. Workspace-related questions take times more time to be answered because of the anallysis stage.
  2. Reliability. Right now approximately 4 of 10 of my questions just fail to be responded and nothing helps until you create a new chat.
  3. Accuracy. Sometimes the workspace agent does not differentiate the source files and the compiled files and starts analyzing the service folders while fully ignoring the desired and relevant ones.
  4. Capabilities. Copilot still cannot create, edit, move or delete the files for you. While it would be really nice if it could when you directly ask to do this.

So at the moment it is really difficult to use it in my day-to-day work. But seeing how much progress Copilot team has made over just the last year – I’m sure most of the issues will be gone in just several months or weeks and the workspace agent quickly becomes your everyday best friend.

Conclusion

I’ve been using Copilot for several years now and have been waiting for the assistant to be able to look at my workspace files on its own.

And the release of Copilot was a sign to me that my expectations were heard by the development team.

I’m very excited about @workspace agent and hope that soon enough it will be able to do much more than it can now. And the quality of my project structure analysis will reach a whole new level.

Thank you, Copilot team, and I look forward to the new versions 😉


👋🏻 Thank you for your reading. I hope this article inspired you to improve your development experience. If you implement at least one of the above advices in your development cycle you will notice its pleasant effect immediately.

✅ Click here to follow me so you don’t miss out the new articles!

💬 Your thoughts and ideas are very appreciated in the comments below

Leave a Reply

Your email address will not be published. Required fields are marked *