How Matrix rooms, DMs, and threads map onto Apus sessions, and how much room history each turn carries.

Threads

Matrix supports native threads for both automatic replies and message-tool sends. Two independent knobs control behavior:

Session routing (sessionScope)

dm.sessionScope decides how Matrix DM rooms map to Apus sessions:

Explicit conversation bindings always win over sessionScope; bound rooms and threads keep their chosen target session.

Reply threading (threadReplies)

threadReplies decides where the bot posts its reply:

dm.threadReplies overrides this for DMs only - for example, keep room threads isolated while keeping DMs flat.

Selecting a reply target inside a thread preserves both the thread and the selected message. Ordinary threaded messages can carry reply metadata for older clients; Apus does not treat that compatibility fallback as a quoted message in the agent's context.

Mentions in bot-created threads

Set channels.matrix.requireMentionInBotThreads: false to accept unmentioned follow-ups in native Matrix threads rooted in an event sent by the receiving bot. Set it to true to require mentions in those threads even when the room uses requireMention: false or autoReply: true. Omitting it preserves the room's existing mention behavior.

The setting is also available under accounts.<id> and each groups or rooms entry. Room entries override the account value. As with other Matrix room settings, an exact room entry replaces the wildcard entry; omitted fields in an exact entry fall back to the account, not the wildcard.

Only a native m.thread relationship qualifies. An ordinary reply to a bot message does not. Apus resolves the thread root using the receiving account and caches its verified author. Matrix content redaction does not change that author, so a redacted bot-authored root still qualifies. If the root's identity cannot be read or verified, the existing mention behavior applies. Room access, sender restrictions, and allowBots: "mentions" still apply.

Thread inheritance and slash commands

When Apus detects a Matrix DM room colliding with another DM room on the same shared session, it posts a one-time m.notice suggesting dm.sessionScope: "per-room" to isolate the rooms. The notice only appears when thread bindings are enabled.

ACP conversation bindings

Matrix rooms, DMs, and existing Matrix threads can become durable ACP workspaces without changing the chat surface.

Fast operator flow:

--bind here does not create a child Matrix thread. threadBindings.spawnSessions gates /acp spawn --thread auto|here, where Apus needs to create or bind a child thread.

Thread binding config

Matrix inherits global defaults from session.threadBindings and supports per-channel overrides:

Matrix thread-bound session spawns default on. Set threadBindings.spawnSessions: false to block native subagent and ACP thread spawns from creating/binding Matrix threads. Set threadBindings.defaultSpawnContext: "isolated" when native subagent thread spawns should not fork the parent transcript.

History context