# Direct messages — handoff

## Summary

The DMs panel lists direct chats and provides flows to start new conversations. Uses `m.direct` account data to identify DM rooms.

## User-facing behavior

- Sidebar Direct tab shows DM rooms sorted
- Create new DM / group chat
- DM room opens in direct route layout
- Paarrot logo badge states on tab (shared with home tab styling)

## Architecture

```
client/direct/
  Direct.tsx — DM room list page
  DirectCreate.tsx — start new chat
  useDirectRooms.ts — room list from m.direct
  RoomProvider.tsx — route-level room context
mDirectAtom — direct room index
```

## Key files

| Path | Role |
|------|------|
| `cinny/src/app/pages/client/direct/Direct.tsx` | DM list |
| `cinny/src/app/pages/client/direct/DirectCreate.tsx` | Create DM |
| `cinny/src/app/pages/client/direct/useDirectRooms.ts` | List logic |
| `cinny/src/app/pages/client/sidebar/DirectTab.tsx` | Sidebar tab |
| `cinny/src/app/state/mDirectList.ts` | `mDirectAtom` |
| `cinny/src/app/hooks/useDirectUsers.ts` | DM user helpers |

## Data model

| Key | Scope |
|-----|-------|
| `m.direct` | User account data — map userId → roomIds[] |

## Dependencies

- matrix-js-sdk DM APIs
- `is_direct` on member events

## Integration points

- **home-and-sidebar**: DirectTab
- **routing-and-navigation**: `DIRECT_PATH`
- **create-flows**: create-chat feature
- **room-timeline**: same Room component for DM rooms

## Testing

### Manual

1. Start DM with user; appears in direct list.
2. Group DM with multiple users.
3. Unread badge on Direct tab.

### Automated

- None

## Known issues & gotchas

- `m.direct` can be stale — client may repair on sync
- DM vs private room distinction relies on account data

## Future work

- Pin favorite DMs
- DM search filter

## Related docs

- [home-and-sidebar HANDOFF](../home-and-sidebar/HANDOFF.md)
- [create-flows HANDOFF](../create-flows/HANDOFF.md)

## Add your extra things here

- `getDirectRoomPath` in pathUtils for DM room URLs
