Skip to content

Commit 8f2b70d

Browse files
authored
chore: add AI agent configuration and ubiquitous language glossary (#7091)
1 parent d03eb78 commit 8f2b70d

3 files changed

Lines changed: 239 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CLAUDE.md

CLAUDE.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Rocket.Chat React Native mobile client. Single-package React Native app (not a monorepo) using Yarn 1.22.22 (npm won't work). Supports iOS 13.4+ and Android 6.0+.
8+
9+
- React 19, React Native 0.79, Expo 53
10+
- TypeScript with strict mode, baseUrl set to `app/` (imports resolve from there)
11+
- Min Node: 22.14.0
12+
13+
## Commands
14+
15+
```bash
16+
# Install & setup
17+
yarn # Install dependencies (postinstall runs patch-package)
18+
yarn pod-install # Install iOS CocoaPods (required before iOS builds)
19+
20+
# Run
21+
yarn start # Start Metro bundler
22+
yarn ios # Build and run on iOS
23+
yarn android # Build and run on Android
24+
25+
# Test
26+
TZ=UTC yarn test # Run Jest unit tests (TZ=UTC is set in script)
27+
yarn test -- --testPathPattern='path/to/test' # Run a single test file
28+
yarn test-update # Update snapshots
29+
30+
# Lint & format
31+
yarn lint # ESLint + TypeScript compiler check
32+
yarn prettier-lint # Prettier auto-fix + lint
33+
34+
# Storybook
35+
yarn storybook:start # Start Metro with Storybook UI
36+
yarn storybook-generate # Generate story snapshots
37+
```
38+
39+
## Code Style
40+
41+
- **Prettier**: tabs, single quotes, 130 char width, no trailing commas, arrow parens avoid, bracket same line
42+
- **ESLint**: `@rocket.chat/eslint-config` base with React, React Native, TypeScript, Jest plugins
43+
- **Before committing**: Run `yarn prettier-lint` and `TZ=UTC yarn test` for modified files
44+
- Pre-commit hooks enforce these checks
45+
46+
## Architecture
47+
48+
### State Management: Redux + Redux-Saga
49+
50+
- **Actions** (`app/actions/`) — plain action creators
51+
- **Reducers** (`app/reducers/`) — state shape (app, login, connect, rooms, encryption, etc.)
52+
- **Sagas** (`app/sagas/`) — side effects (init, login, rooms, messages, encryption, deepLinking, videoConf)
53+
- **Selectors** (`app/selectors/`) — memoized with reselect
54+
- **Store** (`app/lib/store/`) — configures middleware (saga, app state, internet state)
55+
56+
### Navigation: React Navigation 7
57+
58+
- **Stacks** (`app/stacks/`) — InsideStack (authenticated), OutsideStack (login/register), MasterDetailStack (tablets), ShareExtensionStack
59+
- **Root** (`app/AppContainer.tsx`) — switches between auth states
60+
- **Responsive layout** (`app/lib/hooks/useResponsiveLayout/`) — master-detail on tablets vs single stack on phones
61+
62+
### Database: WatermelonDB (offline-first SQLite)
63+
64+
- **Models** (`app/lib/database/model/`) — Message, Room, Subscription, User, Thread, Upload, Server, CustomEmoji, Permission, Role, etc.
65+
- **Schema** (`app/lib/database/schema/`)
66+
- Local-first: UI reads from DB, sagas sync with server
67+
68+
### API Layer
69+
70+
- **SDK** (`app/lib/services/sdk.ts`) — Rocket.Chat JS SDK for WebSocket real-time subscriptions
71+
- **REST** (`app/lib/services/restApi.ts`) — HTTP via fetch
72+
- **Connect** (`app/lib/services/connect.ts`) — server connection management
73+
74+
### Views & Components
75+
76+
- **Views** (`app/views/`) — 70+ screen components
77+
- **Containers** (`app/containers/`) — reusable UI components
78+
- **Theme** (`app/theme.tsx`) — theming context
79+
80+
### Other Key Systems
81+
82+
- **i18n** (`app/i18n/`) — i18n-js with 40+ locales, RTL support
83+
- **Encryption** (`app/lib/encryption/`) — E2E encryption via @rocket.chat/mobile-crypto
84+
- **Enterprise** (`app/ee/`) — Omnichannel/livechat features
85+
- **Definitions** (`app/definitions/`) — shared TypeScript types
86+
- **VideoConf** (`app/sagas/videoConf.ts`, `app/lib/methods/videoConf.ts`) — server-managed video conferencing (Jitsi); uses Redux actions/reducers/sagas. May be replaced or removed in the future.
87+
- **VoIP** (`app/lib/services/voip/`) — new WebRTC peer-to-peer audio calls with native CallKit (iOS) and Telecom (Android) integration; uses Zustand stores, not Redux. VoIP and VideoConf are entirely separate features — do not conflate them.
88+
89+
### Entry Points
90+
91+
- `index.js` — registers app, conditionally loads Storybook
92+
- `app/index.tsx` — Redux provider, theme, navigation, notifications setup
93+
- `app/AppContainer.tsx` — root navigation container

UBIQUITOUS_LANGUAGE.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Ubiquitous Language
2+
3+
## Rooms & Conversations
4+
5+
| Term | Definition | Aliases to avoid |
6+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
7+
| **Room** | A server-side conversation container with shared state (name, type, settings) | Chat, conversation |
8+
| **Subscription** | A user's personal relationship to a Room, holding per-user state (unread count, favorite, muted, open) | Membership, room entry |
9+
| **Channel** | A public Room (type `'c'`) visible to all server users | Public room |
10+
| **Group** | A private Room (type `'p'`) visible only to invited members | Private room, private channel |
11+
| **Direct Message** | A 1-on-1 private Room (type `'d'`) between two users | DM, PM, private message |
12+
| **Thread** | A branched conversation spawned from a single Message, identified by `tmid` (thread message id) | Reply chain |
13+
| **Discussion** | A separate Room spawned from a parent Room, identified by `prid` (parent room id) — unlike Threads, Discussions are full Rooms | Sub-room, sub-channel |
14+
| **Team** | An organizational container that groups multiple Channels and users under a single entity | Workspace (ambiguous) |
15+
16+
## Messages
17+
18+
| Term | Definition | Aliases to avoid |
19+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------- |
20+
| **Message** | A unit of communication within a Room, identified by `_id` with content in `msg` and parsed markdown in `md` | Chat message, text |
21+
| **Thread Message** | A Message that belongs to a Thread, identified by presence of `tmid` | Reply, thread reply |
22+
| **System Message** | A Message generated by the server to record events (user joined, room archived, role changed) — identified by `t` (type) field | Event, notification |
23+
| **Attachment** | Rich media or structured data embedded in a Message (image, video, audio, file, or action buttons) | File, media |
24+
| **Reaction** | An emoji response to a Message, tracking which usernames reacted | Emoji reaction |
25+
| **Mention** | An `@username` reference within a Message that triggers notifications | Tag, ping |
26+
| **Draft Message** | A user's unsent composition stored on a Subscription or Thread (`draftMessage` field) | Unsent message |
27+
| **Snippet** | A saved excerpt from a Message ||
28+
29+
## Message Status
30+
31+
| Term | Definition | Aliases to avoid |
32+
| ----------- | -------------------------------------------------------------------- | ---------------- |
33+
| **Sent** | Message successfully delivered to server (status `0`) | Delivered |
34+
| **Temp** | Message created locally but not yet confirmed by server (status `1`) | Pending, sending |
35+
| **Error** | Message that failed to send (status `2`) | Failed |
36+
| **Pinned** | Message flagged as important and pinned to the Room by a user | Bookmarked |
37+
| **Starred** | Message bookmarked by the current user for personal reference | Saved |
38+
39+
## Users & Roles
40+
41+
| Term | Definition | Aliases to avoid |
42+
| --------------- | ---------------------------------------------------------------------------------- | ----------------------- |
43+
| **User** | An authenticated identity on the server with username, status, and roles | Account, profile |
44+
| **Logged User** | The currently authenticated User session, holding auth token and preferences | Current user, session |
45+
| **Role** | A named permission group assigned to Users (e.g., owner, moderator, leader, guest) | Permission group |
46+
| **Permission** | A named capability mapped to one or more Roles | Privilege, access right |
47+
| **Active User** | A User currently tracked as online/away/busy via real-time presence | Online user |
48+
| **Member** | A User viewed in the context of a specific Room's membership list | Participant |
49+
50+
## User Status
51+
52+
| Term | Definition | Aliases to avoid |
53+
| ----------- | -------------------------------- | ---------------- |
54+
| **Online** | User is actively connected | Active |
55+
| **Away** | User idle past timeout threshold | Idle |
56+
| **Busy** | User has set do-not-disturb | DND |
57+
| **Offline** | User is not connected | Disconnected |
58+
59+
## Omnichannel / Livechat
60+
61+
| Term | Definition | Aliases to avoid |
62+
| ---------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------- |
63+
| **Omnichannel Room** | A customer-service Room (type `'l'`) connecting a Visitor to an Agent | Livechat room, support chat |
64+
| **Visitor** | An external customer who initiates an Omnichannel conversation, identified by a unique token | Client, customer, end-user |
65+
| **Agent** | A User designated to handle Omnichannel conversations, with `statusLivechat` (available/unavailable) | Support agent, operator, rep |
66+
| **Inquiry** | A queued Omnichannel request waiting to be picked up or routed to an Agent | Queue item, ticket |
67+
| **Department** | An organizational unit that groups Agents for Omnichannel routing | Team (ambiguous), group |
68+
| **Omnichannel Source** | How an Omnichannel conversation was initiated (widget, email, sms, app, api) | Channel origin |
69+
| **Served By** | The Agent currently assigned to handle an Omnichannel Room | Assigned agent, handler |
70+
| **On Hold** | An Omnichannel Room temporarily paused by the Agent | Paused, suspended |
71+
| **Transfer** | Moving an Omnichannel Room to a different Agent or Department | Forward, reassign, handoff |
72+
73+
## Encryption
74+
75+
| Term | Definition | Aliases to avoid |
76+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------- | ---------------- |
77+
| **E2E Encryption** | End-to-end encryption for Room content using AES-SHA2, with two protocol versions (`rc.v1.aes-sha2`, `rc.v2.aes-sha2`) | Encryption, E2EE |
78+
| **E2E Key** | A user's asymmetric key pair (public + private) for E2E Encryption | Crypto key |
79+
| **OTR** | Off-The-Record messaging — ephemeral encrypted conversation mode between two users ||
80+
81+
## Video & Voice
82+
83+
| Term | Definition | Aliases to avoid |
84+
| --------------------------- | --------------------------------------------------------------------------------------------------- | ---------------------- |
85+
| **Video Conference** | A video/voice call session with status lifecycle (calling, started, expired, ended, declined) | Video call, meeting |
86+
| **Direct Video Conference** | A 1-on-1 Video Conference ||
87+
| **Group Video Conference** | A multi-participant Video Conference with title and anonymous user support ||
88+
| **VOIP** | Voice-over-IP phone-style call, separate from Video Conference — uses ICE servers and media streams | Phone call, voice call |
89+
90+
## Server & Connection
91+
92+
| Term | Definition | Aliases to avoid |
93+
| ------------------ | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
94+
| **Server** | A Rocket.Chat server instance the app connects to, with version, settings, and enterprise modules | Workspace (used by web but not consistently in mobile), instance |
95+
| **Server History** | List of previously connected Servers for quick reconnection | Recent servers |
96+
| **Meteor Connect** | The WebSocket connection to the Server's DDP (Distributed Data Protocol) endpoint | Socket, connection |
97+
98+
## Navigation & Layout
99+
100+
| Term | Definition | Aliases to avoid |
101+
| -------------------- | ----------------------------------------------------------------------------------------- | ---------------------- |
102+
| **Outside Stack** | Navigation screens shown when unauthenticated (server selection, login, register) | Auth stack, login flow |
103+
| **Inside Stack** | Navigation screens shown when authenticated (rooms, settings, profile) | Main stack, app stack |
104+
| **Master-Detail** | Tablet layout with room list (master pane) and room content (detail pane) side by side | Split view, two-pane |
105+
| **Chats Stack** | The primary messaging navigation within Inside Stack (room list, room view, room actions) ||
106+
| **Drawer Navigator** | Side navigation containing tabs: Chats, Profile, Settings, Admin, Accessibility | Sidebar, menu |
107+
108+
## Unread & Notification Indicators
109+
110+
| Term | Definition | Aliases to avoid |
111+
| ------------------ | -------------------------------------------------------------------------------------------------------- | ----------------- |
112+
| **Unread** | Count of unread regular Messages in a Subscription | Badge count |
113+
| **User Mentions** | Count of Messages that `@mentioned` the current user in a Subscription | Personal mentions |
114+
| **Group Mentions** | Count of `@all` or `@here` mentions in a Subscription | Channel mentions |
115+
| **Tunread** | Array of Thread IDs with unread replies | Thread unread |
116+
| **Alert** | Boolean flag on a Subscription indicating it has unread mentions or special activity requiring attention | Notification flag |
117+
118+
## Relationships
119+
120+
- A **Room** can be of type **Channel**, **Group**, **Direct Message**, or **Omnichannel Room**
121+
- A **Subscription** belongs to exactly one **Room** and one **User**
122+
- A **Message** belongs to exactly one **Room** (via `rid`)
123+
- A **Thread** is spawned from exactly one **Message** and contains one or more **Thread Messages**
124+
- A **Discussion** creates a new **Room** linked to a parent **Room** (via `prid`)
125+
- A **Team** has exactly one main **Room** and can contain multiple **Channels**
126+
- An **Omnichannel Room** connects exactly one **Visitor** with zero or one **Agents** (via **Served By**)
127+
- An **Agent** belongs to one or more **Departments**
128+
- An **Inquiry** becomes an **Omnichannel Room** when picked up by an **Agent**
129+
130+
## Example dialogue
131+
132+
> **Dev:** "When a user opens the app, do they see their **Subscriptions** or their **Rooms**?"
133+
> **Domain expert:** "**Subscriptions**. The sidebar shows the user's Subscriptions — each one points to a Room, but carries user-specific state like **Unread** count and **Alert** flag. A Room exists independently; a Subscription is the user's window into it."
134+
> **Dev:** "So if someone starts a **Thread** in a **Channel**, does that create a new **Subscription**?"
135+
> **Domain expert:** "No. A **Thread** lives inside the parent Room's **Subscription**. Thread unreads are tracked via **Tunread** on the Subscription. A **Discussion**, on the other hand, creates an entirely new Room with its own Subscription."
136+
> **Dev:** "And for **Omnichannel** — when a **Visitor** sends a message from the widget, what happens?"
137+
> **Domain expert:** "An **Inquiry** is created and queued. Once an **Agent** picks it up or routing assigns it, the Inquiry becomes an **Omnichannel Room** with the Agent recorded in **Served By**. If the Agent needs to escalate, they do a **Transfer** to another Agent or **Department**."
138+
139+
## Flagged ambiguities
140+
141+
- **"Workspace"** is used by Rocket.Chat web to mean a server instance, but the mobile codebase uses **Server**. Use **Server** in mobile context to avoid confusion with the web admin concept.
142+
- **"Room type `'e2e'`"** and **"Room type `'thread'`"** appear in `SubscriptionType` enum but are marked with FIXME in code — these are not true room types but flags. Do not treat them as room types in new code.
143+
- **"Account"** is sometimes used loosely to mean either **User** (the identity) or **Server** (the connected instance). These are distinct: a **User** authenticates on a **Server**.
144+
- **"Channel"** in everyday speech can mean any Room, but in domain terms it strictly means a public Room (type `'c'`). A private Room is a **Group** (type `'p'`).
145+
- **"Forward"** in omnichannel context means **Transfer** (reassigning a room to another agent/department). The codebase uses both `forwardRoom` and "transfer" — prefer **Transfer** as the domain term.

0 commit comments

Comments
 (0)