---
name: "Split commands.rs into individual command handler modules"
---

# Refactor 328: Split commands.rs into individual command handler modules

## Current State

- TBD

## Desired State

commands.rs is 1,947 lines with 9 command handlers (help, status, ambient, git, htop, cost, show, overview, delete) plus all their tests in one file. Split into:
- commands/mod.rs — command registry, dispatch, strip_bot_mention, BotCommand/CommandContext/CommandDispatch structs
- commands/status.rs — handle_status, build_pipeline_status, read_stage_items, story_short_label
- commands/cost.rs — handle_cost, extract_agent_type
- commands/git.rs — handle_git
- commands/ambient.rs — handle_ambient
- commands/show.rs — handle_show
- commands/overview.rs — handle_overview, find_story_merge_commit, get_commit_stat, extract_diff_symbols, parse_symbol_definition
- commands/help.rs — handle_help
- Tests split into corresponding test modules

## Acceptance Criteria

- [ ] commands.rs split into focused handler modules under matrix/commands/
- [ ] Registry and dispatch remain in mod.rs
- [ ] Each handler module contains the handler function and its tests
- [ ] All existing tests pass without modification to test logic
- [ ] No public API changes — try_handle_command still works the same way

## Out of Scope

- TBD
