Add the improve skill and split oversized files

Merged
JS
10h ago
+11393-8986

Problem and behavior

Four files that most changes go through were far over the 1500-line limit (src/agent/prompts.rs 3944, src/livekit.rs 3572, src/agent.rs 3520, src/gemini.rs 2815 lines) and web/task.js had no unit-testable logic. The change-and-Rust skills also overlapped and had no method for refactors. After this change those Rust files are 71, 1935, 2004 and 1870 lines, web/task.js is 1550 lines with seven node-testable modules, and one skill, codetrial-improve, carries the method and the Rust and JavaScript profiles. No behavior changes.

Approach

Rust: whole items move by line span into sibling modules and the old file keeps re-exporting the same names, so no caller changes; only visibility (to pub(super)), imports and the ceilings in scripts/rust-style-ceilings.json change. Tests that read source as text and the report evaluation's source digest follow the moved code. Browser: the 45 mutable module-level variables of web/task.js become one sealed state object, and the pure text, room connection and Start handler move to modules that reach what task.js still owns through a lazy host seam, so none imports the page. Skills: codetrial-change and codetrial-rust merge into codetrial-improve with a refactor method, a ceiling-hotspot ranking (scripts/ceiling-hotspots.py), and a check that refuses a skill description a YAML loader would cut. The series is 13 commits, one intent each.


Summary by cubic

Splits the oversized Rust and browser files into smaller, testable modules and merges the change and Rust guidance into codetrial-improve. The refactors preserve behavior: the Rust files re-export the same names, so no caller changes.

  • The Rust files now hold 71, 1935, 2004 and 1870 lines, down from 3944, 3572, 3520 and 2815; web/task.js is split into seven Node-testable modules sharing one sealed state object.
  • Adds scripts/ceiling-hotspots.py to rank oversized files by churn times size, plus Node tests for the extracted browser logic.
  • codetrial-improve carries the refactor method, Rust and JavaScript profiles, and reference-tool notes; routing and skill references are updated, and unquoted descriptions are checked for YAML hazards.
  • Adds tests for the candidate and duplicate-agent rules, documents why each recovered lock is safe, and widens token dispatch to Option<&str>.
  • Rust and portable test lanes pass (1869 library tests) and clippy passes with -D warnings; Playwright, the desktop build and cargo-deny were not run.