Skip to content

feat(v3.2): RPG-style architecture-first planning behind ATLAS_RPG_PLANNING (#120)#124

Open
yogthos wants to merge 2 commits into
itigges22:mainfrom
yogthos:feat/rpg-wavelet-planning
Open

feat(v3.2): RPG-style architecture-first planning behind ATLAS_RPG_PLANNING (#120)#124
yogthos wants to merge 2 commits into
itigges22:mainfrom
yogthos:feat/rpg-wavelet-planning

Conversation

@yogthos

@yogthos yogthos commented Jun 10, 2026

Copy link
Copy Markdown

Adds an opt-in repository-level planning phase that plans the architecture up front and then fills each piece, instead of free-form natural-language planning. It builds on the existing problem-level PlanSearch rather than replacing it: the Repository Planning Graph decides what to build and how the files, signatures, and data flows fit together, and PlanSearch fills in each node whose interface is already pinned.

The work draws on two papers. RPG (arXiv:2509.16198) supplies the repository planning graph and the two-stage proposal-then-implementation construction. PlanSearch (arXiv:2409.03733), already implemented in this repo, supplies the per-node algorithmic search. The wavelet substrate is a faithful, dependency free Python port of wavescope-mcp, whose numeric output matches the upstream TypeScript under the fixture tests.

Everything is gated by ATLAS_RPG_PLANNING and defaults to off. With the flag off, planning and generation behave exactly as before, since the flat planner emits no constraints and the new code paths short-circuit.

What the feature adds:

  • Wavelet substrate providing structural signal, Ricker CWT, the fine/medium/coarse bands, project decomposition, and the peak-diff drift detector on top of pure stdlib.
  • RPG artifact and two-stage planning providing capability tree then files, signatures, and edges, with validation, scoring, and a topological projection back onto the existing flat Plan so the agent loop is untouched.
  • Graph-guided generation where each node's planned interface threads into its /v3/generate call (proxy/rpg.go, proxy/types.go), so PlanSearch fills a node whose architecture is fixed.
  • Structural verification and drift ensures the candidate veto now rejects code that does not realize its planned signatures, and on write the proxy runs one bounded corrective regeneration, then surfaces any surviving drift along with the affected downstream subgraph.

There is some offline evaluation still needed using v3-service/rpg_eval.py to score RPG artifacts for CI and benchmark summaries.

Yogthos added 2 commits June 10, 2026 11:11
…ANNING (itigges22#120)

Adds an opt-in repository-level planning phase that plans the architecture up
front and then fills each piece, instead of free-form natural-language planning.
It builds on the existing problem-level PlanSearch rather than replacing it: the
Repository Planning Graph decides what to build and how the files, signatures,
and data flows fit together, and PlanSearch fills in each node whose interface
is already pinned.

The work draws on two papers. RPG (arXiv:2509.16198) supplies the repository
planning graph and the two-stage proposal-then-implementation construction.
PlanSearch (arXiv:2409.03733), already implemented in this repo, supplies the
per-node algorithmic search. The wavelet substrate is a faithful, dependency
free Python port of wavescope-mcp by Dmitri Sotnikov, whose numeric output
matches the upstream TypeScript bit for bit under the golden-fixture tests.

Everything is gated by ATLAS_RPG_PLANNING and defaults to off. With the flag off,
planning and generation behave exactly as before, since the flat planner emits no
constraints and the new code paths short-circuit.

What landed, by phase:

- Wavelet substrate (v3-service/wavelet): structural signal, Ricker CWT, the
  fine/medium/coarse bands, project decomposition, and the peak-diff drift
  detector, all pure stdlib.
- RPG artifact and two-stage planning (v3-service/rpg.py): capability tree then
  files, signatures, and edges, with validation, scoring, and a topological
  projection back onto the existing flat Plan so the agent loop is untouched.
- Graph-guided generation: each node's planned interface threads into its
  /v3/generate call (proxy/rpg.go, proxy/types.go), so PlanSearch fills a node
  whose architecture is fixed.
- Structural verification and drift: the candidate veto now rejects code that
  does not realize its planned signatures, and on write the proxy runs one
  bounded corrective regeneration, then surfaces any surviving drift along with
  the affected downstream subgraph.
- Offline evaluation: v3-service/rpg_eval.py scores RPG artifacts for CI and
  benchmark summaries. The live RepoCraft comparison needs a GPU and is left as
  a documented runbook; the default stays off until that evidence lands.

Design and phase-by-phase status live in docs/reports/RPG_WAVELET_PLANNING_V3_2.md.
Tests: 152 Python tests under tests/v3-service and the proxy Go suite, all green.
Credit for the idea and framing goes to Dmitri Sotnikov (@yogthos).
A review of the feature turned up two problems that made it inoperative in the
default Docker deployment, plus several correctness gaps. This fixes all of them.

The flag never reached the v3-service container, so the whole feature was dead
when a user set ATLAS_RPG_PLANNING in their .env. It is now forwarded in
docker-compose.yml, along with ATLAS_PLAN_THINKING.

The proposal stage seeded its coarse band by scanning working_dir off disk, but
the v3-service container has no project volume mount, so that scan always found
nothing in Docker. It now builds the coarse band from the in-memory
project_context the proxy already sends, through a new decompose_file_map entry
point, and falls back to a disk scan only when no context was passed.

The plan result is a single SSE line, and with RPG on it now carries the whole
graph. The reader buffer was 1MB, so a large graph could trip ErrTooLong and
silently drop the plan. The buffer is raised to 16MB and a scanner error is now
surfaced instead of being reported as a missing result.

Signature parsing mishandled Go receiver methods like func (s *S) Load(), and
the bare-name fallback would return the keyword func, which produced a false
missing-signature veto. Parsing now recognizes receiver methods and never
treats a lone declaration keyword as a function name, and defined_names picks up
receiver methods too.

The edit_file and ast_edit path threaded RPG constraints but never ran the drift
retry or reporting that the write path does, so drift on edits was invisible. It
now runs the same regenerateOnDrift and reportRPGDrift.

planConstraintsForTarget returned the first overlapping step, so a bare-basename
step could shadow the deeper path it was not for. It now prefers the most
specific match. The corrective regeneration accepted a retry only when the total
miss count dropped, which discarded a retry that fixed the targeted signature
but traded in a different one; it now accepts a retry that resolves any of the
signatures it was correcting for. The topological sort dedups file ids so a
duplicate cannot fake acyclicity or drop a file, and node_drift gained a
threshold so its drift score actually gates the re-plan decision.

Tests: 163 Python tests and the proxy Go suite, all green.
@yogthos yogthos marked this pull request as ready for review June 10, 2026 17:58
@yogthos

yogthos commented Jun 10, 2026

Copy link
Copy Markdown
Author

The only thing to note here is that I haven't tested against a small model like 9b. So, while things should work mechanically as expected, it's worth testing to make sure a small model can work with the output well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant