2026-04-27 13:22:16 +02:00
# chat-cli
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
A terminal chat application built on top of libchat. End-to-end encrypted messaging in your terminal.
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
## Building
2026-04-17 14:43:04 +08:00
2026-08-04 19:05:19 +02:00
`chat-cli` links the native [logos-delivery ](https://github.com/logos-messaging/logos-delivery )
library. The dev shell builds it and sets `LOGOS_DELIVERY_LIB_DIR` for you:
```bash
nix develop
cargo build --release -p chat-cli
```
Or build the library yourself and point `LOGOS_DELIVERY_LIB_DIR` at it:
2026-04-17 14:43:04 +08:00
```bash
2026-04-27 13:22:16 +02:00
nix build .#logos-delivery
LOGOS_DELIVERY_LIB_DIR = ./result/lib cargo build --release -p chat-cli
2026-04-17 14:43:04 +08:00
```
2026-04-27 13:22:16 +02:00
The binary lands at `target/release/chat-cli` .
## Transports
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
Both transports are compiled into the binary and selected at runtime via `--transport` :
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
| Value (`--transport` ) | Description |
|-----------------------|-------------|
| `logos-delivery` (default) | Embedded Waku node on the logos.dev network |
| `file` | Shared directory; no network needed — great for local testing |
2026-04-27 13:22:16 +02:00
2026-05-12 15:33:50 +02:00
## Quick start
2026-04-27 13:22:16 +02:00
2026-05-12 15:33:50 +02:00
Run two instances in separate terminals:
2026-04-27 13:22:16 +02:00
```bash
# Terminal 1
2026-08-19 12:03:50 +02:00
cargo run -p chat-cli -- --name saro --port 60001
2026-04-27 13:22:16 +02:00
# Terminal 2
2026-08-19 12:03:50 +02:00
cargo run -p chat-cli -- --name raya --port 60002
2026-05-12 15:33:50 +02:00
```
For local-only testing without any network dependency, use the file transport:
```bash
# Terminal 1
2026-08-19 12:03:50 +02:00
cargo run -p chat-cli -- --name saro --transport file
2026-05-12 15:33:50 +02:00
# Terminal 2
2026-08-19 12:03:50 +02:00
cargo run -p chat-cli -- --name raya --transport file
2026-04-27 13:22:16 +02:00
```
2026-08-19 12:03:50 +02:00
### Starting a conversation
2026-04-27 13:22:16 +02:00
2026-08-19 12:03:50 +02:00
Every conversation is an MLS group. A **DM** is a 1:1; a **group** is a named
conversation. First share your address: type `/account` — it prints your address
and copies it to the clipboard.
**Direct message (1:1):**
1. Raya runs `/account` and shares her address.
2. Saro types `/dm <paste raya's address>` .
3. The chat opens on both sides; either can message.
**Group:**
2026-08-19 15:37:46 +02:00
1. Saro types `/new weekend` to create a group named "weekend". A name is
required; addresses can follow (e.g. Pax's) to invite people at creation.
2. Saro types `/add <raya's address>` to invite Raya; the invite stays pending
until the group commits it.
2026-08-19 16:06:06 +02:00
3. `/members` lists the roster — Raya shows `(pending)` until the commit lands,
then appears without it. Once committed, both can chat.
2026-04-27 13:22:16 +02:00
2026-06-04 10:09:29 +08:00
### Optional: KeyPackage registry
When `--registry-url <url>` is set, the client publishes its MLS KeyPackage
2026-06-11 21:07:11 +08:00
to the [keypackage-registry ](https://github.com/logos-messaging/chat-store )
service on startup so other clients can later fetch it by `account_id` . Without
the flag, an in-memory registry is used and is only visible inside the local
process.
2026-06-04 10:09:29 +08:00
```bash
2026-06-11 21:07:11 +08:00
# Terminal 1 — registry server (from a chat-store checkout)
cargo run -- --bind 127.0.0.1:18080
2026-06-04 10:09:29 +08:00
# Terminal 2 / 3 — chat clients pointing at it
2026-08-19 12:03:50 +02:00
cargo run -p chat-cli -- --name saro --transport file \
2026-06-04 10:09:29 +08:00
--registry-url http://127.0.0.1:18080
2026-08-19 12:03:50 +02:00
cargo run -p chat-cli -- --name raya --transport file \
2026-06-04 10:09:29 +08:00
--registry-url http://127.0.0.1:18080
```
The registry is a throwaway testnet helper; v0.3 replaces it with a
λLEZ-based discovery service.
2026-05-12 15:33:50 +02:00
## Options
2026-04-27 13:22:16 +02:00
| Flag | Default | Description |
|------|---------|-------------|
2026-05-12 15:33:50 +02:00
| `--transport <kind>` | `logos-delivery` | Transport to use (`logos-delivery` or `file` ) |
| `--data <dir>` | `tmp/chat-cli-data` | Data directory (UI state and default SQLite path) |
| `--db <path>` | `<data>/<name>.db` | SQLite file for persistent identity |
| `--preset <name>` | `logos.dev` | logos-delivery network preset |
2026-04-27 13:22:16 +02:00
| `--port <n>` | `60000` | TCP port for the embedded logos-delivery node |
2026-06-11 21:07:11 +08:00
| `--registry-url <url>` | *(unset)* | Use the HTTP-backed [keypackage-registry ](https://github.com/logos-messaging/chat-store ) at this URL instead of the in-memory registry |
2026-04-27 13:22:16 +02:00
| `--log-file <path>` | *(stderr, off)* | Write logs to a file instead of stderr |
## Commands
2026-04-17 14:43:04 +08:00
| Command | Description |
|---------|-------------|
| `/help` | Show available commands |
2026-08-18 07:08:45 +02:00
| `/account` | Show your account address (copies to clipboard) |
2026-08-19 12:03:50 +02:00
| `/dm <address>` | Start a direct (1:1) chat |
| `/new <name> [address...]` | Create a named group chat (optionally inviting members) |
2026-08-19 15:37:46 +02:00
| `/add <address>` | Add someone to the active group |
2026-08-19 16:06:06 +02:00
| `/members` | List members of the active conversation |
2026-04-27 13:22:16 +02:00
| `/chats` | List all established chats |
| `/switch <user>` | Switch active chat |
| `/delete <user>` | Delete a chat session |
| `/status` | Show identity and connection info |
2026-04-17 14:43:04 +08:00
| `/clear` | Clear current chat's message history |
2026-04-27 13:22:16 +02:00
| `/quit` · `Esc` · `Ctrl+C` | Exit |
2026-04-17 14:43:04 +08:00
2026-05-12 15:33:50 +02:00
## Storage
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
All data lives under `tmp/chat-cli-data/` by default (override with `--data` ):
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
| Path | Contents |
|------|----------|
| `<name>.db` | SQLite — identity keys, ratchet state, chat metadata (encrypted) |
| `<name>_state.json` | UI state — message history, active chat |
2026-05-12 15:33:50 +02:00
| `transport/<name>/` | Inbox directory watched for incoming messages (file transport only) |
2026-04-17 14:43:04 +08:00
2026-04-27 13:22:16 +02:00
The SQLite database can be inspected with *DB Browser for SQLite* : password `chat-cli` , cipher `SQLCipher 4 defaults` .
2026-04-17 14:43:04 +08:00
## Architecture
```
2026-04-27 13:22:16 +02:00
bin/chat-cli/
2026-04-17 14:43:04 +08:00
├── src/
2026-05-12 15:33:50 +02:00
│ ├── main.rs entry point, CLI arg parsing, runtime transport dispatch
2026-04-27 13:22:16 +02:00
│ ├── app.rs application state and command handling
│ ├── ui.rs ratatui terminal UI
│ ├── utils.rs shared helpers
│ ├── transport.rs module declarations
│ └── transport/
│ ├── file.rs file-based transport
│ └── logos_delivery.rs logos-delivery (Waku) transport + FFI
2026-05-12 15:33:50 +02:00
└── build.rs links liblogosdelivery (LOGOS_DELIVERY_LIB_DIR required)
2026-04-17 14:43:04 +08:00
```