code-cleanup
Code cleanup
Clean up and validate one coherent change, then return evidence to the caller, which owns commits, phase transitions, and finding disposition.
Scope and ownership
Read applicable agent instructions, docs/agents/workflow.md, CI, and check configuration. Use the caller's base and task scope, including staged, unstaged, and untracked task files. Preserve unrelated work and the index. A review-only request stays read-only and reports missing evidence.
For delegated work, run repository-required full suites and final builds once on the combined change. Follow repository policy when it requires earlier or broader checks, and record those requirements in the caller's notes.
Match checks to the change
When repository policy leaves scope open, use configured checks for affected files or packages and relevant focused tests. Presentation edits use preview evidence and applicable static checks; full suites and production or deployment builds need a concrete dependency risk, a delivery requirement, or explicit policy. Broaden for shared runtime, dependency, build, security, or data changes.
Coordinate concurrent checks
Run independent checks in parallel when their resources are isolated. Build output and locks inside separate worktrees are isolated files.
For checks with shared resources, read workflow.md's Concurrent runs section and the check configuration. Prefer supported settings that give each run its own ports and resource names, with teardown limited to that run's resources. Otherwise use the repository's lock to serialize every run using that resource, holding it through teardown. Only a held lock or an isolation setting reserves the resource. When neither is available, report the remaining race as a coverage gap.