r/PiCodingAgent • • 19d ago

Plugin Pi-Maestro: a spec driven multiagent development workflow

Hi everyone! I've been building pi-maestro, a Pi extension for a spec-driven multiagent workflow, inspired by GitHub Spec Kit and OpenSpec. It helps you define a change, clarify requirements, and approve a spec with concrete acceptance criteria. You can use it in two ways:

  • Spec only: prepare and approve a spec for implementation elsewhere.
  • Spec + implementation: approve the spec, then let Maestro run the implementation workflow.

By default, three agents run in sequence:

  • Builder implements the spec.
  • Verifier independently checks each acceptance criterion.
  • Simplifier refactors the code for clarity without changing behavior.

You can disable the verifier and simplifier independently, using just the builder or pairing it with either agent. See phase configuration for details.

You make the scope decisions and review the final code.

I'd love some feedback, especially on whether the separation of roles is useful and where the workflow adds unnecessary friction.

If you've built something similar in Pi, I'd be interested in comparing approaches.

https://github.com/emilioSp/pi-maestro

If you find it useful, consider giving it a star on GitHub!

Cheers!

14 Upvotes

5 comments sorted by

4

u/tempaccaun 18d ago

I've spent my past days trying to build a pi extension/workflow almost identical to this.
3 types of agents that run in sequence, like yours do:

Planner
Coder
Tester

and an Orchestrator (not an agent, only .ts + .md).

It starts with the Planner, to whom I give either a feature request, or a project idea. The planner then grills me, asks questions, then prepares a Spec (or multiple specs depending on feature complexity which are placed in a queue) with concrete acceptance criteria.

The "plan" is then handed off to the Coder who performs the implementation (following SE principles), small testing (e.g. unit tests) and then submits a handoff to the Tester. The handoff includes what tests the Coder peformed, what issues he found and what limitations he encountered.

The Tester is independent of the Coder. He checks the Acceptance Criteria and performs different types of tests. At the end after independently testing, he compares his results with the handoff. If all acceptance criteria are fulfilled, the feature is released. If not, the Tester sends back his independent findings along with possible ideas on how to fix the issues back to the Coder. There are max. 3 Coder/Tester sessions allowed, after that the task is escalated for human verification. Neither Tester nor Planner can perform changes to files.

This is a TLDR version of what I'm trying to build. The biggest issue has been efficient memory management between the agents, since each session starts from scratch. Even with a state-ledger and evidence-ledger, often times the agents repeat work that was already done by the previous agent.

I'm limited to 128k context and I've been trying to accomplish this workflow fully local with a Qwen3.8 27B Q4, so that's the main difference between your setup and mine. That as well as the "Simplifier" agent. I'm curious to know why you chose to include a Simplifier agent.

2

u/oppid 18d ago

Well, it's very similar!

The handoffs are basically the protocol I have defined, and they enforce the way an agent ends its job.

I also have "escalations" from the builder, in case of inconsistency with the spec or more in general when the builder cannot proceed alone because a decision is needed, and "findings" from the verifier when the implementation does not fulfill the spec.

Regarding the simplifier, at first, I used Addy Osmani’s skill at the end of the workflow. Then I decided to integrate that step directly into the workflow as a dedicated agent.

In my experience, this works well when the models come from different “families”. This also applies to the workflow in general: a Builder and a Verifier from the same family tend to approach the problem in similar ways.

> Even with a state-ledger and evidence-ledger, often times the agents repeat work that was already done by the previous agent.

This is interesting. I have session logs of the children. I have to check. Tnx!

3

u/IlyaM 18d ago

I think in general this is a flawed approach, what happens is that you eventually find that whatever workflow you originally desigmed ends up not match new use cases you didn't anticipate. I learned this lesson hard way as I had buiding for myself also various dev process automations with pi. Adjusting code every time you run in non-matching use case is just too slow.

Much more flexiable approach is to define workflows purely as agent prose, what means you can adjust them very quickly. It is much better to use actual code to implement only tools that run very well defined and very small parts of your workflow. For example I have a complex flow which feeds CICD results into the loop and reading CI-CD status is written in actual code.

As a forcing function to have different agentic steps to compose well it is helpful to define schema for inputs and outputs and if you like you can validate this with code. Essentially you need in code some generic support for starting arbitrary subagents plus some defined method for them to communicate optionally with ability to validate schemas with code. And as mentioned above you can write small tools to help agents with simple well predefined steps. The whole workflow itself you are better just describe in prose.

1

u/oppid 18d ago

I don't see this workflow as a silver bullet. It helps me give agents a clear direction, and during spec writing, the orchestrator pushes me to be explicit about my intentions.

I see your point about flexibility. The workflow is still a work in progress, but I don't expect it to cover every use case. What I like is that it's a toggle, I turn it on when I want that structure.

I wouldn't use it for small tasks, or for exploratory work where the goals and the approach are still unclear. I find it useful for scoped, reversible changes.

For example, I wouldn't try to build an entire app from a single spec.

1

u/oppid 18d ago

adding Pi Maestro manifesto.

------

Pi Maestro started from the need to use an engineering method when working with agents. With simple prompts or the "let’s write a plan" approach, I would sometimes reach dead ends and have to start over. Agents would say the work was complete too early, without checking the result enough.

Spec-driven development seemed suitable for this problem. So I tried to turn it into a workflow that worked in practice: define the expected behavior, ask one agent to implement it, and ask another to check it independently.

At first, I tried to do everything through skills. However, I noticed that agents would skip steps in the protocol described in the Markdown files. My impression was that following the workflow required too much attention compared to the assigned task.

The workflow must be enforced by code, not by the prompt.

So I introduced deterministic tools that control transitions and check the reports produced by agents. Basically, I built a finite state machine where each step requires a structured handoff. This handoff also becomes the starting point for the next agent.

Taking inspiration from OpenSpec and GitHub Spec Kit, I adopted the concepts that suited the way I work:

- `proposal.md` for the context, goal, and scope of the change.

- `spec.md` for requirements in the form "actor MUST…" and acceptance criteria using `GIVEN`, `WHEN`, `THEN` and concrete examples.

- `design.md` when important technical decisions are needed.

Once the spec is written and approved, the Maestro (orchestrator) starts coordinating a sequence of agents:

- Builder, responsible for implementation.

- Verifier, responsible for checking that everything works as specified.

- Simplifier, responsible for simplifying the code to make it clearer.

Only writing the spec is required. Builder, Verifier, and Simplifier are enabled through configuration. I believe the amount of work done by agents should match the difficulty of the change. In some cases, I use Maestro only to prepare the spec, which I then divide into smaller specs.

I have chosen Pi because it provides events to control the runtime. This made it easy to add the maestro without going through an MCP server. Pi also works with different LLM models. Using different models for each role allows for a more critical view of the spec: a builder and a verifier from the same "family" will approach the problem in similar ways.

Of course, Maestro alone is not enough. You need clear project rules, clear requirements, tests, and human review of the result. You still need to understand what you are building and where you want to go.