Core Structure Cleanup
Core Refactors Without Behavior Drift
Gantry cleaned up shared predicates, feature boundaries, command ownership, rendering layers, diagram modules, and tiny config parsing.
1 milestones 6 tasks 13 agents
2 plan 6 execute 7 review
204k peak context
102k median execute
4h 7m total 9m 21s per task
51m 40s execute 16m 2s review
62 edits 436 commands
codex harness
This run addressed structural debt in Gantry's Rust core without turning the cleanup into product work. The plan grouped independent refactors under one milestone: shared worktree detection, a development-only corpus reconciliation surface, artifact reclamation ownership, a lower domain boundary, explicit diagram modules, and consolidation of tiny key-value parsers. The current tree still shows those boundaries. Some files have moved on through later commits, but the central changes remain visible as shared helpers, gated modules, extracted command code, presentation-side stop rendering, ordinary Rust module declarations, and a common tiny config parser.
How this walkthrough is structured
Feature
What did the run build and ship?
The live core still carries the cleanup as shared runtime decisions, narrower feature exposure, clearer module ownership, and parser plumbing that replaces duplicated hand lexers.
Build
How did Gantry structure the work?
The run kept independent refactors in sibling sprints under one structural milestone; the child work stayed green, while integration stress appeared only at the final merge boundary.
Milestone 1
Structural Cleanup
6 tasks 15 agents 1h 18m wall time 204k peak context
The milestone's shape is still visible across the current tree. Fleet discovery, stats tooling, command reclamation, domain events, stop rendering, diagram drawing, and tiny config parsing now sit behind clearer ownership lines than the old plan described. Later edits have touched many of those files, but the cleanup did not disappear into a revert. It became the structure later work continued to use.
This milestone carried a broad cleanup plan, but the brief kept it bounded by a fixed external contract and a list of explicit exclusions. Each child sprint owned a different boundary, so a fresh agent could work locally without needing the whole codebase in memory. The recorded child gates and reviews stayed green, which says the decomposition was small enough for each workstream. The stress arrived after the milestone composed, at merge reconciliation rather than inside an individual refactor.
Fleet Worktree Filter
2 agents 9m 21s wall time 78k peak context
Fleet discovery now owns `candidate_is_worktree_hosted`, and both lifecycle folding and cache eligibility call that shared predicate. The helper checks direct worktree storage, duplicate paths, and resumable orchestration directories through runtime namespace naming instead of duplicated string pairs. The current tests still cover ordinary candidates, direct worktrees, duplicate worktrees, resumable worktree runs, and the no-parent root case.
This sprint took the only workstream with a known wrong-answer mode, so it went first and kept its scope to fleet candidate classification. The brief asked for one predicate, one runtime naming source, and a hermetic proof of the degenerate root case. That was a compact assignment for a clean-context agent because the callers already existed and only needed to stop answering the same question separately. Its recorded gates and review stayed green.
Devtools Corpus Sync
2 agents 7m 47s wall time 104k peak context
Corpus reconciliation remains compiled through the development-tools feature in the engine and stats CLI. The command parser only accepts the reconciliation flags in that build, and the CLI specification carries feature metadata so stripped help and reference output can omit them. The stats documentation still describes the private reconciliation path as development-only maintenance surface.
This sprint was a feature-boundary change, not a corpus rewrite. The brief isolated the private reconciliation machinery behind the default development-tools feature while preserving the default build's internal command surface. That made the unit narrow: guard implementation, parsing, generated metadata, and documentation consistently. The feature-tier gates supplied the proof, and the run recorded no repair or replan inside the sprint.
Artifact Reclamation
2 agents 13m 43s wall time 204k peak context
`src/commands/artifact_reclamation.rs` now owns request parsing, planning, report rendering, and apply paths for prune, purge, worktree removal, and build-directory cleanup. `src/commands.rs` delegates those verbs through the module and documents that boundary. The moved tests still live with the reclaimed subject, so the command behavior remains checked where the ownership now sits.
This was the largest code-motion unit, but its brief gave it a single subject: reclamation for detailed artifacts and disposable worktrees. It was not allowed to split unrelated command code or rewrite behavior, which made review focus on whether ownership moved intact. The extracted module also established a contract for the later parser audit. Its gates and review stayed green, so the broad command layer could delegate without a follow-up cut.
Boundary Stop Rendering
2 agents 16m 14s wall time 178k peak context
The domain module now states that it is a lower layer consumed by the engine and front ends, and the stop rendering helpers live under the engine side. Stop-card generation calls presentation-side rendering for the mechanical body instead of making the domain own that text. The current TUI renders stop transcript bodies as markdown without modal chrome, while the domain layer remains free of upward engine imports.
This sprint repaired a layer violation while holding user-visible stop text steady. The brief separated shared domain vocabulary from presentation rendering and forbade broad TUI cleanup, which kept the agent from expanding a boundary fix into a god-file split. Existing rendering coverage was allowed to move with the subject, but not to grow prose-pinning tests. The recorded sprint stayed green through review.
Real Module Diagram
2 agents 9m 12s wall time 102k peak context
`src/tui/diagram/mod.rs` now declares the diagram components as Rust modules and re-exports the same public vocabulary from their concrete files. The subtree presents itself as generic diagram code, with Gantry-specific projection kept outside it. There are no textual include calls in the module root, and later diagram work still consumes the same public surface.
This sprint was intentionally mechanical: turn a diagram subtree from textual assembly into ordinary modules without changing its public surface. The brief kept file names, behavior, and outside imports stable, so the fresh agent only had to make internal visibility and imports explicit. That constraint made the refactor easy to judge from the subtree boundary. Its gate and review outcomes were green.
Tiny Config Cleanup
2 agents 12m 8s wall time 99k peak context
`src/engine/tiny_config.rs` is now the shared lexer for Gantry's small key-value formats, with options for delimiters, comments, sections, quote handling, strict parsing, and front matter splitting. Harness pins, pattern front matter, map specs, timing files, provenance manifests, runtime config, and related callers route through it where their semantics fit. The global configuration schema parser remains separate, matching the brief's boundary.
This sprint came last because the parser audit had to respect the reclamation boundary created earlier. The brief required each tiny-format candidate to be audited in its current home, rewritten only when semantics matched, or left local with a rationale when they did not. That made the work a comparison task rather than a blanket parser rewrite. The focused parser changes passed through the recorded gate and review without a replan.