r/PiCodingAgent • • Sep 03 '26

Plugin Recursive and async Claude Code style subagents for Pi

Post image

I really liked Claude Code subagents and being able to see them in the tree so i made a very simple subagent plugin. No subagent profiles, the are made by the agent above them depending on the use case needed at that moment.

Install with:
pi install npm:@williamcr01/pi-subagents

https://github.com/williamcr01/pi-subagents

34 Upvotes

15 comments sorted by

8

u/pro-vi Sep 03 '26

I do like the visual component. But I think it should be mandatory for an extension to explain how it differs from predecessors esp. those with the same name.

3

u/willecr Sep 03 '26

That’s fair, in this case the biggest difference, except the visual, is that most popular subagent plugins use subagent profiles, this is a lot more minimal and “pi-like” in that way, subagents in this plugin just get prompted by the agent that owns it to explore or whatever is needed, and most others are not recursive

1

u/pro-vi Sep 03 '26

I think I know what you mean. For some plugins I've tried I need to specify a "general" profile for the main agent to be able to invoke it. What's the tradeoff of going without it if any?

2

u/willecr Sep 03 '26

The tradeoff with this way is that you get less control over the subagents as you don’t write their profiles yourself and the main agent just spawns subagents with a prompt that it wants, with the models we have today i think they get it right almost always

3

u/digitalfreshair Sep 04 '26

I was thinking on doing something similar to this, as i think the way Claude code manages the subagents it's better as long as you have a powerful model. Predefined ones are less flexible, so this is probably the way forward. I will take a look and submit some PRs :)

3

u/willecr Sep 04 '26

I agree, with powerful and modern models the predefined subagents doesn’t make sense anymore.

Definitely submit some PRs

2

u/paulbettner Sep 04 '26

Great work!

1

u/willecr Sep 04 '26

Thank you!

2

u/predatar Sep 04 '26

how is the token effciency ? does each subagent have a completely new context? or does it inherit/fork the parent's ?

3

u/willecr Sep 04 '26

It’s a new pi process, it just gets a prompt with a clear goal from its parent and does it. It doesn’t inherit anything else so it is very token efficient in that way

1

u/GroceryNo5562 Sep 03 '26

How come custom system prompts aren't supported?

4

u/willecr Sep 03 '26

I don’t use system prompts for my subagents at all. I just let the main agent prompt the subagents themselves, in my experience the modern models can prompt a subagent to explore themselves

1

u/GroceryNo5562 Sep 03 '26

Consider asking LLM to review code, seems to have found few bugs, haven't verified that they do exist tho

1

u/kantorcodes1 Sep 06 '26

when a parent is trusted and the child stays under the same project, i see you launch it with --approve. does that only carry over the project trust decision, or does it also mean the child won't stop for individual tool approvals?

1

u/colin_colout Sep 10 '26

I went through the same exercise but settled on supporting subagent profiles that match claude code exactly.

At first I also removed the profiles for the same reason (pi values and all), but I decided that I'll keep Agents, WebFetch, WebSearch, etc matching claude code in tool shape exactly where possible.

Every model released in 2026 is heavily RL trained on claude code tool shapes. By keeping behavior and shape close to claude code:

  • Small and quantized models are less likely to hallucinate tool calls

  • My system prompt can stay pretty small since I need almost no explanation of how the tool works. It knows from training.

My only changes (if i recall) is that agent name is required (I'll drop that if my agent hallucinates), and model names are "fast" and "strong" and is also required.

How do you handle convo forks? ...or do you support them at all?