What I do
- •Keep the parent agent as the orchestrator for lint/build discovery and final validation.
- •Parse and categorize Rust diagnostics by severity, risk, and file proximity.
- •Dispatch many low-risk fixes to multiple parallel
@developer_jrsubagents. - •Batch nearby related diagnostics into one subagent task when that is safer/faster.
- •Escalate risky or design-sensitive issues to the parent agent for approval.
Workflow
- •Parent-first discovery: Parent agent runs
cargo buildand/orcargo test(and optionally clippy) and collects full diagnostics. - •Normalize diagnostics: Extract
file:line, code (E..., lint name), severity, and suggested fix when available. - •Categorize risk:
- •Safe/easy: unused imports/variables, dead code cleanup, trivial doc or naming cleanup, obvious clippy suggestions, formatting.
- •Risky: behavior changes, API signature changes, architecture refactors, ambiguous type/lifetime fixes.
- •Create parallel fix batches:
- •Prefer one
@developer_jrtask per warning/error when items are independent. - •If there are many nearby diagnostics in the same file/module, batch them into a single
@developer_jrtask. - •Keep each batch low-risk and scoped (ideally 1-5 edits in one area).
- •Prefer one
- •Dispatch in parallel: Launch multiple
@developer_jrsubagents at once for independent safe batches. - •Integrate and validate: Parent agent re-runs build/test and repeats until clean or only risky items remain.
Parallel dispatch rules
- •Run
@developer_jrsubagents in parallel whenever batches do not touch the same lines/files. - •If two batches overlap in one file, merge to one
@developer_jrtask to avoid conflicts. - •Cap each
@developer_jrtask to a tight objective with explicit file/line references. - •Parent agent owns merge conflict handling, reruns, and final pass/fail reporting.
Fallback when routed directly to a developer
- •If work lands directly on
@developer_jrwithout parent-prepared diagnostics, first call@exploreto gather the current Rust diagnostics and propose safe batches. - •
@developer_jrshould not guess lint state from stale context; use fresh evidence from@explore(or fresh build output) before editing. - •After fallback discovery, continue using the same safe-fix and parallel-batching policy.
Safe-fix policy
Apply only low-risk fixes automatically via @developer_jr:
- •Remove unused imports, variables, and dead code.
- •Add
#[allow(dead_code)]or#[allow(unused)]where removal would break APIs. - •Fix obvious typos in code and comments.
- •Add trivial type annotations where inference is clear.
- •Apply simple clippy suggestions (renames, trivial optimizations).
- •Fix formatting issues via
cargo fmt. - •Add or fix doc comments on public items where intent is clear.
- •Resolve simple shadowing or naming conflicts.
Do NOT auto-apply without approval:
- •Behavioral changes or logic modifications.
- •API signature changes (renaming public items, changing return types).
- •Large refactors across multiple modules.
- •Dependency version changes.
- •Config changes (Cargo.toml, rust-toolchain.toml).
- •Workarounds for complex type errors or lifetime issues.
Escalation rule
If warnings/errors require risky changes:
- •List remaining items with file:line context.
- •Mark each as "requires approval" with brief risk note.
- •Ask parent agent to decide: fix now, defer, or skip.
Iteration loop
- •Run
cargo build 2>&1orcargo test 2>&1. - •Extract warnings/errors (use
RUSTFLAGS="-Awarnings"to test error-only baseline). - •Group by risk + file proximity and create independent batches.
- •Dispatch multiple
@developer_jrtasks in parallel. - •Re-run to verify fixes and detect newly surfaced diagnostics.
- •Repeat until clean or only risky items remain.
Final report contract
- •Build/test command run and toolchain version.
- •Total warnings/errors before/after.
- •Fixes applied (file, change category, subagent batch id/summary).
- •Remaining issues (risky items requiring approval).
- •Re-run validation status (pass/fail).