Retrieved article excerpt
Open article · Retrieved 2026-11-22T18:21:56.960472+00:00
[← All posts](https://airepublic.com/blog)
# Pi Dash self-evolution experiment with Muse Code and Meta Muse Spark 1.3
Pi Dash coordinated 26 Muse Code agents to rewrite its own Django backend in Rust. The main port took about ten days and cost about $350 in model usage.
[AI Republic](https://airepublic.com) ·November 20, 2026 ·11 min read
- [engineering](https://airepublic.com/blog?tag=engineering)
- [pi-dash](https://airepublic.com/blog?tag=pi-dash)
- [rust](https://airepublic.com/blog?tag=rust)
## Introduction[#](https://airepublic.com/blog/pi-dash-self-evolution-experiment/#introduction)
[Pi Dash](https://airepublic.com/products/pidash) is an open source agent coordination platform developed by AI Republic, that automatically assigns tasks to a team of AI agents. We used the platform to refactor its own backend. This article is a short report on how that worked.
On a Pi Dash board, agents do the issues: your own Muse Code, Claude Code, Codex or Cursor through the Pi Dash daemon, or the built-in Pi Dash Agent. The rulebook, the coordinator and the review-test-merge loop in this post are ordinary Pi Dash features. You can run the same setup on your own backlog.
## Pi Dash rewrote its own backend in Rust[#](https://airepublic.com/blog/pi-dash-self-evolution-experiment/#pi-dash-rewrote-its-own-backend-in-rust)
In late September and early October 2026, Pi Dash coordinated 26 Muse Code agents on 5 developer machines to rewrite its own backend from Python and Django to Rust. The main port took about ten days. The agents picked up issues from a Pi Dash board, wrote the code, reviewed it, tested it against the running Django server, and merged their own pull requests.
The backend started as a fork of [Plane](https://github.com/makeplane/plane)’s Django API. By September it was about 101,000 lines of application code, plus about 20,000 lines of cloud-only code. We wanted it in Rust. We also wanted to find out whether our own product could run a project this large with no person approving each step.
It could, with caveats. This post covers the rules we gave the agents, how we checked that they were right, and what still needs improving.
**Why Muse Code and Muse Spark.** Every agent was Muse Code running as a Pi Dash runner, with `muse-spark-1.3-contribute` as the model. We chose them for two reasons:
- **Price and performance.** A project this size means an agent run for every step of every issue, so the cost of each run matters as much as its quality.
- **Stability on long runs.** The work went on for days with few people involved, so the model had to stay on task across long sessions without someone stepping in.
Across the whole project, the agents sent about 166,000 requests to the model and used about 48.6 billion tokens, for a total model cost of about $350.
The short version:
- **Time:** about ten days for the main port, September 26 to October 5. By then about three quarters of the final Rust code and nine in ten domain-port pull requests had merged.
- **Volume:** about 1,740 Pi Dash issues and about 1,320 merged pull requests.
- **Correctness:** 5,029 contract tests run against both backends. Every HTTP contract test passes on Rust.
- **Safety:** no `unsafe` code. Every crate forbids it.
- **Process:** no human approval gate on any merge.
## Why leave Django[#](https://airepublic.com/blog/pi-dash-self-evolution-experiment/#why-leave-django)
We had three reasons.
1. **Python cost too much to run.** The Django backend was heavy and slow: on our production host it used about 1.5 GB of memory against 81 MB for Rust, and with 32 requests at once it answered a third as many per second ([The numbers](https://airepublic.com/blog/pi-dash-self-evolution-experiment/#the-numbers) has the details).
2. **One language from the cloud to the developer’s machine.** The agent daemon and the desktop app were already Rust. With the backend in Rust too, the cloud and the daemon can share the same code.
3. **A backend built for running agents.** The backend now hands out and tracks agent work all day, which needs a language that answers fast on few resources. Django serves more requests by adding Python processes; Rust serves them from one process.
## Same behavior, new code[#](https://airepublic.com/blog/pi-dash-self-evolution-experiment/#same-behavior-new-code)
**Planning came first.** Muse Code scanned the Django codebase and wrote a plan: it measured every area of the backend, marked dead code to skip, and split the rest into 10 foundation issues and 37 domain epics. Claude Code reviewed the plan. Muse Code then created the epics and the rulebook in Pi Dash through MCP, one issue per row of the plan. From there, each epic’s first run splits it into its own sub-issues, as the loop section shows.
Every agent run starts by reading one rulebook, a Pi Dash issue called PIDASHCONV-1. Its main rules:
1. **Keep the behavior.** Same URLs, JSON, database schema and SQL behavior. Changing behavior needs its own issue.
2. **Quarantine.** Code goes only under `rust-api/`. No Python file is touched.
3. **Done means green.** The named tests pass. No stubs, skipped tests or placeholders.
4. **Review assumes the code is wrong.** Two independent passes against the Python before any decision.
5. **Report problems, don’t work around them.** A rule that can’t be followed becomes a `process:` comment on the rulebook.
The first rule fixed behavior, not code. Django does much of its work implicitly, through base classes, serializers, permission classes and lazy querysets, so most of it has no direct Rust equivalent. For each issue, an agent worked out what the Python actually does (the rows it reads, the checks it applies, the JSON it returns, the side effects) and wrote new Rust to match. That is closer to clean-room development: the Python was the specification, not the template. Contract tests, Python suites that send real HTTP requests, then ran against both backends to check the result.
Figure 1
The agent works out what the Python does, then writes Rust that does the same
Django does much of its work out of sight: the base view checks the login, and the body is parsed on first use. None of that maps line for line to Rust, so each agent first writes down the behavior, then implements it. This is the per-job toggle of the D-03 epic.
#### Pythonapps/api/pi\_dash/loop/views.py
#### What it does
#### Rustrust-api/crates/api/src/loop/user.rs
| Contract test | What it sends | Django | Rust |
| --- | --- | --- | --- |
Play Restart
Python is the real view, `AutoPMJobEndpoint.patch`. The Rust is shortened from `patch_job` and `job_by_slug_select`: error handling condensed and the status comments added. Test names are the real contract tests in `rust-api/contract-tests/loop/`.
The Rust is organized by layer, not by Django app: `types` → `db` → `auth` → `services` → `api`, plus `jobs`. The lower layers were written first and then locked.
One rule changed midway. On October 26, “same JSON” stopped meaning every byte: business behavior and the API contract must still match, but library quirks no client can trigger are no longer copied.
## The loop: implement, review, test, merge[#](https://airepublic.com/blog/pi-dash-self-evolution-experiment/#the-loop-implement-review-test-merge)
Every issue moves through the same loop on a Pi Dash board, and each step is a separate agent run with its own fresh context. The run that writes the code never reviews it.
Every issue goes from release to merge with no person approving a stepCoordinatorfrees an issue onceits blockers are doneImplement runports the Python,opens a pull requestReview runassumes it is wrong,two passes vs PythonTest runcontract tests onRust and DjangoMergerebase, re-check,squash-merge itselfDoneunblocks the issueswaiting on itdefectsfailed checkspassnext issue released
The issue loop in PIDASHCONV, from the rulebook and project description.
A review or test that finds a problem sends the issue back to Implement. A pass goes straight to the merge, in the same run.
**The coordinator** is a scheduled Pi Dash agent that acts as project manager. It frees issues whose stage is open and whose blockers are done. It re-dispatches stuck runs, turns `process:` comments into issues and reports progress. It never touches code.
**Epics split themselves.** Each Django domain started as one epic. Its first run read the Python and filed sub-issues bottom-up: serializers, then models, queries, permissions, tasks, handlers, with at most five units each. A review run checked that split against the source before any sub-issue could start.
Figure 2
One epic splits itself into issues, and agents carry each one to a merge
The coordinator opens each stage when the previous one is done. A domain epic's first run reads the Python and files its own sub-issues. Then every sub-issue goes through implement, review and test, each a separate agent run.
Play Restart
Sub-issue names, their order and the per-epic pull request counts are real: the D-03 epic's merged sub-issues, and pull requests merged into the Rust branch from September 26 to October 5, 2026. Timing inside the animation is compressed. Stages and rules from the rulebook, PIDASHCONV-1.
**Merging is the test run’s job.** The merge procedure has five steps:
1. Merge the issues this one depends on first.
2. Rebase on the Rust branch.
3. Re-run the affected checks.
4. Wait for the one required check.
5. Squash-merge and post the commit SHA.
If other pull requests keep landing first, the run may rebase up to six times before it stops and reports.
**Red CI after a merge is never reverted.** GitHub runs the full Rust suite after each merge. If it goes red, the coordinator files one urgent fix issue naming the failing tests and the merges since the last green run. The fix run bisects that range using only the failing tests.
## The numbers[#](https://airepublic.com/blog/pi-dash-self-evolution-experiment/#the-numbers)
Most of the code was written in about ten days. From September 26 to October 5, agents merged about 720,000 net lines of Rust, about three quarters of what was there when the branch merged into main. By October 12 it was about 88%. The domain ports themselves ran from September 27 to October 10, and 353 of their 395 pull requests had merged by October 5. The weeks after went to fixes, parity work and cleanup, and to time spent waiting for us to check results and decide what came next. The branch merged into main on November 3.
Net `.rs` lines per day under `rust-api/crates`, from `git log origin/rust-dev`, September 26 to October 5, 2026. Tests and comments included. Leaves out a 201,769-line character-set table added October 5 and deleted October 27.
After October 12 the pace dropped to a few thousand lines a day across all merges, as the work moved to fixes, parity and cleanup.
Figure 3
Ten days of merged pull requests, replayed
Every dot is one pull request an agent merged into the Rust branch, placed at its merge time and sized by the Rust lines it added. Hover a dot for its title.
Clock
Sep 26
Pull requests merged
0
Net Rust lines
0
Domain epics started
0
Play Restart Speed ½×1×2×4×
Source: `git log origin/rust-dev -- rust-api`, 494 squash-merged pull requests authored September 26 to October 5, 2026; lines are net `.rs` lines under `rust-api/crates`. One 201,769-line character-set table (pull request #1102, deleted October 27) is drawn at zero size. Rows are grouped by the rulebook's stages.
| Measure | Value |
| --- | --- |
| Django application code ported | ~101,000 lines (excluding tests, migrations, comments, blank lines) |
| Rust application code | ~505,000 lines (excluding tests, comments, blank lines) |
| Rust comments | ~144,000 lines, mostly “ported from” notes |
| Rust unit tests | 9,175 test functions |
| Contract tests (run on both backends) | 5,029 tests in ~50 domains |
| Recorded fixtures | 715 files |
| `unsafe` blocks | 0 |
| Pi Dash issu