Two-way messaging session commands¶
After connecting WeCom, Feishu, or Slack, use !moi commands in the bot conversation to inspect the agent, manage sessions, or stop the current task. MOI processes each command and sends the result back to the messaging app.
How to send commands¶
Send a command as a separate text message without a task description or file. For example, send
!moi list sessions, not “please run !moi list sessions”.In a group or channel that requires a mention, use the platform’s mention control and place one bot mention before or after the command, for example
@bot !moi list sessions.Start with the ASCII exclamation mark
!. Command keywords are case-insensitive; enter session IDs and names as they are.In the table,
[name]is optional, while<session-id>and<new-name>are required. Do not type the brackets when sending a command.
A message that does not match the command format may be treated as ordinary conversation. Check the bot’s reply to confirm the result.
Command reference¶
Command |
Purpose |
|---|---|
|
Request to stop the task running in the current session. |
|
Show the connected agent’s name. |
|
Show the session ID currently selected for this messaging conversation. |
|
List session IDs for the agent and mark the current one with |
|
Create a session and immediately select it for this messaging conversation. The name is optional. |
|
Select a session by ID for this messaging conversation. |
|
Alternative spelling for |
|
Rename a session without changing the current selection. |
Check the agent and sessions¶
Send these commands separately to see the connected agent and current session:
!moi list agent
!moi list session
To find other sessions, send:
!moi list sessions
The following is an illustrative response; the IDs shown are examples:
Agent sessions:
- ctx_123 (current)
- ctx_456
The list contains session IDs, not names. The ID marked (current) is selected for this messaging conversation. MOI queries up to 100 active sessions for the connecting user, current workspace, and agent, and also places the current session first. Use the IDs returned by your bot.
Stop the current task¶
To stop the task running in the current session, send this command as a separate message without arguments:
!moi stop
The command targets the MOI session selected for the conversation or thread where you send it. If group or thread members share that session, stopping the task affects them as well. The command does not switch or delete the session, clear its history, or remove waiting messages; waiting messages may run after the current task stops.
Check the bot’s reply to determine the outcome:
Task stopped: The current task was canceled.
Stop request accepted; task still stopping: The request was submitted, but the task has not stopped yet. Check the session in MOI later.
Task still preparing: Send
!moi stopagain shortly.No running task or task already ended: The targeted task is no longer running. If a new task has since started, send the stop command again to stop it.
Stop failed: The task may still be running. Send
!moi stopagain and check the session in MOI.
If the command is treated as an ordinary message, ask your administrator whether the current MOI environment supports it.
Create a session¶
For example, send:
!moi new session Quarterly analysis
The bot returns the new session’s name and ID. Once created, the session is selected for this messaging conversation and subsequent messages continue there.
The name may contain spaces or be omitted. Without a name, the default is New session:
!moi new session
Switch to an existing session¶
Send
!moi list sessionsand copy the complete ID from the bot’s reply.Replace the example ID below with that value and send the command separately:
!moi switch session ctx_456
Check the bot’s confirmation. If needed, send
!moi list sessionto verify the selected ID.
!moi use session ctx_456 is equivalent. Use a session ID, not its list position or name. If the session does not exist or belongs to another agent, the current selection does not change; list the sessions and copy an ID again.
Rename a session¶
Get an ID using !moi list sessions, then replace the example ID and name below:
!moi rename session ctx_456 Quarterly analysis
The name may contain spaces. Renaming does not switch sessions. To enter the renamed session, send !moi switch session <session-id> separately. A missing session or one belonging to another agent does not change the current selection.
Which conversations are affected?¶
Direct messages, different groups, and supported message threads maintain separate current-session selections. Creating or switching a session changes the selection only for the messaging conversation or thread where the command was sent. Members of the same group or thread share its selection, so consider other participants before switching it.
You can also view the session in MOI. To continue existing work from another entry point, check the ID with !moi list session or !moi list sessions, then switch to the intended session.