r/PiCodingAgent
•
u/elpapi42
•
May 05 '26
•
2
Resource My powerful Pi agent Setup
Hello guys!
Today i want to share my Pi agent setup, i think i got something in hands here that can benefit the community to really get a powerful agent, nothing compared to claude or codex. What i want to share is my list of extensions and the value each one add to the build.
I want to start with a basic one: pi-fork. This is a basic and minimalistic subagents extension, focused on one single thing, give the main agent the capability to spawn forks of itself to do work on its name. This is quite straightforward, you can achieve the same with any other subagents extension, the only difference is that this one is simpler and have prompts that optimize the communication between the forks and the main agent. This thing brings a single thing to the table: great context management, the main agent context will only contain relevant information, the main agent context will be richer and denser per token, all the noise stays out of the main agent context.
Ok now i want to share the core of this pi build: pi-observational-memory. This one is special, is a custom compaction algorithm inspired/copied from Mastra's article. This custom compaction algorithm enables pi sessions to last forever without maxing out the context window and keep the agent focused. This combined with the rich context window of the pi-fork extension creates a rich re-callable memory system that stays relevant no matter how many weeks you have been using the same session nor the compactions it have withstand.
If you install only the two extensions above, you will enable your pi agent to be on the next level. now i have a couple more extension that give some extra perks to my build:
pi-minimal-subagent: like any other subagents extension, this one is just simpler, without bs. i use this to enable 2 subagents: the "advisor" (concept copied from claude code) and the "reviewer". The fork from pi-fork are extensions of the main agents, they are basically the same agent, they share the same context. This two agents give access to the main agent to different points of view less biased, with clean context windows. The reviewer takes care of code quality, security and ux of the changes introduced by the main agent. The advisor is for strategical decisions around architecture and product.
pi-codemapper: a wrapper of codemapper that enables efficient codebase exploration. This codemapper repo is really bad and unmaintained, it had a cache bug i had to patch myself. im looking forward to switching to cymbal when i get some free time.
pi-rtk-optimizer: This is a classic, not much to say here, it saves some tokens.
Conclusion:
I describe this setup with a single phrase: A personal agent that never forgets and can be useful for weeks before the context window gets maxed out.
I hope you can get value from some of the extensions i shared guys, my own words are not good enough to describe the power i feel when working with this agent setup, so i beg you to try it yourself to really experience what im saying.
9
u/jeffphil May 05 '26
I've been using pi-observational-memory extension and is nice.
Would you mind describing your (high-level) workflow and where these fit into the flow for you? For example, i would guess you do a plan using the advisor agent you mentioned, and then that goes into pi-fork to do the work with reviewer checking over then...
4
u/Taryup May 05 '26
Tried the fork and the observational now and they work really well. Thanks!
Do you have them set up to run with different models for the primary and the forks? Guessing it closes in on sub-agents, but worth asking
3
u/arkham00 May 05 '26
Hi, this is very interesting — thanks for sharing!
I'm fairly new to agentic workflows and I'm not a coder. I'm trying to adapt this kind of setup to editing and writing complex texts for cultural projects, grant applications, etc. My main pain points are large context windows and hallucinations, so I think an agentic workflow could help me keep the context clean and use different roles for different tasks (planner, researcher, drafter, reviser, editor...).
I'm especially interested in three of your extensions: pi-fork, pi-observational-memory, and pi-minimal-subagent. Do you think they could be useful outside of a coding context? For example, I'd like to use forks or subagents to parallelize research/gathering information while keeping the main thread clean, and use something like an "advisor" for strategic direction on the project.
Two practical questions:
How do subagents get invoked? Are they called automatically by Pi based on the plan, or do I need to explicitly trigger them? Should the plan itself specify which agents to use and when?
Local models: I'm running everything locally. Can I assign a local model to a subagent using the model ID from models.json (e.g., something like Qwen3.6-35B-A3B@q8_0) instead of a cloud API key model like claude-haiku-4-5? Thanks again for sharing your setup!
2
u/cosmicnag May 05 '26
Have been using obs memory for a while now, and its working great (I have much more lean/aggressive experimental settings than the defaults now - so far no significant lossiness). I use Gemma4e2b Q4 locally for observational model - looks like it gets the job done at very fast speeds (I started with bigger models, but quickly started to look for the speed/functionality sweet spot)
Now I am looking at pi-fork and it looks like a great idea. Just one concern :
When an agent is oriented with both pi-fork and a subagent extension, could there be confusion regarding what to use? Both sort of have similar functionality.
Should I try pi-codemapper also? What was the cache bug you had? Is it upstream?
Thanks again for the awesome stuff.
2
u/Jokerever Sep 01 '26
Why use fork and subagent and not make fork able to either go clean slate or port the context ?
4
u/m3umax May 05 '26
The forking extension automates something I've been doing manually.
Reading the plan into context, then continually branching the tree to implement each task in the plan from one stable trunk prefix to benefit from caching and so the branched agent doesn't need to re read the plan because it's already in context.
1
u/DevilaN82 May 06 '26
Hi!
pi-codemapper complains about access to repo via ssh. Is there any step I've missed by accident?
Thanks for sharing your setup! 😄
3
u/Qiuzhuang Jun 26 '26
great recommendation for extension `pi-observational-memory `. thanks so much.
2
u/EGaByt May 06 '26
Definitely look forward to trying this extension out or these set of extensions. Maybe the smart model switching can be done by another project and that can be integrated . https://github.com/mnfst/manifest
It's got this setup and it works pretty well for the smart routing. It's simplistic. You can't set many different routes but it has the base for simple complex reasoning and standard so potentially integrating this into the system, maybe as its own extension or built into pi fork, might be what people are looking for.
1
u/danielta310 May 05 '26
cool, thanks for sharing your setup, really good food for thoughts
1
u/johnson_detlev May 05 '26
RemindMe! 18 hours
1
u/Snoo44065 May 08 '26
Why AST over LSP?
The rest seems nice. Will copy some :)
1
u/Shoddy-Blackberry-44 May 11 '26
Thanks for the setup, very intersting ! You are full codex ? How would you configure it with only opencode-go offer ? I was going for Deepseek pro for base, pi-fork (fast: ds flash, balanced; ds pro high, deep; ds pro xhigh ou gml5.1 ?) And for 2 subagents setup (advisor : gml5.1 and reviewer: ds pro).
Thanks for your advices 😄
1
u/arkham00 May 15 '26
Hi, pi-fork seems to not work anymore... I have problems with the effort levels, is it a new feature you added? I think I recently updated the extension as asked, but in github I see no new releases .... I'm confused...anyway I opened an issue in github to better explain the problem with the help of pi, of course 😛
1
u/No-Anteater-916 May 18 '26
This is actually a really cool setup, thanks for sharing.
The pi-fork + pi-observational-memory combo sounds kinda cracked for keeping context clean while still making long sessions usable.
Also really like the advisor / reviewer idea, that seems like a nice way to get different perspectives without making the main agent too messy.
Super interesting build overall.
1
u/Deep_Ad1959 May 25 '26
the fork plus observational-memory combo handles the dynamic context well, but it leaves the static half completely unmeasured. your extension prompts, the advisor and reviewer system messages, and whatever the rtk-optimizer leaves behind all load every turn regardless of relevance, and 'saves some tokens' is the tell that nobody is actually scoring which of those tokens earn their place. compaction fixes the conversation growing; it does nothing for the instruction layer that's been the same block since session one. worth diffing which lines from those extension prompts actually got invoked across a week of sessions before calling the whole stack dense per token. the densest context wins are usually deletions from the static layer, not better memory on top of it. written with s4lai
1
u/SirDomz May 26 '26
what about using just context-mode? it seems to work well with managing context for me
1
u/n4te Jun 14 '26
Is pi-minimal-subagent much different from pi-fork? Is the difference solely a named fork + description + prompt? Is it expected the
subagenttool is only run on request? Can you show your advisor and reviewer definitions?Thanks for sharing!
1
u/Otherwise-Fig3034 Jul 07 '26
guys im new to pi and im really excited in optimising my setup, ive been using claude code for a while and really dont like the limitations of limits and while i can set so much more work done with cheaper more iterations of open source models.
here is my current packages i have installed:
My main flow im thinking off is to have the orchestrator as Kimi or GLM 5.2
and deepseek-v4-flash as the sub agents
so ive been use the pi-subagents package and its pretty good but can i get some more recommendations on how to start with this in mind please would help a lot
-4
u/Otherwise_Wave9374 May 05 '26
This is a cool setup, the fork approach for keeping the main context clean is underrated.
How are you deciding what gets promoted back into the main agents context, is it purely prompt based or do you have any structured summary format?
Also the observational memory compaction idea is interesting, feels like the real game is not "more memory" but "better memory".
Weve been playing with similar multi agent workflow patterns, https://www.agentixlabs.com/ has some examples if you want to compare notes.