| name | refactor-clean |
| description | Imported from everything-codex command refactor-clean |
| version | 0.1.0 |
| source | fork |
| checksum | a8500c117b78940fb9d9b3c4505a829ddfa2d3232a46f92d157aae5c69c09aa8 |
| updated_at | "2026-02-11T01:29:16.000Z" |
| layer | quality |
Refactor Clean
Native Subagent Protocol (Codex)
Codex supports native subagents. Delegate with spawn_agent, coordinate with send_input, collect via wait_agent, and clean up with close_agent.
Execution preference:
- Use native subagents first for independent workstreams (parallel when possible).
- Merge results in main thread and run final verification.
- Fallback only when delegation is blocked: use the
[ANALYST]/[ARCHITECT]/[EXECUTOR]/[REVIEWER] structure in a single response.
Minimal orchestration pattern:
spawn_agent -> send_input (optional) -> wait_agent -> close_agent
Safely identify and remove dead code with test verification:
-
Run dead code analysis tools:
- knip: Find unused exports and files
- depcheck: Find unused dependencies
- ts-prune: Find unused TypeScript exports
-
Generate comprehensive report in .reports/dead-code-analysis.md
-
Categorize findings by severity:
- SAFE: Test files, unused utilities
- CAUTION: API routes, components
- DANGER: Config files, main entry points
-
Propose safe deletions only
-
Before each deletion:
- Run full test suite
- Verify tests pass
- Apply change
- Re-run tests
- Rollback if tests fail
-
Show summary of cleaned items
Never delete code without running tests first!