---
name: "Reorganize chat system into chat module with transport submodules"
---

# Refactor 383: Reorganize chat system into chat module with transport submodules

## Current State

- TBD

## Desired State

Currently chat-related code is scattered at the top level of `src/`: `transport.rs`, `whatsapp.rs`, `slack.rs`, plus `matrix/` as a directory module. This should be reorganized into a clean module hierarchy:

```
src/
  chat/
    mod.rs          # Generic chat traits, types, ChatTransport etc.
    transport/
      mod.rs
      matrix/       # Existing matrix module moved here
      whatsapp.rs   # Existing whatsapp.rs moved here
      slack.rs      # Existing slack.rs moved here
      twilio.rs     # Future Twilio transport
```

The `ChatTransport` trait and shared chat types should live in `chat/mod.rs`. Each transport implementation becomes a submodule of `chat::transport`.

## Acceptance Criteria

- [ ] ChatTransport trait and shared chat types live in `chat/mod.rs`
- [ ] Matrix transport lives in `chat/transport/matrix/`
- [ ] WhatsApp transport lives in `chat/transport/whatsapp.rs`
- [ ] Slack transport lives in `chat/transport/slack.rs`
- [ ] Top-level `transport.rs`, `whatsapp.rs`, `slack.rs`, and `matrix/` are removed
- [ ] All existing tests pass without modification (or with only import path changes)
- [ ] No functional changes — pure file reorganization and re-exports

## Out of Scope

- TBD
