Matrix is one of Oscar's chat platforms, beside Telegram and Discord; all three share the same commands, approvals and media handling (Chat gateways).
Run it
export MATRIX_HOMESERVER=https://matrix.example.org
export MATRIX_ACCESS_TOKEN=... # Oscar's own account
export MATRIX_ALLOWED_USERS=@you:example.org
oscar matrix serve # add MATRIX_E2EE=on for encrypted roomsThe homeserver and token can also live in $OSCAR_HOME/credentials.env (or
a matrix.env next to it, loaded by the service); the allowed users also in
config.toml as matrix_allowed_users. oscar matrix serve runs Matrix
alone; oscar gateway serve runs it together with Telegram and Discord when
their tokens are set, and oscar gateway install makes that a system service
(Chat gateways).
Oscar answers only allowed users, joins a room only when an allowed user invites it, answers several rooms at once but each room one message at a time (with a delivery ledger so a restart never answers twice). Strangers are told no in a two-person room and ignored in rooms the homeserver reports as bigger.
Group rooms
In a room with more than two members Oscar answers only when it is
addressed: its user id mentioned (a client's mention pill, m.mentions, a
link to it, or its id in the text), a reply to one of its messages, a
message that starts with its name (oscar: …), or a command. Private
chats never need a mention. The model sees who wrote each group message
([Yuri K|@yuri:example.org] …, from the room's member names) and the
room's name, and may stay silent there (see
Chat gateways). Edits (m.replace) are
never answered as new messages.
| Variable (config key) | Meaning |
|---|---|
MATRIX_REQUIRE_MENTION (matrix_require_mention) |
false: answer every message in group rooms (default true); !mention on|off|default changes one room |
MATRIX_FREE_RESPONSE_ROOMS (matrix_free_response_rooms) |
rooms where every message is answered without a mention |
MATRIX_ALLOWED_ROOMS (matrix_allowed_rooms) |
when set, the only group rooms answered in (private chats are not affected) |
MATRIX_IGNORE_USER_PATTERNS (matrix_ignore_user_patterns) |
senders never answered, as patterns with * and ? — bridge ghosts such as @telegram_*:example.org, @discord_*:example.org |
MATRIX_MAX_MEDIA_MB (matrix_max_media_mb) |
the largest file taken from a room (default 100) |
Room commands
Type !name (Matrix clients keep / for themselves): !new (fresh
conversation; the old one is kept), !status, !model [id] (this room),
!undo, !retry, !stop (stop what Oscar is doing), !approve,
!approve session, !deny, !usage, !whoami, !proposals (skills Oscar
proposed from your work), !accept <id>, !reject <id>, !rollback
(the files Oscar changed per turn; !rollback <n> puts a turn's files back,
asking in the room first), !verbose, !mention, !sethome, !help (the
full list is in Chat gateways). Unknown
!words are ordinary chat. When a background review saves to memory or
proposes a skill, Oscar posts a short notice in the room. Admins also have
!pair, !voice, !platform, !restart and !update (see
Chat gateways).
Threads and shared rooms
A reply in a thread starts (or continues) a conversation of its own, and
Oscar answers in the thread (with a reply fallback for clients without
threads). A room counts as a group when more than two are in it: there each
person has a conversation of their own unless matrix_group_sessions = "shared" (see
rooms shared by several people).
A room's own settings go in [rooms."matrix:!abc123:example.org"]; a thread
uses its room's table. With matrix_pairing = "on", Oscar accepts an invite
to a private chat (an invite marked as direct) from someone not on the list
and gives them a pairing code there; other
invites from strangers stay ignored. MATRIX_ADMINS and MATRIX_APPROVERS
(matrix_admins, matrix_approvers) name the
admins and approvers.
With matrix_auto_thread = "on" (MATRIX_AUTO_THREAD; off by default) a
mention at the top level of a group room starts a thread on that message,
and the conversation continues there — the way Discord's auto_thread opens
one. Private chats, messages already in a thread, replies, commands and
free-response rooms stay where they are, and so do the rooms in
matrix_no_thread_rooms.
While Oscar works
When Oscar takes a message it marks it read, reacts with 👀 and shows
"Oscar is typing…" until the reply is out; then it adds ✅ (or ❌ when the
turn failed; nothing when you stopped it) and takes the 👀 back a few seconds
later. Reactions are sent unencrypted, even in encrypted rooms (as the usual
Matrix clients do: only the emoji is visible to the server, which sees what
they react to anyway), so a reaction taken back simply disappears instead of
leaving a "message deleted" line. MATRIX_REACTIONS=false
turns the reactions off, MATRIX_TYPING=false the typing. A message you
send while it works gets ⚡ (it redirected the turn), ⏳ (it waits) or ⏩ (it
joins the turn). Discord does the same; Telegram keeps reactions off by
default.
Approvals and activity
When a tool needs approval Oscar posts the exact command in a code block with
pre-seeded pills ✅ allow once, 🔁 allow for this session, ❌ deny (dangerous
commands get only ✅/❌). For a shell command 🔁 covers that exact command
only. With approve = "auto" (approval modes)
only dangerous commands are asked; the rest run and are written to the audit
log. A bare "yes" or "no" in the room answers the waiting approval too.
While working, an activity message lists each tool call with a short
preview (📖 read_file: "src/main.rs" ✓ 0.2s, a command in a code block)
and is edited in place; when Oscar writes something before its next call,
the next calls go into a new activity message under that text.
MATRIX_PROGRESS (off, new, all, verbose) or !verbose sets how
much it shows (tool activity). Replies use
Matrix formatting for Markdown.
When Oscar needs a decision it posts the question with numbered choices and
1️⃣ 2️⃣ … pills: tap one, or reply with a number or your own answer (!skip
skips). That reply answers the question rather than starting a new message.
Questions wait up to 10 minutes.
Pictures, voice and files
Send a picture and the model sees it (it is also saved under inbox/ in the
workspace); send a voice message and Oscar answers its transcript (with
speech-to-text set up). Spoken replies (text_to_speech) and files the model
sends with send_file arrive as m.audio, m.image, m.video or m.file,
encrypted in encrypted rooms (where the homeserver gets the ciphertext
without the file's name, which travels inside the encrypted event). Files (m.file) and videos (m.video) you
send are saved under inbox/ and the model is told where; a small text
file (up to 100 KiB) is also put into the message itself. See
Voice, pictures and files.
End-to-end encryption
- Keys live in
$OSCAR_HOME/matrix-crypto/— keep this folder; losing it means the device needs a new login (a new access token). - First start publishes device keys and a cross-signing identity.
- An account whose cross-signing identity another client made (you set up
secure backup in Element) keeps it: set
MATRIX_RECOVERY_KEY(the recovery key, or the passphrase it was made from; incredentials.env, neverconfig.toml) and on the next start Oscar opens the account's secret storage, imports the cross-signing keys and signs its own device with them, so clients that trust you trust Oscar's session. Without it the log says the identity is someone else's, and the session stays unsigned until you verify it from another client. The key is never stored or logged by Oscar. MATRIX_E2EE=onserves encrypted rooms; otherwise they are refused. Messages and files are never sent unencrypted into an encrypted room (reactions travel in the clear, as most Matrix clients send them).- Default trust: decrypt only from, and share keys only with, devices their
owner cross-signed.
MATRIX_E2EE_TRUST=anyrelaxes both. - "I couldn't decrypt your last message" notices name the reason: the key never arrived (resend; check the client shares keys with Oscar's session) or the sending session is not verified by its owner.