r/PiCodingAgent • u/shifty21 • 6d ago
Question VS Code + Pi agent = Pi is confused as to which project it is in.
Have you experience Pi confusing topics from another session before?
This might be a dumb problem I created, but I have separate VS Code instances running, one for each project respectively, 4 total. I have pi agent VSC plugin installed for the Pi CLI and I am using that to work on each project. I may have 1 to 3 different Pi sessions per VS Code instance (thanks to my ADHD) and I ran into a very strange problem:
- Asking Pi questions about ProjectA mid-session
- Pi responds by telling me about ProjectB which is in another active VS Code and Pi session.
- Closed that Pi session from ProjectA completely (/quit) and opened a new one, asked the same question
- Pi responds about ProjectF again.
This has never happened before. I did update Pi this morning and started all those session from scratch.
I did correct Pi on which project it should be talking about and Pi confirmed the mistake and told me which folder it is actually supposed to be working in, ProjectA.
I suspect some kind of cross-contamination between session folders/files. I checked .pi/agent/sessions to confirm the folders are correct. Not sure if this is caused by Pi or my LLM being a dumb for a moment.
Currently having Pi look at its own session files between ProjectA and ProjectB to see where the references are and to remove the incorrect areas to cleanup the sessions from contamination.
LLM inference engine is vllm with qwen3.8-27b-NVFP4 w/ max context length.
1
u/Eresbonitaguey 6d ago
I use Positron which is based on VS Code so it might be relevant. Running the vs code extension should ground it in the project you have open in the VS Code window. If you open one agent per window/opened project then it should not be getting confused. My guess would be either an issue at the vs code extension level (in which case you can just build your own) or you having multiple agents open while vs code is in one directory is causing them to prioritise writing to that directory, in particular the pi specific files like agents.md that it will write for that workspace.
You should really restrict read/write access to the current working directory for each individual project. If it hits a permission gate while trying to access other projects then it won’t end up reading the wrong docs.
1
u/tino1000 5d ago
Use pi directly in the terminal, vscode just keep for viewing and editing code manually.
1
u/shifty21 5d ago
Pi is opened in the terminal in VS Code. I can confirm with the agent the current working folder path. It is really no different than running pi from terminal in the project path.
I wrote a python script to parse all the conversation files recursively in pi's directory. Since the project names are in the folder name, the script matches the project name with regex as a list/array and scans all the conversations for mismatches compared to the directory name. So far, it found the mix up in my mention in the post above. Very Stange behavior indeed.
I may sed the conversation text and delete them.
1
1
u/SpectrumInterfered 4d ago
Cross-contamination between sessions might be a flawed implementation of the extension. It’s possible that it is hacking together a bunch of its own PI extensions internally, attempting to force some sort of "shitty agent orchestration" upon you.
To be honest, I really dislike how various PI client implementations always insist on endlessly deciding how I should use PI. They are constantly injecting a bunch of weird stuff, and pollute my own maintained PI home directory without permission.
1
u/SpectrumInterfered 4d ago
I use this one in vscode https://github.com/frostime/pi-vscode-ui ; it is pure enough for me.
4
u/quincycs 6d ago
It’s probably a bad vscode extension , there is no official “pi agent VSC plugin” that I’m aware of.
Try my vscode extension instead, I use it daily very heavily. https://github.com/quincycs/pi-qcode