mindroom / references
llms.txt319 starsChanged 56 days agoApache-2.0View on GitHub
AI agents that know you and your work, in a chat app anyone can use. Open source, any model, self-host or hosted. AI agents that know you and your work, in a chat app anyone can use. MindRoom gives you a personal AI agent for everything from family trips to your homelab, and gives teams shared agents connected to their email, chat, calendar, documents, tickets, and code. They find what you need, write what you ask for, run recurring jobs…
- Reads credentials
- Installs packages
- Sends data out
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/mindroom-docs/references/llms.txtllms.txt
- address-pr-review-commentsSkill
- agent-cli-devSkill
- agent-cli-tmux-supervisionSkill
- code-debateSkill
- docs-reviewSkill
- duplication-auditSkill
- live-testSkill
- native-subagent-pr-loopSkill
- pr-reviewSkill
- mindroom-docsSkill
- open-knowledge-formatSkill
The file
Show its rules and text
We split this llms-full.txt into the rules it gives an agent
64 rules. About 0 are common, 29 are distinctive, and 35 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈29
Distinctive · estimate
This author's own choices. Worth a look.
35
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Keep your calendar, reminders, and to-do lists in order, by voice from your phone.
- Distinctive: line 30
Keep notes, a journal, and memories you can still find months later.
- Distinctive: line 32
Follow the topics you care about, with a digest that only arrives when there is something new.
- Distinctive: line 33
Look after your homelab and smart home: check services, read logs, change configs, and control devices through Home Assistant, with …
- Distinctive: line 40
Write status updates from what actually happened in chat and the tracker, not from what people remembered to report.
- Very specific: line 98
Extensible: add your own tools, skills, and event hooks as plugins, which reload while MindRoom keeps running (Plugins, Hooks).
- Very specific: line 133
Every video on this page is a recording of MindRoom Chat talking to a MindRoom backend.
- Very specific: line 441
When no config exists and MindRoom runs in a terminal, it asks a few setup questions:
- Very specific: line 455
After approval, MindRoom prints the approving account and asks Is this your account?
- Very specific: line 461
After pairing, first-run setup asks whether to run MindRoom in the background and start it at login, as a systemd user service on Linux or …
- Very specific: line 463
Check it with mindroom service status, and run mindroom service restart after editing ~/.mindroom/.env.
- Very specific: line 494
Use config init to review the files before starting, to choose a preset without prompts, or to use a self-hosted homeserver:
- Very specific: line 509
Use this when you want everything local: the MindRoom dashboard, a Matrix homeserver, and the MindRoom Chat client in one stack.
- Very specific: line 532
Use this when you want to give a MindRoom agent full freedom over its own virtual machine while you, from the host, control precisely what …
- Very specific: line 550
Use this if you already have a Matrix homeserver and want to run MindRoom directly.
- Very specific: line 618
Put credentials in a .env next to config.yaml:
- Distinctive: line 649
If registration fails, check the selected credentials and the homeserver's registration policy.
- Very specific: line 683
Local agents: run MindRoom on this Mac and connect to your Matrix chat account.
- Distinctive: line 686
Use either role, or both; starting one does not start the other.
- Distinctive: line 709
Use Open in Browser to use your browser session or a sign-in provider that requires a browser.
- Very specific: line 718
When the installed runtime is a different release, for example after an app update, it shows Update needed and Update MindRoom.
- Distinctive: line 724
Check that the code above Chat matches the page and that the signed-in account is yours, then click Approve.
- Very specific: line 727
Use Open Config Folder to add AI provider credentials to the adjacent .env or configure a local model in config.yaml.
- Distinctive: line 729
Files found: only means configuration exists.
- Distinctive: line 735
If the service starts before your account is connected, the section shows Waiting for your chat account until you choose Connect Account …
- Distinctive: line 744
No separate inference application or model-provider API key is required.
- Very specific: line 764
After five idle minutes, model memory is released.
- Distinctive: line 769
Use Stop Inference to stop local inference and Start Inference to start it again.
- Distinctive: line 783
Run the Matrix server separately from this app.
- Very specific: line 791
After changing MINDROOM_URL or MINDROOM_API_KEY, select Reload in Dashboard.
- Distinctive: line 802
Check the homeserver, Matrix account, controller fingerprint, requester, and agent before signing in, because the setup data chooses which …
- Distinctive: line 806
If the app closes before this step, request fresh setup data and repeat Connect.
- Distinctive: line 811
If you saved applications, allow Accessibility and Screen Recording in Permissions with Request or Open Settings, restart the app if macOS …
- Distinctive: line 815
Start needs at least one saved application, folder, or shell choice.
- Very specific: line 847
Stop the bridge in the interface that started it before starting it in the other.
- Distinctive: line 853
If you replaced the signed release with a local build, reinstall the signed release or remove the old permission entry and approve the …
- Distinctive: line 890
If the dashboard does not open, start the service and check its logs for missing provider credentials or startup errors.
- Very specific: line 898
Use brew uninstall --zap --cask mindroom to also remove app preferences and logs.
- Very specific: line 929
Standalone: run mindroom run and open http://localhost:8765.
- Very specific: line 930
When running from a source checkout, MindRoom builds the dashboard assets on first start if Bun is available.
- Very specific: line 931
When MINDROOM_API_KEY is set, the dashboard first asks for that key, and the login page shows which .env file holds it.
- Distinctive: line 938
When the router, an agent, or a team uses a model whose provider has no API key, every dashboard page shows a Connect your AI provider …
- Distinctive: line 943
If you connect Anthropic or OpenAI while your models still use OpenRouter, the dialog lists the affected models so you can switch them on …
- Very specific: line 944
When an agent cannot reply because no provider key is set, it answers in chat with a pointer to this setup step, including the dashboard …
- Very specific: line 961
More settings: - every other agent field, such as participation, mid_turn, accept_invites, access, memory_search, thread_exports, and …
- Very specific: line 991
Add and edit models with provider, model ID, host URL, and advanced settings, and set provider API keys.
- Very specific: line 1008
Create, edit, and delete knowledge bases, including description, mode (semantic search or files-only), path, watch, and Git repository, …
- Distinctive: line 1034
Search tools, filter by category or status (Available, Unconfigured, Configured), and choose Shared deployment credentials or an agent with …
- Distinctive: line 1064
If another dashboard tab or a server-side edit changed the configuration, saving shows
- Very specific: line 1069
If config.yaml fails validation when the dashboard loads, it opens a raw YAML recovery editor so you can fix and save the whole file.
- Distinctive: line 1073
When the configuration uses include tags, the dashboard shows a banner and structured saves fail, so edit the included source files …
- Very specific: line 1076
If the source files cannot be read well enough to tell whether they use !include, structured saves return HTTP 422.
- Very specific: line 1120
Add agent_name to target an agent's credentials in its saved worker scope.
- Very specific: line 1220
Add an agent to config.yaml, starting from this example:
- Very specific: line 1279
If you switch the agent to mem0 and still want MEMORY.md preloaded, add it to context_files.
- Distinctive: line 1280
Use knowledge bases only for non-memory documents that should be searchable as external knowledge.
- Very specific: line 1295
If MEMORY.md or another workspace file is sensitive, keep the agent in private rooms only, or split it into a private and a public agent …
- Very specific: line 1317
If MINDROOM_CONFIG_PATH is set, MindRoom uses that path, even when no file exists there.
- Very specific: line 1337
All top-level sections are optional.
- Very specific: line 1356
Keep models.default configured, because room topic generation and automatic thread summaries fall back to it even when agents, teams, and …
- Distinctive: line 1447
After a failed reload, fixing any file the failed attempt read triggers a retry.
- Distinctive: line 1449
When migrating an existing monolith, diff the fully merged config before and after the split:
- Distinctive: line 1458
When the configuration uses include tags, structured saves from the dashboard and the self-config tools are rejected, so edit the source …
- Very specific: line 1463
Use the optional root prompts block to replace MindRoom's built-in prompts, keyed by the prompt's uppercase name:
≈ “Common” is an estimate: at least 1 in 5 of the 1,484 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
# MindRoom
> AI agents that know you and your work, in a chat app anyone can use. Open source, any model, self-host or hosted.
# MindRoom Docs
# MindRoom
**AI agents that know you and your work, in a chat app anyone can use.**
MindRoom gives you a personal AI agent for everything from family trips to your homelab, and gives teams shared agents connected to their email, chat, calendar, documents, tickets, and code.
They find what you need, write what you ask for, run recurring jobs on their own, and learn from every conversation, so they get better the more they are used.
It is open source, and you choose each agent's model: a local one that keeps your private life at home, or a frontier one for hard problems.
You can run all of it yourself: the chat app, the server, and the AI backend.
<video controls playsinline preload="metadata" aria-label="Tour of MindRoom: approvals, a team thread, code, documents, and the browser" style="width: 100%" poster="https://github.com/user-attachments/assets/6f59f173-dab8-4af7-8c0a-55747a9d8d5b" data-poster-light="https://github.com/user-attachments/assets/6f59f173-dab8-4af7-8c0a-55747a9d8d5b" data-poster-dark="https://github.com/user-attachments/assets/e126d12b-5609-4c97-b69f-e2f9289a0008">
<source src="https://github.com/user-attachments/assets/6ec88440-9b9a-4319-b4e9-88d452819bb6" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/af51cf1e-840a-415e-ae97-df453d2afdda" type="video/mp4">
</video>
**[Get started](https://docs.mindroom.chat/getting-started/)** · **[See it in action](https://docs.mindroom.chat/showcase/)** · **[Try hosted MindRoom](https://mindroom.chat/#hosted)** · **[Coming from OpenClaw?](https://docs.mindroom.chat/openclaw/)**
## What People Use It For
=== "Personal"
- Plan a family trip: flights, places to stay, a day-by-day itinerary, and a packing list.
- Keep your calendar, reminders, and to-do lists in order, by voice from your phone.
- Sort your personal email and draft replies, approving each one before it goes out.
- Keep notes, a journal, and memories you can still find months later.
- Track your budget, workouts, or anything else in files the agent keeps up to date.
- Follow the topics you care about, with a digest that only arrives when there is something new.
- Look after your homelab and smart home: check services, read logs, change configs, and control devices through Home Assistant, with approval for the actions you choose.
- Build quick tools and scripts in the agent's own workspace.
=== "Work"
- Find anything across email, chat, documents, tickets, and code, and see where each answer came from.
- Get a morning briefing, or a summary of your week before every one-on-one.
- Write status updates from what actually happened in chat and the tracker, not from what people remembered to report.
- Turn a question into a report or an interactive presentation built from your own documents.
- Triage the inbox, prepare for meetings, and draft emails, then approve each one before it is sent.
- Investigate a technical question across specifications, code, and records, with every claim traced to its source.
- Join a new team and ask its agent how the work fits together and whom to ask.
## Why MindRoom
### Agents that know you and your work
Agents connect to 100+ tools, including Gmail, Google Drive, Slack, Jira, Confluence, GitHub, and any MCP server ([Tools](https://docs.mindroom.chat/tools/), [MCP Servers](https://docs.mindroom.chat/mcp/)), and search knowledge bases built from your folders and Git repositories ([Knowledge Bases](https://docs.mindroom.chat/knowledge/)).
Each person can get a private room with their own agent ([Personal Rooms](https://docs.mindroom.chat/personal-rooms/)), each team can share agents that answer only its members ([Access Control](https://docs.mindroom.chat/authorization/)), and agents can work as a team or hand tasks to each other ([Teams](https://docs.mindroom.chat/configuration/teams/), [Agent Orchestration](https://docs.mindroom.chat/tools/agent-orchestration/)).
### Private where it matters
You choose the model for each agent.
A private agent can run on a local model through Ollama or llama.cpp, so you can share your most personal data with it, while an agent that writes code uses a frontier model from Anthropic, OpenAI, or Google ([Models](https://docs.mindroom.chat/configuration/models/)).
Pair a local model with local memory and your own server, and nothing that agent sees leaves your home ([Memory](https://docs.mindroom.chat/memory/), [Deployment](https://docs.mindroom.chat/deployment/)).
Each agent keeps its own memory, tools, and access, so what you tell a private agent stays out of shared ones, and rooms can be end-to-end encrypted ([End-to-End Encryption](https://docs.mindroom.chat/matrix/#end-to-end-encryption)).
### They remember, and keep improving
Agents keep what is worth remembering from every conversation without being asked, and look it up again when it becomes relevant ([Memory](https://docs.mindroom.chat/memory/)).
A shared agent gets better as more people use it: what it learns while helping one person helps the next.
With skill learning on, an agent also turns work it repeats into reusable skills, following the self-improvement loop of Hermes Agent ([Automatic Skill Learning](https://docs.mindroom.chat/skills/#automatic-skill-learning)).
You can teach it directly too: tell it a preference or a correction, and it is remembered.
### They work while you don't
Schedule recurring jobs in plain language, such as a daily briefing or a weekly report, including silent checks that post only when something changed ([Scheduling](https://docs.mindroom.chat/scheduling/)).
Send a voice message from your phone ([Voice Messages](https://docs.mindroom.chat/voice/)), or call an agent and talk while it hands longer tasks to background agents ([Voice Calls](https://docs.mindroom.chat/voice-calls/)).
### Safe to give real access
- Sending or changing something can wait for your one-tap approval, which shows exactly what will be sent and to whom ([Tool Approval](https://docs.mindroom.chat/tool-approval/)).
- Code can run in isolated workers ([Workers & Sandboxing](https://docs.mindroom.chat/deployment/sandbox-proxy/)), and agents can be kept off the open internet except for sites a person approves ([Approved Egress](https://docs.mindroom.chat/deployment/approved-egress/)).
- Each agent answers only the people and rooms you allow ([Access Control](https://docs.mindroom.chat/authorization/)).
- It all runs on [Matrix](https://docs.mindroom.chat/matrix/), an open messaging standard, with optional end-to-end encryption, that governments chose for their own secure messaging: France's Tchap, the German armed forces' BwMessenger, Germany's national healthcare messenger TI-Messenger, and a messenger NATO is testing all run on it.
The [Security Model](https://docs.mindroom.chat/architecture/security-posture/) documents exactly which boundary protects what.
### A chat app built for agents
MindRoom builds its own client, MindRoom Chat, on the [web](https://chat.mindroom.chat), on [iPhone and iPad](https://docs.mindroom.chat/ios/), on the [Mac](https://docs.mindroom.chat/installation/macos-app/), and in beta on Android, along with the server and the AI backend.
So agents are not limited to what Slack or WhatsApp can display:
- Replies stream in with every tool call shown, and you can stop them at any time ([Streaming Responses](https://docs.mindroom.chat/streaming/)).
- Approval cards and clickable questions sit right in the conversation ([Interactive Questions](https://docs.mindroom.chat/interactive/)).
- An agent can work in its own browser that you watch live and take over, for example to log in ([Worker Computer](https://docs.mindroom.chat/tools/worker-computer/#watch-take-control-and-resume)).
- An agent running on a server across the world can still use your laptop, or any computer you pair: the apps and folders you allow and the shell commands you approve, over end-to-end encrypted Matrix with no open ports ([Desktop Bridge](https://docs.mindroom.chat/tools/desktop/)).
- An agent can open an interactive page next to the conversation, such as a dashboard, a presentation, or a form you answer in place ([Interactive Canvases](https://docs.mindroom.chat/canvases/)).
- You can switch the model for a thread or a room from the chat ([Model Overrides in Chat](https://docs.mindroom.chat/configuration/models/#model-overrides-in-chat)).
### Yours to own
- **Open source:** MindRoom is Apache 2.0 licensed, so you can run the whole stack on your own hardware, or use the [hosted Matrix server](https://docs.mindroom.chat/deployment/hosted-matrix/) and run only the backend yourself.
- **Any model:** pick a model per agent, room, or thread, and switch the day a better one comes out ([Models](https://docs.mindroom.chat/configuration/models/)).
- **Federated like email:** separate MindRoom deployments, such as groups with different data rules, can still share rooms where that is allowed.
- **Extensible:** add your own tools, skills, and event hooks as plugins, which reload while MindRoom keeps running ([Plugins](https://docs.mindroom.chat/plugins/), [Hooks](https://docs.mindroom.chat/hooks/)).
### Works where you already are
Matrix bridges bring the same agents, with the same memory, to Slack, Telegram, WhatsApp, Discord, and email ([Bridges](https://docs.mindroom.chat/deployment/bridges/)).
Agents also answer any OpenAI-compatible client ([OpenAI-Compatible API](https://docs.mindroom.chat/openai-api/)), and tools like Claude Code and Codex can use them through the [MCP Gateway](https://docs.mindroom.chat/deployment/mcp-gateway/).
## How MindRoom Compares
AI apps such as ChatGPT, Claude, and Gemini can connect to your email, calendar, and documents, but each one ties those connections to one company.
Connect your inbox to ChatGPT, and OpenAI's servers process it for OpenAI's models only; using Claude or Gemini as well means connecting everything again, handing your data to another company, and teaching it about you from scratch.
In MindRoom you connect once: your accounts, memory, and documents live in MindRoom, which can run on your own machine, and every agent uses them with the model that fits.
A cloud model sees only what its agent sends it, and an agent on a local model, with local memory and your own server, keeps everything at home.
Agents such as OpenClaw and Hermes Agent plug into existing messaging apps through one adapter per app.
That lets them reach many apps, but each app decides what the agent can show.
MindRoom takes the opposite approach.
| | Agents inside other messaging apps | MindRoom |
|---|---|---|
| Who they serve | Usually one person's assistant | Personal agents for everyone and shared agents for teams, in rooms where people and agents work together, with access control |
| What agents can show | Whatever each app allows, mostly text and simple buttons | Its own client: approval cards, live tool traces, voice calls, a browser you can take over, and interactive pages |
| How they connect | One adapter per messaging app | One open, encrypted protocol, plus bridges for reach |
| Where messages go | Through each messaging platform | On servers you can run yourself, where rooms can be end-to-end encrypted |
Coming from OpenClaw? MindRoom reads OpenClaw workspace files and skills; see [Import from OpenClaw](https://docs.mindroom.chat/openclaw/).
## Get Started
1. [Install & First Run](https://docs.mindroom.chat/getting-started/): run `uvx mindroom run` and pair it with your MindRoom Chat account.
2. [Configuration](https://docs.mindroom.chat/configuration/): define agents, models, and teams in `config.yaml` or the [Dashboard](https://docs.mindroom.chat/dashboard/); most changes apply without a restart.
3. [Deployment](https://docs.mindroom.chat/deployment/): run MindRoom with Docker or Kubernetes when you are ready to share it.
# Showcase
Every video on this page is a recording of MindRoom Chat talking to a MindRoom backend.
The model responses and external services are scripted so each recording is repeatable; the rooms, threads, approvals, streaming, and tool traces are MindRoom's own.
Each video comes in a light and a dark recording to match your color scheme.
## Films
=== "Film · 50 s"
Approvals, a team thread, code, documents, and the browser at work, then lights, trips, and dinners at home.
<video class="only-light" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/88accc8b-6666-494b-a415-6f7effaaf751" aria-label="MindRoom at work and at home" style="width: 100%">
<source src="https://github.com/user-attachments/assets/f35866c4-c226-408a-9f1f-b7588f76c564" type="video/mp4">
</video>
<video class="only-dark" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/7c8011bd-22b7-4795-8d4d-ab2864c7b118" aria-label="MindRoom at work and at home" style="width: 100%">
<source src="https://github.com/user-attachments/assets/f99556da-f289-49fe-a365-7c2a8bb93c77" type="video/mp4">
</video>
=== "Short · 29 s"
The same story with two moments at work and two at home, as in the README.
<video class="only-light" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/a424646b-c904-482e-8328-ce158b581500" aria-label="The short version" style="width: 100%">
<source src="https://github.com/user-attachments/assets/8333a521-c8b1-4e71-834d-81f3010870ae" type="video/mp4">
</video>
<video class="only-dark" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/6fcfba4c-ca70-45dc-a35a-bc21311d43cf" aria-label="The short version" style="width: 100%">
<source src="https://github.com/user-attachments/assets/28c957e3-d445-4341-b7d0-e3e689212209" type="video/mp4">
</video>
=== "Work tour · 82 s"
Thirteen moments at work, one after another, in an earlier full-screen style.
<video class="only-light" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/6f59f173-dab8-4af7-8c0a-55747a9d8d5b" aria-label="Narrated tour" style="width: 100%">
<source src="https://github.com/user-attachments/assets/af51cf1e-840a-415e-ae97-df453d2afdda" type="video/mp4">
</video>
<video class="only-dark" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/e126d12b-5609-4c97-b69f-e2f9289a0008" aria-label="Narrated tour" style="width: 100%">
<source src="https://github.com/user-attachments/assets/6ec88440-9b9a-4319-b4e9-88d452819bb6" type="video/mp4">
</video>
## Canvases
Agents can show a page they made beside the conversation and act on what you pick in it.
See [Interactive Canvases](https://docs.mindroom.chat/canvases/).
=== "Overview · 27 s"
A narrated film of all four: a scheduling grid, a data fit, a slide deck, and a trip planner.
<video class="only-light" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/77e36a87-9fec-41f9-b626-73b950003845" aria-label="Canvas film: four agent canvases beside the conversation" style="width: 100%">
<source src="https://github.com/user-attachments/assets/381f7395-4f1b-4167-8749-7f85080da8ce" type="video/mp4">
</video>
<video class="only-dark" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/d2b7a4a6-0723-4d22-af2a-6b2ee7213602" aria-label="Canvas film: four agent canvases beside the conversation" style="width: 100%">
<source src="https://github.com/user-attachments/assets/1a820f71-dd19-415f-9301-611310c3d510" type="video/mp4">
</video>
=== "Scheduling"
A week grid of four people's availability; the pick goes back with **Send**, and the agent books the meeting after approval.
<video controls playsinline preload="metadata" aria-label="An agent shows a week grid; the user picks a slot and sends it, and the agent books it" style="width: 100%" poster="https://github.com/user-attachments/assets/c44fdc29-a35d-45ed-9b67-8a8f2d046bef" data-poster-light="https://github.com/user-attachments/assets/c44fdc29-a35d-45ed-9b67-8a8f2d046bef" data-poster-dark="https://github.com/user-attachments/assets/df646508-7bd3-494f-b560-c49bd5ec0982">
<source src="https://github.com/user-attachments/assets/e6698792-c676-4a4f-9824-ae04c1e970da" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/89fb462e-4895-43a0-9cf6-44f91fd7084d" type="video/mp4">
</video>
=== "Data"
An interactive fit drawn in inline SVG with the theme variables; leaving out an outlier refits the curve live.
<video controls playsinline preload="metadata" aria-label="An agent shows a data fit; the user leaves out an outlier and sends back the fit" style="width: 100%" poster="https://github.com/user-attachments/assets/d6a4d93a-2ce0-466a-bca6-8b7b2f84cad3" data-poster-light="https://github.com/user-attachments/assets/d6a4d93a-2ce0-466a-bca6-8b7b2f84cad3" data-poster-dark="https://github.com/user-attachments/assets/f283e9b8-4b9a-40be-a8e9-da758ad163a1">
<source src="https://github.com/user-attachments/assets/39a4fa17-51f4-46df-821d-7391c2418071" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/62d2d1d3-5754-4d6a-a5a4-d70b0a354d43" type="video/mp4">
</video>
=== "Slides"
A deck the agent writes to a workspace file and shows by `path`; after a change request it rewrites the file and the open deck updates in place.
<video controls playsinline preload="metadata" aria-label="An agent shows a slide deck from its workspace and updates it in place after a change request" style="width: 100%" poster="https://github.com/user-attachments/assets/a397afe2-943b-436c-813d-c5a7e03d81cf" data-poster-light="https://github.com/user-attachments/assets/a397afe2-943b-436c-813d-c5a7e03d81cf" data-poster-dark="https://github.com/user-attachments/assets/1517814d-cb7f-47f1-be9f-d2fc52ceffa8">
<source src="https://github.com/user-attachments/assets/fa8b1989-9b8c-4dad-b55d-18dd0412013a" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/e215f9e4-ffdb-4e64-9782-e787d3dd464b" type="video/mp4">
</video>
=== "Trip planner"
One canvas, two steps: pick a stay, then plan the days against a live budget, updated in place with `canvas_event_id`.
<video controls playsinline preload="metadata" aria-label="One canvas, two steps: pick a stay, then plan the days against a live budget" style="width: 100%" poster="https://github.com/user-attachments/assets/57143ac5-9fb7-400d-8ad4-ccf036f16b5e" data-poster-light="https://github.com/user-attachments/assets/57143ac5-9fb7-400d-8ad4-ccf036f16b5e" data-poster-dark="https://github.com/user-attachments/assets/01cf9610-83fc-4752-ac72-64750807af71">
<source src="https://github.com/user-attachments/assets/dd5ab134-eeba-4cd5-93e3-4dd6e8d0a9cd" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/3e772d7a-1acc-44bf-8e6e-f7e3032ee374" type="video/mp4">
</video>
## At work
### Ask, approve, done
An agent finds two requests in the inbox, picks a free slot, and pauses for approval before it books the meeting.
See [Tool Approval](https://docs.mindroom.chat/tool-approval/#tool-approval).
<video controls playsinline preload="metadata" aria-label="Ask, approve, done" style="width: 100%" poster="https://github.com/user-attachments/assets/444fee69-b77f-4c48-b7d1-b92043159bb3" data-poster-light="https://github.com/user-attachments/assets/444fee69-b77f-4c48-b7d1-b92043159bb3" data-poster-dark="https://github.com/user-attachments/assets/94181525-4b2b-43b4-b366-d85aa18f59b8">
<source src="https://github.com/user-attachments/assets/f3792ec9-ea73-4169-97ee-d09146cd65cc" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/cf813bb1-5f9d-43b2-a197-b4749696a86e" type="video/mp4">
</video>
### One thread, the whole team
Three colleagues work with one agent in a shared thread, and everyone sees each answer stream in live.
See [Streaming Responses](https://docs.mindroom.chat/streaming/).
<video controls playsinline preload="metadata" aria-label="One thread, the whole team" style="width: 100%" poster="https://github.com/user-attachments/assets/fa232e8f-a26b-425f-b667-433fb12da6ec" data-poster-light="https://github.com/user-attachments/assets/fa232e8f-a26b-425f-b667-433fb12da6ec" data-poster-dark="https://github.com/user-attachments/assets/54a96fc9-91dc-48a7-985c-7d4e41ad9be8">
<source src="https://github.com/user-attachments/assets/571db927-105b-4907-9c83-ed4f9ef1fc4a" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/c913ed8a-4afb-43be-8d90-cdd2aa4158a9" type="video/mp4">
</video>
### Bring the team in
New colleagues are invited to a room, and the agent tells them what is left before the deadline.
See [Authorization](https://docs.mindroom.chat/authorization/).
<video controls playsinline preload="metadata" aria-label="Bring the team in" style="width: 100%" poster="https://github.com/user-attachments/assets/83b9f414-40f7-4fe5-8f1d-62304b641b87" data-poster-light="https://github.com/user-attachments/assets/83b9f414-40f7-4fe5-8f1d-62304b641b87" data-poster-dark="https://github.com/user-attachments/assets/d4b50091-0d28-4185-8ecb-3f2615542e74">
<source src="https://github.com/user-attachments/assets/83081f1a-9caf-476a-b147-3c5f93762471" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/5eb23908-4555-42ca-8b38-a2636097339b" type="video/mp4">
</video>
### Tag two agents, get a team
Mentioning two agents in one message forms a team that researches and answers together.
See [Team Configuration](https://docs.mindroom.chat/configuration/teams/).
<video controls playsinline preload="metadata" aria-label="Tag two agents, get a team" style="width: 100%" poster="https://github.com/user-attachments/assets/dfdbd003-6c31-49e0-8183-445ff0a8a271" data-poster-light="https://github.com/user-attachments/assets/dfdbd003-6c31-49e0-8183-445ff0a8a271" data-poster-dark="https://github.com/user-attachments/assets/41849fb8-3dd1-4b9c-8eff-33bb10803f48">
<source src="https://github.com/user-attachments/assets/cb657cd9-3114-442f-a4fa-d8e6a96b6425" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/9ee83e64-1425-4165-b1f5-5d4aa978b46e" type="video/mp4">
</video>
### From alert to all-clear
One agent traces failing signups to a deploy, rolls it back with approval, and hands the customer update to another agent.
See [Agent conversations](https://docs.mindroom.chat/tools/matrix-message/#agent-conversations).
<video controls playsinline preload="metadata" aria-label="From alert to all-clear" style="width: 100%" poster="https://github.com/user-attachments/assets/a5eb5a08-bd1e-4533-a8ec-71bd462d072c" data-poster-light="https://github.com/user-attachments/assets/a5eb5a08-bd1e-4533-a8ec-71bd462d072c" data-poster-dark="https://github.com/user-attachments/assets/dcd0bb4a-c51b-420f-8e32-f8ce140b1037">
<source src="https://github.com/user-attachments/assets/2dce4510-bb8a-440b-9bb3-0bcb0d324955" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/c4093417-247c-4961-b6bc-85f73f2e9b55" type="video/mp4">
</video>
### Connect once, then just ask
A user connects an account from the conversation, and the agent answers from it.
See [OAuth Integration Framework](https://docs.mindroom.chat/oauth-framework/).
<video controls playsinline preload="metadata" aria-label="Connect once, then just ask" style="width: 100%" poster="https://github.com/user-attachments/assets/03c90592-472a-42ea-8e57-d802e9129b6f" data-poster-light="https://github.com/user-attachments/assets/03c90592-472a-42ea-8e57-d802e9129b6f" data-poster-dark="https://github.com/user-attachments/assets/9849b052-508e-409a-867c-cf155a640d31">
<source src="https://github.com/user-attachments/assets/c3a4166f-79a4-4ccb-a176-3a7c9922b828" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/62767b38-9729-4277-b615-e2b7b6863234" type="video/mp4">
</video>
### What the policy actually says
The agent answers a travel question from Confluence and Drive, with its sources.
See [Atlassian Cloud](https://docs.mindroom.chat/tools/atlassian/).
<video controls playsinline preload="metadata" aria-label="What the policy actually says" style="width: 100%" poster="https://github.com/user-attachments/assets/01040947-ffd8-4649-a7bd-baf96130d1a7" data-poster-light="https://github.com/user-attachments/assets/01040947-ffd8-4649-a7bd-baf96130d1a7" data-poster-dark="https://github.com/user-attachments/assets/95022cb5-336c-4abc-93e3-430d7dd8eb07">
<source src="https://github.com/user-attachments/assets/e0f957e4-d610-4408-b30b-87b9e553ee53" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/a5a4917a-a373-499e-95d2-e8c30f354368" type="video/mp4">
</video>
### Answers you can trust
The agent compares two Drive documents and flags a stale number before a drawing goes out.
See [Google Drive](https://docs.mindroom.chat/tools/data-and-databases/#google_drive).
<video controls playsinline preload="metadata" aria-label="Answers you can trust" style="width: 100%" poster="https://github.com/user-attachments/assets/21a9b571-0a54-47e6-8050-391ec757ba55" data-poster-light="https://github.com/user-attachments/assets/21a9b571-0a54-47e6-8050-391ec757ba55" data-poster-dark="https://github.com/user-attachments/assets/ce6ffe08-b3c1-4bdd-9d75-8e3abbea1e65">
<source src="https://github.com/user-attachments/assets/ffba1923-b463-4674-88af-5a862de1613f" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/690273d3-7fee-4e49-a1b5-75e39be00d8b" type="video/mp4">
</video>
### Two policies, one draft
The agent merges two travel policies into one draft and asks a multiple-choice question where they disagree.
See [Interactive Q&A](https://docs.mindroom.chat/interactive/).
<video controls playsinline preload="metadata" aria-label="Two policies, one draft" style="width: 100%" poster="https://github.com/user-attachments/assets/0a47822d-348e-4ca1-9ab6-a704861f1327" data-poster-light="https://github.com/user-attachments/assets/0a47822d-348e-4ca1-9ab6-a704861f1327" data-poster-dark="https://github.com/user-attachments/assets/ba161463-03d9-41f7-bd99-7369c5542619">
<source src="https://github.com/user-attachments/assets/f49c4ff4-b0fe-4f4f-a36b-b8a3481f8147" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/6f31e382-0a78-4415-a610-a207744d4b73" type="video/mp4">
</video>
### From numbers to a board deck
The agent gathers the quarter's numbers and the launch status and builds a five-slide board deck.
See [Execution & Coding](https://docs.mindroom.chat/tools/execution-and-coding/).
<video controls playsinline preload="metadata" aria-label="From numbers to a board deck" style="width: 100%" poster="https://github.com/user-attachments/assets/a53021c3-8b79-41be-95c7-f269b42f02b5" data-poster-light="https://github.com/user-attachments/assets/a53021c3-8b79-41be-95c7-f269b42f02b5" data-poster-dark="https://github.com/user-attachments/assets/0ba728cb-5a3c-4bfa-9d7d-5d3a71769638">
<source src="https://github.com/user-attachments/assets/5dfdf732-4386-4171-9d08-99a83d10a9c4" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/ba9046b5-d6a9-400a-b3c1-5629c32a22d6" type="video/mp4">
</video>
### Real analysis, real numbers
The agent writes and runs an analysis script on its own computer and posts the fitted result with a plot.
See [Execution & Coding](https://docs.mindroom.chat/tools/execution-and-coding/).
<video controls playsinline preload="metadata" aria-label="Real analysis, real numbers" style="width: 100%" poster="https://github.com/user-attachments/assets/64437d95-27eb-4ec7-916f-c09150c5fb95" data-poster-light="https://github.com/user-attachments/assets/64437d95-27eb-4ec7-916f-c09150c5fb95" data-poster-dark="https://github.com/user-attachments/assets/b9ccd95c-1899-4fa2-9beb-a03d22ec6c46">
<source src="https://github.com/user-attachments/assets/e1a47a55-05a6-4035-b50c-b631e867b8c8" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/a9d21f4f-d9c7-480f-b71b-8a7155903bfc" type="video/mp4">
</video>
### It drives, you take the wheel
The agent reorders supplies in its browser while the user watches, takes control, and hands it back.
See [Worker Computer](https://docs.mindroom.chat/tools/worker-computer/#watch-take-control-and-resume).
<video controls playsinline preload="metadata" aria-label="It drives, you take the wheel" style="width: 100%" poster="https://github.com/user-attachments/assets/cb907777-89c8-4e0e-9df5-04969e863ec5" data-poster-light="https://github.com/user-attachments/assets/cb907777-89c8-4e0e-9df5-04969e863ec5" data-poster-dark="https://github.com/user-attachments/assets/19244c17-be66-410f-b2cf-b8e3edb4b228">
<source src="https://github.com/user-attachments/assets/6aa0e537-bd5e-462d-89e2-6592cd9e3be9" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/00f08e39-3b52-4556-860b-3b5b0b2d7287" type="video/mp4">
</video>
### Your morning, already handled
A scheduled task posts a morning brief.
See [Scheduling](https://docs.mindroom.chat/scheduling/).
<video controls playsinline preload="metadata" aria-label="Your morning, already handled" style="width: 100%" poster="https://github.com/user-attachments/assets/4ba7b6f1-e2be-4b2a-a38a-e7a7bb49826e" data-poster-light="https://github.com/user-attachments/assets/4ba7b6f1-e2be-4b2a-a38a-e7a7bb49826e" data-poster-dark="https://github.com/user-attachments/assets/38261697-8f2a-478d-a256-32559e107315">
<source src="https://github.com/user-attachments/assets/e59e09c8-c8c7-4e90-8e3c-30b8f18b6de2" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/fdbc3860-9301-4d62-907a-857c818d4e73" type="video/mp4">
</video>
### Nothing falls through the cracks
A check asked for in conversation becomes a weekly scheduled report.
See [Scheduler tool](https://docs.mindroom.chat/scheduling/#scheduler).
<video controls playsinline preload="metadata" aria-label="Nothing falls through the cracks" style="width: 100%" poster="https://github.com/user-attachments/assets/5750a5bc-e5cb-4112-86ac-21ed044fa5d1" data-poster-light="https://github.com/user-attachments/assets/5750a5bc-e5cb-4112-86ac-21ed044fa5d1" data-poster-dark="https://github.com/user-attachments/assets/6194d6c7-89e7-4e66-8810-048efc3b3001">
<source src="https://github.com/user-attachments/assets/2fa5d666-16bd-4864-b27f-fb212609e2a1" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/7a68cee9-24d4-43cf-84de-599405fd16d7" type="video/mp4">
</video>
### Say it, and it's handled
A voice message between meetings becomes a reminder.
See [Voice Messages](https://docs.mindroom.chat/voice/).
<video controls playsinline preload="metadata" aria-label="Say it, and it's handled" style="width: 100%" poster="https://github.com/user-attachments/assets/d8829350-12c9-4045-aed0-4a5a5127213c" data-poster-light="https://github.com/user-attachments/assets/d8829350-12c9-4045-aed0-4a5a5127213c" data-poster-dark="https://github.com/user-attachments/assets/9ec1837a-3566-4b0c-8274-7af7c30b988c">
<source src="https://github.com/user-attachments/assets/823df173-50ae-4304-b652-36a61bfbc911" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/f048c8cc-3384-41e2-be59-000d3ab22099" type="video/mp4">
</video>
## At home
### Lock up on the way out
A voice note from a phone locks up, turns off the lights, and lowers the heating.
See [Home Assistant](https://docs.mindroom.chat/tools/location-commerce-and-home/#homeassistant).
<video controls playsinline preload="metadata" aria-label="Lock up on the way out" style="width: 100%" poster="https://github.com/user-attachments/assets/e7b9f61d-45c0-4e64-81d5-2a68141de523" data-poster-light="https://github.com/user-attachments/assets/e7b9f61d-45c0-4e64-81d5-2a68141de523" data-poster-dark="https://github.com/user-attachments/assets/aac77c0a-6c51-4e8b-aaa6-e682ca08f228">
<source src="https://github.com/user-attachments/assets/51d85cfc-79de-4666-a3e2-aa2356f1c5ed" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/b5d7a6f2-11bb-45a5-b92e-03ab0d9c5ba0" type="video/mp4">
</video>
### A weekend away, planned together
Two people plan a weekend trip, and the agent checks the calendar, offers options, and books the one they pick.
See [Google Calendar](https://docs.mindroom.chat/tools/calendar-and-scheduling/#google_calendar).
<video controls playsinline preload="metadata" aria-label="A weekend away, planned together" style="width: 100%" poster="https://github.com/user-attachments/assets/5dc33fcf-8ef3-4e35-a8d9-8e8d2946470f" data-poster-light="https://github.com/user-attachments/assets/5dc33fcf-8ef3-4e35-a8d9-8e8d2946470f" data-poster-dark="https://github.com/user-attachments/assets/1d522e45-873f-4ed3-b6f4-99bf44b3a423">
<source src="https://github.com/user-attachments/assets/936b2d54-9e2c-4fc7-aef3-fab8e0004665" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/2dc8de4b-f91d-4bb1-aeda-3dc0ffb42901" type="video/mp4">
</video>
### Dinners that fit everyone
The agent remembers each person's diet and plans the week's dinners.
See [Memory System](https://docs.mindroom.chat/memory/).
<video controls playsinline preload="metadata" aria-label="Dinners that fit everyone" style="width: 100%" poster="https://github.com/user-attachments/assets/deebd6ee-063e-4227-a2ad-ea3ee15ccf8e" data-poster-light="https://github.com/user-attachments/assets/deebd6ee-063e-4227-a2ad-ea3ee15ccf8e" data-poster-dark="https://github.com/user-attachments/assets/4ae62fd6-04fe-4dcc-aed6-d9b1de92b5f9">
<source src="https://github.com/user-attachments/assets/440c7742-da69-41e1-a131-788ca5307e31" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/a7ccca20-2047-4d8c-8bf5-a2251e0946f3" type="video/mp4">
</video>
# Getting Started
This page installs MindRoom and gets a first agent answering in chat.
Pick one setup:
| Setup | Use when |
| --- | --- |
| [Your computer + MindRoom Chat](#recommended-your-computer-mindroom-chat) (recommended) | You want the simplest start: MindRoom runs on your computer, and Matrix and the chat app are hosted at `mindroom.chat` |
| [macOS app](https://docs.mindroom.chat/installation/macos-app/) | You want a native app that runs your agents on an Apple silicon Mac, including one-click local models |
| [Full stack Docker Compose](#full-stack-docker-compose) | You want everything on your own machine: dashboard, Matrix homeserver, and chat app |
| [Agent-managed NixOS container](#advanced-agent-managed-nixos-container) | You want an agent to manage its own persistent machine while the host controls what it can see |
| [Manual install](#manual-install-with-your-own-matrix-homeserver) | You already run a Matrix homeserver |
| [Hosted MindRoom](https://mindroom.chat/#hosted) | You want nothing to install, and MindRoom runs your agents for you |
## Recommended: your computer + MindRoom Chat
MindRoom runs on your computer, while the Matrix homeserver is hosted at `mindroom.chat` and the chat app at `chat.mindroom.chat`.
Before you start:
- Install [uv](https://docs.astral.sh/uv/getting-started/installation/), which installs Python when needed.
- Have a model ready: an API key for a provider such as Anthropic, OpenAI, or OpenRouter; a subscription login such as Codex; or a local model through Ollama or llama.cpp (see [Supported Providers](https://docs.mindroom.chat/configuration/models/#supported-providers)).
- Sign in at [chat.mindroom.chat](https://chat.mindroom.chat); the first sign-in creates the MindRoom Chat account that approves the pairing.
### 1. Run MindRoom
```bash
uvx mindroom run
```
When no config exists and MindRoom runs in a terminal, it asks a few setup questions:
1. Choose a model provider preset (default `openai`; the choices are listed under [`config init`](https://docs.mindroom.chat/cli/#config-init)).
2. For `anthropic`, `openai`, or `openrouter`, paste the API key; input is hidden.
Press Enter to skip, then connect the provider later through the [dashboard](https://docs.mindroom.chat/dashboard/#connect-your-ai-provider), or add the key to `~/.mindroom/.env` and restart `mindroom run`.
MindRoom does not ask when the key is already set in your environment.
Other presets print their remaining step instead, such as `codex login`, `ollama pull`, or the Azure, Bedrock, or Vertex AI settings to add to `~/.mindroom/.env` before restarting.
MindRoom then writes `~/.mindroom/config.yaml` and `~/.mindroom/.env` with hosted Matrix defaults (`MATRIX_HOMESERVER=https://mindroom.chat`) and a starter `Mind` agent in a `Personal` room.
### 2. Approve pairing
MindRoom prints a pairing link and QR code.
Open the link or scan the QR code with your MindRoom Chat account to approve, or enter the displayed code in MindRoom Chat → Settings → Local MindRoom.
After approval, MindRoom prints the approving account and asks `Is this your account? [Y/n]` before saving anything.
Pair codes expire after 10 minutes, and `mindroom run` prints a new one when that happens.
See [connect](https://docs.mindroom.chat/deployment/hosted-matrix/#connect) for pairing details, the credentials it saves, and how to revoke a pairing.
### 3. Choose how MindRoom keeps running
After pairing, first-run setup asks whether to run MindRoom in the background and start it at login, as a systemd user service on Linux or a launchd agent on macOS.
Pressing Enter installs and starts the service, the same as `mindroom service install`, and returns to your shell.
Check it with `mindroom service status`, and run `mindroom service restart` after editing `~/.mindroom/.env`.
Answering `n` runs MindRoom and the dashboard in the terminal instead, which also happens when the service cannot be installed.
See [`mindroom service`](https://docs.mindroom.chat/cli/#service) for when the question is skipped.
### Verify
- **Chat:** open `https://chat.mindroom.chat` and send `hello` in the `Personal` room; `Mind` is its only responder, so it answers without a mention.
- **Dashboard:** open `http://localhost:8765` to configure agents, models, and tools.
It asks for the `MINDROOM_API_KEY` that setup generated in `~/.mindroom/.env`, because `mindroom run` serves the dashboard on every network interface by default.
- **Preflight check:** `uvx mindroom doctor` checks config, API keys, Matrix connectivity, pairing, and storage in one pass; see [doctor](https://docs.mindroom.chat/cli/#doctor).
See [Hosted Matrix + Local Backend](https://docs.mindroom.chat/deployment/hosted-matrix/) for what runs where and the credential and trust model.
To run worker-routed execution tools such as `coding`, `docker`, `file`, `python`, and `shell` in dedicated Docker workers on the same machine, see [Sandbox Proxy Isolation](https://docs.mindroom.chat/deployment/sandbox-proxy/).
### Set up from a script or service
Without a terminal (services, Docker, the macOS app), a missing config is an error that points to `mindroom config init`, unless you pass `--provider`.
Flags answer the setup questions up front, which lets a script or coding agent set up MindRoom:
```bash
OPENAI_API_KEY=sk-... uvx mindroom run --provider openai --service
```
`--provider` picks the preset and the API key comes from the environment.
`--service` installs the login service after pairing, and `--no-service` skips the question.
MindRoom prints the pairing link and code for a person to approve, and prints the approving account instead of asking about it.
### Create the config first with `config init`
Use `config init` to review the files before starting, to choose a preset without prompts, or to use a self-hosted homeserver:
```bash
uvx mindroom config init --provider anthropic
$EDITOR ~/.mindroom/.env
uvx mindroom run
```
The generated `.env` lists the credentials the chosen preset needs; set them before running.
See [`config init`](https://docs.mindroom.chat/cli/#config-init) for every option and the extra steps for the `codex`, `kimi`, `ollama`, and `llama.cpp` presets, and [Model Environment Variables](https://docs.mindroom.chat/configuration/models/#environment-variables) for each provider's credentials.
## Full stack Docker Compose
Use this when you want everything local: the MindRoom dashboard, a Matrix homeserver, and the MindRoom Chat client in one stack.
It requires Docker, Docker Compose, and Python 3 for the quickstart script.
```bash
git clone https://github.com/mindroom-ai/mindroom-stack
cd mindroom-stack
cp .env.example .env
$EDITOR .env # set ANTHROPIC_API_KEY for the default stack config
./scripts/quickstart.py
```
The quickstart validates provider configuration, starts the stack, waits until it is ready, and explains common port and startup failures.
The default stack config uses Anthropic and requires `ANTHROPIC_API_KEY`.
To use another provider, edit `config/config.yaml` and supply its credentials before starting; see the [stack model configuration guide](https://github.com/mindroom-ai/mindroom-stack#configure-models).
The stack serves the MindRoom dashboard at `http://localhost:8765`, the MindRoom Chat client at `http://localhost:8080`, and Matrix at `http://localhost:8008`, using the published `mindroom`, `mindroom-chat`, and `mindroom-tuwunel` images.
To reach it from another device, set `CLIENT_HOMESERVER_URL=http://<host-ip>:8008` in `.env` before starting.
See the [stack README](https://github.com/mindroom-ai/mindroom-stack) for running `docker compose` directly, changing host ports, and pinning images.
## Advanced: agent-managed NixOS container
Use this when you want to give a MindRoom agent full freedom over its own virtual machine while you, from the host, control precisely what it can see.
The [mindroom-ai/lxc-nixos](https://github.com/mindroom-ai/lxc-nixos) flake provisions an Incus LXC system container running NixOS with MindRoom, the Tuwunel Matrix homeserver, MindRoom Chat, and Caddy, plus Docker and `ragenix`-based secrets.
Because the whole machine is declared in the flake, the agent can rebuild and manage the persistent system it runs on without touching the host, unlike the mostly stateless Docker Compose stack.
It is harder to set up by hand, but a coding agent such as Codex or Claude Code can follow the repo's `AGENTS.md` runbook directly.
It requires a Linux host running [Incus](https://linuxcontainers.org/incus/docs/main/installing/):
```bash
git clone https://github.com/mindroom-ai/lxc-nixos.git
cd lxc-nixos
incus launch images:nixos/unstable mindroom -c security.nesting=true
incus config device add mindroom repo disk source="$PWD" path=/mnt/repo shift=true
```
Then follow the repo's `AGENTS.md` runbook for operator SSH keys, secrets bootstrap, and the `nixos-rebuild switch` deployment.
## Manual install with your own Matrix homeserver
Use this if you already have a Matrix homeserver and want to run MindRoom directly.
Prerequisites:
- Python 3.12 or higher.
- A Matrix homeserver where MindRoom can create agent accounts (see [Matrix account provisioning](#matrix-account-provisioning)).
- Credentials for at least one AI provider.
### Installation
=== "uv (recommended)"
```bash
uv tool install mindroom
```
=== "pip"
```bash
pip install mindroom
```
=== "From source"
```bash
git clone https://github.com/mindroom-ai/mindroom
cd mindroom
uv sync
source .venv/bin/activate
```
Install Node.js 24 and [Bun](https://bun.sh/) to build missing dashboard assets on first run, or set `MINDROOM_FRONTEND_DIST` to a prebuilt dashboard directory.
Without assets and Bun, the API is available but the dashboard is not.
### Configuration
Generate a starter with `mindroom config init --matrix-server self-hosted`, or write `config.yaml` yourself.
A generated config contains `__MINDROOM_OWNER_USER_ID_FROM_PAIRING__` placeholders; replace each with your quoted Matrix user ID, such as `"@alice:matrix.example.com"`, because only hosted pairing fills them in.
See [Configuration](https://docs.mindroom.chat/configuration/#configuration-file) for where MindRoom looks for `config.yaml`.
A minimal hand-written `config.yaml`:
```yaml
agents:
assistant:
display_name: Assistant
role: A helpful AI assistant that can answer questions
model: default
rooms: [lobby]
models:
default:
provider: openai
id: gpt-6-astra
defaults:
tools: [scheduler]
markdown: true
administrators:
- "@alice:matrix.example.com"
room_defaults:
invite_users:
- "@alice:matrix.example.com"
timezone: America/Los_Angeles
```
Put credentials in a `.env` next to `config.yaml`:
```bash
MATRIX_HOMESERVER=https://matrix.example.com
# Recommended when the homeserver supports token-gated registration.
# MATRIX_REGISTRATION_TOKEN=your-registration-token
# Optional: for self-signed certificates (development)
# MATRIX_SSL_VERIFY=false
# Optional: when server_name differs from the homeserver hostname
# MATRIX_SERVER_NAME=example.com
# AI provider API keys
OPENAI_API_KEY=your_openai_key
# ANTHROPIC_API_KEY=your_anthropic_key
# OPENROUTER_API_KEY=your_openrouter_key
# Dashboard API key; generate one with `openssl rand -hex 32`.
# `mindroom run` listens on every network interface by default, so keep this key set;
# leave it empty (MINDROOM_API_KEY=) only together with `--api-host 127.0.0.1`.
MINDROOM_API_KEY=replace-with-a-long-random-secret
```
See [Environment Variables](https://docs.mindroom.chat/configuration/#environment-variables) for every setting.
### Matrix account provisioning
MindRoom creates a Matrix account for each agent, team, and the router.
Configure one way for it to do so: hosted provisioning, `MATRIX_REGISTRATION_TOKEN`, `MATRIX_REGISTRATION_SHARED_SECRET`, an [application service](https://docs.mindroom.chat/matrix/#agent-users), or intentionally open registration.
If registration fails, check the selected credentials and the homeserver's registration policy.
### Optional: local Synapse and MindRoom Chat with Docker
On Linux or macOS, `local-stack-setup` starts Synapse and a MindRoom Chat container from the core MindRoom repository's `local/matrix` Compose files and writes the matching Matrix settings to the `.env` next to your active config:
```bash
mindroom local-stack-setup --synapse-dir /path/to/mindroom/local/matrix
```
From a source checkout, run `uv run mindroom local-stack-setup --synapse-dir local/matrix`.
With a custom config path, export `MINDROOM_CONFIG_PATH` first so it updates the matching `.env`.
See [local-stack-setup](https://docs.mindroom.chat/cli/#local-stack-setup) for its options.
### Run MindRoom
```bash
mindroom run
```
MindRoom connects to the homeserver, creates Matrix users for each agent, creates and joins the configured rooms, and starts answering messages.
See [`mindroom run`](https://docs.mindroom.chat/cli/#run) for options such as `--config` and `--storage-path`.
## Next Steps
- Learn about [agent configuration](https://docs.mindroom.chat/configuration/agents/)
- Learn about [OpenClaw workspace import](https://docs.mindroom.chat/openclaw/) if you want file-based memory/context patterns
- Explore [available tools](https://docs.mindroom.chat/tools/)
- Set up [teams for multi-agent collaboration](https://docs.mindroom.chat/configuration/teams/)
# macOS App
The MindRoom macOS app is a native window with a menu bar companion for two independent roles:
- **Local agents** run MindRoom on this Mac and connect to your Matrix chat account.
- **Computer access** lets a paired agent running elsewhere observe or control selected applications, read selected folders, and request shell commands that you approve on this Mac.
Use either role, or both; starting one does not start the other.
## Requirements
- macOS 14 Sonoma or later on an Apple silicon Mac; Intel Macs are not supported.
- Network access to install the MindRoom runtime and reach your Matrix server.
- For local agents, a model provider credential, local model, or supported provider login.
- For computer access, a Desktop-enabled MindRoom agent; application access also needs the macOS permissions in the [Desktop guide](https://docs.mindroom.chat/tools/desktop/).
## Install
```bash
brew install --cask mindroom-ai/tap/mindroom
```
Open **MindRoom** from Applications or Spotlight.
The window has **Overview**, **Chat**, **Dashboard**, **Local agents**, **Computer access**, and **Settings** sections, and Overview shows the status of each role.
## Chat in the App
**Chat** opens your chat client inside the app.
Sign in once; the app remembers that session separately from your browser, and switching sections keeps your conversation and draft.
The default chat website is `https://chat.mindroom.chat`; for a self-hosted client, enter an HTTPS URL or a loopback HTTP URL in **Settings** > **Chat website** and select **Save Chat Website**.
Use **Open in Browser** to use your browser session or a sign-in provider that requires a browser.
**Reload** returns to the configured chat website, or reloads the approval page while you connect local agents.
## Set Up Local Agents
**Local agents** has four numbered steps, each with its own status.
The app opens at the first step that needs attention: **Install** when the runtime needs installing or updating, **Check** when configuration exists without a service, and **Start** when a service is installed.
1. **Install** finds an existing `mindroom` executable, including a terminal installation, or installs the runtime release that matches the app version with **Install MindRoom**.
When the installed runtime is a different release, for example after an app update, it shows **Update needed** and **Update MindRoom**.
Configuring, pairing, checking, and installing the service wait until the runtime matches; starting, stopping, and restarting an installed service stay available.
Installing the runtime does not install the background service.
2. **Configure** uses the installed service's saved configuration, or `~/.mindroom/config.yaml` for a new service, and shows the path.
**Prepare Configuration** creates missing files and keeps existing configuration and credentials.
Under **Connect or reconnect your chat account**, **Connect Account** opens the approval page in the **Chat** section.
Check that the code above Chat matches the page and that the signed-in account is yours, then click **Approve**; **Cancel** stops waiting without saving credentials.
An unapproved code expires after 10 minutes; choose **Connect Account** again for a new one.
Pairing a Mac that is already connected asks first, because it creates a new connection and a new agent namespace while existing agents keep working.
Use **Open Config Folder** to add AI provider credentials to the adjacent `.env` or configure a local model in `config.yaml`.
3. **Check** (**Check Setup**) runs `mindroom doctor` on the displayed configuration and the service's storage path, covering configuration, providers, Matrix connectivity, and storage.
**Files found** only means configuration exists; **Passed last check** means a check in this app session had no failures or warnings.
Warnings show **Needs attention** with a summary, and **Command output** has details.
Editing `config.yaml` or `.env` clears the result; rerun the check after editing included files or changing external services.
4. **Start** offers **Install and Start Agents** when the launchd service is missing, **Start Agents** when it is stopped, and stop, restart, chat, and dashboard controls when it runs.
A check is recommended but not required.
An installed service always uses its saved configuration path, including a custom path chosen in the terminal.
If the service starts before your account is connected, the section shows **Waiting for your chat account** until you choose **Connect Account** and approve.
**Refresh Status** rereads the runtime, configuration, and service state, including changes made in a terminal.
These controls manage only this Mac's launchd service.
**Service running** means the process is running; use Chat or the dashboard to confirm agents are ready.
### Local AI Models
In **Configure**, choose a model under **Run AI on this Mac** and click **Set Up Local Model**.
No separate inference application or model-provider API key is required.
Setup downloads the model, displays download progress, and makes it the default for your agents.
Choose **Cancel Setup** to stop a download; retry setup to resume it.
The initial download requires internet; after setup, the model runs locally without internet.
Matrix chat and hosted pairing still require their configured network connection.
The suggested models are conservative starting points based on total unified memory:
| Unified memory | Suggested model | Approximate model download |
| --- | --- | --- |
| 8–15 GB | Qwen 3.5 2B | 1.5 GB |
| 16–23 GB | Qwen 3.5 4B | 2.8 GB |
| 24–31 GB | Qwen 3.5 9B | 5.7 GB |
| 32 GB or more | Qwen 3.8 27B | 17.6 GB |
We recommend Qwen 3.8 27B on Macs with at least 32 GB unified memory, leaving room for macOS, MindRoom, and the model's working memory.
Local inference currently supports text and tool calls.
Other apps and longer conversations consume additional memory; choose a smaller model when memory is tight.
Local models support an 8,192-token context, with one model active at a time.
After five idle minutes, model memory is released; the next request takes longer while the model loads again.
Agents and the router using `default` follow the new selection; explicitly selected models and existing credentials are kept.
Setup saves the original YAML as `config.yaml.before-local-model` and rewrites the active YAML without its comments.
For configurations using `!include`, edit the model's source file manually instead of using automatic setup.
Use **Stop Inference** to stop local inference and **Start Inference** to start it again.
Agents configured to use it cannot answer while it is stopped.
The service starts at login and continues after quitting the app.
Downloaded models are stored in `~/Library/Application Support/MindRoom/inference/models`.
### Where Do My Agents Run?
Your agents run on this Mac.
The hosted `mindroom.chat` Matrix server only relays their chat messages, and signing in to `chat.mindroom.chat` creates your hosted Matrix account without moving agents to the cloud.
For pairing details, see [Hosted Matrix](https://docs.mindroom.chat/deployment/hosted-matrix/).
### Your Own Matrix Server
Under **Use your own Matrix server**, choose **Prepare Self-Hosted Configuration**, then edit `config.yaml` and `.env` for your server and model provider.
Run the Matrix server separately from this app.
### Open the Dashboard
While the service runs, **Open Dashboard** opens the local dashboard in the app for agent and model configuration.
The app signs in with `MINDROOM_API_KEY` from `~/.mindroom/.env` and uses `MINDROOM_URL` from the same file, defaulting to `http://127.0.0.1:8765`.
`MINDROOM_URL` must be an HTTP loopback URL (`localhost`, `127.0.0.1`, or `[::1]`) with an explicit port; otherwise the app reports `Local dashboard address is invalid. Check MINDROOM_URL and retry.`
The key is sent only to this Mac's MindRoom service, so if the dashboard cannot connect while the service is starting, select **Reload**.
After changing `MINDROOM_URL` or `MINDROOM_API_KEY`, select **Reload** in Dashboard.
The dashboard session is separate from Chat and ends when the app quits.
## Computer Access
Computer access uses the Desktop Helper bundled with the app and does not need the local-agent runtime or service.
The **Computer access** section has a summary and four steps: **Connect**, **Access**, **Permissions**, and **Start**.
The summary shows **Not connected**, **Connection saved · Access off**, or **Connected**, and always names the next required action.
1. In a private chat with your Desktop-enabled agent, send `!desktop setup` and copy its JSON setup data.
2. In **Connect**, paste it into **Setup data** and select **Import Setup**.
3. Check the homeserver, Matrix account, controller fingerprint, requester, and agent before signing in, because the setup data chooses which server receives your sign-in.
The app reuses a matching saved Matrix login; otherwise choose **Sign In with Browser** or the password option.
4. Confirm the values again and select **Save and Connect**.
5. Copy the displayed confirmation command into the same agent chat, and after the agent confirms pairing, select **I’ve Confirmed in Chat**.
If the app closes before this step, request fresh setup data and repeat **Connect**; the saved login is kept.
6. In **Access**, choose **Applications**, **Read-only folders**, or **Shell commands**, and save each choice.
For applications, search and check the ones to allow, then select **Save App Access**; search accepts partial and reordered words, such as `chr goo` for Google Chrome.
The list shows running apps and apps in standard folders; use **Add App…** to choose an application from another location.
For folders and shell commands, see [Folders and Shell Commands](#folders-and-shell-commands).
7. If you saved applications, allow Accessibility and Screen Recording in **Permissions** with **Request** or **Open Settings**, restart the app if macOS requires it, and select **Check Again**.
Without saved applications, **Permissions** shows **Not needed**.
8. Select **Start Observe Only**, or **Start Access** when folders or shell commands are saved.
Start needs at least one saved application, folder, or shell choice.
**Save App Access** and **Save Folder and Shell Access** each update their own choices without changing the other.
For homeservers behind Cloudflare Access, install `cloudflared`; see [Homeservers Behind an Identity-Aware Proxy](https://docs.mindroom.chat/tools/desktop/#homeservers-behind-an-identity-aware-proxy).
### Control Applications
Applications start observe-only.
**Grant Control…** shows the identities, allowed applications, and duration for confirmation, and control ends when that lease expires; it is never renewed at launch or restart.
**Revoke Now** removes input authority while observation continues, and **Stop Access** ends the session.
Controlling a terminal, a scripting or automation app, the primary screen, or a browser or Matrix client signed in as you gives the agent your own authority; see [Security Model](https://docs.mindroom.chat/tools/desktop/#security-model).
Optional browser settings and redacted diagnostics are in expandable sections; see the [Desktop guide](https://docs.mindroom.chat/tools/desktop/#use-the-signed-in-browser-profile) for browser-extension setup.
### Folders and Shell Commands
In **Access**, **Read-only folders** lists the folders agents may list and read; **Add Folder…** adds one and **Remove** drops one.
**Shell commands** has one switch, **Allow shell command requests**.
Save both with **Save Folder and Shell Access**; while access runs, **Stop and Save…** stops it first after confirmation.
Approved shell commands run with your full macOS account access; read [Shell Commands](https://docs.mindroom.chat/tools/desktop/#shell-commands) before enabling them.
While access runs with shell requests allowed, each request appears, unless auto-approval is active, on an approval card in the window and in a separate approval window that does not take keyboard focus.
Closing that window or choosing **Later** leaves the request waiting until it expires.
**Approve Once** and **Approve & Allow…** become available one second after a request appears.
Choose **Reject**, **Approve Once**, or **Approve & Allow…** with **5 Minutes**, **15 Minutes**, **60 Minutes**, or **Until I Stop**; without a waiting request, **Allow Without Asking…** offers the same durations.
Both auto-approval choices ask for confirmation and list the agents and requesters they cover; see [Local Approval](https://docs.mindroom.chat/tools/desktop/#local-approval) for what auto-approval allows.
While a command waits, every window section shows a **Review Command** bar and the menu bar shows **Command waiting** with **Review Command…**, which opens the card but never approves.
**Revoke Shell Access** ends auto-approval, rejects a waiting request, and stops running commands.
**Background commands** lists commands still running after their first reply, with a **Kill** button for each.
### Use the Terminal with the App
The app and `mindroom desktop setup` share the same saved setup in `~/.mindroom`; an open app picks up terminal setup while access is stopped.
You can save folders and shell access with `mindroom desktop access` and start from either the app or `mindroom desktop run`.
Stop the bridge in the interface that started it before starting it in the other.
A terminal `--config` or `--storage-path` override creates a separate setup that the app does not use.
### Fix Computer Access Problems
- **Permission shows Not allowed yet although System Settings shows MindRoom enabled**: quit and reopen MindRoom.
If you replaced the signed release with a local build, reinstall the signed release or remove the old permission entry and approve the current copy, then select **Check Again**.
- **Access fails to start**: **View Details** shows the full error, recovery advice, and redacted diagnostics to copy for support.
- **Connection or TLS certificate errors**: your saved setup is kept, so check the network or update the app and select **Start Access** again; you do not need to sign in or pair again.
See the [Desktop guide](https://docs.mindroom.chat/tools/desktop/) for pairing recovery and device rotation.
## Window, Menu Bar, and Login
Closing the window keeps the app and its background work running in the menu bar; reopen it with **Open MindRoom…** or by opening the app again.
The menu shows local-agent and computer-access status as shortcuts to their sections, plus chat, dashboard, start and stop, **Revoke Computer Control** while a control lease is active, **Revoke Shell Access** while shell auto-approval or a command is active, settings, and quit actions.
**Settings** > **Open menu bar app at login** launches the menu app at login.
Local agents start at login through their own launchd service, while computer access always needs an explicit start in the app.
**Quit MindRoom** stops computer access but leaves the local-agent service running; use **Stop Local Agents** to stop it.
Let a running runtime action finish before quitting.
## Updates
**Settings** separates app updates from runtime updates:
- **Check App Updates…** updates the app, including the bundled Desktop Helper.
- **Update Local Runtime** installs the runtime release that matches the app version; `uv tool upgrade mindroom` does not move the runtime off that version.
- **Apply Runtime to Service…** reinstalls the background service on the updated runtime and starts or restarts local agents after confirmation.
Homebrew users can also update the app with:
```bash
brew update
brew upgrade --cask mindroom
```
## Logs and Troubleshooting
**Open Logs Folder** opens `~/Library/Logs/mindroom`, and **Open Config Folder** opens the folder holding the local agents' configuration, `~/.mindroom` by default, which the CLI shares.
Failed local-agent actions show their output in the window with a copy action.
For local model download or loading errors, check `inference.log` in the logs folder.
If the dashboard does not open, start the service and check its logs for missing provider credentials or startup errors.
## Uninstall
```bash
brew uninstall --cask mindroom
```
Use `brew uninstall --zap --cask mindroom` to also remove app preferences and logs.
Neither removes `~/.mindroom`, which holds configuration, credentials, and agent data, or the runtime; remove the runtime with `uv tool uninstall mindroom`.
# iOS App
MindRoom AI is the MindRoom Chat client for iPhone, iPad, and Apple silicon Macs, available on the App Store.
It requires iOS or iPadOS 16.4 or later, or macOS 13.3 or later on a Mac with an M1 chip or newer.
<p>
<a class="md-button md-button--primary" href="https://apps.apple.com/us/app/mindroom-ai/id6760272172">Download on the App Store</a>
</p>
## Sign In
The app is a Matrix client, so sign in with the Matrix homeserver and account you normally use.
For hosted MindRoom, the homeserver is `https://mindroom.chat`.
To pair a local MindRoom runtime with that account, follow [Getting Started](https://docs.mindroom.chat/getting-started/#2-approve-pairing); on a computer, approve the pairing at `https://chat.mindroom.chat`.
## Reporting Issues
Report problems through the [support page](https://docs.mindroom.chat/support/#what-to-include-in-a-support-request), which lists the device, app, and homeserver details to include.
# Web Dashboard
The web dashboard configures agents, teams, rooms, models, credentials, and integrations without editing YAML by hand.
Each editor keeps a local draft and writes `config.yaml` when you save.
This page covers opening the dashboard, what each tab does, saving and conflict errors, and the dashboard REST API.
## Accessing the Dashboard
**Standalone:** run `mindroom run` and open `http://localhost:8765`.
When running from a source checkout, MindRoom builds the dashboard assets on first start if Bun is available.
When `MINDROOM_API_KEY` is set, the dashboard first asks for that key, and the login page shows which `.env` file holds it.
See [Authorization](https://docs.mindroom.chat/authorization/#dashboard-configuration) for who can open the dashboard and [Environment Variables](https://docs.mindroom.chat/configuration/#dashboard-and-api) for the related settings.
**SaaS platform:** open `https://<instance-id>.mindroom.chat`.
## Connect Your AI Provider
When the router, an agent, or a team uses a model whose provider has no API key, every dashboard page shows a **Connect your AI provider** banner.
Keys in `.env`, keys saved per model on the **Models** tab, and provider keys saved under their environment variable name (for example `OPENROUTER_API_KEY`) all count as set.
Select **Connect provider**, choose OpenRouter, Anthropic, or OpenAI, and paste a key.
MindRoom checks the key with the provider without using credits and saves it as the `openrouter`, `anthropic`, or `openai` credential only if the provider accepts it.
OpenRouter is recommended for the hosted default setup, where one key covers chat, memory, and voice.
If you connect Anthropic or OpenAI while your models still use OpenRouter, the dialog lists the affected models so you can switch them on the **Models** tab.
When an agent cannot reply because no provider key is set, it answers in chat with a pointer to this setup step, including the dashboard address when `MINDROOM_PUBLIC_URL` is set.
## Dashboard Tabs
### Dashboard (Home)
The home tab shows today's activity, upcoming schedules, and shortcuts to room and agent editors.
Select **Browse workspace** to search and filter agents, rooms, and teams, inspect an item and open its editor, or **Export summary**.
The exported JSON summary lists counts, agents, rooms, teams, and model configurations; it is not a complete `config.yaml` backup.
### Agents
- **Display name**, **Role description**, **Model**, **Instructions**, and **Rooms**
- **Memory backend** - inherit the global backend or override it per agent (`mem0`, `file`, or `none`)
- **Tools** - configured tools (green badge) and tools that need no setup
- **Learning** and **Learning mode** (`always` or `agentic`); see [Agent Configuration](https://docs.mindroom.chat/configuration/agents/)
- **Lazy tool loading** - open a checked tool's settings and enable **Load lazily** (`defer`) or **Load at session start** (`initial`, which requires `defer`); presets and control-plane tools such as `dynamic_tools` do not offer it (see [Dynamic Tools](https://docs.mindroom.chat/tools/dynamic-tools/))
- **More settings** - every other agent field, such as `participation`, `mid_turn`, `accept_invites`, `access`, `memory_search`, `thread_exports`, and `room_thread_modes`
### Teams
- **Display name** and **Team purpose**
- **Collaboration mode** - Coordinate or Collaborate (see [Teams](https://docs.mindroom.chat/configuration/teams/))
- **Team model** - optional model override
- **Team members** and **Team rooms**
### Rooms
- **Room Admins** - the panel at the top of the tab edits `room_defaults.admins`, the default Matrix room-admin list; add or remove user IDs and click **Save**
- **Display name** and **Description**
- **Room model** - optional model override
- **Agents in room**
- **More settings** - per-room `join_policy`, `listed`, `encrypted`, `invite_users`, and `admins` overrides (see [Rooms](https://docs.mindroom.chat/rooms/))
### Schedules
Lists scheduled tasks across rooms with room, status, schedule type, delivery mode, and next run time.
You can edit a task's timing, description, and visible or silent delivery, or cancel it.
See [Scheduling](https://docs.mindroom.chat/scheduling/).
### External Rooms
The **External** tab lists, per agent, rooms the agent has joined that are not in the configuration.
Select rooms and use **Leave rooms** to remove the agents, or open a room in your Matrix client.
### Models
Add and edit models with provider, model ID, host URL, and advanced settings, and set provider API keys.
A row's **Save** only updates the draft; click **Save All Changes** to write model changes to `config.yaml`.
The add-model dropdown does not have a preset for every supported provider, but the dashboard keeps any provider already in the configuration.
A model's **More settings** section appears below the table while its row is being edited, and **Cancel** on the row also reverts More settings changes made since the last save.
See [Models](https://docs.mindroom.chat/configuration/models/) for providers and fields.
### Usage
See [Usage Tracking](https://docs.mindroom.chat/usage/#dashboard-usage-tab).
### Memory
Sets the global memory backend, embedder, file backend, and auto-flush settings; per-agent backend overrides are on the **Agents** tab.
See [Memory](https://docs.mindroom.chat/memory/#ui-configuration) for the fields.
### Knowledge
- Create, edit, and delete knowledge bases, including `description`, `mode` (semantic search or files-only), `path`, `watch`, and Git repository, branch, filtering, credentials service, and sync options
- Upload and remove files for non-Git bases
- Reindex or sync a base on demand
- See index status (`file_count` and `indexed_count`)
Git-backed bases hide upload and delete controls; change files in the repository, then sync.
The file list shows only files that pass the base's `include_patterns` and `exclude_patterns`.
See [Knowledge Bases](https://docs.mindroom.chat/knowledge/) for configuration and sync behavior; assign bases to agents on the **Agents** tab.
### Credentials
- List, create, edit (as raw JSON), test, and delete credential services, such as `github_private` or `model:sonnet`
- Reference a stored service from config, for example `knowledge_bases.<id>.git.credentials_service`
A new service named after a provider key environment variable, such as `ANTHROPIC_API_KEY`, is saved as the canonical provider service (`anthropic`) that the Models tab and runtime read.
An existing service with an environment-variable name keeps receiving writes, because config may reference it by that exact name.
See [Credential Storage](https://docs.mindroom.chat/oauth-framework/#credential-storage) for credentials imported from `.env`, such as `GITHUB_TOKEN`.
### Voice
Enables voice messages and configures speech-to-text (OpenAI or a self-hosted OpenAI-compatible service), the transcript-cleanup model, and [voice calls](https://docs.mindroom.chat/voice-calls/#calls-configuration) with named call profiles and per-agent assignments.
See [Voice Messages](https://docs.mindroom.chat/voice/).
### Tools
The **Tools** tab connects external services that tools need, including OAuth flows such as Google, Spotify, and Home Assistant.
Search tools, filter by category or status (**Available**, **Unconfigured**, **Configured**), and choose **Shared deployment credentials** or an agent with a worker scope to configure that scope (see [Dashboard credentials and worker scopes](https://docs.mindroom.chat/deployment/sandbox-proxy/#dashboard-credentials-and-worker-scopes)).
### Skills
Lists installed skills with origin and edit status, shows `SKILL.md` content, and creates, edits, and deletes user skills.
See [Skills](https://docs.mindroom.chat/skills/#installing-and-managing-skills).
### Settings
The **Settings** tab edits every top-level configuration section without a dedicated tab, grouped into Responses, History and context, Tools and workers, Router, Personal rooms, Room defaults, Tool approval, Prompts, MCP servers, Plugins, Access and identity, Matrix and runtime, and Diagnostics.
Any option no tab claims appears under **Other**.
**Tools and workers** also edits per-tool overrides for the default tools every agent inherits.
## Editing and Saving
### More Settings and Schema Forms
The Agents, Teams, Rooms, Memory, Knowledge, Voice, and Models tabs show a collapsible **More settings** section with the fields their main editor does not cover.
These sections and the Settings tab are generated from the running backend's configuration schema.
Each field shows its description and default, references such as model or agent names are pickers, and credential fields are masked.
Resetting a field removes it from `config.yaml` so the default applies again, and optional blocks are added or removed with their **Configure** checkbox.
Validation errors from a save appear beside the affected field, and Settings sections with errors are marked **Needs attention**.
### Save Status
The header shows **Synced**, **Syncing...**, **Sync Error**, or **Disconnected** (lost connection to the backend).
The dashboard has dark and light themes and works on mobile.
### Save Conflicts
If another dashboard tab or a server-side edit changed the configuration, saving shows `Configuration changed elsewhere. Your draft has not been saved. Copy any changes you want to keep, then refresh this page and reapply them.`
Saving stays blocked until you refresh, even if you edit the draft.
### Invalid Configuration
If `config.yaml` fails validation when the dashboard loads, it opens a raw YAML recovery editor so you can fix and save the whole file.
### Configurations Split With `!include`
When the configuration uses [include tags](https://docs.mindroom.chat/configuration/#splitting-the-configuration-into-multiple-files), the dashboard shows a banner and structured saves fail, so edit the included source files directly.
The raw recovery editor still edits the top-level file's text.
Through the API, structured saves return HTTP 409 with `{"code": "config_composed_from_includes", "message": "configuration uses !include; edit the source files instead"}`, unlike the plain-text 409 for a stale write, which can be retried.
If the source files cannot be read well enough to tell whether they use `!include`, structured saves return HTTP 422; repair the files or edit the raw YAML.
`POST /api/config/load` reports include use in the `x-mindroom-config-uses-includes` response header, and `GET /api/config/raw` in its `uses_includes` field.
## API Endpoints
The dashboard uses the backend REST API under `/api/`, with the same authentication as the dashboard.
### Configuration API
| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/api/config/load` | Fetch current configuration |
| PUT | `/api/config/save` | Save full configuration |
| GET | `/api/config/raw` | Fetch raw `config.yaml` text |
| PUT | `/api/config/raw` | Replace raw `config.yaml` text |
| GET | `/api/config/schema` | Configuration JSON schema used by Settings and More settings |
| GET | `/api/config/agents` | List agents |
| POST | `/api/config/agents` | Create agent |
| PUT | `/api/config/agents/{id}` | Update agent |
| DELETE | `/api/config/agents/{id}` | Delete agent |
| GET | `/api/config/teams` | List teams |
| POST | `/api/config/teams` | Create team |
| PUT | `/api/config/teams/{id}` | Update team |
| DELETE | `/api/config/teams/{id}` | Delete team |
| GET | `/api/config/models` | List model configurations |
| PUT | `/api/config/models/{id}` | Update model configuration |
| GET | `/api/config/room-models` | Get room model overrides |
| PUT | `/api/config/room-models` | Update room model overrides |
| POST | `/api/config/agent-policies` | Derived agent policies for a draft config |
### Credentials API
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/credentials/list` | List services with credentials |
| GET | `/api/credentials/{service}/status` | Get credential status |
| GET | `/api/credentials/{service}` | Get credentials for editing |
| POST | `/api/credentials/{service}` | Set credentials |
| POST | `/api/credentials/{service}/api-key` | Set API key |
| GET | `/api/credentials/{service}/api-key` | Get masked API key |
| POST | `/api/credentials/{service}/test` | Check stored credentials exist |
| DELETE | `/api/credentials/{service}` | Delete credentials |
| POST | `/api/credentials/{service}/copy-from/{source_service}` | Copy credentials from another service |
Add `agent_name` to target an agent's credentials in its saved worker scope.
The optional `execution_scope` requires `agent_name` and must match that agent's saved scope; save the configuration first after changing the scope.
Agent-scoped requests return HTTP 403 unless the requester may manage that agent's credentials; see [Platform and credential authority](https://docs.mindroom.chat/authorization/#platform-and-credential-authority).
### Knowledge API
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/knowledge/bases` | List knowledge bases |
| GET | `/api/knowledge/bases/{base_id}/files` | List files in a base |
| POST | `/api/knowledge/bases/{base_id}/upload` | Upload files to a non-Git base |
| DELETE | `/api/knowledge/bases/{base_id}/files/{path}` | Delete a file from a non-Git base |
| GET | `/api/knowledge/bases/{base_id}/status` | Get indexing status |
| POST | `/api/knowledge/bases/{base_id}/reindex` | Reindex a base, or sync a Git-backed base |
Upload and delete return HTTP 409 for Git-backed bases (see [Sync Behavior](https://docs.mindroom.chat/knowledge/#sync-behavior)).
### Skills API
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/skills` | List installed skills |
| GET | `/api/skills/{skill_name}` | Get skill content, origin, and edit status |
| POST | `/api/skills` | Create a user skill |
| PUT | `/api/skills/{skill_name}` | Update a user skill |
| DELETE | `/api/skills/{skill_name}` | Delete a user skill |
### Schedules API
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/schedules` | List scheduled tasks, optionally filtered by room, including each task's `silent` flag |
| PUT | `/api/schedules/{task_id}` | Edit a scheduled task, including `silent` |
| DELETE | `/api/schedules/{task_id}` | Cancel a scheduled task |
### Workers API
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/workers` | List sandbox workers |
| POST | `/api/workers/cleanup` | Clean up idle sandbox workers |
### Tools and Matrix API
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/tools` | List available tools |
| GET | `/api/rooms` | List configured rooms |
| GET | `/api/matrix/agents/rooms` | All agents' room memberships |
| GET | `/api/matrix/agents/{id}/rooms` | One agent's rooms |
| POST | `/api/matrix/rooms/leave` | Leave one room |
| POST | `/api/matrix/rooms/leave-bulk` | Leave multiple rooms |
For usage reports and health endpoints, see [Usage Report API](https://docs.mindroom.chat/usage/#usage-report-api) and [Health & Readiness](https://docs.mindroom.chat/deployment/operational-log-events/#health-readiness).
# OpenClaw Workspace Import
This page covers moving an OpenClaw workspace into MindRoom: where to put the files, a starting agent config, the `openclaw_compat` tool preset, and what does not carry over.
MindRoom reuses OpenClaw's file-based workspace (`SOUL.md`, `AGENTS.md`, `USER.md`, `MEMORY.md`, daily notes, and skills); it is not a clone of the OpenClaw gateway.
## What carries over
Supported:
- File-based identity and instruction documents, loaded through `context_files`
- File-first memory (`MEMORY.md` plus `memory/` notes) through MindRoom's `file` memory backend
- OpenClaw skills, including `metadata.openclaw` eligibility gating
- A matching tool bundle through the [`openclaw_compat`](#openclaw_compat) preset, including Matrix messaging with `matrix_message`
Not included:
- The OpenClaw gateway control plane
- Device nodes and canvas platform tools
- OpenClaw tool aliases such as `exec`, `process`, `web_search`, `web_fetch`, `tts`, and `image`; use MindRoom's native tools instead
- The heartbeat runtime; schedule heartbeats with the `scheduler` tool instead (see [Scheduling](https://docs.mindroom.chat/scheduling/))
## Import a workspace
1. Copy or sync your OpenClaw files into the agent's workspace, `agents/<agent>/workspace/` in the storage directory (`mindroom_data/` by default):
```text
mindroom_data/
└── agents/
└── openclaw/
└── workspace/
├── SOUL.md
├── AGENTS.md
├── USER.md
├── IDENTITY.md
├── MEMORY.md
├── TOOLS.md
├── HEARTBEAT.md
├── memory/
│ ├── YYYY-MM-DD.md
│ └── topic-notes.md
└── skills/
└── transcribe/
└── SKILL.md
```
2. Add an agent to `config.yaml`, starting from this example:
```yaml
agents:
openclaw:
display_name: OpenClawAgent
role: OpenClaw-style personal assistant with persistent file-based identity and memory.
model: default
rooms: [personal]
include_default_tools: false
learning: false
memory_backend: file
instructions:
- You wake up fresh each session with no memory of previous conversations. Your context files are already loaded into your system prompt.
- Important long-term context is persisted by the configured MindRoom memory backend. If something must be preserved exactly, write/update the relevant file directly.
- MEMORY.md is curated long-term memory; daily files are short-lived notes and logs.
- Ask before external/public actions and destructive operations.
- Before answering prior-history questions, search memory files first with `search_memories`.
context_files:
- SOUL.md
- AGENTS.md
- USER.md
- IDENTITY.md
- TOOLS.md
- HEARTBEAT.md
tools:
- openclaw_compat
- memory
- python
memory:
search:
mode: semantic
auto_flush:
enabled: true
```
`context_files`, file memory, and `search_memories` all read this one workspace.
`context_files` paths are relative to it; see [File-Based Context Loading](https://docs.mindroom.chat/configuration/agents/#file-based-context-loading).
## [`openclaw_compat`]
`openclaw_compat` is a preset that belongs in an agent's `tools:` list and expands to `shell`, `coding`, `duckduckgo`, `website`, `browser`, `scheduler`, and `matrix_message`.
`matrix_message` also enables `attachments` and `matrix_room`, so the agent gets all nine tools.
The preset has no callable functions of its own, and listing it next to one of its member tools does not create duplicates.
The preset has no configuration fields and cannot be deferred.
Setting `defer` or `initial` on it fails with `'openclaw_compat' is a preset and cannot be deferred; defer/initial are only valid on individual tools.`
To configure or lazy-load a member tool, list that tool individually, and if you need only one or two of the tools, list them instead of the preset.
## Memory
OpenClaw-style agents use the same memory backends as every other agent; see [Memory System](https://docs.mindroom.chat/memory/) for backends, file layout, semantic search, and auto-flush.
The recommended setup is `memory_backend: file` with `memory.auto_flush.enabled: true`, as in the example above.
With the `file` backend, MindRoom loads `MEMORY.md` into every reply's prompt automatically, so leave it out of `context_files`.
If you switch the agent to `mem0` and still want `MEMORY.md` preloaded, add it to `context_files`.
Use [knowledge bases](https://docs.mindroom.chat/knowledge/) only for non-memory documents that should be searchable as external knowledge.
## Context and history
Preloaded `context_files` are capped by `defaults.max_preload_chars` (default `50000`); see [File-Based Context Loading](https://docs.mindroom.chat/configuration/agents/#file-based-context-loading) for what gets dropped when a workspace exceeds it.
How much conversation history each reply sees is set by `num_history_runs`, `num_history_messages`, and `compaction`; see [History & Compaction](https://docs.mindroom.chat/configuration/history/).
## Room conversations instead of threads
MindRoom replies in Matrix threads by default, while OpenClaw keeps one continuous conversation per room.
To match OpenClaw, especially on mobile or through bridges (Telegram, Signal, WhatsApp), set `thread_mode: room` on the agent; see [Threads, Replies & Participation](https://docs.mindroom.chat/configuration/threads/).
## Privacy
`context_files` and file memory load in every room the agent is in.
If `MEMORY.md` or another workspace file is sensitive, keep the agent in private rooms only, or split it into a private and a public agent and leave the sensitive files out of the public agent's workspace.
## Skills
Skills in `agents/<agent>/workspace/skills/<name>/` load for that agent without being listed in `skills:`, so copying the OpenClaw workspace's `skills/` folder keeps them portable.
To share a skill across agents, install it under `~/.mindroom/skills/<name>/` and add its name to each agent's `skills:` allowlist:
```bash
mkdir -p ~/.mindroom/skills
cp -r /path/to/openclaw-workspace/skills/transcribe ~/.mindroom/skills/
```
Set any environment variables the skill's `SKILL.md` requires, such as `WHISPER_URL`.
See [Skill locations and precedence](https://docs.mindroom.chat/skills/#skill-locations-and-precedence) and [`metadata.openclaw` eligibility gating](https://docs.mindroom.chat/skills/#eligibility-gating-openclaw-metadata) (`os`, `requires`, `always`).
# Configuration
MindRoom is configured through one `config.yaml` file, optionally split across included files, plus environment variables.
This page covers where the file lives, a minimal working configuration, which page owns each top-level section, splitting the file, built-in prompt overrides, and the environment variable reference.
## Configuration File
If `MINDROOM_CONFIG_PATH` is set, MindRoom uses that path, even when no file exists there.
Otherwise, it uses `./config.yaml` in the current working directory if present, then `~/.mindroom/config.yaml`.
Data storage (`mindroom_data/`) is placed next to the config file by default.
Validate a file with:
```bash
mindroom config validate --path /path/to/config.yaml
```
Edits to `config.yaml` apply by hot reload without restarting MindRoom, except [event journal](https://docs.mindroom.chat/deployment/storage/#event-journal) changes, which need a restart.
Edits to an agent's or team's own settings, such as `instructions`, `model`, `tools`, or a team's `mode`, apply from its next reply without restarting it.
Changing `display_name` or `accept_invites`, an agent's `private` settings, whether an agent has the `desktop` tool, or which MCP tools it has restarts that agent or team.
An edit that restarts no agent, team, or router and changes no access, room, or authorization setting, such as a model definition, knowledge base, or agent instruction change, applies within seconds even while agents are replying.
Other edits, including ones that restart an agent or team, an agent's or team's `access` or `rooms`, `administrators`, `authorization`, `room_defaults`, `rooms`, or `router.access`, first wait for active responses to finish, for at most 600 seconds.
To confirm that a reload finished, use [`mindroom config check-applied`](https://docs.mindroom.chat/deployment/config-bundles/#config-fingerprint-and-config-check-applied).
## Minimal Configuration
All top-level sections are optional; configure at least one agent for conversational replies.
This configuration runs one agent in a `lobby` room, with `ANTHROPIC_API_KEY` set in the environment or in the `.env` next to `config.yaml`:
```yaml
models:
default:
provider: anthropic
id: claude-sonnet-5-5
agents:
assistant:
display_name: Assistant
role: A helpful AI assistant
model: default
rooms: [lobby]
timezone: America/Los_Angeles
```
Keep `models.default` configured, because room topic generation and automatic thread summaries fall back to it even when agents, teams, and the router select other models.
## Top-Level Sections
| Section | Purpose | Documented in |
| --- | --- | --- |
| `agents` | Individual AI agents | [Agents](https://docs.mindroom.chat/configuration/agents/) |
| `models` | Model providers and IDs | [Models](https://docs.mindroom.chat/configuration/models/) |
| `teams` | Multi-agent collaboration | [Teams](https://docs.mindroom.chat/configuration/teams/) |
| `router` | Message routing | [Router](https://docs.mindroom.chat/configuration/router/) |
| `defaults` | Fallback values for agent settings and global-only behavior | [Agents — Defaults](https://docs.mindroom.chat/configuration/agents/#defaults) |
| `memory` | Memory backends and embedder | [Memory](https://docs.mindroom.chat/memory/) |
| `knowledge_bases` | File-backed knowledge bases | [Knowledge Bases](https://docs.mindroom.chat/knowledge/) |
| `mcp_servers` | External Model Context Protocol servers | [MCP](https://docs.mindroom.chat/mcp/) |
| `plugins` | Plugin loading | [Plugins](https://docs.mindroom.chat/plugins/) |
| `voice` | Speech-to-text for voice messages | [Voice](https://docs.mindroom.chat/voice/) |
| `calls` | Agents joining Element Call voice calls | [Voice Calls](https://docs.mindroom.chat/voice-calls/#calls-configuration) |
| `administrators`, `authorization`, `bot_accounts` | Platform administrators, command access, bridge aliases, and bridge bots | [Authorization](https://docs.mindroom.chat/authorization/) |
| `room_defaults`, `rooms` | Managed room policy, invitations, and room admins | [Rooms & Spaces](https://docs.mindroom.chat/rooms/#room-policy) |
| `room_models` | Map of managed room name to model name, the authored model default for a room | [Models](https://docs.mindroom.chat/configuration/models/#room_model) (`!room_model`) |
| `room_thread_summary_models` | Map of room alias or Matrix room ID to automatic thread summary model | [Matrix & Attachments](https://docs.mindroom.chat/tools/matrix-and-attachments/#automatic-thread-summaries) |
| `matrix_space` | Root Matrix Space for managed rooms | [Matrix Space](https://docs.mindroom.chat/rooms/#matrix-space) |
| `timezone`, `scheduler_catch_up_grace_seconds` | Scheduled task timezone (default `UTC`) and missed-run catch-up | [Scheduling](https://docs.mindroom.chat/scheduling/) |
| `external_trigger_policy` | Inbound external triggers | [External Triggers](https://docs.mindroom.chat/external-triggers/) |
| `tool_approval` | Human approval for tool calls | [Tool Approval](https://docs.mindroom.chat/tool-approval/#tool-approval) |
| `personal_rooms` | One private room per onboarded user | [Personal Rooms](https://docs.mindroom.chat/personal-rooms/#personal-rooms) |
| `prompts` | Built-in prompt overrides | [Built-In Prompt Overrides](#built-in-prompt-overrides) |
| `matrix_sync` | Matrix sync transport and limits | [Matrix Sync](https://docs.mindroom.chat/matrix/#matrix-sync) |
| `event_journal` | Storage for the Matrix event journal | [Event Journal](https://docs.mindroom.chat/deployment/storage/#event-journal) |
| `debug` | Provider request logging | [Debug Logging](https://docs.mindroom.chat/deployment/operational-log-events/#debug-logging) |
| `mindroom_user` | Internal MindRoom user account | [Internal User](https://docs.mindroom.chat/matrix/#internal-user) |
Optional tools that agents load on demand are configured as described in [Dynamic Tools](https://docs.mindroom.chat/tools/dynamic-tools/), and skills in [Skills](https://docs.mindroom.chat/skills/).
## Splitting the Configuration Into Multiple Files
Large configs can be split across multiple files with Home-Assistant-style include tags.
| Tag | Result |
|-----|--------|
| `!include rel/path.yaml` | The parsed content of that YAML file, with nested include tags resolved recursively |
| `!expand rel/path.yaml` | Splices the file's YAML list into the surrounding list at this item |
| `!include_text rel/path.md` | The file's raw text as a string (one trailing newline stripped), for long prompt or instruction blocks |
| `!include_dir_list rel/dir` | A list with one item per YAML file in the directory |
| `!include_dir_named rel/dir` | A mapping of filename-without-extension to each file's parsed content |
| `!include_dir_merge_list rel/dir` | The concatenation of the lists contained in each file |
| `!include_dir_merge_named rel/dir` | The merge of the mappings contained in each file |
A realistic split keeps each agent in its own file, shared lists in `_`-prefixed snippets, and long prompts in Markdown:
```yaml
# config.yaml
agents: !include_dir_merge_named agents/
models: !include models.yaml
```
```yaml
# agents/researcher.yaml
researcher:
display_name: Researcher
role: Deep research and analysis
model: default
tools:
- !expand _shared/web_tools.yaml
- calculator
instructions:
- !include_text ../prompts/researcher.md
```
```yaml
# agents/_shared/web_tools.yaml
- duckduckgo
- website
- browser
```
Here `tools` resolves to `[duckduckgo, website, browser, calculator]`.
- Relative paths resolve against the directory of the file containing the tag.
- Absolute paths are rejected, and every include must stay inside the top-level config file's directory after symlinks and `..` are resolved.
- Explicit include paths may not contain hidden components starting with `.`, so `!include_text .env` fails.
- Directory includes recurse into subdirectories, take only `.yaml`/`.yml` files in lexicographic order of their relative path, and skip files and directories whose name starts with `.` or `_`.
- YAML anchors cannot cross an include boundary, so share values through `_`-prefixed snippet files.
- `!expand` is only valid as a list item, may appear several times in one list, and splices one level while keeping order and duplicates.
The expanded file must be a YAML list; `[]` adds nothing, while an empty file, `null`, a scalar, or a mapping is an error.
An ordinary `- !include tools.yaml` inserts the included value as one item, and `tools: !include tools.yaml` replaces the whole list.
- An empty included file resolves to `null` under `!include` and contributes nothing to directory includes.
- Include cycles, missing files, duplicate keys across `!include_dir_merge_named` files, and duplicate filename stems under `!include_dir_named` are errors that name the file and line of the failing tag.
Editing any file in the include tree triggers the same hot reload as editing `config.yaml`, and a multi-file update such as `git pull` applies as one reload.
Adding a file to an included directory or deleting an included file does not trigger a reload by itself; save `config.yaml` again (for example with `touch config.yaml`) or restart MindRoom to apply it.
After a failed reload, fixing any file the failed attempt read triggers a retry.
When migrating an existing monolith, diff the fully merged config before and after the split:
```bash
mindroom config resolve > before.yaml
# split config.yaml into include files
mindroom config resolve > after.yaml
diff before.yaml after.yaml
```
When the configuration uses include tags, structured saves from the dashboard and the self-config tools are rejected, so edit the source files instead; the raw config editor still edits the top-level file's text (see [Dashboard](https://docs.mindroom.chat/dashboard/#configurations-split-with-include)).
`MINDROOM_CONFIG_TEMPLATE` copies only the single template file, so a template that uses includes needs its included files shipped next to the config path.
## Built-In Prompt Overrides
Use the optional root `prompts` block to replace MindRoom's built-in prompts, keyed by the prompt's uppercase name:
```yaml
prompts:
HIDDEN_TOOL_CALLS_PROMPT: |
Tool calls are hidden from users.
Answer directly without narrating internal tool use.
ROUTER_AGENT_SELECTION_PROMPT_TEMPLATE: |
Decide which agent or team should respond to this message.
Available agents and teams:
{agents_info}
User message: {message}
Return only the agent or team name.
```
An unknown key fails config validation with an error that lists every allowed prompt name.
Template prompts accept only their own `{field_name}` placeholders, and an unsupported placeholder fails validation with an error that lists the allowed ones.
Placeholders are exact `{field_name}` replacements, not Jinja or Python `str.format`, so `{message.text}`, `{message!r}`, and `{message:.2f}` are rejected.
Escape literal braces as `{{` and `}}` in overrides that use placeholders.
Changed overrides apply through hot reload.
Changing a prompt that agents build in when they start, such as `HIDDEN_TOOL_CALLS_PROMPT` or `AGENT_IDENTITY_CONTEXT_TEMPLATE`, restarts every agent, team, and the router; other prompt changes apply without restarts.
## Environment Variables
Set variables in the process environment or in the `.env` file next to `config.yaml`; the process environment wins.
`MINDROOM_CONFIG_PATH`, `LOG_LEVEL`, `MINDROOM_LOGGER_LEVELS`, `MINDROOM_LOG_FORMAT`, `NO_COLOR`, and [`MINDROOM_TIMING`](https://docs.mindroom.chat/deployment/operational-log-events/#debug-logging) are read only from the process environment, so the `.env` file does not set them.
Container `env_file`/`--env-file` injection sets process variables and therefore works.
### Core
| Variable | Description | Default |
|----------|-------------|---------|
| `MINDROOM_CONFIG_PATH` | Path to `config.yaml` | `./config.yaml`, then `~/.mindroom/config.yaml` |
| `MINDROOM_STORAGE_PATH` | Data storage directory | `mindroom_data/` next to config |
| `MINDROOM_SESSION_STORAGE_PATH` | Separate root for agent and team session databases; relative paths resolve from the config directory, and other state stays under `MINDROOM_STORAGE_PATH` (see [Storage](https://docs.mindroom.chat/deployment/storage/)) | `MINDROOM_STORAGE_PATH` |
| `MINDROOM_CONFIG_TEMPLATE` | File copied to the config path when `config.yaml` does not exist, used by Docker images to seed config | _(unset)_ |
| `MINDROOM_CREDENTIALS_ENCRYPTION_KEY` | Key for encrypted-at-rest credential files (see [Credential Storage Encryption](https://docs.mindroom.chat/oauth-framework/#credential-storage-encryption)) | _(unset)_ |
| `LOG_LEVEL` | Logging level for `mindroom run` (`DEBUG`, `INFO`, `WARNING`, `ERROR`); `mindroom run --log-level` takes precedence | `INFO` |
| `MINDROOM_LOGGER_LEVELS` | Comma- or semicolon-separated logger level overrides, for example `mindroom:DEBUG,httpx:WARNING,nio:WARNING` | _(unset)_ |
| `MINDROOM_LOG_FORMAT` | `text` for readable logs or `json` for structured logs | `text` |
| `NO_COLOR` | Any nonempty value disables console colors and styled tracebacks; installed background services set this to `1` | _(unset)_ |
### Matrix
| Variable | Description | Default |
|----------|-------------|---------|
| `MATRIX_HOMESERVER` | Matrix homeserver URL | `http://localhost:8008` |
| `MATRIX_SERVER_NAME` | Server name for federation | _(derived from homeserver)_ |
| `MATRIX_SSL_VERIFY` | Set to `false` for a dev or self-signed homeserver; it covers `MATRIX_HOMESERVER` and its MatrixRTC voice-call requests, never the provisioning service or other homeservers (see [TLS Trust](https://docs.mindroom.chat/matrix/#tls-trust)) | `true` |
| `MATRIX_REGISTRATION_TOKEN` | Registration token for creating managed agent accounts on a self-hosted homeserver | _(unset)_ |
| `MATRIX_REGISTRATION_SHARED_SECRET`, `MATRIX_REGISTRATION_SHARED_SECRET_FILE` | Synapse shared registration secret, or a file containing it, for creating managed agent accounts without pairing | _(unset)_ |
| `MATRIX_MANAGED_ACCOUNT_AUTH` | `password` or `appservice` authentication for accounts MindRoom creates and operates (see [Agent Users](https://docs.mindroom.chat/matrix/#agent-users)) | `password` |
| `MATRIX_APPSERVICE_TOKEN`, `MATRIX_APPSERVICE_TOKEN_FILE` | Application-service token, or a file containing it, used when `MATRIX_MANAGED_ACCOUNT_AUTH=appservice` | _(unset)_ |
| `MINDROOM_MATRIX_HOMESERVER_STARTUP_TIMEOUT_SECONDS` | Seconds to wait at startup for the homeserver to respond (`0` waits indefinitely); a certificate verification failure stops startup immediately | _(wait indefinitely)_ |
| `MINDROOM_MATRIX_SYNC_STARTUP_TIMEOUT_SECONDS` | Positive seconds allowed for the first Matrix sync response | `600` |
| `MINDROOM_MATRIX_INGESTION_GRACE_SECONDS` | Positive seconds the sync watchdog and `/api/health` keep waiting while event catch-up is still making progress; set it above the deployment's observed healthy catch-up time | `600` |
Hosted pairing variables written by `mindroom connect` are described in [Hosted Matrix](https://docs.mindroom.chat/deployment/hosted-matrix/#connect), and desktop setup variables in [Desktop](https://docs.mindroom.chat/tools/desktop/).
### Model Providers
Provider API keys such as `ANTHROPIC_API_KEY` and `OPENAI_API_KEY`, their `_FILE` variants, and Vertex AI and Bedrock settings are listed in [Models — Environment Variables](https://docs.mindroom.chat/configuration/models/#environment-variables), and `codex login` and `CODEX_HOME` in [Codex Models with ChatGPT Login](https://docs.mindroom.chat/configuration/models/#codex-models-with-chatgpt-login).
Provider keys from the environment or `.env` are also copied into the shared credentials store, as described in [Automatic Credential Import](https://docs.mindroom.chat/oauth-framework/#automatic-credential-import).
| Variable | Description |
|----------|-------------|
| `OPENAI_BASE_URL` | Base URL for `provider: openai` models, such as a local inference server; a model's `extra_kwargs.base_url` overrides it, and `extra_kwargs.client_params.base_url` overrides both |
### Dashboard and API
| Variable | Description | Default |
|----------|-------------|---------|
| `MINDROOM_API_KEY` | API key for dashboard/API requests; `mindroom config init` and first-run `mindroom run` add a generated key to `.env` when it has none; unset or empty means open access | _(none)_ |
| `MINDROOM_PORT` | Port in the default OAuth callback URL when `MINDROOM_PUBLIC_URL` and `MINDROOM_BASE_URL` are unset, also read by deployment tooling; set the API server bind port with `mindroom run --api-port` instead | `8765` |
| `MINDROOM_DASHBOARD_ALLOWED_HOSTS` | Comma-separated extra host names that unauthenticated dashboard or `/v1` requests may address (see [Authorization](https://docs.mindroom.chat/authorization/#unauthenticated-dashboard-host-names)) | _(none)_ |
| `MINDROOM_DASHBOARD_CORS_ALLOWED_ORIGINS` | Comma-separated origins allowed credentialed dashboard CORS responses; cookie and trusted-upstream mutations still require the app's own origin | `http://localhost:3003`, `http://localhost:5173`, `http://127.0.0.1:3003`, `http://127.0.0.1:5173`, or the hosted public origins when `MINDROOM_PUBLIC_URL` is set |
| `MINDROOM_DASHBOARD_CORS_ALLOW_ALL_ORIGINS` | `true` allows every dashboard API origin while disabling credentialed CORS responses; without dashboard authentication, origins outside `MINDROOM_DASHBOARD_ALLOWED_HOSTS` are still refused | _(unset)_ |
| `MINDROOM_ENABLE_API_DOCS` | `false` hides the generated API docs at `/docs`, `/redoc`, and `/openapi.json` | `true` (`false` on hosted platform instances) |
| `OPENAI_COMPAT_API_KEYS` | Comma-separated API keys for `/v1/*` requests (see [OpenAI-Compatible API](https://docs.mindroom.chat/openai-api/)) | _(none; `/v1` is locked without this or the flag below)_ |
| `OPENAI_COMPAT_ALLOW_UNAUTHENTICATED` | `true` allows unauthenticated `/v1/*` access for local development only | _(unset)_ |
| `OPENAI_COMPAT_API_KEY_REQUESTERS` | JSON object mapping `/v1` API keys to Matrix user IDs (see [Requester identities](https://docs.mindroom.chat/openai-api/#requester-identities-and-delegation)) | _(none)_ |
| `MINDROOM_AUTO_BUILD_FRONTEND` | Set to `0` to skip the automatic dashboard frontend build | _(enabled)_ |
### Workers and Background Scripts
| Variable | Description | Default |
|----------|-------------|---------|
| `MINDROOM_NAMESPACE` | Installation namespace for Matrix identity isolation (4–32 lowercase alphanumeric chars) | _(none)_ |
| `MINDROOM_NO_AUTO_INSTALL_TOOLS` | `1`/`true`/`yes` disables automatic tool dependency installation | _(unset; auto-install enabled)_ |
| `MINDROOM_WORKER_BACKEND` | Worker backend for tool execution (`static_runner`, `docker`, or `kubernetes`) | `static_runner` |
| `MINDROOM_SANDBOX_PROXY_URL` | Sandbox proxy endpoint URL (static runner) | _(none)_ |
| `MINDROOM_SANDBOX_PROXY_TOKEN` | Auth token for the sandbox proxy | _(none)_ |
| `MINDROOM_SCRIPT_GATEWAY_URL` | Worker-reachable background-script gateway base URL, including `/api/script-gateway` | _(none)_ |
| `MINDROOM_SCRIPT_GATEWAY_PORT` | Port for a second listener that serves only the script gateway and Agent CLI routes | _(none)_ |
| `MINDROOM_SCRIPT_GATEWAY_ISOLATED` | `true` attests that the Kubernetes script-gateway listener exposes only the gateway and Agent CLI routes | `false` |
| `MINDROOM_KUBERNETES_DEFAULT_SCRIPT_RESOURCE_PROFILE` | Default Kubernetes background-script profile (`small`, `standard`, or `large`) when `start_script` omits `resource_profile` | `small` |
| `MINDROOM_KUBERNETES_SCRIPT_RESOURCE_PROFILES_JSON` | JSON object defining CPU and memory requests and limits for the `small`, `standard`, and `large` profiles | Built-in profiles |
| `MINDROOM_SCRIPT_RETENTION_SECONDS` | Positive seconds to retain finished background-script runs, tool-call receipts, and approval records | `2592000` (30 days) |
See [Background Scripts](https://docs.mindroom.chat/tools/background-scripts/#worker-and-network-requirements) for when each script gateway variable is required, and [Sandbox Proxy](https://docs.mindroom.chat/deployment/sandbox-proxy/#environment-variable-reference) for the other `MINDROOM_SANDBOX_*` and Kubernetes worker variables.
Credential seed variables are described in [Credential Seeds](https://docs.mindroom.chat/oauth-framework/#credential-seeds).
# Agent Configuration
This page covers the `agents:` section of `config.yaml`, where each agent is one AI actor with its own model, tools, rooms, and instructions.
It also covers requester-private agents, files preloaded into an agent's prompt, naming rules, and the `defaults:` section that every agent inherits from.
## Basic Agent
```yaml
agents:
assistant:
display_name: Assistant
role: A helpful AI assistant
model: sonnet
rooms: [lobby]
```
The key (`assistant`) is the agent's name, `model` names an entry under `models:`, and `rooms` lists the rooms the agent joins.
A coding agent that runs its code tools in a worker, preloads workspace notes, and replies as plain room messages in a bridged room:
```yaml
agents:
developer:
display_name: Developer
role: Generate code, manage files, execute shell commands
model: sonnet
tools:
- file
- github
- shell:
extra_env_passthrough: "DAWARICH_*"
worker_tools: [shell, file]
instructions:
- Always read files before modifying them
context_files: [AGENTS.md, USER.md]
rooms: [lobby, dev, bridge_telegram]
room_thread_modes:
bridge_telegram: room
access:
members_of_rooms: [dev]
delegate_to: [research]
```
To keep `defaults.tools` away from one agent:
```yaml
agents:
researcher:
display_name: Researcher
role: Focus on deep research
include_default_tools: false
tools: [duckduckgo]
```
## Configuration Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `display_name` | string | *required* | Name shown in Matrix |
| `role` | string | `""` | System prompt describing the agent's purpose and expertise |
| `model` | string | `"default"` | Key of an entry under `models:` |
| `tools` | list | `[]` | Tool names or single-key dicts with per-agent overrides; see [Tools](https://docs.mindroom.chat/tools/) and [Per-Agent Tool Configuration](https://docs.mindroom.chat/tools/#per-agent-tool-configuration). The agent gets these plus `defaults.tools`, without duplicates |
| `include_default_tools` | bool | `true` | Set `false` to leave out `defaults.tools` and its overrides for this agent |
| `skills` | list | `[]` | Skill names the agent can use; see [Skills](https://docs.mindroom.chat/skills/) |
| `skill_learning` | object | disabled | [Automatic skill learning](https://docs.mindroom.chat/skills/#settings), separate from `learning` |
| `instructions` | list | `[]` | Extra lines appended to the system prompt after the role |
| `minimal_instructions` | list | `[]` | Guidance included on every minimal-mode request; see [Prompt and `minimal_instructions`](https://docs.mindroom.chat/tools/agent-cli/#prompt-and-minimal_instructions) |
| `rooms` | list | `[]` | Room keys, aliases, or Matrix room IDs to join; missing managed rooms are created (see [Rooms](https://docs.mindroom.chat/rooms/)) |
| `accept_invites` | bool or list | `true` | `true` accepts every room invitation, `false` or `[]` accepts none, and a list accepts only inviters matching an exact or wildcard Matrix user ID. Rooms joined this way are kept across restarts. Joining a room never grants its members access; see [Authorization](https://docs.mindroom.chat/authorization/) |
| `access` | object | `null` | Who may converse with the agent: `current_room_members`, `members_of_rooms`, and `users`. When omitted, members of the agent's own managed `rooms` have access. See [Responder access](https://docs.mindroom.chat/authorization/#responder-access) |
| `credential_managers` | list | `[]` | Concrete Matrix user IDs (no wildcards) allowed to manage this agent's credentials and shared OAuth connections; grants no conversation access. See [OAuth](https://docs.mindroom.chat/oauth-framework/) |
| `participation` | object | `null` | Opt into adaptive replies in existing multi-human threads; see [Adaptive Participation](https://docs.mindroom.chat/configuration/threads/#adaptive-participation) |
| `mid_turn` | object | `null` | Judge whether messages queued during a response can wait until it finishes; see [Mid-Turn Coalescing](https://docs.mindroom.chat/configuration/threads/#mid-turn-coalescing) |
| `thread_mode` | string | `"thread"` | `thread` replies in Matrix threads; `room` sends plain room messages with one continuous conversation per room, which suits bridges (Telegram, Signal, WhatsApp) and mobile clients |
| `room_thread_modes` | map | `{}` | Per-room `thread` or `room` overrides keyed by room key, alias, or Matrix room ID; see [Thread Mode Resolution](https://docs.mindroom.chat/configuration/threads/#thread-mode-resolution) |
| `markdown` | bool | `null` | Instruct the agent to format replies as Markdown |
| `learning` | bool | `null` | Enable [Agno Learning](https://docs.mindroom.chat/memory/#agno-learning), a persistent profile of user preferences |
| `learning_mode` | string | `null` | `always` learns after every turn; `agentic` lets the agent decide through a tool call |
| `memory_backend` | string | `null` | `mem0`, `file`, or `none`, overriding `memory.backend`; `none` disables memory but not `learning`. See [Memory](https://docs.mindroom.chat/memory/) |
| `memory_search` | object | `null` | File-memory search override (`mode`, `include`, `include_entrypoint`) when the backend is `file`; omitted fields inherit `memory.search`. See [Searching file memory](https://docs.mindroom.chat/memory/#searching-file-memory) |
| `automations` | list | `null` | Built-in automations such as `prompt_curation`; `null` inherits `defaults.automations` for shared file-memory agents and `[]` turns them off. See [Built-in Automations](https://docs.mindroom.chat/scheduling/#built-in-automations) |
| `knowledge_bases` | list | `[]` | Keys under top-level `knowledge_bases`, each at most once; see [Knowledge Bases](https://docs.mindroom.chat/knowledge/) |
| `context_files` | list | `[]` | Workspace files preloaded into the prompt; see [File-Based Context Loading](#file-based-context-loading) |
| `private` | object | `null` | Give each requester a separate copy of the agent's state; see [Private Instances](#private-instances) |
| `num_history_runs`, `num_history_messages`, `compress_tool_results`, `max_tool_calls_from_history` | | | See [History Settings](https://docs.mindroom.chat/configuration/history/#history-settings) |
| `compaction` | object | `defaults.compaction` | Per-agent compaction overrides; `enabled: false` turns automatic compaction off. See [Agent Compaction Settings](https://docs.mindroom.chat/configuration/history/#agent-compaction-settings) |
| `max_tool_calls_per_turn` | int, >= 1 | `null` | Tool calls one turn may execute. Further calls return a tool error, and after this many plus two model requests the turn ends with the text produced so far, which also stops loops of unknown or malformed tool calls |
| `show_tool_calls` | bool | `null` | Show tool-call markers and trace metadata in Matrix messages; see [Tool Calls During Streaming](https://docs.mindroom.chat/streaming/#tool-calls-during-streaming) |
| `worker_tools` | list | `null` | Tools to run in an isolated worker instead of the primary process; `[]` runs everything in the primary process. When unset here and in `defaults`, the deployment's [execution mode](https://docs.mindroom.chat/deployment/sandbox-proxy/#execution-modes) decides. See [Worker Routing](https://docs.mindroom.chat/deployment/sandbox-proxy/#worker-routing) |
| `worker_scope` | string | `null` | How worker runtimes are shared: `shared` (one per agent), `user` (one per user, across agents), or `user_agent` (one per user and agent). Not allowed together with `private`. See [Worker scopes](https://docs.mindroom.chat/deployment/sandbox-proxy/#worker-scopes) |
| `file_access` | string | `null` | `workspace` limits path-taking tools such as `file`, `coding`, `attachments`, and `matrix_message` to the agent workspace and its attachments; `unrestricted` allows any path the tool's process can reach. `shell`, `python`, and other code-execution tools are never confined; isolate them with `worker_tools`. See [File access](https://docs.mindroom.chat/architecture/security-posture/#file-access) |
| `allow_self_config` | bool | `null` | Give the agent a tool to read and change its own entry under `agents:`; see [`self_config`](https://docs.mindroom.chat/tools/agent-orchestration/#self_config) |
| `delegate_to` | list | `[]` | Agents this agent may run as subagents, including itself only when listed; see [Agent Delegation](https://docs.mindroom.chat/tools/agent-orchestration/#agent-delegation) |
| `thread_exports` | bool or object | `null` | Keep YAML exports of the agent's threads under `<workspace>/thread_exports/`; `true` uses the defaults. See [Thread Exports](https://docs.mindroom.chat/thread-exports/#thread-exports) |
Unset fields that appear in the inheritance table under [Defaults](#defaults) take the `defaults` value; a per-agent value overrides it.
`memory_backend` and `memory_search` inherit from the top-level `memory:` section instead.
## Private Instances
Use `private` when one shared agent definition should give each requester their own workspace, file memory, and knowledge index.
The YAML stays shared, while each requester's files live in their own private root.
```yaml
knowledge_bases:
company_docs:
path: ./company_docs
watch: false
agents:
mind:
display_name: Mind
role: A persistent personal AI companion
model: sonnet
tools: [file, shell]
worker_tools: [file, shell]
memory_backend: file
private:
per: user
root: mind_data
template_dir: ./mind_template
context_files: [SOUL.md, USER.md, MEMORY.md]
knowledge:
path: memory
watch: false
knowledge_bases: [company_docs]
```
Here every user gets their own `mind_data/` root, seeded from `./mind_template/` (for example `SOUL.md`, `USER.md`, `MEMORY.md`, and a `memory/` folder), while `company_docs` stays shared by everyone.
Private roots live at `<storage>/private_instances/<requester scope>/<agent>/<private.root>/`, not next to `config.yaml`, and dedicated workers mount only that root.
How a private agent behaves:
- The template directory is copied into each new private root, and template files added later are copied in without overwriting requester edits.
- The private root is created even without a template.
- `private.context_files` load from the private root; agent-level `context_files` still load from the shared agent workspace.
- With `memory_backend: file`, the private root is the requester's file-memory root; with any other backend, private files exist but are not file memory, and `none` turns memory off.
- Nothing is enabled implicitly: set `memory_backend`, `private.context_files`, and `private.knowledge` explicitly for whatever the template provides; the file names are up to you.
- Because `private.per` sets the agent's worker scope, configuring both `private` and `worker_scope` fails with `Private agents derive their execution scope from private.per; configure private or worker_scope, not both`.
- Private agents cannot be configured as team members, and a shared team member cannot reach one through `delegate_to`.
Tagging a private agent together with other agents in a message still forms an ad hoc team for that requester.
- A private agent runs only for a known requester; otherwise it fails with `Private agent '<name>' requires an active execution identity to resolve requester-local state`.
### Private Fields
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `private.per` | `user` or `user_agent` | *required* | Requester boundary that gets its own private instance; it also sets the agent's [worker scope](https://docs.mindroom.chat/deployment/sandbox-proxy/#worker-scopes) |
| `private.root` | string | `<agent_name>_data` | Relative directory name of the private root; cannot be absolute, contain `..`, or start with `sessions`, `learning`, `chroma`, `knowledge_db`, `memory_files`, `calls`, `agent_modes.json`, `agent_modes.lock`, `browser`, `browser-profiles`, or `.sessions-recovery.lock` |
| `private.template_dir` | string | `null` | Directory copied into each private root; relative paths resolve from `config.yaml`, absolute paths are allowed, and a missing directory is a config error (`Agent '<name>' has invalid private.template_dir`) |
| `private.context_files` | list | `null` | Private-root-relative files preloaded into the prompt; cannot escape the private root |
| `private.knowledge` | object | `null` | Per-requester knowledge index built from the private root; see [Private Agent Knowledge](https://docs.mindroom.chat/knowledge/#private-agent-knowledge). Omit it or set `enabled: false` for no index |
| `private.knowledge.enabled` | bool | `true` | Whether to index private knowledge |
| `private.knowledge.description` | string | `""` | What the private knowledge contains, shown to the agent in the `search_knowledge_base` tool description |
| `private.knowledge.path` | string | *required* when enabled | Knowledge directory relative to the private root (`.` allowed) |
| `private.knowledge.watch` | bool | `true` | Refresh the index in the background on access; when `false`, external edits need an explicit refresh |
| `private.knowledge.chunk_size` | int | `5000` | Maximum characters per indexed chunk (min: 128) |
| `private.knowledge.chunk_overlap` | int | `0` | Overlapping characters between adjacent chunks; must be smaller than `chunk_size` |
| `private.knowledge.git` | object | `null` | Git sync, with the same schema as `knowledge_bases.<id>.git`; needs a dedicated `path` subtree, see [Private Agent Knowledge](https://docs.mindroom.chat/knowledge/#private-agent-knowledge) |
## File-Based Context Loading
`context_files` inlines files into the agent's prompt under a `Personality Context` section, without a knowledge base.
- Paths are relative to the agent's workspace, `agents/<name>/workspace/` in the storage directory; absolute paths and `..` are rejected.
With `memory_backend: file`, the same workspace holds the agent's file memory.
- Files load in list order, each headed by its resolved path so the agent knows where to edit it.
- Missing files are skipped with a warning in the logs.
- Edits take effect on the next reply without a restart.
`defaults.max_preload_chars` (default `50000`) caps the section.
When it is exceeded, MindRoom drops whole files from the start of the list first and then trims the last remaining file from its end.
Each affected file keeps its path and a marker with the omitted character count, so the agent can open the file for the rest.
A cap too small to hold the headings and markers fails with `max_preload_chars=<n> cannot fit required context headings and omission markers`.
## Naming Rules
Agent and team keys may contain only letters, digits, and underscores (`^[a-zA-Z0-9_]+$`).
The same key cannot appear under both `agents:` and `teams:`.
`router`, `user`, and `_shared` are reserved.
## Defaults
The `defaults` section sets values every agent inherits unless it sets its own, plus global-only settings that cannot be overridden per agent.
```yaml
defaults:
tools: [scheduler]
learning_mode: agentic
max_tool_calls_per_turn: 200
worker_tools: [shell, file, python]
enable_streaming: true
max_preload_chars: 50000
```
These defaults apply to each agent that leaves the same field unset:
| Field | Default |
|-------|---------|
| `markdown` | `true` |
| `learning` | `true` |
| `learning_mode` | `always` |
| `num_history_runs`, `num_history_messages`, `max_tool_calls_from_history` | `null` (no limit) |
| `compress_tool_results` | `false` |
| `compaction` | enabled; see [Agent Compaction Settings](https://docs.mindroom.chat/configuration/history/#agent-compaction-settings) |
| `max_tool_calls_per_turn` | `1000` |
| `show_tool_calls` | `true` |
| `worker_tools` | `null` (the deployment's execution mode decides) |
| `worker_scope` | `null` |
| `file_access` | `workspace` |
| `allow_self_config` | `false` |
| `automations` | `[]`; private and non-file-memory agents never inherit them. See [Built-in Automations](https://docs.mindroom.chat/scheduling/#built-in-automations) |
`defaults.tools` (default `[scheduler]`) is added to every agent with `include_default_tools: true`; set it to `[]` to add nothing.
It accepts the same per-tool overrides as `agents.<name>.tools`.
These settings are global-only:
| Field | Default | Description |
|-------|---------|-------------|
| `enable_streaming` | `true` | Show replies as progressive message edits; see [Streaming](https://docs.mindroom.chat/streaming/#configuration) |
| `streaming` | see [Streaming](https://docs.mindroom.chat/streaming/#configuration) | Timing settings for progressive edits |
| `large_message_strategy` | `sidecar` | Oversized replies as a preview with the full text attached (`sidecar`) or as several complete messages (`split`); see [Large Messages](https://docs.mindroom.chat/streaming/#large-messages) |
| `coalescing.debounce_ms` | `1000` | Milliseconds (>= 0) to wait after media for more attachments or a trailing caption before replying; text replies immediately |
| `show_stop_button` | `true` | Add a 🛑 reaction while an agent responds; see [Stop Button](https://docs.mindroom.chat/chat-commands/#stop-button) |
| `max_consecutive_agent_replies` | `50` | Consecutive agent or team messages (>= 1) before agents stop waking each other; see [Agents mentioning other agents](https://docs.mindroom.chat/authorization/#agents-mentioning-other-agents) |
| `max_preload_chars` | `50000` | Cap (>= 1) on preloaded context files; see [File-Based Context Loading](#file-based-context-loading) |
| `tool_output_auto_save_threshold_bytes` | `51200` | Larger tool outputs are saved to the workspace; see [Workspace and tool output files](https://docs.mindroom.chat/tools/execution-and-coding/#workspace-and-tool-output-files) |
| `worker_grantable_credentials` | `null` | Shared credential services available inside isolated workers (`null` grants none); Google OAuth client and token services and `google_vertex_adc` cannot be granted. See [Credential leases](https://docs.mindroom.chat/deployment/sandbox-proxy/#credential-leases) |
| `thread_summary_model`, `thread_summary_temperature`, `thread_summary_first_threshold`, `thread_summary_subsequent_interval` | `null`, `0.2`, `1`, `10` | Automatic thread summaries; see [Automatic Thread Summaries](https://docs.mindroom.chat/tools/matrix-and-attachments/#automatic-thread-summaries) |
# Model Configuration
The `models` section names the AI providers and model IDs that agents, teams, and the router use.
This page covers model fields, provider credentials, provider-specific setup, request tuning, and switching models from chat.
The same model can have different IDs on different providers; check the [OpenAI](https://developers.openai.com/api/docs/models), [Claude](https://platform.claude.com/docs/en/models/overview), [Gemini](https://ai.google.dev/gemini-api/docs/models), and [OpenRouter](https://openrouter.ai/api/v1/models) catalogs.
## Supported Providers
- `anthropic` - Claude models (Anthropic)
- `bedrock_claude` - Anthropic Claude models on Amazon Bedrock
- `azure` - OpenAI models through Azure OpenAI deployments
- `openai` - GPT models and OpenAI-compatible endpoints
- `codex` or `openai_codex` - OpenAI models available through a local Codex CLI ChatGPT login
- `kimi` or `kimi_code` - Kimi models available through a local Kimi Code CLI login
- `google` or `gemini` - Google Gemini models
- `vertexai_claude` - Anthropic Claude models on Google Vertex AI
- `ollama` - Local models via Ollama
- `llama_cpp` - Local models through an OpenAI-compatible llama.cpp server
- `groq` - Groq-hosted models (fast inference)
- `openrouter` - OpenRouter-hosted models (access to many providers)
- `cerebras` - Cerebras-hosted models
- `deepseek` - DeepSeek models
- `zai` - Z.ai GLM models
- `synthetic` - Built-in Lorem Ipsum model for local conversations and load generation
To generate a starter config for one provider, use `mindroom config init --provider <preset>` (see [Getting Started](https://docs.mindroom.chat/getting-started/)).
The [macOS app's local model setup](https://docs.mindroom.chat/installation/macos-app/#local-ai-models) downloads and runs models with one click, with hardware recommendations including Qwen3.8 27B when memory permits.
## Model Config Fields
| Field | Required | Default | Description |
|-------|----------|---------|-------------|
| `provider` | Yes | - | The AI provider (see supported providers above) |
| `id` | Yes | - | Model ID specific to the provider; for Azure OpenAI, the deployment name |
| `display_name` | No | `null` | Friendly model name shown in clients |
| `icon` | No | `null` | Image path relative to the config file's directory, or a Matrix `mxc://` URI |
| `api` | No | `null` | `responses` or `chat_completions`; valid only with `provider: openai` (see [OpenAI API Models](#openai-api-models)); unset selects automatically |
| `host` | No | `null` | Host URL for self-hosted models (e.g., Ollama) |
| `api_key` | No | `null` | Model-specific API key used instead of the provider's shared key; equivalent to `extra_kwargs.api_key` |
| `extra_kwargs` | No | `null` | Additional provider-specific parameters (see [Extra Kwargs](#extra-kwargs)) |
| `context_window` | No | `null` | Provider context window in tokens, at least 1; budgets history replay and compaction (see [Context Window](https://docs.mindroom.chat/configuration/history/#context-window)); a `compaction.model` or `compaction.fallback_model` needs its own value |
| `stream_idle_timeout_seconds` | No | `null` | Seconds a streamed request may go without a provider event before it counts as stalled, at least 0; `0` disables the limit (see [Stalled Streams](#stalled-streams)) |
The mapping key, such as `default` below, is the stable name agents, teams, the router, and commands use.
`display_name` and `icon` only change how clients show the model and are never sent to the provider:
```yaml
models:
default:
provider: openai
id: gpt-6-astra
display_name: Quick helper
icon: icons/helper.png
```
A local `icon` must be a PNG, JPEG, WebP, or GIF image of at most 1 MiB inside the config file's directory; absolute paths fail validation.
A missing, unreadable, unsupported, or out-of-directory image falls back to the client's provider icon and does not prevent startup.
External image URLs are not fetched.
Blank `display_name` or `icon` values count as unset.
## Configuration Examples
```yaml
models:
# Anthropic Claude
sonnet:
provider: anthropic
id: claude-sonnet-5-5
context_window: 1000000
haiku:
provider: anthropic
id: claude-haiku-4-5
context_window: 200000
# OpenAI
gpt:
provider: openai
id: gpt-6-astra
context_window: 1050000
# Google Gemini (both 'google' and 'gemini' work as provider names)
gemini:
provider: google
id: gemini-3.8-flash
context_window: 1048576
# Anthropic Claude on Vertex AI
vertex_claude:
provider: vertexai_claude
id: claude-sonnet-5-5
extra_kwargs:
project_id: your-gcp-project
region: global
# Local via Ollama
local:
provider: ollama
id: qwen3.8:27b
context_window: 256000
host: http://localhost:11434
# OpenRouter (access to many model providers)
openrouter:
provider: openrouter
id: anthropic/claude-sonnet-5.5
# Groq (fast inference; Qwen3.8 is a preview model)
groq:
provider: groq
id: qwen/qwen3.8-27b
context_window: 131042
# Cerebras (65,536 tokens on the free tier; paid plans support 131,072)
cerebras:
provider: cerebras
id: qwen-3.8-27b
context_window: 65536
# DeepSeek
deepseek:
provider: deepseek
id: deepseek-v4-pro
context_window: 1048576
# Z.ai GLM Coding Plan (OpenAI Chat Completions endpoint)
glm:
provider: zai
id: glm-5.3
context_window: 1048576
stream_idle_timeout_seconds: 300 # hosted service behind a custom endpoint; see Stalled Streams
extra_kwargs:
base_url: https://api.z.ai/api/coding/paas/v4
# Custom OpenAI-compatible endpoint (e.g., vLLM, llama.cpp server)
custom:
provider: openai
id: my-model
extra_kwargs:
base_url: http://localhost:8080/v1
```
Azure, Bedrock, Codex, and Kimi examples are in their own sections below.
Claude Fable 5.1 uses `claude-fable-5-1` on Anthropic, `anthropic.claude-fable-5-1` on Bedrock, and `anthropic/claude-fable-5.1` on OpenRouter.
Claude Opus 5.5 and Sonnet 5.5 use `claude-opus-5-5` and `claude-sonnet-5-5` on Anthropic and Vertex AI, `anthropic.claude-opus-5-5` and `anthropic.claude-sonnet-5-5` on Bedrock, and `anthropic/claude-opus-5.5` and `anthropic/claude-sonnet-5.5` on OpenRouter.
For the direct DeepSeek API, use `deepseek-flash` for V4.1 Flash or `deepseek-v4-pro` for Pro; the older `deepseek-v4-flash` name is a [temporary compatibility route to V4.1 Flash](https://api-docs.deepseek.com/updates/#date-2026-09-10).
OpenRouter uses the distinct ID `deepseek/deepseek-v4.1-flash`.
[GLM 5.3](https://docs.z.ai/guides/llm/glm-5.3) is available through the GLM Coding Plan endpoint shown above.
The [Qwen3.8-27B model card](https://huggingface.co/Qwen/Qwen3.8-27B) and each hosting provider document their own context limits.
### Claude 5.5 and Fable 5.1 Limits
Fable 5.1, Opus 5.5, and Sonnet 5.5 follow the same [tool-choice rules](https://platform.claude.com/docs/en/models/opus-5-5/migration-guide): `auto` and `none` are allowed, while forcing `any` or a named tool returns an error.
They reject `thinking: {type: disabled}` and manual `budget_tokens`; lower effort with `extra_kwargs.output_config: {effort: low}` instead, or use `extra_kwargs.thinking: {type: between_tools}` on [Sonnet 5.5](https://platform.claude.com/docs/en/models/sonnet-5-5/whats-new-sonnet-5-5#turn-off-up-front-thinking).
With adaptive thinking, the notes these models write between tool calls are hidden, so responses show tool traces without that narration; Sonnet 5.5's `between_tools` setting returns those notes as text.
## Environment Variables
Provider credentials come from environment variables, stored credentials, CLI logins, or a model-specific key.
A model uses the key saved for it in the dashboard's **Models** editor first, then `api_key` or `extra_kwargs.api_key` from its config, then the provider's shared key from the environment or credential store.
Setting both `api_key` and `extra_kwargs.api_key` is a validation error, and a blank key counts as unset.
A model whose `extra_kwargs` authenticate another way (`auth_token` for `anthropic`, `azure_ad_token` or `azure_ad_token_provider` for `azure`, or `vertexai: true` for `google` and `gemini`) never receives the shared key, although the provider SDK may still read `ANTHROPIC_API_KEY` or `AZURE_OPENAI_API_KEY` from the process environment.
`codex`, `kimi`, `bedrock_claude`, `vertexai_claude`, and `synthetic` models authenticate without an API key and ignore a configured one.
Shared API keys are read from these variables:
```bash
ANTHROPIC_API_KEY=sk-ant-...
AZURE_OPENAI_API_KEY=...
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
# Optional, only when overriding the default Azure OpenAI API version:
# AZURE_OPENAI_API_VERSION=2024-10-21
# Optional Azure deployment for the client:
# AZURE_OPENAI_DEPLOYMENT=...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=...
GROQ_API_KEY=...
OPENROUTER_API_KEY=...
CEREBRAS_API_KEY=...
DEEPSEEK_API_KEY=...
ZAI_API_KEY=...
```
For Amazon Bedrock Claude, use standard AWS credential resolution:
```bash
AWS_REGION=us-east-1 # AWS_DEFAULT_REGION is used when AWS_REGION is unset
# Optional static credentials:
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AWS_SESSION_TOKEN=...
# Optional local profile instead:
AWS_PROFILE=...
```
Without static credentials or a profile, Bedrock uses the runtime IAM role.
For Ollama, you can also set:
```bash
OLLAMA_HOST=http://localhost:11434
```
For Vertex AI Claude, set these instead of an API key:
```bash
ANTHROPIC_VERTEX_PROJECT_ID=your-gcp-project
CLOUD_ML_REGION=global
# Optional custom Vertex AI endpoint:
# ANTHROPIC_VERTEX_BASE_URL=https://...
```
For `claude-sonnet-5-5`, use the [global endpoint or a supported multi-region endpoint](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai#global-multi-region-and-regional-endpoints), with `region` / `CLOUD_ML_REGION` set to `global`, `us`, or `eu`.
Authenticate with `gcloud auth application-default login` or set `GOOGLE_APPLICATION_CREDENTIALS` to a service account key file.
For Gemini on Vertex AI (`provider: google` with `extra_kwargs.vertexai: true`), authenticate the same way and set `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`, or pass `extra_kwargs.project_id` and `extra_kwargs.location`.
Gemini reads these variables and `GOOGLE_APPLICATION_CREDENTIALS` only from the process environment, not from `.env`.
`OPENAI_BASE_URL` is described in [Configuration — Model Providers](https://docs.mindroom.chat/configuration/#model-providers).
### File-based Secrets
For container environments (Kubernetes, Docker Swarm), supported API-key and secret variables can also use a `_FILE` suffix:
```bash
# Instead of setting the key directly:
ANTHROPIC_API_KEY=sk-ant-...
# Point to a file containing the key:
ANTHROPIC_API_KEY_FILE=/run/secrets/anthropic-api-key
```
This works for all API key environment variables (e.g., `OPENAI_API_KEY_FILE`, `GOOGLE_API_KEY_FILE`, etc.).
## OpenAI API Models
Set `api: responses` or `api: chat_completions` on an `openai` model to choose the API independently of its model ID or endpoint.
When `api` is unset, GPT 5.4 and newer on the first-party OpenAI endpoint use Responses, and every other route, including all custom OpenAI-compatible endpoints, uses Chat Completions.
The endpoint must support the selected API.
```yaml
models:
astra:
provider: openai
id: gpt-6-astra
api: responses
extra_kwargs:
base_url: http://localhost:4000/v1
reasoning_effort: high
```
[GPT-6 Astra requires Responses for function calling](https://developers.openai.com/api/docs/guides/latest-model), and GPT-6.1 Sol and GPT-6 Luna support function calling in Chat Completions only with `reasoning_effort: none`.
Through a proxy or custom alias, set `api: responses` for GPT-6 models, or tool calls on Astra, Sol, and Luna fail at their default reasoning effort.
Set `extra_kwargs.reasoning_effort` or `extra_kwargs.reasoning` only when you want to customize reasoning.
Selecting Responses keeps any `extra_kwargs.store: false` setting.
How `api` affects tool search is described in [Native Server-Side Tool Search](https://docs.mindroom.chat/tools/dynamic-tools/#native-server-side-tool-search).
## OrcaRouter via the OpenAI-Compatible Endpoint
[OrcaRouter](https://docs.orcarouter.ai/introduction) works through the `openai` provider with its endpoint and an OrcaRouter API key:
```yaml
models:
orcarouter:
provider: openai
id: orcarouter/auto
api: chat_completions
stream_idle_timeout_seconds: 300 # hosted service behind a custom endpoint; see Stalled Streams
extra_kwargs:
base_url: https://api.orcarouter.ai/v1
api_key: your-orcarouter-api-key
```
`orcarouter/auto` lets OrcaRouter choose a model per request; replace it with an ID from its [catalog](https://docs.orcarouter.ai/getting-started/models) to pin one.
Set an agent's `model: orcarouter`, or select it for a thread with `!model orcarouter`.
To keep the key out of YAML, omit `extra_kwargs.api_key` and save the key in this model's **API Key** field in the dashboard's **Models** editor, so OrcaRouter and direct OpenAI models use separate keys.
`ORCAROUTER_API_KEY` is not read automatically.
## Codex Models with ChatGPT Login
Use `provider: codex` to call models through an authenticated local Codex CLI session instead of the billed OpenAI API.
Run `codex login` first so `~/.codex/auth.json` contains ChatGPT OAuth tokens; MindRoom refreshes the access token as needed.
Model access and usage limits depend on the logged-in ChatGPT account, so check the [current Codex model catalog](https://developers.openai.com/codex/models).
| Model | Model ID | Best fit |
|-------|----------|----------|
| GPT-6.1 Sol | `gpt-6.1-sol` | Near-Astra reasoning for long-running work; the starter default |
| GPT-6 Astra | `gpt-6-astra` | The hardest end-to-end reasoning and agentic work |
| GPT-6 Luna | `gpt-6-luna` | Efficient, high-volume work such as summaries and routing |
Older or preview slugs work when the account exposes them, the form `openai-codex/gpt-6.1-sol` is accepted, and the legacy `gpt-5.6` alias maps to `gpt-5.6-sol`.
If Codex state lives outside `~/.codex`, set `CODEX_HOME` in the process environment or `extra_kwargs.codex_home`; `~` prefixes are expanded.
`mindroom config init --provider codex` generates this config (see [CLI](https://docs.mindroom.chat/cli/)):
```yaml
models:
default:
provider: codex
id: gpt-6.1-sol
display_name: Sol
context_window: 258000
extra_kwargs:
reasoning_effort: medium
astra:
provider: codex
id: gpt-6-astra
display_name: Astra
context_window: 258000
extra_kwargs:
reasoning_effort: medium
luna:
provider: codex
id: gpt-6-luna
display_name: Luna
context_window: 258000
extra_kwargs:
reasoning_effort: low
router:
model: luna
defaults:
thread_summary_model: luna
```
Use `258000` as the context window: it is the effective budget of the Codex ChatGPT surface (just under 95% of its 272000-token window), not the larger window of the OpenAI API.
Set reasoning effort with `extra_kwargs.reasoning_effort`; GPT-6.1 Sol, GPT-6 Astra, and GPT-6 Luna accept `low`, `medium`, `high`, `xhigh`, and `max`.
Codex clients also offer Ultra for Sol and Astra, but Ultra's Codex-managed subagents are not available through MindRoom.
The provider supports text and image input with text output; transcription, text-to-speech, and realtime speech are not supported.
The adapter depends on the Codex CLI login format and backend, so a Codex CLI update can require a MindRoom update; use `provider: openai` for the public API contract and API billing.
## Kimi Models with Kimi Code Login
Use `provider: kimi` to call Kimi models through an authenticated local Kimi Code CLI session (Kimi Code subscription) instead of the billed Moonshot API.
Run `kimi` and `/login` first so `~/.kimi-code/credentials/kimi-code.json` contains OAuth tokens; MindRoom refreshes the access token as needed and calls `https://api.kimi.com/coding/v1`.
| Model | Model ID | Best fit |
|-------|----------|----------|
| Kimi K3 | `k3` | Flagship reasoning, long-horizon coding, and agent work with up to a 1M-token context |
| Kimi K3 256k | `k3-256k` | The same K3 generation with a 256k-token context |
| Kimi for Coding | `kimi-for-coding` | Coding-tuned tier exposed by the Kimi Code CLI |
| Kimi for Coding Highspeed | `kimi-for-coding-highspeed` | Faster coding tier exposed by the Kimi Code CLI |
[Kimi Code context limits depend on the subscription plan](https://www.kimi.com/code/docs/en/kimi-code/models.html): `k3` supports 1,048,576 tokens on Pro (legacy Allegretto) and higher, while Plus (legacy Moderato) is limited to 262,144.
The starter config and this example require Pro/Allegretto or higher; on Plus/Moderato, and for `k3-256k` on any plan, set `context_window: 262144`.
```yaml
models:
default:
provider: kimi
id: k3
context_window: 1048576
```
The form `kimi-code/k3` is accepted.
If Kimi Code state lives outside `~/.kimi-code`, set `KIMI_CODE_HOME` or `extra_kwargs.kimi_home`; `~` prefixes are expanded.
Kimi K3 always reasons before replying, so responses include reasoning tokens even for short answers.
The adapter depends on the Kimi Code CLI login format and backend, so a Kimi Code update can require a MindRoom update.
## OpenRouter Provider Routing
OpenRouter routes each request to one of several upstream providers serving the model, and upstream quality varies.
Control routing with OpenRouter [provider preferences](https://openrouter.ai/docs/features/provider-routing) in `extra_kwargs.extra_body`:
```yaml
models:
deepseek:
provider: openrouter
id: deepseek/deepseek-v4.1-flash
context_window: 1048576
extra_kwargs:
extra_body:
provider:
sort: price # cheapest available endpoint
# order: [fireworks, together] # or pin specific upstreams, in order
# allow_fallbacks: false # fail instead of using unlisted upstreams
```
Provider slugs are in the `tag` field of `https://openrouter.ai/api/v1/models/<model-id>/endpoints`.
Account-level OpenRouter settings (ignored providers, data-policy filters) still apply, so pinning an upstream your account excludes fails with `No endpoints found`.
Verify a new pin with a direct API request and check the `provider` field in the response.
## Azure OpenAI
Use `provider: azure` for models deployed through Azure OpenAI, with `id` set to your deployment name rather than the upstream model name.
Set the Azure variables listed in [Environment Variables](#environment-variables) in the config-adjacent `.env` file or the exported environment.
```yaml
models:
default:
provider: azure
id: your-azure-openai-deployment
```
Deployment limits vary, so the starter config leaves `context_window` unset; set it to your deployment's limit when you know it.
## Amazon Bedrock Claude
Use `provider: bedrock_claude` to call Anthropic Claude through Amazon Bedrock, with `id` set to a Bedrock model ID or inference profile ID enabled in your AWS account and region.
The `aws_bedrock` optional extra installs automatically on first use unless `MINDROOM_NO_AUTO_INSTALL_TOOLS=1` is set; otherwise install `mindroom[aws_bedrock]`.
AWS settings come from the config-adjacent `.env` file, the exported environment, a local AWS profile, or the runtime IAM role.
```yaml
models:
default:
provider: bedrock_claude
id: anthropic.claude-opus-5-5
context_window: 1000000
```
Bedrock lists Fable 5.1 and Sonnet 5 as open access, while Opus 5.5 and Sonnet 5.5 access can depend on the AWS account and region.
The Bedrock starter config defaults to Opus 5.5 with commented alternatives, so confirm access, or switch to its `fable` alternative or `id: anthropic.claude-sonnet-5`.
## Built-In Synthetic Model
Use `provider: synthetic` to run normal MindRoom conversations without an API key or model server, for example for load testing.
The model streams a repeatable random amount of Lorem Ipsum at a fixed rate, and when the agent has the `shell` tool it occasionally calls `run_shell_command` with `echo hi` before continuing.
The `extra_kwargs` values below are the defaults:
```yaml
models:
synthetic:
provider: synthetic
id: lorem-ipsum
extra_kwargs:
seed: 1
min_response_chars: 320
max_response_chars: 960
chunk_chars: 40
chars_per_second: 80
tool_call_probability: 0.2
agents:
load_test:
display_name: Load Test
role: Generate synthetic traffic.
model: synthetic
tools: [shell]
rooms: [lobby]
```
Tag `@load_test` in Lobby to receive a streamed synthetic reply.
Set `tool_call_probability` to `1` to call the shell tool on every turn or `0` to disable tool calls.
Set `chars_per_second` to `0` to stream without pacing delays for maximum throughput.
Changing `seed` changes the response length, split point, and tool-call choice, which stay the same for a given conversation history.
## Extra Kwargs
`extra_kwargs` sets additional parameters on the underlying [Agno](https://docs.agno.com/) model class.
Common options include:
- `base_url` - Custom API endpoint (useful for OpenAI-compatible servers)
- `temperature` - Sampling temperature
- `max_tokens` - Maximum tokens in response
- `extra_body` - Extra JSON body fields for OpenAI-compatible providers (e.g., [OpenRouter provider routing](#openrouter-provider-routing))
Some models reject sampling controls:
- Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Opus 5, and Sonnet 5 reject non-default `temperature`, `top_p`, and `top_k`, so MindRoom omits them on Anthropic, Bedrock, and Vertex requests.
- MindRoom also omits those controls for direct Gemini 3.8 Flash and Gemini 3.5 Flash-Lite requests.
- [GPT-6 Astra does not support `temperature`, `top_p`, or `top_logprobs`](https://developers.openai.com/api/docs/guides/latest-model#update-api-and-model-parameters), and GPT-6.1 Sol and GPT-6 Luna reject them unless reasoning effort is `none`; leave them out of these models' `extra_kwargs`.
- For Mem0 memory extraction with `provider: openai`, use GPT-6 Luna; MindRoom drops the `temperature` and `top_p` values Mem0 sends, which GPT-6 models reject.
## Prompt Caching
Claude and OpenAI Responses models keep shared agent instructions (identity, role, workspace context files, and tool instructions) separate from the current date and session context, so the shared part can be reused across conversations when the provider cache allows it.
Cache reads and writes appear in usage metrics as cached and cache-write input tokens.
The `anthropic`, `bedrock_claude`, and `vertexai_claude` providers enable prompt caching with a one-hour lifetime by default.
The `openrouter` provider caches the same way for model IDs that route to Anthropic, such as `anthropic/claude-sonnet-5.5` and `~anthropic/claude-sonnet-latest`, using OpenRouter [`cache_control` breakpoints](https://openrouter.ai/docs/guides/best-practices/prompt-caching); other OpenRouter model families cache implicitly.
Set `extra_kwargs.cache_system_prompt: false` to turn off MindRoom's Claude cache breakpoints, or `extra_kwargs.extended_cache_time: false` to use the five-minute lifetime.
The `openai` Responses API and `codex` providers rely on provider-managed caching; on the public OpenAI API, GPT-5.6 and later also get an explicit cache breakpoint after the shared instructions.
See [OpenAI's prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for eligibility and accounting.
Set `extra_kwargs.cache_system_prompt: false` on a Responses model to send the instructions as one undivided system message.
Chat Completions providers other than OpenRouter Claude routes keep their usual request format.
Kimi Code caches repeated request prefixes automatically and reports them as `cached_tokens`.
For `codex` and `kimi`, conversations share a `prompt_cache_key` per agent and requester within one MindRoom storage path, account, and channel, while different agents and requesters stay separate.
Set `extra_kwargs.prompt_cache_key` to choose your own cache group, for example to separate deployments that share a storage path and provider account, or set it to `null` to send no key.
A shared key still needs identical prefixes and tools, and provider routing can produce cache misses.
## Stalled Streams
A provider sometimes accepts a streamed request and then sends nothing more, which would leave the agent busy and queue every follow-up message behind it.
MindRoom ends a streamed request when the provider sends no event for `stream_idle_timeout_seconds`.
If nothing was streamed yet, MindRoom sends the request once more; a second silent attempt, or a stall after text already appeared, ends the turn with "⚠️ Model provider temporarily unavailable after automatic retries. Please try again shortly."
The limit measures the gap between provider events, so long replies and slow tool calls are unaffected.
It applies only to streamed responses (`defaults.enable_streaming: true`, the default).
By default the limit is 300 seconds for hosted providers on their built-in endpoint.
Local servers can stay silent for minutes while a request waits in a queue or a model loads, so `ollama`, `llama_cpp`, and any model with a configured endpoint get no limit unless you set one.
A configured endpoint is a `base_url` anywhere in `extra_kwargs` (such as `extra_kwargs.base_url` or `extra_kwargs.client_params.base_url`) or one read from `OPENAI_BASE_URL` or `ANTHROPIC_VERTEX_BASE_URL`.
Set the limit explicitly for a hosted service behind a custom endpoint, such as OrcaRouter or the Z.ai coding endpoint.
Endpoint variables that only a provider SDK reads, such as `ANTHROPIC_BASE_URL`, are not detected; set `0` when one points at a local server.
For a local model, pick a value above its slowest queue wait plus model load; set `0` to turn the limit off for a hosted model:
```yaml
models:
local:
provider: openai
id: qwen3-coder
extra_kwargs:
base_url: http://localhost:8080/v1
stream_idle_timeout_seconds: 1800 # longest wait for a queued request plus model load
deep_thinker:
provider: openrouter
id: openai/gpt-6-astra
stream_idle_timeout_seconds: 0 # never cut off long silent reasoning
```
## Hot Reload
After a successful config reload, changes to a model definition, including its provider options, model ID, and `context_window`, apply from the next agent, team, or router response without restarting the bot.
Agents with voice calls enabled can still restart, because their call runtime keeps its configuration between responses.
## Model Overrides in Chat
Each agent, team, and the router normally answers with its own configured `model` (`router.model` for the router).
Users can change that per thread or per room, and the most specific choice wins:
1. An explicit model for one run, such as a delegated child run.
2. The thread override set with `!model`, the `thread_model` tool, or a client's model picker.
3. The runtime room default set with `!room_model`.
4. The authored room default in `room_models`.
5. The entity's configured model.
Thread and room overrides name models from the `models:` section and survive restarts.
A Matrix client's model picker lists the configured models and changes the thread override like `!model`.
The picker works in encrypted and unencrypted rooms when the router and at least one agent you may address are joined; teams alone do not qualify.
It shows each model's key, display name, provider, model ID, and icon, never API keys, hosts, local paths, or `extra_kwargs`.
Catalogs with more than 256 models or over 64 KiB are not offered to the picker; `!model` still works.
The client protocol is described in [Model Selection Protocol](https://docs.mindroom.chat/architecture/matrix/#model-selection-protocol).
### `!model`
Show or switch the model that the agents, teams, and router you may address use in the current thread.
```
!model
!model list
!model opus
!model reset
```
`!model` and `!model list` show each thread override with the entities it applies to, plus the available model names.
The override applies from the next message in the thread, and only to the entities whose `access` admits the user who set it in this room; every other entity keeps its own thread override or room-level model.
During a configured team's turn, the team's thread override also applies to its member agents, because the team's `access` reaches them.
`!model reset` removes the override only for the entities you may address.
Other threads and rooms are unaffected.
### `!room_model`
Show or switch the default model for every agent, team, and the router in the current room.
```
!room_model
!room_model list
!room_model opus
!room_model reset
```
`!room_model` and `!room_model list` show the current runtime override and available model names to authorized room members.
Setting and resetting require a Matrix room admin; other users get `❌ Room admin only.`
`!room_model opus` stores a room override without modifying `config.yaml`, keyed by Matrix room ID, so it survives restarts and room-alias changes.
The new default applies to later turns; a turn in progress or waiting for approval keeps the model it started with.
`!room_model reset` removes the runtime override so `room_models` or each entity's configured model applies again.
To set an authored room default in `config.yaml`, map managed room names to model names with `room_models` (default `{}`):
```yaml
room_models:
lobby: haiku
dev: opus
```
### [`thread_model`]
The `thread_model` tool lets an agent list models and show, switch, or reset the current thread's model override, like `!model`.
It has no tool-specific configuration.
```yaml
agents:
assistant:
tools:
- thread_model
```
- `list_models()` returns every configured model name with its provider and model ID and works outside a thread.
- `get_thread_model()` returns an `overrides` map from each entity with an active thread override to its model, plus the available model names; an override naming a model since removed from `models` is ignored and reported under `stale_overrides`.
- `switch_thread_model(model_name, when)` accepts a configured model name and rejects unknown names with the available list.
`when` is `next-turn` (default), which keeps the current response on its model, or `after-toolcall`, which continues the current response with the new model after the tool call.
- `reset_thread_model()` removes the thread override so room-level selection applies again.
All functions except `list_models` require an active thread and return an error outside one.
Overrides set by the tool follow the same entity scope and team rules as [`!model`](#model) and are stored per thread root and entity in `mindroom_data/tracking/thread_models.json`.
# Team Configuration
A team lets several agents answer one request together, either as a named team under `teams:` that has its own Matrix account, or as an ad hoc team formed when a message involves several agents.
<video controls playsinline preload="metadata" aria-label="Mentioning two agents forms a team that answers together" style="width: 100%" poster="https://github.com/user-attachments/assets/dfdbd003-6c31-49e0-8183-445ff0a8a271" data-poster-light="https://github.com/user-attachments/assets/dfdbd003-6c31-49e0-8183-445ff0a8a271" data-poster-dark="https://github.com/user-attachments/assets/41849fb8-3dd1-4b9c-8eff-33bb10803f48">
<source src="https://github.com/user-attachments/assets/cb657cd9-3114-442f-a4fa-d8e6a96b6425" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/9ee83e64-1425-4165-b1f5-5d4aa978b46e" type="video/mp4">
</video>
## Team Modes
| Mode | What happens | Use when | Example |
|------|--------------|----------|---------|
| `coordinate` (default) | The team model splits the task into subtasks, assigns each to the member whose role fits, runs them in sequence or in parallel depending on their dependencies, and synthesizes the results | Members need to do different parts of the work | "Get weather and news": one agent fetches weather, another fetches news |
| `collaborate` | Every member works on the same task independently, and the team model synthesizes their answers | You want several perspectives on one question | "What do you think about X?": every agent answers, then the views are combined |
A team reply opens with a `🤝 Team Response (<members>)` header, shows each member's contribution under its name, and ends with a **Team Consensus** section; without a consensus it notes that only the individual responses are shown.
## Named Teams
```yaml
teams:
dev_team:
display_name: Dev Team
role: Development team for building features
agents: [architect, coder, reviewer]
mode: coordinate
rooms: [dev]
model: sonnet
research_team:
display_name: Research Team
role: Research team for comprehensive analysis
agents: [researcher, analyst, writer]
mode: collaborate
num_history_runs: 8
compaction:
enabled: true
threshold_percent: 0.8
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `display_name` | string | *required* | Name shown in Matrix |
| `role` | string | *required* | Description of the team's purpose |
| `agents` | list | *required* | Names of agents under `agents:` that form the team; at least one, no duplicates |
| `mode` | string | `coordinate` | `coordinate` or `collaborate` |
| `rooms` | list | `[]` | Room keys, aliases, or Matrix room IDs the team joins and responds in |
| `accept_invites` | bool or list | `true` | `true` accepts every room invitation, `false` or `[]` accepts none, and a list accepts only inviters matching an exact or wildcard Matrix user ID; this is separate from the members' own settings. Joining a room never grants its members access; see [Invitations](https://docs.mindroom.chat/authorization/#invitations) |
| `access` | object | `null` | Who may converse with the team: `current_room_members`, `members_of_rooms`, and `users`. When omitted, members of the team's own managed `rooms` have access. See [Responder access](https://docs.mindroom.chat/authorization/#responder-access) |
| `model` | string | `"default"` | Key under `models:` used for coordination and synthesis |
| `max_tool_calls_per_turn` | int, >= 1 | `defaults.max_tool_calls_per_turn` | Tool calls the team may execute in one turn, delegations to members included; each member keeps its own budget, and the end-of-budget behavior matches [agents](https://docs.mindroom.chat/configuration/agents/#configuration-options) |
| `num_history_runs`, `num_history_messages`, `max_tool_calls_from_history`, `compaction` | | | History replay and compaction for the team's shared history; see [Team History and Compaction](https://docs.mindroom.chat/configuration/history/#team-history-and-compaction) |
Team keys follow the agent [naming rules](https://docs.mindroom.chat/configuration/agents/#naming-rules), and a key cannot be used under both `agents:` and `teams:`.
Private agents, and agents that can reach a private agent through `delegate_to`, cannot be team members; see [Private Instances](https://docs.mindroom.chat/configuration/agents/#private-instances).
## Ad Hoc Teams
MindRoom forms a team without any `teams:` entry when:
1. **Several agents are tagged in one message**, for example `@code @research analyze this`.
2. **An untagged follow-up in a thread** where several agents were mentioned earlier or several agents have replied.
3. **An untagged message in the main timeline of a DM room** that contains several agents.
Tagging exactly one agent gets a reply from that agent alone.
Threads where two or more people have posted never form a team from earlier thread context; tag the agents again in the current message (see [Multi-Human Thread Protection](https://docs.mindroom.chat/configuration/threads/#multi-human-thread-protection)).
If any tagged agent cannot take part, for example because it is not in the room or not available to you, MindRoom replies with the reason instead of forming a partial team, such as `Team request includes agent 'code' that is not available in this room.`
For teams formed from thread context or a DM room, unavailable agents are left out, and if only one remains it answers alone.
The `default` model picks the mode for each ad hoc team from the request: `coordinate` when the agents have different subtasks, `collaborate` for opinions or brainstorming, and `collaborate` when the choice fails.
Ad hoc teams take their history and compaction settings from `defaults`; see [Team History and Compaction](https://docs.mindroom.chat/configuration/history/#team-history-and-compaction).
# Router Configuration
The router is a built-in MindRoom account that is always present, cannot be disabled, and joins every room with configured agents or teams.
It picks which agent or team answers a message that mentions no one, accepts room invitations, and sends welcome messages.
Configure it under `router:` to choose its routing model, who may invite it into rooms, who may interact with it, and optional System One responder selection.
See also [Threads, Replies & Participation](https://docs.mindroom.chat/configuration/threads/), [Access Control](https://docs.mindroom.chat/authorization/), and [Logs & Monitoring](https://docs.mindroom.chat/deployment/operational-log-events/).
## Configuration
```yaml
router:
model: haiku # Must exist under models
accept_invites: true
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `model` | string | `"default"` | Model alias used for routing decisions |
| `judgment` | object or null | `null` | Optional System One responder selection before LLM routing; see [Responder Selection Judgments](#responder-selection-judgments) |
| `access` | object or null | `null` | Who may interact with the router; see [Access Control](https://docs.mindroom.chat/authorization/) |
| `accept_invites` | bool or list[string] | `true` | `true` accepts every room invitation, `false` or `[]` accepts none, and a list accepts only inviters matching an exact or wildcard Matrix user ID |
Point `model` at a cheap, fast alias to keep routing inexpensive.
Room and thread model overrides also apply to routing.
### Invitations and access
Inviter patterns are matched after [identity alias](https://docs.mindroom.chat/authorization/#requester-identity-and-private-state) resolution and use the same case-sensitive wildcard rules as `access.users`.
Rooms joined through an invitation are kept across restarts and survive room cleanup.
Accepting an invitation only joins the room; every interaction afterwards still requires the router's `access` policy.
Router `access` defaults to `current_room_members: true`, which still applies when you set only `access.users`; set `current_room_members: false` to remove it.
## How Routing Works
When a message mentions no agent or team, MindRoom first finds the responders the sender may address in that room.
- In configured rooms, candidates are the agents and teams that list the room in `rooms`.
- In ad-hoc rooms the router joined by invitation, candidates are the MindRoom agents and teams currently joined to the room.
- Either way, candidates the sender is not allowed to address are removed.
Then:
1. If the thread requires explicit targeting, the router stays silent; eligible individual agents already in the thread may still use opt-in [adaptive participation](https://docs.mindroom.chat/configuration/threads/#adaptive-participation).
2. If exactly one eligible responder remains, it answers directly without an AI routing call.
3. If several remain, the router reads the message and up to three previous thread messages (each cut to 100 characters) and picks the best match from the candidates' roles, tools, and instructions.
4. The router posts a message mentioning the chosen agent or team (for example "@code could you help with this?"), and that entity answers in the thread.
If routing fails, for example because of a model error or an invalid choice, the router replies "Please try mentioning an agent or team directly with @ or rephrase your request."
Mentioning an agent or team with `@name` always bypasses routing, but the entity still answers only if it is in the room, listed for that room in its `rooms` when the room is configured, and allowed by its `access`.
An entity invited into a configured room that does not list it posts a note when it joins, and repeats that note instead of answering when it alone is mentioned there: the room's agents are managed in the MindRoom configuration, so talk to the entity in a new room it is invited to.
A request that mentions several entities gets the same explanation when every entity it cannot use is such an invited, unlisted entity.
The note speaks only to people the entity's `access` admits and names the room's agents they can ask instead.
See [Multi-Human Thread Protection](https://docs.mindroom.chat/configuration/threads/#multi-human-thread-protection) for when threads require explicit tags.
### Mentioning the router
The router is not a conversational agent.
A message that mentions only the router gets a short rules-of-engagement reply instead of an answer.
Mention a specific agent or team to get an answer, or several agents for an ad-hoc collaboration.
## Responder Selection Judgments
Set `router.judgment` to let System One (TypeSafe) choose among the eligible agents and teams before ordinary LLM routing.
It is off by default, even when `TYPESAFE_API_KEY` is set.
Explicit mentions, thread participation rules, access control, and the single-candidate shortcut work the same way with or without it.
Set `TYPESAFE_API_KEY` in the process environment or the `.env` next to `config.yaml`, then enable it:
```yaml
router:
model: default
judgment:
provider: typesafe
threshold: 0.8
timeout_seconds: 1.5
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `provider` | string | Required | Must be `typesafe` |
| `threshold` | float | `0.8` | From `0` to `1`; both the chosen option's probability and System One's confidence must reach it |
| `timeout_seconds` | float | `1.5` | Positive deadline of at most `30` seconds |
Unknown fields are rejected.
System One receives each candidate's role, tools, delegation targets, and brief instructions, the current message, and the last three visible messages with senders replaced by aliases.
It does not receive system prompts, tool results, attachment contents, or the rest of the conversation.
It runs only with 2 to 253 candidates and a request of at most 16,000 bytes; messages are never shortened, so long input or input that looks like a secret uses ordinary routing instead.
| Outcome | Result |
|---------|--------|
| A candidate is chosen | The router mentions that agent or team as usual |
| `no_fit` | The router asks the user to mention a responder or rephrase; OpenAI-compatible [`auto`](https://docs.mindroom.chat/openai-api/#auto-routing) requests get HTTP 400 with code `no_suitable_responder` |
| `multiple` | Ordinary LLM routing picks one responder; several agents are never launched |
| Tie, low confidence, abstention, missing key, full judgment limit, timeout, or error | Ordinary LLM routing with `router.model` |
The router's prompt overrides apply only to LLM routing, not to System One.
Router judgments share the process-wide limit and logging described in [Judgment Backends](https://docs.mindroom.chat/configuration/threads/#judgment-backends), with at most one router judgment at a time.
## Welcome Messages
After accepting an invitation into a room with no message history, the router posts a welcome if the inviter has router access, listing the agents and teams the inviter may address, how to mention them, and a quick command reference.
At startup, empty configured rooms get a welcome listing their configured responders.
Send [`!hi`](https://docs.mindroom.chat/chat-commands/#hi) to see the welcome again, limited to responders visible to you.
The router's other duties are documented on their own pages: [command handling](https://docs.mindroom.chat/chat-commands/#command-handling), [room management](https://docs.mindroom.chat/rooms/#room-management), [voice message processing](https://docs.mindroom.chat/voice/#voice-message-processing), [configuration confirmations](https://docs.mindroom.chat/chat-commands/#configuration-confirmations), and [scheduled task restoration](https://docs.mindroom.chat/scheduling/#scheduled-task-restoration).
# Threads, Replies & Participation
This page covers how agents group replies into threads or one room conversation, when agents answer in threads with several people, how agents can opt into judging untagged messages, what happens to messages sent while an agent is still working, and how edits and restarts affect replies.
See also [Routing & Responder Selection](https://docs.mindroom.chat/configuration/router/), [Access Control](https://docs.mindroom.chat/authorization/), and [Logs & Monitoring](https://docs.mindroom.chat/deployment/operational-log-events/).
## Thread Mode Resolution
Each agent's `thread_mode` and `room_thread_modes` fields (see [Agent Configuration](https://docs.mindroom.chat/configuration/agents/)) choose between Matrix threads and one continuous conversation per room.
A room override set with [`!thread_mode`](#thread_mode) takes precedence for every agent, team, and the router in that room.
Without one, an agent uses the `room_thread_modes` entry matching the current room by Matrix room ID, room key, or alias, and otherwise its `thread_mode`.
A team uses its members' mode for the room when all members agree, and `thread` when they differ.
The router uses the mode shared by all agents relevant to the room, including agents that join through `teams.<name>.rooms`, and `thread` when they differ.
### `!thread_mode`
Show or switch how future agent replies are grouped in the current Matrix room.
```
!thread_mode
!thread_mode show
!thread_mode room
!thread_mode thread
!thread_mode reset
```
`!thread_mode` and `!thread_mode show` (also `list` or `status`) show the current room override.
`!thread_mode room` uses one continuous conversation for the whole room.
Room-mode conversations are not included in [thread exports](https://docs.mindroom.chat/thread-exports/).
`!thread_mode thread` uses Matrix threads for separate conversations in this room.
`!thread_mode reset` (also `clear`) removes the room override so agents use their configured `thread_mode` and `room_thread_modes` again.
Only Matrix room admins can set or reset the override; others get `Room admin only.`
The override is stored in MindRoom's runtime state under `mindroom_data/tracking`, not in `config.yaml`, so it works when config is static or read-only.
## Threading (MSC3440)
Agents reply in [MSC3440](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3440-threading-via-relations.md) threads.
In `thread` mode, an agent answering a room-level message starts a new thread on it.
Clients and bridges that send plain replies instead of thread replies still work: a plain reply whose reply chain reaches a thread joins that thread, and one that never reaches a thread stays room-level.
Edits, reactions, and redactions belong to the same thread as the message they target.
## Multi-Human Thread Protection
When two or more people have posted in a thread, agents answer only when explicitly mentioned, so they do not interrupt a human conversation.
The router stays silent in such threads, and they never automatically form ad hoc teams.
Agents that already replied there can opt into [Adaptive Participation](#adaptive-participation) to judge untagged messages.
The rules are:
1. **Mentioned eligible agents or teams respond**: an explicit `@agent` or `@team` bypasses AI routing, but room configuration and reply permissions still apply.
2. **Non-thread messages**: a single eligible agent or team can auto-respond, regardless of how many humans are present.
3. **Threads with one human**: normal auto-response behavior applies, so the agent or team continues the conversation.
4. **Threads with two or more humans**: explicit targeting is required, except for agents using adaptive participation.
5. **Mentioning another joined room participant**: if a message tags only joined users who are neither agents, teams, nor configured bot accounts, agents and teams stay silent.
MindRoom reads a message's mentions from `m.mentions.user_ids`, or when that is empty from HTML mention pills in `formatted_body`, or otherwise from plain `@name` text in the body, so bridged messages without mention metadata still count.
Mentions of users who are not in the room or only invited do not suppress normal responses.
Mentioning a configured agent that has not joined the room still counts as an explicit mention for the other agents.
A thread too long to read at once, more than 2,000 messages or 16 MiB of stored content, is not continued from an untagged message when the room has more than one possible responder, unless an agent is still answering there; mention the agent or team to continue it.
### Bot accounts
Any Matrix user that is not a MindRoom agent or team counts as a human for these rules, including bridge bots (Telegram, Slack, etc.) and other non-MindRoom bots.
A bridge bot relaying messages into a thread therefore looks like a second human and makes agents require mentions.
List such accounts in the top-level [`bot_accounts`](https://docs.mindroom.chat/authorization/#bot-accounts) field so their messages and mentions do not count toward multi-human detection.
## Adaptive Participation
Set `agents.<name>.participation` to let an agent that already replied in a multi-human thread decide whether to answer an untagged message or stay silent.
`participation: {}` enables it with the defaults below; omitting it or setting it to `null` keeps the mention requirement.
The setting applies in every room where the agent may reply, including ad hoc rooms, and has no per-room override.
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `debounce_seconds` | number | `3.0` | Quiet window before deciding, from `0` to `30` seconds; a burst of messages from one sender is judged as one turn |
| `instructions` | string | `""` | Additional guidance for deciding whether the agent should participate |
| `decline_reaction` | string or null | `null` | Reaction to a deliberate decline, such as `"👀"`; nonblank and at most 64 characters; `null` keeps declines invisible |
| `judgment` | object or null | `null` | Separate [judgment backend](#judgment-backends); `null` lets the agent's reply model decide |
```yaml
agents:
assistant:
display_name: Assistant
participation:
debounce_seconds: 3.0
instructions: "Reply when you can help; leave human conversation uninterrupted."
decline_reaction: "👀"
```
An agent judges a message only when all of these hold:
- The message is text in a thread with at least two human participants, including the sender.
- The message mentions neither an agent nor another human; mentioned messages follow the normal rules.
- This agent has already replied in the thread and may still reply to the sender.
Configured human aliases count as one participant, while agents, the internal service account, and `bot_accounts` do not count as humans.
Agents merely present in the room never join: with 50 agents in a room and two already in the thread, only those two can judge, and only if each opted in.
Each eligible agent decides separately.
Commands and scheduled work never use adaptive participation.
An agent that declines sends no reply; with `decline_reaction` set, it reacts once to the latest message of the turn.
Choose the emoji with care, because 👍 can read as agreement with the message.
A failed check never reacts and the agent stays quiet.
Without `judgment`, the agent's own reply model decides with tools disabled.
Gemini explicit context caches, OpenAI Chat search-only requests, OpenRouter automatic web search, and Groq Compound systems cannot decide this way, so agents using them stay quiet unless a separate judgment backend approves.
After a judgment backend approves, the agent replies normally with its own model, including those provider modes.
### Judgment Backends
`participation.judgment` and `mid_turn.judgment` select a separate decision model, while the agent's configured model still writes the reply.
| Field | Backend | Default | Description |
|-------|---------|---------|-------------|
| `provider` | both | Required | `llm` for a configured model alias, or `typesafe` for System One |
| `model` | `llm` | Required | Existing alias under `models`, which can be cheaper than the reply model |
| `threshold` | `typesafe` | `0.8` | Minimum probability from `0` to `1`; rejected for `llm` |
| `timeout_seconds` | both | `5` for `llm`, `1.5` for `typesafe` | Positive deadline of at most `30` seconds; for participation it starts after `debounce_seconds` |
Unknown fields are rejected.
```yaml
agents:
assistant:
display_name: Assistant
participation:
instructions: "Reply when you can help; leave human conversation uninterrupted."
judgment:
provider: llm
model: fast
timeout_seconds: 5
```
To use System One instead, set `TYPESAFE_API_KEY` in the process environment or config-adjacent `.env` and change the judgment:
```yaml
judgment:
provider: typesafe
threshold: 0.8
timeout_seconds: 1.5
```
The LLM backend uses the alias's normal provider credentials and receives no tools, agent system prompt, or agent memory.
A model alias whose provider adds native tools that cannot be disabled is refused.
For participation, a TypeSafe probability at or above `threshold` approves; the default `0.8` has not been calibrated on representative conversations.
Both backends get the same question and context, but their judgments can differ.
At most eight judgments run at once across the process, including [router judgments](https://docs.mindroom.chat/configuration/router/#responder-selection-judgments), and one per agent; a judgment that finds the limit full is not queued and is treated as failed.
Judgment outcome logs record backend, model, decision, latency, token usage, input size, and failure category, plus probability and threshold for TypeSafe, without request text or credentials.
#### Participation Context and Fallback
A participation judgment sends the agent's guidance and up to eight recent user and assistant messages, with Matrix identities replaced by aliases.
System prompts, memory, tool definitions and results, and media are not sent, but message text can still contain private information.
When the context contains media, attachment references, detected secrets, or more than 16 KB of text, the backend is skipped and the reply model decides instead.
Missing credentials, a full limit, a timeout, a provider error, malformed output, or an abstention also fall back to the reply model's decision, and the agent stays quiet if that fails too.
## Mid-Turn Coalescing
When another human message arrives while an agent is responding, MindRoom normally sends the agent a wrap-up notice after its current tool batch, asking it to stop making new tool calls and summarize its progress.
A "thanks" or "is this still running?" can therefore cut a long task short.
Set `agents.<name>.mid_turn` to let a judge decide whether the queued messages can wait until the task finishes.
The setting applies in every room where the agent may reply and has no per-room override; teams do not inherit it from their members.
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `judgment` | object | Required | LLM model alias or TypeSafe backend; see [Judgment Backends](#judgment-backends) |
| `instructions` | string | `""` | Extra guidance for the continue-or-wrap-up decision |
| `defer_reaction` | string or null | `null` | Reaction such as `"👀"` on a queued message that can wait |
```yaml
agents:
helper:
display_name: Helper
mid_turn:
instructions: Continue for acknowledgements; wrap up for corrections or changed requirements.
defer_reaction: "👀"
judgment:
provider: llm
model: fast # An existing alias under models
timeout_seconds: 5
```
The judge lets the task continue for acknowledgements, thanks, "continue", "do not interrupt", and unrelated requests, which wait for a later turn.
It asks for a wrap-up when a message stops, pauses, or corrects the task, changes a relevant requirement, or asks to switch tasks now, even alongside praise.
When the judge is unsure, times out, or fails, the agent gets the wrap-up notice.
With TypeSafe, the task continues only when the probability that no interruption is needed is at least `threshold` (default `0.8`).
The judge sees the active request, recent earlier messages in the thread, up to eight queued messages, the reply text the agent had published when each message arrived, and your `instructions`.
Long earlier messages are shortened and the oldest drop out first, so the request fits the judge's 16 KB limit.
Earlier files and images appear only as their file name and any caption, such as `[file: report.pdf]`.
Attachment contents, tool arguments and results, system prompts, and memory are never sent, but message text can still contain private information.
The agent gets the wrap-up notice without a judgment when:
- the thread's history could not be read completely;
- the active request or a queued message has an attachment or is not typed text, such as a scheduled task or a voice message;
- the active request and queued messages alone exceed 16 KB, or more than eight messages are queued;
- anything the judge would see looks like a credential;
- the agent replies in `thread_mode: room`.
Each skip logs `Mid-turn judgment skipped` with a `reason` such as `history_unavailable` or `essential_input_too_large`, and judge timeouts and errors log `Mid-turn continuation evaluated` with a `failure`.
The check runs between completed tool batches and never interrupts a running tool.
Queued messages are handled after the active response finishes either way.
A decision to continue covers only the messages the judge saw, so a later message gets its own decision, and a wrap-up notice once sent is not taken back.
The wrap-up notice asks the agent to hand off; it does not cancel tools, abort the response, or show the agent the queued text, and stopping a response and tool approval work as usual.
With `defer_reaction` set, each message that can wait gets that reaction once.
## Message Edits
When a user edits a message that already received an agent response, the agent regenerates its reply for the updated content and edits its previous reply in place.
Edits by agents never trigger regeneration.
When another agent's reply finishes with a mention of this agent, it reaches this agent as a new message.
# History & Compaction
This page covers how much earlier conversation an agent or team sees on each reply, how a model's `context_window` keeps that history within the provider limit, and how compaction summarizes old history so long conversations keep working.
Use it to tune replay depth, set up or disable compaction, or explain why an agent forgot earlier context or posted a `Compacting history...` notice.
## History Settings
Set these fields in `defaults` or on an agent; teams use the same fields except `compress_tool_results` (see [Team History and Compaction](#team-history-and-compaction)).
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `num_history_runs` | int, >= 1 | `null` | Number of prior runs to replay as history (`null` = all). Mutually exclusive with `num_history_messages` |
| `num_history_messages` | int, >= 1 | `null` | Maximum messages replayed from history (`null` = no limit). Mutually exclusive with `num_history_runs` |
| `compress_tool_results` | bool | `null` | Compress tool results in history to save context. Inherits `defaults.compress_tool_results` (default `false`). On Anthropic and Vertex AI Claude models, `true` can invalidate prompt caching |
| `max_tool_calls_from_history` | int, >= 0 | `null` | Maximum tool-call messages replayed from history. `null` inherits `defaults.max_tool_calls_from_history`; no limit when that is also `null` |
| `compaction` | object | `defaults.compaction` | Compaction overrides; see [Agent Compaction Settings](#agent-compaction-settings) |
An agent or team that leaves both `num_history_runs` and `num_history_messages` at `null` inherits both from `defaults`; setting either one replaces both defaults.
History replay is unlimited only when the inherited values are also `null`.
## Context Window
Set `context_window` on each model to the provider's actual limit (see [Models](https://docs.mindroom.chat/configuration/models/)).
When the active model has a known `context_window`, MindRoom fits replayed history to it before each reply, reducing raw replay, replaying only the saved summary, or skipping saved history for that run when needed.
Your configured `num_history_runs` stays unchanged; the reduction applies only to the run that needs it.
Without a known `context_window` (and without `compaction.replay_window_tokens`), history is not fitted and automatic text compaction is unavailable.
On `vertexai_claude` models, a known `context_window` also checks every provider request, including follow-ups after tool results.
A request that would exceed the window drops its oldest replayed history turns for that request only and logs a warning.
When the current turn alone cannot fit, the request fails with a provider error instead of being sent oversized.
```yaml
models:
default:
provider: anthropic
id: claude-sonnet-5-5
context_window: 1000000 # 1M tokens
defaults:
compaction:
replay_window_tokens: 200000 # Keep replayed history around a smaller operational window
```
## Agent Compaction Settings
Compaction is enabled by default through `defaults.compaction`.
It summarizes older history so later replies keep useful context instead of losing it to replay fitting.
Supported OpenAI and Claude routes use [native compaction](#native-compaction) inside ordinary requests; every other route uses portable text compaction.
Text compaction runs before a reply only when history exceeds the hard replay budget, or when [requested manually](#manual-compaction).
While it runs, the agent posts `Compacting history...` and edits that notice with the result.
If compaction fails, the notice reads `Compaction failed; continuing with trimmed history.` with the reason, and the reply continues with fitted history.
Set these fields under `defaults.compaction`, an agent's `compaction`, or a team's `compaction`:
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `enabled` | bool | `true` | `false` disables automatic native and pre-reply text compaction for the scope |
| `threshold_tokens` | int, >= 1 | `null` | Native provider trigger in tokens; on text-only routes a soft planning threshold that does not compact by itself while history still fits. Mutually exclusive with `threshold_percent` |
| `threshold_percent` | float, > 0 and < 1 | `null` | The same trigger as a fraction of the effective replay window. When neither threshold is set, the trigger is 80% of that window |
| `replay_window_tokens` | int, >= 1 | `null` | Cap replayed history and compaction planning below the model's real `context_window` without lowering the provider request limit. The smaller of the two applies; when the model window is unknown, this value alone sets the replay window |
| `reserve_tokens` | int, >= 0 | `16384` | Headroom kept free for the current prompt, tool definitions, and output |
| `model` | string | `null` | Model config name used to write summaries; `null` uses the active model. Must define its own `context_window` |
| `fallback_model` | string | `null` | Different model config retried once when the summary model refuses for safeguards; after success it writes the remaining summaries for that compaction. Must define its own `context_window` |
| `timeout_seconds` | float, > 0 | `600` | Maximum seconds for each summary request; a shorter provider timeout still applies |
An agent or team `compaction` block overrides `defaults.compaction` field by field, and setting a field to `null` clears the inherited value.
Setting either threshold in an override replaces an inherited value of the other.
A `compaction` block that sets any field enables compaction for that scope, even when `defaults.compaction` disables it, unless it sets `enabled` to `false` or `null`.
A block that only clears `model` or `fallback_model` with `null` keeps the inherited enabled state.
Set `defaults.compaction: null` or `enabled: false` to turn compaction off everywhere that does not override it.
`model` and `fallback_model` must name entries under `models:` that define `context_window`; otherwise config validation fails with `Compaction model references unknown models: ...` or `Explicit compaction model references require a model with context_window: ...`.
A `fallback_model` that resolves to the same provider and model ID as the summary model is ignored.
Text compaction needs more than 2,000 tokens of summary input after `reserve_tokens` and prompt overhead are subtracted from the summary model's `context_window`.
With the default `reserve_tokens`, a summary model with a context window of roughly 10,000 tokens or less cannot compact; lower `reserve_tokens` to make it work.
### Compacted history and redaction
Text compaction moves older runs into an archive in the conversation database and replays a merged summary in their place.
Compaction deletes no stored history; only Matrix redaction and conversation deletion remove archived runs.
Redacting a message, including one the agent never answered, removes the first stored run that read, answered, or wrote it, and every later run, from an agent's or team's history before that agent or team next replies in the conversation (for a private agent, its next reply to that requester).
Until then the text stays in local storage; a reply that continues after a tool approval, and a voice-call reply, do not remove it first.
Redacting a Matrix event that a compacted run consumed rolls compaction back to just before that run, removing that run and everything after it, instead of clearing the whole conversation.
If a reply fails with `Saved conversation summary exceeds the available history budget`, the saved summary no longer fits beside the current prompt.
This can happen after switching to a model with a smaller context window or when system instructions and the current message leave too little room.
Choose a model with a larger context window or shorten the prompt; MindRoom never silently drops or truncates the saved summary.
### Native compaction
MindRoom supports automatic [OpenAI Responses compaction](https://developers.openai.com/api/docs/guides/compaction) and [Claude compaction](https://platform.claude.com/docs/en/build-with-claude/compaction).
- **OpenAI**: GPT-5.3 Codex, GPT-5.4, and GPT-6 model families on the official Responses endpoint or the Codex login backend.
An explicit `store: true`, background mode, an alternate OpenAI endpoint, or a custom context-management request keeps the model on text compaction.
- **Claude**: direct Anthropic and Vertex AI Claude on Sonnet 4.6 and later, Opus 4.6 and later, Fable, and Mythos models.
This is a provider beta and needs a trigger of at least 50,000 tokens.
An authored `compact_20260112` context-management policy keeps its own trigger and instructions, and `pause_after_compaction: true` is rejected because MindRoom needs the provider to continue its response.
- Gemini, Chat Completions, and all other providers use text compaction.
Native compaction also requires compaction to be enabled, replay of all history (no `num_history_runs` or `num_history_messages`), no `max_tool_calls_from_history`, and a trigger above the current prompt size and below the hard request limit.
An explicit `compaction.model`, a [scheduled task](https://docs.mindroom.chat/scheduling/) with a `history_limit`, or a request already over the hard budget uses text compaction instead.
Native checkpoints survive restarts and are tied to their provider, model, and endpoint; after a model switch, the conversation is rebuilt from its full stored history.
### Manual compaction
Add the `compact_context` tool to an agent's `tools` to let it request compaction itself.
The request runs before the next reply in the same conversation and always uses text compaction.
It requires a summary model with a `context_window` and the same 2,000-token summary input budget; otherwise the tool returns `Error: Compaction is unavailable for this scope because ...` with the reason.
## Team History and Compaction
Named teams accept `num_history_runs`, `num_history_messages`, `max_tool_calls_from_history`, and `compaction`, with the same meaning, limits, and mutual exclusion as for agents.
The team's shared history uses the team's own settings, never a member agent's, and the team model's `context_window` sets its replay budget.
[Ad hoc teams](https://docs.mindroom.chat/configuration/teams/#ad-hoc-teams) have no `teams:` entry, so their history and compaction settings come from `defaults`, not from any participating agent.
# Memory System
Memory lets agents remember facts, preferences, and context across conversations.
This page covers choosing a memory backend, configuring embeddings and extraction, file-based memory, the `memory` tool, and Agno Learning.
| Backend | What it does | Use it when |
|---|---|---|
| `mem0` (default) | Vector memory: relevant memories are retrieved before each reply and new ones are extracted automatically after each turn | You want hands-off semantic memory |
| `file` | Markdown files (`MEMORY.md` plus dated notes in `memory/`) that are the source of truth | You want memory you can read and edit, or an OpenClaw-style workspace |
| `none` | No built-in memory | The agent should keep no memories ([Agno Learning](#agno-learning) stays on unless disabled) |
<video controls playsinline preload="metadata" aria-label="The agent remembers each person's diet and plans the week's dinners" style="width: 100%" poster="https://github.com/user-attachments/assets/deebd6ee-063e-4227-a2ad-ea3ee15ccf8e" data-poster-light="https://github.com/user-attachments/assets/deebd6ee-063e-4227-a2ad-ea3ee15ccf8e" data-poster-dark="https://github.com/user-attachments/assets/4ae62fd6-04fe-4dcc-aed6-d9b1de92b5f9">
<source src="https://github.com/user-attachments/assets/440c7742-da69-41e1-a131-788ca5307e31" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/a7ccca20-2047-4d8c-8bf5-a2251e0946f3" type="video/mp4">
</video>
## Choosing a Backend
Set the global backend with `memory.backend` (`mem0`, `file`, or `none`; default `mem0`), and override it for one agent with `agents.<name>.memory_backend`.
`memory: none` is shorthand for `memory: {backend: none}`.
```yaml
memory:
backend: mem0
agents:
coder:
display_name: Coder
role: Write and review code
memory_backend: file
scratch:
display_name: Scratch
role: Stateless scratchpad agent
memory_backend: none
```
With `none`, the agent gets no memories in its prompt, stores none after its turns, and does not receive the `memory` tool.
`none` does not turn off [Agno Learning](#agno-learning); set `learning: false` as well to disable all built-in memory and learning.
Conversation history is separate and stays in the session; see [History & Compaction](https://docs.mindroom.chat/configuration/history/).
OpenClaw-compatible agents use this same backend selection.
## Memory Scopes
| Scope | ID | Contents |
|---|---|---|
| Agent | `agent_<name>` | The agent's preferences and durable user context |
| Team | `team_<agent1>+<agent2>+...` (member names sorted) | Shared memory from team conversations |
An agent's memory reads cover its own scope and the scopes of the configured teams it belongs to, searched through the agent's own backend.
A team reads its own team scope; set `memory.team_reads_member_memory: true` (default `false`) to let it also read its members' agent scopes.
Team memory picks one backend from the members' effective backends:
- All members use `file`: the team uses file memory.
- All members use `none`: team memory is disabled.
- Any other combination, including `file` plus `none`, uses Mem0 with the configured `memory.embedder` and `memory.llm`.
A member's `none` setting disables only its own memory, so team conversations it takes part in can still be remembered in the team scope.
A `file` member of a team that uses Mem0 does not see that team's memory in its own conversations.
## Backend: `mem0`
Before each reply, Mem0 retrieves memories relevant to the message and adds them to the prompt.
After each turn, the [memory LLM](#memory-llm) extracts durable facts into a Chroma vector store under the agent's storage directory.
### Embedder
`memory.embedder` sets the embedding model used by Mem0, semantic file-memory search, and [knowledge bases](https://docs.mindroom.chat/knowledge/#embedder-configuration).
Mem0 supports the `openai` (default), `ollama`, `huggingface`, and `sentence_transformers` providers; semantic file memory and knowledge bases support the [narrower set](https://docs.mindroom.chat/knowledge/#embedder-configuration).
| Field | Default | Description |
|---|---|---|
| `provider` | `openai` | Embedding provider |
| `config.model` | `text-embedding-3-small` | Embedding model name |
| `config.host` | `null` | Base URL for OpenAI-compatible endpoints, or the Ollama host; for `ollama`, a configured `OLLAMA_HOST` takes precedence, and the fallback is `http://localhost:11434` |
| `config.dimensions` | `null` | Embedding dimension override (>= 1) for OpenAI-compatible providers |
| `config.api_key` | `null` | Explicit API key for the `openai` provider |
| `config.credentials_service` | `null` | Credential service that supplies the `openai` provider's key |
```yaml
memory:
backend: mem0
embedder:
provider: openai
config:
model: text-embedding-3-small
credentials_service: embedder # Optional strict credential binding
dimensions: null # Optional, for example 256
```
Fully local embedders:
```yaml
memory:
embedder:
provider: sentence_transformers
config:
model: sentence-transformers/all-MiniLM-L6-v2
```
```yaml
memory:
embedder:
provider: ollama
config:
model: nomic-embed-text
host: http://localhost:11434
```
MindRoom installs the optional `sentence_transformers` extra the first time that provider is used.
Changing the embedder provider, model, host, or dimensions switches Mem0 to a separate collection, so memories stored with the previous embedder are no longer retrieved.
The `openai` embedder takes its API key from the first of these that is set:
1. `memory.embedder.config.api_key`.
2. The service named by `memory.embedder.config.credentials_service`; when it has no key, MindRoom does not fall back to another key.
3. When no service is named, the dedicated `embedder` credential (seeded from `EMBEDDER_API_KEY` or `EMBEDDER_API_KEY_FILE`), then the shared `openai` provider key.
Use `credentials_service` when the embedding endpoint needs a different key than chat, voice, or other OpenAI-compatible models.
With no key at all, keyless local OpenAI-compatible endpoints still work, while a keyed endpoint fails with an authentication error.
When the embedder rejects its credential, semantic memory search reports the cause in `memory` tool output and in the agent's prompt instead of returning empty results, and `/api/health` includes an `embedder` block until a request succeeds again.
### Memory LLM
`memory.llm` sets the model Mem0 uses to extract memories.
Supported providers are `ollama`, `openai`, `openrouter`, and `anthropic`.
When `memory.llm` is omitted, MindRoom uses `gemma4` on the Ollama server set by `OLLAMA_HOST` (default `http://localhost:11434`).
With `provider: ollama`, `config.host` points extraction at a different Ollama server, but a configured `OLLAMA_HOST` takes precedence; other providers ignore `host`.
With `provider: openai`, use `gpt-6-luna`; MindRoom drops the `temperature` and `top_p` values Mem0 sends, which GPT-6 models reject.
```yaml
memory:
llm:
provider: ollama
config:
model: gemma4
```
OpenRouter-only example, where both the memory LLM and the embeddings use the `openrouter` key:
```yaml
memory:
embedder:
provider: openai
config:
model: openai/text-embedding-3-small
host: https://openrouter.ai/api/v1
credentials_service: openrouter
dimensions: 1536
llm:
provider: openrouter
config:
model: openai/gpt-6-luna
```
The LLM uses `memory.llm.config.api_key` when set and not blank, and otherwise the provider's credential (for example `openrouter`, or a dashboard credential stored as `OPENROUTER_API_KEY`).
When `OPENROUTER_API_KEY` is set in the process environment, the `openai` and `openrouter` memory LLMs send that key to OpenRouter, overriding `memory.llm.config.api_key`.
## Backend: `file`
File memory keeps `MEMORY.md` and dated notes under `memory/` in the agent's workspace, and those files are the source of truth.
```yaml
memory:
backend: file
file:
max_entrypoint_lines: 200
max_entrypoint_tokens: 50000
search:
mode: keyword
include:
- memory/**/*.md
include_entrypoint: false
auto_flush:
enabled: true
```
For a single agent, the file backend writes memory only when the agent uses the [`memory` tool](#memory) or edits the files, or when [auto-flush](#file-auto-flush-worker) is enabled; it does not extract memories after every turn like `mem0`.
A team whose members all use `file` appends each message it answers to the team's `MEMORY.md`, even without auto-flush.
Before each reply, MindRoom inlines the start of `MEMORY.md` into the prompt under a header with its path, so the agent does not need to re-read it, and adds memories that match the message.
`memory.file.max_entrypoint_lines` (default `200`, minimum `1`) caps the inlined lines, and `memory.file.max_entrypoint_tokens` (default `50000`, minimum `1`) caps their estimated size at characters / 4.
Only whole lines are inlined, so a line that would cross the token cap is withheld with everything after it.
When either cap truncates, a marker reports the included and total line counts, both caps, and the path to read for the rest.
`memory.file.path` (default unset, relative to the config directory) is a fallback root for team file memory and never moves agent file memory out of the workspace.
### File layout
Agent file memory lives in the agent workspace, `agents/<agent>/workspace/` in the storage directory:
- `MEMORY.md`, where `add_memory` writes
- `memory/YYYY-MM-DD.md`, where auto-flush writes
Team file memory is mirrored under each member's storage directory:
- `agents/<agent>/memory_files/team_<sorted_members>/MEMORY.md`
- `agents/<agent>/memory_files/team_<sorted_members>/memory/YYYY-MM-DD.md`
Memory files must be regular files; symlinks, FIFOs, and device nodes are ignored when reading and rejected when writing.
Each file is read up to 1 MiB, cut at its last complete line, and updating a truncated or non-UTF-8 file fails so the rest of it is preserved.
### Searching file memory
`memory.search` controls how `search_memories` and per-turn retrieval search file memory, and `agents.<name>.memory_search` overrides it per agent, with omitted fields inherited.
| Field | Default | Description |
|---|---|---|
| `mode` | `keyword` | `keyword` or `semantic` |
| `include` | `[memory/**/*.md]` | Glob patterns relative to the file-memory root that semantic search indexes; must be non-empty |
| `include_entrypoint` | `false` | Also index `MEMORY.md` for semantic search |
In `keyword` mode, `search_memories` matches structured entries with IDs in `MEMORY.md`, plus entries and plain-text lines in `memory/**/*.md`.
Ordinary prose in `MEMORY.md` reaches the agent through the prompt preload, not keyword search; to reach lines beyond the preload cap, read the file directly or use semantic search with `include_entrypoint: true`.
In `semantic` mode, MindRoom builds a vector index of the `include` files with `memory.embedder` on first use and stores it under `<storage-root>/knowledge_db/` (see [Knowledge storage](https://docs.mindroom.chat/knowledge/#storage)).
Until the index is ready, or when embeddings fail, search falls back to keyword results.
Writes through the `memory` tool and auto-flush refresh the index, but a ready index does not notice direct file edits until a later such write refreshes it.
Semantic mode covers the agent's own memory; team file memory is always keyword searched.
```yaml
agents:
coder:
display_name: Coder
role: Write and review code
memory_backend: file
memory_search:
mode: semantic
```
Once its semantic index is ready, an agent's file memory also appears as a read-only source in `search_knowledge_base`.
That source is semantic-only, without keyword fallback, team memory, or memory IDs, so use `search_memories` when you need those.
### Per-requester file memory
To give each requester their own file memory from one agent definition, combine `memory_backend: file` with [`private`](https://docs.mindroom.chat/configuration/agents/#private-instances); the requester's private root then becomes the file-memory root.
## File Auto-Flush Worker
Auto-flush periodically turns recent conversation in file-backed agents into durable memories.
It applies only to agents whose effective backend is `file`.
1. Each turn marks its session as having unsaved conversation.
2. A background worker picks eligible sessions in bounded batches.
3. The agent's own model reads the new messages, plus existing memories to avoid duplicates, and writes durable facts.
4. When the model answers with the `no_reply_token`, nothing is written.
5. Results are appended to `memory/YYYY-MM-DD.md`.
```yaml
memory:
backend: file
auto_flush:
enabled: true
flush_interval_seconds: 1800
idle_seconds: 120
max_dirty_age_seconds: 600
batch:
max_sessions_per_cycle: 10
extractor:
max_messages_per_flush: 20
```
| Field | Default | Description |
|---|---|---|
| `enabled` | `false` | Turn on auto-flush |
| `flush_interval_seconds` | `1800` (min 5) | Time between worker cycles |
| `idle_seconds` | `120` (min 0) | Session idle time before it becomes eligible |
| `max_dirty_age_seconds` | `600` (min 1) | Make a session eligible after this long with unsaved conversation, even if still active |
| `stale_ttl_seconds` | `86400` (min 60) | Forget pending sessions older than this |
| `max_cross_session_reprioritize` | `5` (min 0) | Other pending sessions of the same agent moved up the queue when a new message arrives |
| `retry_cooldown_seconds` | `30` (min 1) | Wait before retrying a failed extraction |
| `max_retry_cooldown_seconds` | `300` (min 1) | Upper bound for the growing retry wait |
| `batch.max_sessions_per_cycle` | `10` (min 1) | Sessions processed per cycle |
| `batch.max_sessions_per_agent_per_cycle` | `3` (min 1) | Sessions per agent processed per cycle |
| `extractor.no_reply_token` | `NO_REPLY` | Reply meaning nothing should be saved |
| `extractor.max_messages_per_flush` | `20` (min 1) | Messages considered per extraction |
| `extractor.max_chars_per_flush` | `12000` (min 1) | Message characters considered per extraction |
| `extractor.max_extraction_seconds` | `30` (min 1) | Timeout for one extraction, retried in a later cycle |
| `extractor.include_memory_context.memory_snippets` | `5` (min 0) | Existing memories shown to the model to avoid duplicates |
| `extractor.include_memory_context.snippet_max_chars` | `400` (min 1) | Characters per existing memory shown |
## Prompt Curation
Agents append to `MEMORY.md` and their context files more often than they condense them, so the prompt they send on every turn keeps growing.
Enable the [`prompt_curation`](https://docs.mindroom.chat/scheduling/#prompt_curation) automation to have MindRoom check their size daily and, once they pass a trigger, ask the agent in a visible thread to condense them gradually and move detail into searchable `memory/` files, then measure the result and ask the agent to re-check a cut outside the bounds.
```yaml
agents:
mind:
memory_backend: file
automations: [prompt_curation]
```
## [`memory`]
The `memory` tool lets an agent deliberately remember, look up, correct, or forget something, alongside automatic memory.
It has no tool-specific configuration; it always uses the agent's effective backend and the `memory.search` settings, and agents with `memory_backend: none` do not receive it.
```yaml
agents:
assistant:
tools: [memory]
```
```python
add_memory("The user prefers terse release notes.")
search_memories("release notes", limit=3) # default limit 5
list_memories(limit=20) # default limit 50
get_memory("abc123")
update_memory("abc123", "The user prefers terse release notes with dates.")
delete_memory("abc123")
```
The tool reaches every agent and team scope visible to the agent, as described in [Memory Scopes](#memory-scopes).
Search and list results include an ID: Mem0 memory IDs and file-backed `file:<path>:<line>` IDs work with `get_memory`, `update_memory`, and `delete_memory`.
Semantic file-memory matches use read-only `semantic:<source_file>:<rank>` locators that these functions do not accept.
Result metadata includes `search_mode` (`keyword` or `semantic`), showing which search produced each result.
Failures are returned as readable error messages rather than raised into the conversation.
## UI Configuration
The Dashboard **Memory** page edits the `memory` section: backend, `team_reads_member_memory`, embedder provider, model, credential service, and host, file settings (`path`, `max_entrypoint_lines`, `max_entrypoint_tokens`), search settings, and all auto-flush settings.
The remaining fields, such as `llm`, are under **More settings**.
Save from the Memory page to write the changes to `config.yaml`.
## Agno Learning
Agno Learning builds a persistent profile of user preferences from conversations, separately from the memory backends above.
It is on by default for every agent, and `memory_backend: none` does not disable it.
```yaml
defaults:
learning: true # default
learning_mode: always # learn after every turn; agentic lets the agent decide via a tool
agents:
assistant:
learning: false # disable for one agent
research:
learning_mode: agentic
```
See [Agent fields](https://docs.mindroom.chat/configuration/agents/#defaults) for how `learning` and `learning_mode` inherit from `defaults`.
Disabled agents create and update no learning data.
Learning data is stored in `learning/<agent>.db` under the agent's state root (`agents/<agent>/` in the storage directory for shared agents), so it survives container restarts when the storage directory is mounted.
# Knowledge Bases
Knowledge bases give agents access to your own documents.
Point a knowledge base at a folder or Git repository and assign it to agents.
In `semantic` mode (the default), MindRoom indexes the files with an embedder into a vector database, and assigned agents get a `search_knowledge_base` tool.
In `files` mode, MindRoom skips embeddings and agents inspect the files directly with their file and shell tools.
## Quick Start
Add a knowledge base and assign it to an agent:
```yaml
knowledge_bases:
docs:
description: Product documentation, support notes, and internal operating procedures
mode: semantic
path: ./knowledge_docs
watch: false
chunk_size: 5000
chunk_overlap: 0
agents:
assistant:
display_name: Assistant
role: A helpful assistant with access to our docs
knowledge_bases: [docs]
```
Place files in `./knowledge_docs/`, then trigger a reindex from the dashboard or API, or set `watch: true` so MindRoom picks up file changes automatically.
Knowledge base IDs are the keys under `knowledge_bases`.
An ID must be a non-empty single path component such as `docs` or `company_docs`; `.`, `..`, and names containing `/`, `\`, or line breaks are rejected.
### Files-Only Knowledge Base
Use `mode: files` when agents should search, grep, list, and read the source files directly without paying for embeddings.
```yaml
knowledge_bases:
source_docs:
description: Source documents the agent should inspect directly
mode: files
path: ${MINDROOM_STORAGE_PATH}/agents/assistant/workspace/source_docs
agents:
assistant:
display_name: Assistant
role: A helpful assistant with direct file access to source docs
memory_backend: file
tools: [file, shell]
knowledge_bases: [source_docs]
```
A files-mode base has no vector index, does not use the embedder, and does not provide `search_knowledge_base`.
The agent needs a workspace, which `memory_backend: file` creates at `${MINDROOM_STORAGE_PATH}/agents/<agent>/workspace` (private agents use their private root).
When the base's path is inside that workspace and the folder exists, MindRoom exposes it as `knowledge/<base_id>` and tells the agent to use file tools on it.
Bases outside the workspace are not linked, and with the default [`file_access: workspace`](https://docs.mindroom.chat/configuration/agents/#configuration-options) the agent's file tools cannot reach them.
## Configuration
```yaml
knowledge_bases:
my_docs:
description: Product documentation, support notes, and internal operating procedures
mode: semantic # "semantic" builds a vector search index; "files" skips embeddings
path: ./knowledge_docs/my_docs # Folder containing documents
watch: false # Direct external edits require reindex; dashboard/API changes still refresh
require_content_before_publish: false
chunk_size: 5000
chunk_overlap: 0
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `description` | string | `""` | What the base contains; shown to agents in the `search_knowledge_base` tool description and in files-mode instructions so they know when to use it |
| `mode` | `semantic` or `files` | `semantic` | `semantic` builds an embedding-backed search index; `files` skips embeddings and exposes the files to workspace-aware agents |
| `path` | string | `./knowledge_docs` | Folder path, relative to the config file directory or absolute |
| `watch` | bool | `true` | Watch the local folder and refresh in the background when files change. When `false`, direct external edits require an explicit reindex; dashboard/API uploads and deletes still trigger a refresh |
| `require_content_before_publish` | bool | `false` | Keep a new semantic index in the initializing state until at least one source file exists, instead of publishing an empty index |
| `chunk_size` | int | `5000` | Maximum characters per chunk for plain-text and Markdown files (minimum `128`); other formats such as JSON and PDF use their reader's own chunking; semantic mode only |
| `chunk_overlap` | int | `0` | Overlap characters between adjacent plain-text and Markdown chunks; must be smaller than `chunk_size`; semantic mode only |
| `include_patterns` | list | `[]` | Root-anchored glob patterns a file must match to be included |
| `exclude_patterns` | list | `[]` | Root-anchored glob patterns removed after include filtering |
| `include_extensions` | list | `null` | Exact set of extensions to index instead of the default text-like set (semantic mode only) |
| `extra_extensions` | list | `[]` | Extensions to index in addition to the default set (semantic mode only) |
| `exclude_extensions` | list | `[]` | Extensions to exclude, applied last (semantic mode only) |
| `skip_hidden` | bool | `true` | Skip files and folders whose names start with `.`, such as temp files from editors that write in place. Git-backed bases use `git.skip_hidden` instead |
| `git` | object | `null` | Sync the folder from a Git repository; see [Git-Backed Knowledge Bases](#git-backed-knowledge-bases) |
Set `skip_hidden: false` if the folder intentionally contains dot-prefixed files that should be indexed.
Use a smaller `chunk_size` when your embedding server has lower token or batch limits; chunks that are too large make indexing fail with embedder 500 errors.
### Keeping Indexes Fresh
Chat never waits for indexing or Git sync.
Agents search the last successfully published index, and a missing, stale, or failed base schedules a background refresh while the current request continues.
A successful refresh replaces the published index; a failed refresh keeps the previous one and shows the error in the base's status.
A refresh reuses the stored vectors of unchanged files and only embeds files that were added or edited.
Changing `chunk_size`, `chunk_overlap`, the embedder, or any file filter re-embeds the whole base on the next refresh.
An explicit reindex from the dashboard or API rebuilds every vector, which is how you replace an index you no longer trust.
An interrupted or failed semantic build continues where it stopped on the next refresh instead of starting over.
Temporary embedding failures (timeouts, connection errors, HTTP 408, 429, and 5xx) are retried, while permanent failures such as authentication errors stop the refresh until you fix the cause.
Knowledge base configuration hot-reloads.
After a `chunk_size` or `chunk_overlap` change, agents keep searching the previous index until the rebuild succeeds.
After a change to `path`, `mode`, the embedder, the Git source, or any file filter, the base is not searchable until its new index is built.
### Indexing Performance
| Environment variable | Default | Description |
|----------------------|---------|-------------|
| `MINDROOM_KNOWLEDGE_FILE_INDEX_CONCURRENCY` | `4` | Files indexed concurrently within one semantic refresh, from `1` through `128`; invalid values are rejected at startup |
| `MINDROOM_KNOWLEDGE_REFRESH_CONCURRENCY` | `1` | Knowledge base refreshes that run at the same time; must be at least `1` |
| `MINDROOM_KNOWLEDGE_REFRESH_SUBPROCESS_TIMEOUT_SECONDS` | `3600` | Maximum seconds for one background refresh; must be a finite positive number. Raise it for very large corpora |
Local `sentence_transformers` embedding indexes one file at a time regardless of `MINDROOM_KNOWLEDGE_FILE_INDEX_CONCURRENCY`.
### File Type Filtering
In semantic mode, MindRoom indexes a default set of text-like extensions covering Markdown, plain text, source code, and structured text formats such as `.json`, `.yaml`, and `.csv`.
```yaml
knowledge_bases:
reports:
path: ./knowledge_docs/reports
extra_extensions: [".pdf", ".docx"] # Default text-like set plus PDF and Word
exclude_extensions: [".csv"] # Drop CSV files from the default set
```
- `extra_extensions` adds extensions on top of the default set.
- `include_extensions` replaces the default set entirely, and `extra_extensions` still adds on top of it.
- `exclude_extensions` removes extensions last and wins over both.
The allowed set depends only on this configuration, never on the embedder or installed packages.
Formats such as `.pdf`, `.docx`, or `.pptx` need their reader package (for example `pypdf`, `python-docx`, or `python-pptx`) installed in the MindRoom environment.
When a reader package is missing, the refresh indexes the other files, logs a warning naming the file and the missing package, and reports an indexing error instead of publishing an index that silently lacks those files.
Extension filtering does not apply in `files` mode.
Semantic indexing skips symlinked files and folders inside a base, so copy linked documents into the base instead.
Files larger than 64 MiB are left out of every knowledge base with a logged warning, and the next refresh removes any vectors they already had.
A `.json` file is split into one searchable document per top-level JSON value.
If the file is not valid JSON, its raw text is indexed like plain text and a warning names the file and the line and column of the parse error; fix that error to get per-value splitting back.
### Multiple Knowledge Bases
Define several knowledge bases and assign each agent the ones it needs:
```yaml
knowledge_bases:
engineering:
path: ./knowledge_docs/engineering
product:
path: ./knowledge_docs/product
legal:
path: ./knowledge_docs/legal
chunk_size: 1000
chunk_overlap: 100
agents:
developer:
display_name: Developer
role: Engineering assistant
knowledge_bases: [engineering]
pm:
display_name: Product Manager
role: Product planning assistant
knowledge_bases: [product, engineering]
compliance:
display_name: Compliance
role: Legal and compliance reviewer
knowledge_bases: [legal]
```
When an agent searches several semantic bases, results are interleaved so no single base dominates the top results.
Knowledge base paths must not be nested inside one another.
Several bases may use exactly the same path to expose different filtered views of one folder, as long as their Git settings (`repo_url`, `branch`, `credentials_service`, and `lfs`) match or none of them uses Git; see [File Filtering with Patterns](#file-filtering-with-patterns).
### Private Agent Knowledge
Use `agents.<name>.private.knowledge` when each requester of a [private agent](https://docs.mindroom.chat/configuration/agents/#private-instances) should have their own knowledge index built from their private root.
```yaml
knowledge_bases:
company_docs:
description: Shared company policies, project notes, and operating procedures
path: ./company_docs
watch: false
agents:
mind:
display_name: Mind
role: A persistent personal AI companion
model: sonnet
private:
per: user
root: mind_data
template_dir: ./mind_template
knowledge:
description: Requester-private notes, preferences, and working memory for this agent
path: memory
watch: false
knowledge_bases: [company_docs]
```
Each requester's private knowledge path becomes `<their private root>/memory`, and their index is never shared with another requester.
The fields are listed under [Private Fields](https://docs.mindroom.chat/configuration/agents/#private-fields).
`private.knowledge.path` is required unless `private.knowledge.enabled` is `false`; it must be relative to the private root (`.` allowed) and cannot be absolute or escape with `..`.
Private knowledge has no background file watcher: with `watch: true` or `git`, it refreshes when the agent uses it, and with `watch: false` and no `git`, external edits are not picked up automatically.
An agent can combine private knowledge with shared top-level `knowledge_bases`, which stay the mechanism for documents shared across agents or users.
Private knowledge is available in normal agent conversations, not through the OpenAI-compatible `/v1` API.
With `private.knowledge.git`, use a dedicated subtree such as `kb_repo`; MindRoom rejects `.` and any path that overlaps private file memory (`memory/`, `MEMORY.md`) or content copied from `template_dir`.
## Git-Backed Knowledge Bases
A knowledge base can sync its folder from a Git repository.
MindRoom refreshes a shared Git-backed base every `poll_interval_seconds`, starting one interval after startup, and agents keep using the last published index while a refresh runs.
```yaml
knowledge_bases:
pipefunc_docs:
path: ./knowledge_docs/pipefunc
chunk_size: 1200
chunk_overlap: 120
git:
repo_url: https://github.com/pipefunc/pipefunc
branch: main
poll_interval_seconds: 300
lfs: false
skip_hidden: true
include_patterns:
- "docs/**"
```
### Git Configuration Fields
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `repo_url` | string | *required* | Repository URL to clone and fetch; see the accepted forms below |
| `branch` | string | `main` | Branch to track |
| `poll_interval_seconds` | int | `300` | Interval between background Git refreshes (minimum `5`) |
| `credentials_service` | string | `null` | Credential service for private repositories; see [Private Repository Authentication](#private-repository-authentication) |
| `lfs` | bool | `false` | Download Git LFS files after each sync. Requires `git-lfs` on the machine running MindRoom; bundled container images include it |
| `sync_timeout_seconds` | int | `3600` | Abort a single Git command after this many seconds (minimum `5`) |
| `skip_hidden` | bool | `true` | Skip files and folders whose names start with `.` |
| `include_patterns` | list | `[]` | Root-anchored glob patterns to include |
| `exclude_patterns` | list | `[]` | Root-anchored glob patterns to exclude |
#### Accepted `repo_url` forms
| Form | Example |
|------|---------|
| URL with a host | `https://github.com/org/repo.git`, `ssh://git@host/org/repo.git` |
| scp-style SSH | `git@github.com:org/repo.git`, `github.com:org/repo.git` |
| Absolute local path | `/srv/repos/repo.git` |
| `file:` URL | `file:///srv/repos/repo.git` |
Network forms must have a resolvable host.
MindRoom refuses, with an error naming the reason, relative and home-relative paths (`./repo.git`, `../repo.git`, `~/repo.git`, `repo.git`), and URLs with an empty host (`https:///org/repo.git`).
**Do not embed credentials in `repo_url`.**
A password in a well-formed URL is kept out of the checkout's Git configuration, but it stays in your config file and is passed to Git on every command.
A credential MindRoom cannot reliably separate from the URL, such as `oauth2:TOKEN@gitlab.com:org/repo.git` or `x-access-token:TOKEN@github.com/org/repo.git`, makes the sync fail.
Use `credentials_service` instead; those credentials reach Git only for the duration of each command and are never written to disk.
### Sync Behavior
- An explicit reindex or sync from the dashboard or API syncs Git first, then rebuilds the semantic index or, in files mode, publishes the new file list.
- The checkout is owned by MindRoom: when the branch moves, sync discards local edits to tracked files and restores deleted ones, so edit the source repository and sync instead.
- Dashboard and API file uploads and deletes are rejected for Git-backed bases.
- When `lfs: true`, MindRoom downloads all LFS files after each sync, even ones the indexing filters exclude.
- LFS downloads use the endpoint derived from `repo_url`; an LFS URL set in the repository's `.lfsconfig` is ignored.
### File Filtering with Patterns
Patterns are matched from the repository or folder root.
`*` matches one path segment and `**` matches zero or more segments.
```yaml
knowledge_bases:
project_docs:
path: ./knowledge_docs/project
git:
repo_url: https://github.com/org/project
include_patterns:
- "docs/**" # All files under docs/
- "README.md" # Root README only
- "content/posts/*/index.md" # Specific nested files
exclude_patterns:
- "docs/internal/**" # Exclude internal docs
```
- If `include_patterns` is empty, all non-hidden files are eligible.
- If `include_patterns` is set, a file must match at least one pattern.
- `exclude_patterns` are applied last and remove matching files.
- On a Git-backed base, a file must pass both the top-level patterns and the `git` patterns.
Pointing several bases at the same path is the preferred way to expose separate views of a large repository without cloning it more than once:
```yaml
knowledge_bases:
project_docs:
path: ./knowledge_docs/project
git:
repo_url: https://github.com/org/project
branch: main
include_patterns: ["docs/**"]
project_source:
path: ./knowledge_docs/project
git:
repo_url: https://github.com/org/project
branch: main
include_patterns: ["src/**"]
```
### Checkout Layout
The knowledge folder holds only the checked-out files.
The Git data lives at `<storage>/knowledge_git/<folder>_<path digest>`, and bases that share a folder share it.
A `.git` written into the knowledge folder is ignored and never indexed.
The folder must be empty when MindRoom first clones into it.
Changing a base's `path` starts a new clone in the new folder; delete the old directory under `<storage>/knowledge_git/` to reclaim its space.
Deleting only the knowledge folder restores its files from the Git data on the next sync; delete both to clone afresh.
Knowledge Git commands ignore system and global Git configuration, repository hooks, and credential helpers, and they do not receive MindRoom's secrets.
Configure proxies, CA bundles, and SSH through environment variables or `~/.ssh/config`, and credentials through `credentials_service`.
### Private Repository Authentication
For private HTTPS repositories, store credentials and reference them in the config.
**Step 1:** Store credentials through the dashboard **Credentials** tab or the API:
```bash
curl -X POST http://localhost:8765/api/credentials/github_private \
-H "Content-Type: application/json" \
-d '{"credentials":{"username":"x-access-token","token":"ghp_your_token_here"}}'
```
**Step 2:** Reference the service name in the knowledge base config:
```yaml
knowledge_bases:
private_docs:
path: ./knowledge_docs/private
git:
repo_url: https://github.com/org/private-repo
credentials_service: github_private
```
| Fields | Notes |
|--------|-------|
| `username` + `token` | Standard GitHub or GitLab access token |
| `username` + `password` | Basic HTTP auth; the password wins if a token is also set |
| `token` or `api_key` alone | Authenticates as `x-access-token` |
For unattended GitHub access, a GitHub App installation can replace a personal access token.
Store this object under the service named by `credentials_service`:
```json
{
"auth_type": "github_app",
"app_id": 12345,
"installation_id": 67890,
"private_key_file": "/var/run/secrets/github-app/private-key.pem"
}
```
`private_key_file` must be an absolute path, ideally a read-only secret mount; do not put the PEM contents in the credential object.
`repo_url` must use the canonical `https://github.com/<owner>/<repository>` form.
MindRoom requests short-lived installation tokens limited to that repository with read-only Contents permission, so the App needs Contents read access, and the tokens are never written to disk or logs.
## Open Knowledge Format Bundles
An [Open Knowledge Format](https://github.com/GoogleCloudPlatform/open-knowledge-format) (OKF) bundle is a folder of markdown files whose YAML frontmatter records who wrote each concept, who verified it, and whether it is current.
Use `mode: files` for OKF bundles, because semantic search cannot filter on frontmatter.
Agents with the bundled `open-knowledge-format` skill report trust and freshness when they answer, and when they edit, they record themselves as the author and add a `verified` entry only when a person confirms the content.
### Reading a Published Bundle
Mirror the bundle's repository inside the agent workspace and name the bundle root in the description:
```yaml
knowledge_bases:
acme_okf:
description: Acme Retail finance knowledge, a read-only Open Knowledge Format (OKF) bundle mirrored from Git. Start at knowledge/acme_okf/bundles/acme_retail/index.md.
mode: files
path: ${MINDROOM_STORAGE_PATH}/agents/analyst/workspace/okf/acme
git:
repo_url: https://github.com/GoogleCloudPlatform/open-knowledge-format
agents:
analyst:
display_name: Analyst
role: Answers questions from the team's knowledge bundles
memory_backend: file
tools: [file]
knowledge_bases: [acme_okf]
skills: [open-knowledge-format]
```
The mirror is a [Git-backed base](#git-backed-knowledge-bases), so trigger a sync from the dashboard to clone it before the first poll.
### Maintaining a Bundle with Agents
For a bundle that agents edit, create a local folder with a root `index.md` inside the agent workspace, then add it to the agent's `knowledge_bases`:
```yaml
knowledge_bases:
ops_wiki:
description: The team's ops wiki, an Open Knowledge Format (OKF) bundle that the team and its agents maintain.
mode: files
path: ${MINDROOM_STORAGE_PATH}/agents/analyst/workspace/okf/ops_wiki
```
## Embedder Configuration
Semantic knowledge bases use the embedder configured under `memory.embedder`; files-mode bases use none.
Semantic knowledge and file-memory indexes support the `openai`, `ollama`, and `sentence_transformers` providers, while the Mem0 memory backend also supports `huggingface`.
| Provider | Model example | Notes |
|----------|---------------|-------|
| `openai` | `text-embedding-3-small` | Also works with keyless OpenAI-compatible local endpoints |
| `ollama` | `nomic-embed-text` | Self-hosted; set `host` or `OLLAMA_HOST` |
| `sentence_transformers` | `sentence-transformers/all-MiniLM-L6-v2` | Runs locally in MindRoom; the optional extra installs on first use |
See [Memory](https://docs.mindroom.chat/memory/#embedder) for the embedder fields, API key resolution, and how embedder failures are reported.
## Storage
Semantic indexes are stored under `<storage_path>/knowledge_db/<base_id>_<hash>/`, where the hash comes from the resolved knowledge path.
For private agent knowledge, the requester's private root is part of that path, so each requester gets a separate index.
Files-mode bases need no vector database.
The storage path defaults to `mindroom_data/` next to `config.yaml` and can be changed with `MINDROOM_STORAGE_PATH`.
## Search Limits
A search times out after 30 seconds, and at most four searches run at once; a search that finds no free slot can fail with `Knowledge reader is busy; try again shortly`.
## Dashboard and API
Manage knowledge bases, files, reindexing, and Git sync from the dashboard **Knowledge** tab or the API; see [Dashboard](https://docs.mindroom.chat/dashboard/#knowledge) for the tab and the [knowledge API endpoints](https://docs.mindroom.chat/dashboard/#knowledge-api).
# Skills
Skills are instruction packs: a `SKILL.md` file with optional scripts and reference documents that guide an agent through a task without adding new code capabilities.
MindRoom uses Agno's skills system with OpenClaw-compatible metadata.
This page covers writing, installing, and allowlisting skills, skills agents keep in their own workspace, and opt-in automatic skill learning.
## Skill directory structure
A skill is a directory containing:
```
my-skill/
├── SKILL.md # Required: instructions; YAML frontmatter is recommended
├── scripts/ # Optional: executable scripts
│ └── audit.sh
└── references/ # Optional: reference documents
└── examples.md
```
## SKILL.md format (OpenClaw compatible)
```markdown
---
name: repo-quick-audit
description: Quick repository audit checklist
metadata: '{openclaw:{requires:{bins:["git"], env:["GITHUB_TOKEN"]}}}'
---
# Repo Quick Audit
1. Check CI status
2. Review open issues
```
| Field | Type | Description |
| --- | --- | --- |
| `name` | string | Unique skill identifier; defaults to the skill directory name |
| `description` | string | Brief summary shown to users and models; defaults to the skill name when omitted or blank |
| `metadata` | mapping or JSON5 string | OpenClaw metadata (see [Eligibility gating](#eligibility-gating-openclaw-metadata)) and custom fields |
| `license` | string | Informational only; accepted but not used by the runtime |
| `compatibility` | string | Informational only; accepted but not used by the runtime |
| `allowed-tools` | list | Reserved; accepted but not enforced by the runtime |
A skill without any frontmatter still loads with the name and description fallbacks, but frontmatter gives clearer listings.
Keep each skill focused on one capability, give it a descriptive name such as `code-review`, and declare its dependencies with `metadata.openclaw.requires`.
Workspace skill frontmatter must not use YAML aliases, `%TAG` directives, or unusually large or deeply nested structures.
A workspace skill that breaks these limits is skipped with a warning, while bundled, plugin, and `~/.mindroom/skills` skills are parsed like any YAML.
## Installing and managing skills
Install a user skill at `~/.mindroom/skills/<name>/SKILL.md`, or use the dashboard Skills page to create, view, edit, and delete user skills.
Bundled and plugin-provided skills are visible but read-only in the dashboard.
An agent can use a bundled, plugin, or user skill only after you add its name to the agent's `skills:` allowlist in `config.yaml`:
```yaml
agents:
developer:
display_name: Developer
role: A coding assistant
model: sonnet
skills:
- repo-quick-audit
- code-review
```
If `skills` is empty or unset, the agent gets no bundled, plugin, or user skills.
Skills in the agent's own workspace load without being listed; see [Workspace skills](#workspace-skills).
## Skill locations and precedence
MindRoom resolves skills for each agent from these locations, in this order:
1. Bundled skills shipped with MindRoom
2. Plugin-provided skill directories (see [Plugins](https://docs.mindroom.chat/plugins/))
3. User skills: `~/.mindroom/skills/`
4. Agent workspace skills: `<resolved workspace>/skills/`
For agents without `private`, the workspace skills directory is `<storage>/agents/<agent>/workspace/skills/`.
Private instances use `<storage>/private_instances/<scope-directory>/<agent>/<private.root>/skills/`; see [Private Instances](https://docs.mindroom.chat/configuration/agents/#private-instances).
If several skills share a name, the later location wins: agent workspace over user, user over plugin, and plugin over bundled.
## Workspace skills
Workspace skills are available only to the owning agent or private instance.
They do not appear in the dashboard Skills page or the skills API, because those views are not agent-scoped.
Hidden entries such as `.usage.json`, `.history/`, and `.archive/` are never loaded as skills.
Agents never need write access to a global skill root to create skills, so the bundled, plugin, and user roots can stay read-only, for example in container or Kubernetes deployments.
An agent with a workspace and workspace-rooted file or shell tools can write a skill to `<workspace>/skills/<skill-name>/SKILL.md`, which its file tools address as `skills/<skill-name>/SKILL.md`.
Such agents are told how in their system prompt through the `WORKSPACE_SKILL_AUTHORING_PROMPT` built-in prompt, which you can change through [Built-In Prompt Overrides](https://docs.mindroom.chat/configuration/#built-in-prompt-overrides).
A new or edited workspace skill is picked up on the agent's next run without a config change.
Being able to write workspace skills does not make an agent create them.
To have agents save reusable workflows on their own, add that guidance to the agent's instructions, or enable [automatic skill learning](#automatic-skill-learning).
MindRoom loads at most 256 workspace skills per agent, skips a skill whose `SKILL.md` exceeds 1 MiB or whose name exceeds 64 characters, and truncates descriptions to 1,024 characters, logging a warning in each case.
## Eligibility gating (OpenClaw metadata)
If `metadata.openclaw` is present, MindRoom loads the skill only when these rules pass:
- `os: ["linux", "darwin", "windows"]`: the current OS must be listed
- `always: true` bypasses `requires`, but not an OS mismatch
- `requires.env`: each environment variable is set, or a stored credential with that key exists
- `requires.config`: each config path is truthy, for example `agents.code.tools`
- `requires.bins`: all binaries exist in `PATH`
- `requires.anyBins`: at least one binary exists in `PATH`
Skills without `metadata.openclaw` are always eligible.
## Using skills at runtime
Agents see their available skills in the system prompt and load details with these tools:
- `get_skill_instructions(skill_name)` loads the full instructions for a skill
- `get_skill_reference(skill_name, reference_path)` reads a reference document
- `get_skill_script(skill_name, script_path, execute=False, args=None, timeout=30)` reads or executes a script
Workspace skill scripts can be read with `get_skill_script`, but not executed through it.
Agents with shell or file execution tools can still run workspace files through those tools.
Added, removed, or edited `SKILL.md` files take effect on the agent's next request, within about a second.
A workspace skill created during a turn becomes available on the next agent run, not in the same response.
## Automatic skill learning
Automatic skill learning follows the self-improvement loop of [Hermes Agent](https://github.com/NousResearch/hermes-agent).
After enough work in a conversation, a background review maintains a small library of class-level skills in the agent's workspace, and unused learned skills are archived.
It is opt-in for each agent:
```yaml
agents:
assistant:
display_name: Assistant
skill_learning:
enabled: true
model: null # null reviews on the response's own model and reuses its prompt cache
review_interval: 10
timeout_seconds: 120
notify: true
archive_after_days: 30
```
Hosted MindRoom instances enable it for the agents of a newly provisioned instance; set `agents.<name>.skill_learning.enabled: false` to turn it off.
Self-hosted configurations from `mindroom config init` leave it off.
Reviews incur additional model usage, reported under `kind: skill_learning` in [usage tracking](https://docs.mindroom.chat/usage/#token-usage).
Learned skills are generated from conversation content, so review them before relying on them for sensitive work.
### Settings
All `agents.<name>.skill_learning` fields are optional, and unknown fields are rejected.
| Field | Type | Default | Bounds and behavior |
|---|---|---|---|
| `enabled` | boolean | `false` | Count completed standalone responses, review conversations that reach the interval, and offer the `skill_manage` tool. |
| `model` | string or null | `null` | Review model alias from `models`; null reviews on the model the response used and reuses its prompt cache, while another model replays a digest of the conversation. |
| `review_interval` | integer | `10` | 1–1000 model replies per conversation between reviews, counting each tool-calling step. |
| `timeout_seconds` | integer | `120` | 10–900 seconds per review. |
| `notify` | boolean | `true` | Post an `m.notice` in the conversation when a review changes skills. |
| `archive_after_days` | integer | `30` | 0–3650 days with no use, creation, or `skill_manage` edit before a learned skill is archived; `0` keeps learned skills indefinitely. |
### When reviews run
Each conversation keeps a count of model replies: one for each tool-calling step and one for the final answer.
Only successful standalone-agent responses to a person in Matrix count.
Team responses, responses another agent asked for, scheduled, hook, and external-trigger responses, responses that resume after an approval, and runs resumed after a restart never count.
A response that calls `skill_manage` restarts the count from its last call, except in minimal mode, where `skill_manage` runs through the command line.
Once the count reaches `review_interval`, it restarts and the review starts in the background, so it never delays a reply.
A new response in the same conversation stops a running review.
Counts are per agent or private instance and conversation, not per requester, so a thread shared by several people is reviewed once.
Counts live in memory, so a restart starts every count over, and a review that fails or is stopped is not retried.
### What a review sees
By default, the review resends the final model request of the response that made the conversation due, on the same model with the review prompt appended.
The provider can serve it from its prompt cache, and the review sees the conversation verbatim, including tool calls and results.
This request is sent unredacted, because it is the request the same provider just received.
The review instead replays a digest of the stored conversation on a separate request when `skill_learning.model` names another model, the agent runs in minimal mode, or the final request cannot be reused or is too large for the review's input budget.
A digest shows the newest 24 messages verbatim and older messages shortened, leaves out older tool results, and redacts credential-like values on a best-effort basis.
Without its own `model`, a digest replay runs on the model the response used.
A review's input budget scales with the review model's `context_window`.
Set `context_window` on the agent's model so long conversations can still be reviewed verbatim; without it, a final request over about 30,000 input tokens is replayed as a digest.
A review makes a bounded number of tool calls and stops after `timeout_seconds`.
Only the skill tools run during a review; any other tool the agent has answers that it is not available, and scripts never run.
Provider-hosted tools, such as a provider's web search, stay available because the provider runs them.
The review prompt asks for class-level skills that capture lessons rather than logs, treats user corrections as first-class signals, prefers patches over rewrites, and excludes environment-specific failures, transient errors, one-off narratives, and unresolved attempts.
Override it through the `SKILL_REVIEW_PROMPT` [built-in prompt override](https://docs.mindroom.chat/configuration/#built-in-prompt-overrides).
### The skill_manage tool
Agents with skill learning enabled get a `skill_manage` tool, and the review writes skills with the same tool.
Other agents can list `skill_manage` in `tools` to save skills from chat.
Its actions are `create` a skill from a full `SKILL.md`, `patch` text in `SKILL.md` or a support file, `edit` to replace `SKILL.md`, and `write_file` or `remove_file` for one support file directly under `references/` or `scripts/`.
It cannot delete a skill; unused learned skills are archived, and you remove any skill by deleting its directory.
In chat, `skill_manage` can change any workspace skill, and a skill it creates belongs to the person, not the learner.
Configured bundled, plugin, and user skills are read-only.
Tool approval rules apply to chat calls as to any tool.
`skill_manage` works only on skills in their own `skills/<name>/` directories, so a workspace whose `skills/SKILL.md` makes the whole directory one skill gets no new skills or edits until that file moves into `skills/<name>/`.
A new skill needs a lowercase hyphenated name matching its directory and a description of at most 60 characters.
Files that contain a likely literal credential are refused with the offending line named: a quoted API key, token, secret, or password of at least 20 characters that does not name an environment variable, a private key header, or a GitHub, OpenAI, Anthropic, AWS, or GitLab token.
This check is a heuristic for common formats, not a guarantee.
### Ownership
The review edits only learned skills, never bundled, plugin, or user skills or workspace skills someone else wrote, and its new skills cannot reuse their names.
Ownership is recorded in `skills/.usage.json`, so a learned skill stays learner-owned when the agent or a person later rewrites it.
Skills the review creates also carry a visible marker in their frontmatter:
```yaml
metadata:
mindroom:
learned: true
```
Add this marker to a skill you wrote to hand it to the learner.
Add `pinned: true` under `metadata.mindroom` to any skill to keep the review and archival from ever editing or archiving it.
Private agents learn only from and into the requester's private workspace, and shared agents use `<storage>/agents/<agent>/workspace/skills/`.
### History, archive, and notices
Before `skill_manage` replaces or removes a file, in chat or in a review, it saves the previous version under `skills/.history/<skill>/`, keeping the ten newest versions.
Copy a saved version back to restore it.
Before each review, learned skills with no use, creation, or `skill_manage` edit for `archive_after_days` days move to `skills/.archive/<skill>--<timestamp>`; nothing is deleted.
Move a directory back to `skills/<skill>/` to restore it.
Archiving a skill forgets its ownership record, and a deleted skill's record is forgotten at the next review, so a skill restored or recreated after that starts a new inactivity period.
A restored learned skill still carries `learned: true` and stays learner-owned; add `pinned: true` to keep the learner from editing or archiving it.
Loading a workspace skill or one of its files through the skill tools counts as a use, also for agents without skill learning.
Minimal-mode agents read skills through their command line, which records no use, so a learned skill used only in minimal mode is archived after `archive_after_days`.
Archival is logged rather than announced, because other conversations may share the workspace.
With `notify: true`, a review that changed skills posts an `m.notice` in the conversation naming those skills, such as ``💾 Skill review: created `deploy-checks` ``.
The notice is also posted when a new response stopped the review after its changes landed, and it is left out of later model context.
Review log lines carry `kind: skill_learning`, so you can filter logs for them.
# Scheduling
Schedule agents or teams to do one-time or recurring work, such as reminders, daily reports, or periodic checks, using natural language.
Create schedules with the `!schedule` chat command or let an agent create them with the `scheduler` tool.
<video controls playsinline preload="metadata" aria-label="A scheduled task posts a morning brief" style="width: 100%" poster="https://github.com/user-attachments/assets/4ba7b6f1-e2be-4b2a-a38a-e7a7bb49826e" data-poster-light="https://github.com/user-attachments/assets/4ba7b6f1-e2be-4b2a-a38a-e7a7bb49826e" data-poster-dark="https://github.com/user-attachments/assets/38261697-8f2a-478d-a256-32559e107315">
<source src="https://github.com/user-attachments/assets/e59e09c8-c8c7-4e90-8e3c-30b8f18b6de2" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/fdbc3860-9301-4d62-907a-857c818d4e73" type="video/mp4">
</video>
## Commands
Use `!help schedule` for inline help on the scheduling commands.
### `!schedule`
Schedule a one-time or recurring task.
```
!schedule <natural-language-request>
```
```
!schedule in 5 minutes Check the deployment
!schedule tomorrow at 3pm Send the weekly report
!schedule Every hour, @shell check server status
!schedule Daily at 9am, @finance market report
!schedule Weekly on Friday, @analyst prepare weekly summary
```
Include `@agent_name` or `@team_name` to choose who answers each run.
MindRoom checks that mentioned agents and teams are available in the room before it creates the task.
A task runs where it was created: in the room timeline for a room-level schedule, or in the current thread for a threaded schedule.
The task text never runs as a chat command, even when it starts with `!`; agents receive it as an ordinary message.
Conditional requests such as `if` or `when` become recurring polling schedules, not event subscriptions.
The condition is part of the task message, so the responder checks it on each run.
Include an explicit polling cadence for predictable behavior.
```
!schedule Every 5 minutes, check if I got an email about "urgent"; if so, @phone_agent call me
!schedule Every 10 minutes, check whether Bitcoin dropped below $40k; if so, @crypto_agent notify me
```
Add phrases to the request to change how each run behaves:
| Phrase | Effect |
| --- | --- |
| `with no history`, `without context`, `context-free` | Each run sees no prior messages; see [History limits](#history-limits) |
| `with only the last 5 messages of context` | Each run sees only recent messages |
| `silently`, `quietly` | Hide the trigger and post only findings; see [Silent delivery](#silent-delivery) |
### `!edit_schedule`
Replace an existing task's timing and content.
```
!edit_schedule <task-id> <new-task-description>
```
MindRoom re-parses the description to update timing and content.
Omitted settings stay unchanged, including the history limit, silent mode, and model.
A task cannot switch between one-time and recurring; cancel it and create a new one instead.
```
!edit_schedule task42 keep the same schedule but restore full history
!edit_schedule task42 every weekday at 8am check build status with no history
!edit_schedule task42 keep the same schedule but make it silent
```
**Aliases:** `!editschedule`, `!edit-schedule`
### `!list_schedules`
List pending tasks in the current room, or in the current thread when used inside one.
Each entry shows its task ID, timing, mode (`Silent` or `Visible`), and selected model if any.
```
!list_schedules
```
**Aliases:** `!listschedules`, `!list-schedules`, `!list_schedule`, `!listschedule`, `!list-schedule`, `!inspect_schedules`, `!inspectschedules`, `!inspect-schedules`, `!inspect_schedule`, `!inspectschedule`, `!inspect-schedule`
### `!cancel_schedule`
Cancel one task, or every task in the room.
```
!cancel_schedule <task-id>
!cancel_schedule all
```
Use `!list_schedules` to find task IDs.
**Aliases:** `!cancelschedule`, `!cancel-schedule`
## [`scheduler`]
<video controls playsinline preload="metadata" aria-label="A check asked for in conversation becomes a weekly scheduled task" style="width: 100%" poster="https://github.com/user-attachments/assets/5750a5bc-e5cb-4112-86ac-21ed044fa5d1" data-poster-light="https://github.com/user-attachments/assets/5750a5bc-e5cb-4112-86ac-21ed044fa5d1" data-poster-dark="https://github.com/user-attachments/assets/6194d6c7-89e7-4e66-8810-048efc3b3001">
<source src="https://github.com/user-attachments/assets/2fa5d666-16bd-4864-b27f-fb212609e2a1" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/7a68cee9-24d4-43cf-84de-599405fd16d7" type="video/mp4">
</video>
The `scheduler` tool lets an agent create, edit, list, and cancel the same tasks as the chat commands.
It is included in `defaults.tools` by default, needs no setup, and has no tool-specific configuration fields.
It only works from a live room or thread; elsewhere it returns `Scheduler tool is unavailable in this context.`
```yaml
agents:
assistant:
tools:
- scheduler
```
| Function | Arguments |
| --- | --- |
| `schedule(request, new_thread, history_limit=None, silent=None, model=None)` | `new_thread` is required |
| `edit_schedule(task_id, request, history_limit=None, silent=None, model=None)` | Omitted arguments keep the task's current settings |
| `schedule_tool_call(tool_name, arguments_json, execute_at, description)` | One approval-gated call that the requester approves now; see [Pre-Approved Tool Calls](#pre-approved-tool-calls) |
| `run_scheduled_call(task_id, arguments_json=None)` | Runs a pre-approved scheduled call when its task asks; see [Pre-Approved Tool Calls](#pre-approved-tool-calls) |
| `list_schedules()` | |
| `cancel_schedule(task_id)` | |
- `new_thread=False` posts each run in the current room or thread.
`new_thread=True` posts each run as a new room-level message, and the responder answers in a new thread under it with a fresh session.
- `history_limit` caps how many recent messages each run sees: `0` for none, a positive integer for that many, unset for full history.
- `silent=True` turns on [silent delivery](#silent-delivery); unset infers the mode from the request text.
- `model` picks a model alias for each run; see [Model selection](#model-selection).
```python
schedule("tomorrow at 9am @ops check the deployment", new_thread=False)
schedule("every weekday at 8am post the on-call handoff summary", new_thread=True)
schedule("every hour @ops check deployment health", new_thread=False, history_limit=0, model="cheap")
schedule("every 5 minutes check the inbox for urgent mail", new_thread=False, history_limit=0, silent=True)
list_schedules()
edit_schedule("a1b2c3d4", "tomorrow at 10am @ops check the deployment", history_limit=5, silent=False)
cancel_schedule("a1b2c3d4")
```
## History Limits
Scheduled runs normally use the responder's configured conversation history.
Use `with no history`, `without context`, or `context-free` when each run should see no prior room or thread messages; the system prompt and the task message remain available.
Use phrases such as `with only the last 5 messages of context` or `include the last 5 messages` to cap each run to recent context.
In an edit, say `restore full history` or `use unlimited history` to remove a limit.
Agents set the same limit with the tool's `history_limit` argument.
## Silent Delivery
Schedules are visible by default.
Add `silently` or `quietly` to a request when the trigger and routine no-report results should stay out of the room timeline.
```
!schedule Every 5 minutes, quietly check the inbox for urgent messages and report only when one arrives
!schedule Daily at 9am, silently check whether the backup failed and report failures
```
A silent schedule does not show its trigger in the room.
A successful run that returns nothing, whitespace, or only `NO_REPLY` (any case) posts no message.
Findings, failures, and messages that tools send explicitly remain visible.
Silent runs also show no typing indicator, progress placeholder, stop control, or streaming updates.
With `new_thread=True`, a silent schedule posts any finding or failure as a new room-level message.
Say `make this schedule silent` or `make this schedule visible` in `!edit_schedule` to change the mode.
Silent delivery only hides messages from the room; the task text still travels through Matrix and is subject to homeserver retention.
Each silent run writes a JSON receipt to `<agent-workspace>/.mindroom/scheduled_runs/`, so you can check what a silent run did.
A receipt records the prompt, room, thread, `status` (`started` or `completed`), `result` (`reported`, `no_report`, or `suppressed`), the final response text, and UTC start and completion times.
A receipt still in `started` means the run began but never reached a final response.
Team runs write a receipt to each member agent's workspace, and private agents write to the requester's workspace.
Workspace knowledge indexing skips these receipts.
## Model Selection
Pass `model` to `schedule()` to run each scheduled response with a model alias from `models:` in `config.yaml`, for example a cheaper model for simple recurring checks.
```python
schedule("every hour @ops check deployment health", new_thread=False, history_limit=0, model="cheap")
edit_schedule("task42", "keep the same schedule and task", model="cheap")
edit_schedule("task42", "keep the same schedule and task", model="")
```
The model applies to the whole scheduled response, including a team's coordinator and members.
It takes precedence over room and thread model settings without changing them for later messages.
Omitting `model` on creation uses normal model selection; omitting it on an edit keeps the saved choice, and an empty string restores normal model selection.
Parsing the scheduling request itself always uses the default model.
## Pre-Approved Tool Calls
An agent can store one of its own approval-gated tool calls to run later, and the requester approves it while scheduling it, so a gated action such as an external message runs at its time without a second approval.
The agent calls `schedule_tool_call(tool_name, arguments_json, execute_at, description)` from a thread.
`tool_name` must be one of that agent's own tools, `arguments_json` is a JSON object of the call's arguments, and `execute_at` is an ISO 8601 time with a UTC offset, such as `2026-10-04T09:00:00-04:00`.
The `tool_approval` policy must require approval for the call (or the tool must ask for its own confirmation), the scheduler must be an agent rather than a team, and the agent must be able to reply to the requester in that room; otherwise the scheduler refuses it.
```python
schedule_tool_call(
tool_name="post_slack_message",
arguments_json='{"channel": "U0123ABCD", "text": "Good morning! The report is ready."}',
execute_at="2026-10-04T09:00:00-04:00",
description="Morning report DM",
)
```
MindRoom stores the call and posts an approval card in the thread showing the tool, its arguments, and the send time; only the requester can approve or deny it, and it expires at the send time.
The requester approves either the stored arguments or, when the card offers it, any arguments to the same tool.
Approving any arguments lets the agent decide the arguments for that tool when the task runs, following the task's description, so choose it only when the content must be decided later.
The card offers it only when requesters approve their own calls; operators can stop offering it with [`tool_approval.scheduled_any_arguments`](https://docs.mindroom.chat/tool-approval/), and generic MCP `*_call_tool` calls and tools that ask for their own confirmation are always approved exactly.
When the task runs, it asks the agent to call `run_scheduled_call(task_id)`, which runs the stored call once with the stored arguments, without a new card, and posts an approved receipt naming who approved it, when, and for which scope.
With an any-arguments approval the agent may pass `arguments_json` to `run_scheduled_call` to replace the arguments for the same tool.
The approval can be used once, by that agent for that requester in that thread, from when the task runs until 15 minutes after its scheduled time.
If the card was not approved in time, `run_scheduled_call` runs nothing and the agent can call the tool directly, which asks for approval as usual.
If the requester denies the card, the task does not run, and cancelling the task withdraws the approval.
A pre-approved task cannot be edited; cancel it and schedule the call again.
The arguments are not posted in the task or its trigger message; MindRoom keeps them with the approval, and the card shows them with secrets hidden.
Recurring schedules cannot pre-approve calls.
## Timezone
The top-level `timezone` setting (default `UTC`) controls how MindRoom interprets times in requests and displays scheduled times.
```yaml
timezone: America/Los_Angeles
```
Recurring schedules run on UTC cron times, so their local clock time shifts when the timezone's UTC offset changes, such as at daylight-saving transitions.
Edit or recreate a recurring schedule after an offset change if it must keep the same local time.
## Permissions and Automatic Cancellation
Schedules belong to the room, not to their creator.
Any authorized participant in the room can edit or cancel any of its schedules by task ID, and listing inside a thread only filters the view.
Each run acts as the schedule's creator, as if the creator had sent the message, so it uses that person's access, per-user credentials, and private-agent workspace.
Editing a schedule with `!edit_schedule` or the `scheduler` tool makes the editor its new creator.
MindRoom cancels a schedule automatically once neither its creator nor any of the creator's [bridge aliases](https://docs.mindroom.chat/authorization/#bridge-aliases) is joined to the room.
Bot accounts and managed identities do not count.
A run waits rather than proceeding when membership cannot be confirmed.
## Persistence and Missed Runs
Schedules are stored in Matrix room state and survive restarts.
MindRoom only acts on schedule state written by its own router, agent, or team accounts; schedule state written by any other account, including a room admin, is ignored and logged.
The homeserver must support `GET /_matrix/client/v3/rooms/{roomId}/state/{eventType}/{stateKey}?format=event` (Matrix spec v1.16), as Synapse, Tuwunel, and Dendrite do; otherwise reading tasks fails.
### Scheduled Task Restoration
The router restores a room's schedules and pending configuration changes when it joins the room after startup.
A one-time task missed by less than 24 hours runs once Matrix sync is ready; an older one is marked failed instead.
### Recurring task recovery
After a restart or a late wake-up, a recurring task runs its latest missed occurrence if it is within the catch-up window, and multiple missed occurrences run once.
Occurrences outside the window are skipped and logged, and later runs keep the normal cadence.
```yaml
scheduler_catch_up_grace_seconds: 3600 # default; 0 disables catch-up
```
Recurring progress is kept in `tracking/recurring_schedules/` under the storage directory, which must persist across restarts.
Without it, or after a schedule edit, MindRoom resumes from the next future occurrence without replaying past ones.
Restarts do not post the same trigger twice.
For `schedule:fired` hooks that run more than once for the same occurrence, see [Hooks](https://docs.mindroom.chat/hooks/#event-notes).
## Built-in Automations
Built-in automations are checks MindRoom runs on a cron schedule; when one passes, the agent posts the automation's prompt in its room and answers it with a normal, visible run.
The check runs in code, so a schedule that finds nothing to do costs no model call and posts nothing.
Enable them per agent in `config.yaml`, or under `defaults` for every eligible agent:
```yaml
defaults:
automations: [] # inherited by agents that omit the field
agents:
mind:
memory_backend: file
automations:
- prompt_curation # the built-in with its defaults
# or: {name: prompt_curation, cron: "0 4 * * *", room: personal, trigger_tokens: 30000, model: opus}
```
- An entry is a built-in name, or a mapping with `name` plus overrides; unknown names and fields fail config load.
- `cron` is a five-field expression in the configured [timezone](#timezone).
- `room` is a room alias or ID; it defaults to the agent's first configured room, and each prompt starts a new thread.
- `agents.<name>.automations: []` turns inherited defaults off for one agent.
- Automations run unattended, so requester-private agents cannot list them and do not inherit defaults.
- Edits apply on config reload without restarting the agent.
- The agent posts the prompt in its own name and mentions itself, so it answers even in a room with other agents.
- When the response to that prompt is final, or after an hour without one, the automation's verify step runs and posts a notice in the prompt's thread.
- An automation does not post again while its previous prompt awaits verify.
- A restart skips an occurrence it missed, and prompts posted before the restart get no verify notice.
For conditions that need your own code, gate an ordinary recurring schedule with a [`schedule:fired` hook](https://docs.mindroom.chat/hooks/#event-notes), which can suppress a fire or rewrite its message.
### `prompt_curation`
Agents append to `MEMORY.md` and their `context_files` far more often than they condense them, and every model call re-sends those files.
`prompt_curation` checks their total size daily and, once it passes the trigger, asks the agent for a gradual cut.
1. The check measures `MEMORY.md` plus the agent's `context_files` with the estimate behind `static_prompt_tokens` (characters / 4).
2. Above `trigger_tokens`, it posts a prompt with exact numbers, for example "bring them to at most 46876 tokens in total, but not below 44272", a cut between `min_reduction` and `max_reduction` (10 to 15%).
3. The prompt asks the agent to commit the files to git first, keep each fact once in the file that owns it, move detail and history verbatim into `memory/` topic files with one-line pointers, and never invent facts.
4. Once the run ends, verify measures the files again; when any of these holds, it lists them in the thread and mentions the agent once to re-check its change against that commit:
- a file can no longer be read safely;
- a file shrank by more than 25%;
- the files total less than the floor, or did not shrink;
- a file is no longer valid UTF-8;
- total memory content (the files plus `memory/**`) dropped by more than `max_content_loss` of the files' size, which means detail was deleted instead of moved.
When the files changed and none of these holds, verify reports the new size and marks the thread resolved.
When the prompt files are unchanged, verify only checks that no `memory/` detail was deleted, and otherwise reports that nothing changed.
Verify never changes the files; the agent's answer to a re-check is not verified again, and the next pass comes on the next scheduled check.
| Field | Default | Description |
|---|---|---|
| `cron` | `0 4 * * *` | When to check |
| `room` | first configured room | Where to post the prompt |
| `trigger_tokens` | `50000` (min 1) | Post the prompt once the files exceed this many estimated tokens |
| `min_reduction` | `0.10` (at most `0.25`) | Smallest cut the prompt asks for; no file may shrink more than 25%, so no pass can be asked for more |
| `max_reduction` | `0.15` | Largest cut before verify asks for a re-check |
| `max_content_loss` | `0.05` | Largest net drop in total memory content, as a fraction of the files' size, before verify asks for a re-check |
| `model` | the agent's model | A key of `models` to run the prompt and its re-check with, for example one with a larger context window than the agent's everyday model |
`prompt_curation` needs `memory_backend: file`, because moved detail must stay searchable, and the prompt templates are overridable as `PROMPT_CURATION_PROMPT_TEMPLATE` and `PROMPT_CURATION_RECHECK_TEMPLATE`.
# Chat Commands
Chat commands are messages starting with `!` that you type in any Matrix room where MindRoom agents or teams are present.
Use them to get help, manage schedules, switch models or modes, manage room encryption, and, when enabled, change configuration from chat.
This page lists every command and fully covers `!help`, `!hi`, and `!config`; the other commands are documented on the linked pages.
## Command List
| Command | Description | Details |
|---------|-------------|---------|
| `!help [topic]` | Get help on commands or a specific topic | [`!help`](#help) |
| `!hi` | Show the welcome message again | [`!hi`](#hi) |
| `!schedule <task>` | Schedule a task or reminder | [Scheduling](https://docs.mindroom.chat/scheduling/#schedule) |
| `!list_schedules` | List pending scheduled tasks | [Scheduling](https://docs.mindroom.chat/scheduling/#list_schedules) |
| `!cancel_schedule <id>` | Cancel a scheduled task | [Scheduling](https://docs.mindroom.chat/scheduling/#cancel_schedule) |
| `!edit_schedule <id> <task>` | Edit an existing scheduled task | [Scheduling](https://docs.mindroom.chat/scheduling/#edit_schedule) |
| `!desktop [setup\|status\|confirm\|rotate\|disconnect]` | Manage your Desktop target for one agent | [Desktop](https://docs.mindroom.chat/tools/desktop/#desktop) |
| `!mode <agent> minimal\|standard\|show\|reset` | Switch one agent between standard tools and a Bash-only interface | [Minimal Agent Mode](https://docs.mindroom.chat/tools/agent-cli/#mode) |
| `!model [name\|list\|reset]` | Show or switch the model used in the current thread | [Models](https://docs.mindroom.chat/configuration/models/#model) |
| `!room_model [name\|list\|reset]` | Show the room model default or switch it (set/reset require a room admin) | [Models](https://docs.mindroom.chat/configuration/models/#room_model) |
| `!thread_mode [room\|thread\|reset\|show]` | Show or switch the thread mode used in the current room (set/reset require a room admin) | [Threads](https://docs.mindroom.chat/configuration/threads/#thread_mode) |
| `!encrypt [confirm]` | Enable end-to-end encryption for this room (irreversible, room admin only) | [Matrix](https://docs.mindroom.chat/matrix/#encrypt) |
| `!e2ee` | Show encryption diagnostics for this room | [Matrix](https://docs.mindroom.chat/matrix/#e2ee) |
| `!config <operation>` | View and modify configuration (disabled by default, platform administrators only) | [`!config`](#config) |
| `!reload-plugins` | Force-reload all configured plugins (platform administrators only) | [Plugins](https://docs.mindroom.chat/plugins/#reload-plugins) |
Command names are case-insensitive.
Any other message starting with `!` gets `❌ Unknown command. Try !help for available commands.`
## Command Handling
The router answers commands, in the main room and in threads, even in rooms with a single agent.
The exception is `!desktop`, which a private agent may answer itself when the room contains only you and that agent; see [`!desktop`](https://docs.mindroom.chat/tools/desktop/#desktop) for its room requirements.
Commands follow the same [authorization](https://docs.mindroom.chat/authorization/) rules as ordinary messages.
"Room admin" means a Matrix room administrator, while "platform administrator" means a user listed in `administrators`.
Commands must be typed as text; voice messages are never turned into commands.
An agent can send `!help`, `!mode`, `!model`, and the schedule commands on your behalf, and they run with your permissions.
Any other command sent by an agent for you is refused with `❌ Agents cannot run this command for you. Send it yourself.`
## `!help`
`!help` lists all commands, and `!help <topic>` shows detailed usage and examples for one topic.
```
!help
!help schedule
!help config
```
**Topics:** `schedule`, `list_schedules`, `inspect_schedules`, `cancel`, `cancel_schedule`, `edit`, `edit_schedule`, `config`, `mode`, `model`, `room_model`, `room-model`, `roommodel`, `thread_mode`, `thread-mode`, `threadmode`, `reload-plugins`, `reload_plugins`, `encrypt`, `e2ee`, `encryption`
Any other topic shows the general command list.
## `!hi`
`!hi` shows the room's welcome message again: the agents and teams you can address, their roles and tools, and quick-start instructions.
## `!config`
`!config` views and changes `config.yaml` from chat.
It is disabled by default; set `authorization.config_command_enabled: true` (boolean, default `false`) to enable it.
Even when enabled, only platform administrators can use it.
Otherwise it replies `❌ Config command disabled.` or `❌ Admin only.`
```
!config show
!config get agents
!config get agents.analyst.display_name
!config set agents.analyst.display_name "Research Expert"
!config set models.default.id gpt-6-astra
!config set defaults.markdown false
!config set agents.analyst.tools [shell, file]
```
`!config` alone is the same as `!config show`.
Paths use dot notation, such as `agents.analyst.role`, and list items use indexes, such as `agents.analyst.tools.0` for the first tool.
Values are parsed as YAML, so `false`, `42`, and `[shell, file]` become a boolean, a number, and a list.
Quote a value to keep its exact spacing.
Shown values are redacted like `config_manager` output; see [Access, Redaction, and Saving](https://docs.mindroom.chat/tools/agent-orchestration/#access-redaction-and-saving).
`!config set` refuses a value containing the `***redacted***` marker or a masked URL password such as `user:***@host`, so copying shown values back cannot overwrite a hidden secret; set the field to its real value instead.
### Configuration Confirmations
`!config set` validates the change against the full configuration and replies with an error ending in `Changes were NOT applied.` when it is invalid.
A valid change gets a preview of the current and new values from the router, with ✅ and ❌ reactions.
Only the user who requested the change can confirm or cancel it, and that user must still be a platform administrator.
Unconfirmed changes expire after 24 hours.
Pending changes usually survive a MindRoom restart; if one cannot, such as a secret value, the confirmation asks you to run `!config set` again.
On confirmation, the change is saved to `config.yaml` and applies to new agent interactions, except [event journal](https://docs.mindroom.chat/deployment/storage/#event-journal) changes, which apply after MindRoom restarts.
## Stop Button
Cancel an in-progress response by reacting with 🛑 on the message being generated.
When `defaults.show_stop_button` is `true` (the default), MindRoom adds that 🛑 reaction to the message for you to click.
Setting `show_stop_button: false` hides only that reaction; a 🛑 reaction you add yourself still cancels.
The stop button only works on messages still being generated, and 🛑 reactions from agents are ignored.
See [Cancellation and Errors](https://docs.mindroom.chat/streaming/#cancellation-and-errors) for how a cancelled response is finalized.
# Streaming Responses
MindRoom streams agent responses to Matrix by progressively editing a single message, so users see text appear as the model generates it.
This page covers when streaming is used, how to tune or disable it, how streamed messages show tool calls, completion, cancellation, and errors, and how oversized responses are delivered.
<video controls playsinline preload="metadata" aria-label="Three colleagues and one agent in a shared thread, each answer streaming live" style="width: 100%" poster="https://github.com/user-attachments/assets/fa232e8f-a26b-425f-b667-433fb12da6ec" data-poster-light="https://github.com/user-attachments/assets/fa232e8f-a26b-425f-b667-433fb12da6ec" data-poster-dark="https://github.com/user-attachments/assets/54a96fc9-91dc-48a7-985c-7d4e41ad9be8">
<source src="https://github.com/user-attachments/assets/571db927-105b-4907-9c83-ed4f9ef1fc4a" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/c913ed8a-4afb-43be-8d90-cdd2aa4158a9" type="video/mp4">
</video>
## How It Works
1. MindRoom sends an initial message showing a `Thinking...` placeholder until text arrives.
2. As text arrives, MindRoom edits the same message with the accumulated content.
3. When the response finishes, a final edit holds the complete text.
When a response is not streamed, the placeholder is replaced with the complete response in a single edit.
Agents also show a typing indicator while they work on a response.
## Configuration
Streaming is enabled by default.
These settings are global-only under `defaults` and cannot be overridden per agent.
```yaml
defaults:
enable_streaming: true # Set false to disable progressive edits
streaming:
update_interval: 5.0
min_update_interval: 0.5
interval_ramp_seconds: 15.0
max_idle: 2.0
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `enable_streaming` | bool | `true` | Stream responses via progressive message edits. When `false`, the placeholder is replaced with the complete response in a single edit. |
| `streaming.update_interval` | float, > 0 | `5.0` | Steady-state seconds between edits. |
| `streaming.min_update_interval` | float, > 0 | `0.5` | Seconds between edits at the start of a response. |
| `streaming.interval_ramp_seconds` | float, >= 0 | `15.0` | Seconds over which the interval ramps from `min_update_interval` to `update_interval`. Set `0` to use `update_interval` from the start. |
| `streaming.max_idle` | float, > 0 | `2.0` | When no new text has arrived for this many seconds, the buffered text is shown with the next streaming update. |
Edits also come sooner than the interval once enough new text has accumulated, and a tool-call marker appears as soon as the tool starts.
Raise `update_interval` to reduce load on the homeserver, or lower it for smoother updates.
## Presence-Based Streaming
Even when streaming is enabled, MindRoom streams a response only when the user who sent the message is `online` or `unavailable`; for an `offline` requester, the placeholder is replaced with the complete response.
Everyone in the room sees the same edits.
If the presence check fails, for example because the homeserver has presence disabled, MindRoom does not stream.
A reply that continues after a restart always streams, even when streaming is off or the requester is offline, so the part it already showed stays in the message.
When no requester can be identified, MindRoom streams.
## Presence
Running agents appear `online` (or `unavailable` when idle) and `offline` when stopped or disconnected.
Their presence status message shows the model, role, and tool count, for example `🤖 Model: anthropic/claude-sonnet-5-5 | 💼 Code assistant | 🔧 5 tools available`.
## Stream Status
Each streamed message carries its progress in the Matrix event content field `io.mindroom.stream_status`.
| Value | Meaning |
|-------|---------|
| `pending` | Initial message of the response |
| `streaming` | Response is still being generated |
| `approval_pending` | Response is paused until someone approves or denies a tool call (see [Tool Approval](https://docs.mindroom.chat/tool-approval/)) |
| `completed` | Response finished successfully |
| `cancelled` | User stopped the response |
| `error` | Response failed or was otherwise interrupted |
To confirm a response finished, inspect the latest `io.mindroom.stream_status` in a client or event view that shows event content.
MindRoom never appends an ellipsis to generated text, and clients may draw their own progress indicators, so a trailing ellipsis is not a progress signal.
## Tool Calls During Streaming
When an agent calls tools, MindRoom shows inline markers in the message text:
```
🔧 `web_search` [1] ⏳ ← tool call started
🔧 `web_search` [1] ← tool call completed
```
The number in brackets counts tool calls within the message, and `io.mindroom.tool_trace.events[N-1]` in the event content holds the tool name, argument preview, and result preview for call `[N]`.
Tools that start in quick succession appear together in one edit.
Markers and tool-trace metadata are shown by default; to hide them, set `show_tool_calls: false` on one agent or under `defaults` for every agent that leaves it unset (see [Agent Configuration](https://docs.mindroom.chat/configuration/agents/#defaults)).
With tool calls hidden, the agent still shows typing activity, and a tool that needs an isolated worker may show generic progress such as `Preparing isolated worker... 17s elapsed.` without naming the tool.
## Cancellation and Errors
Users can cancel an in-progress response by reacting with 🛑 on the message being generated (see [Stop Button](https://docs.mindroom.chat/chat-commands/#stop-button)).
Tool calls running in a [worker](https://docs.mindroom.chat/deployment/sandbox-proxy/), such as `run_shell_command` or `run_python_code`, stop with it, apart from the exceptions listed there.
The partial text stays in the message, followed by a note explaining how it ended:
| Note | Cause |
|------|-------|
| `**[Response cancelled by user]**` | The user stopped the response. |
| `**[Response interrupted by service restart]**` | MindRoom restarted while the response was being generated; the reply continues below the note once MindRoom is back, or ends there if nothing is left to continue. |
| `**[Response interrupted]**` | The response was interrupted for another reason. |
| `**[Response interrupted by an error: <error description>]**` | Generation failed; the description says why. |
A crash, an orderly shutdown, or an agent restarted by a configuration or MCP change, including during an approved tool call, keeps the partial reply and its tool calls, and the agent continues it in the same message once MindRoom is back.
The agent is told which visible tool calls already finished so it does not repeat side effects; calls hidden by `show_tool_calls: false` cannot be passed on, so it is only warned that they may have run.
## Large Messages
A Matrix event holds at most about 64 KB, so `defaults.large_message_strategy` controls how a larger response is delivered.
| Value | Delivery |
|-------|----------|
| `sidecar` (default) | A preview with as much text as fits, plus the full message content attached as `message-content.json` (`message-content.json.enc`, encrypted, in encrypted rooms). |
| `split` | Several complete rich-text messages: the first replaces the streaming placeholder and the rest follow it in the same thread or room. |
The `sidecar` strategy applies to messages over about 55 KB and edits over about 27 KB, and the preview omits inline tool-trace metadata.
With `split`, each segment renders as standalone Markdown, text is cut at paragraph or line boundaries and never inside a fenced code block, and the segments together reproduce the full response exactly.
Even with `split`, non-text payloads, metadata that alone exceeds the size budget, and a single code block larger than one event use the sidecar.
# Voice Messages
This page covers Matrix voice messages sent to agents and teams: speech-to-text (STT) setup, transcript cleanup, what appears in the room, and what happens without STT.
For live spoken conversations in Matrix calls, see [Voice Calls](https://docs.mindroom.chat/voice-calls/).
<video controls playsinline preload="metadata" aria-label="A voice message becomes a reminder" style="width: 100%" poster="https://github.com/user-attachments/assets/d8829350-12c9-4045-aed0-4a5a5127213c" data-poster-light="https://github.com/user-attachments/assets/d8829350-12c9-4045-aed0-4a5a5127213c" data-poster-dark="https://github.com/user-attachments/assets/9ec1837a-3566-4b0c-8274-7af7c30b988c">
<source src="https://github.com/user-attachments/assets/823df173-50ae-4304-b652-36a61bfbc911" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/f048c8cc-3384-41e2-be59-000d3ab22099" type="video/mp4">
</video>
With voice enabled, MindRoom transcribes each voice message, cleans up the transcript, and handles it like a text message prefixed with `🎤`.
The responder also receives the original audio as an attachment.
Without STT, voice messages still reach responders as raw audio; see [Voice Fallback](#voice-fallback-no-stt-available).
## Setup
Configure voice in `config.yaml` or in the dashboard's Voice tab.
### OpenAI transcription
```yaml
voice:
enabled: true
stt:
provider: openai
model: gpt-transcribe
intelligence:
model: default # Model used for mention normalization and light ASR cleanup
```
Cloud OpenAI transcription uses the `openai` credential service by default, which resolves a stored OpenAI credential or `OPENAI_API_KEY`.
Set `voice.stt.api_key` or a different `voice.stt.credentials_service` to use another key.
### Self-hosted Whisper
Any service that implements the OpenAI-compatible `/v1/audio/transcriptions` endpoint works, such as [faster-whisper-server](https://github.com/fedirz/faster-whisper-server):
```yaml
voice:
enabled: true
stt:
provider: openai_compatible
model: whisper-1
host: http://localhost:8080
api_key: your-custom-api-key # Optional
```
`host` may be the service root or its `/v1` base URL.
Without `api_key` or `credentials_service`, MindRoom sends a non-secret placeholder key, so keyless local servers work and your OpenAI key is never sent to them.
## Configuration Reference
| Field | Default | Description |
|-------|---------|-------------|
| `voice.enabled` | `false` | Transcribe voice messages; when `false`, voice messages use the [raw-audio fallback](#voice-fallback-no-stt-available). |
| `voice.visible_router_echo` | `true` | Let the router show transcription progress and the transcript in the room; see [Voice Message Processing](#voice-message-processing). |
| `voice.stt.provider` | `openai` | `openai` or `openai_compatible`. |
| `voice.stt.model` | `gpt-transcribe` | STT model name. |
| `voice.stt.host` | none | Service root or `/v1` base URL; must be an HTTP(S) URL. Required for `openai_compatible`. |
| `voice.stt.api_key` | none | Inline API key. |
| `voice.stt.credentials_service` | `openai` for `provider: openai`, otherwise none | Named credential service holding the API key. |
| `voice.stt.extra_kwargs` | `{}` | Extra form fields sent with each transcription request, such as `language`; must not set `api_key`, `base_url`, `client`, or `model`. |
| `voice.intelligence.model` | `default` | Name of a `models` entry used for transcript cleanup. |
`provider: openai` requires `api_key` or `credentials_service`, and `provider: openai_compatible` requires `host`.
Each transcription request has a 60-second limit and is not retried.
On timeout or service error, the message uses the raw-audio fallback.
## Voice Message Processing
What appears in the room depends on whether the router is present and whether the responder is already clear.
Voice messages follow the same mention, thread, and access rules as text from the original sender.
**Router echo.**
With `voice.enabled: true` and `voice.visible_router_echo: true`, the router immediately posts `Router agent is transcribing…` and then replaces it with the cleaned transcript, or with the fallback text if transcription failed.
With `voice.enabled: false`, the router posts the fallback text directly instead.
The echo is display-only: agents answer the original voice message, not the echo.
The echo appears only when the router is in the room and allowed to reply to the sender.
Set `voice.visible_router_echo: false` to hide it; this does not change who answers.
**Responder already clear.**
If only one agent or team can respond, the transcript or caption mentions one, or thread context picks one, that responder answers the voice message directly without a router handoff.
**Router must choose.**
If several agents or teams can respond and none is targeted, the router routes on the transcript and posts a normal handoff such as `@home could you help with this?`.
The chosen responder answers that handoff and still receives the original audio attachment.
**No router, or router cannot reply to the sender.**
Agents and teams handle the voice message directly with the same rules as text, and no router echo appears.
If several responders remain and none is targeted, nobody answers until the user mentions an agent or team.
## Transcript Normalization
The `voice.intelligence.model` cleans up each raw transcript before dispatch:
- Spoken agent or team names become `@agent` or `@team` mentions, using display names such as "HomeAssistant" to produce `@home`.
- Mentions of agents or teams not available to the sender in the room lose their `@`, so they do not trigger a response.
- Spoken text is never rewritten into `!command` syntax.
- Light speech-recognition errors are corrected.
If cleanup fails or times out, MindRoom uses the raw transcript.
Choose a faster or stronger model in `voice.intelligence.model` to trade cleanup speed against accuracy.
## Voice Fallback (No STT Available)
When voice is disabled, STT is unavailable, or transcription fails, the voice message is dispatched as `🎤 [Attached voice message]`, or as `🎤` followed by the message caption when it has one.
The audio is registered as an attachment, so responders with audio-capable models receive it directly and tool-using responders can fetch it with the `attachments` tool.
Attachment IDs follow the context-scoping rules in [File & Video Attachments](https://docs.mindroom.chat/attachments/).
If the audio cannot be downloaded from Matrix, the fallback text is dispatched without an attachment.
Without a transcript, routing has little text to work with, so use explicit `@mentions` or reply in an existing thread in rooms with several responders.
## Limitations and Tips
- Only OpenAI-compatible STT APIs are supported.
- Audio quality and background noise affect transcription accuracy.
- Say the agent or team name first, for example "Hey assistant, what's the weather?"
## Text-to-Speech
Agents can also send spoken replies, which is separate from voice message transcription.
The `matrix_voice_message` tool sends a playable Matrix voice note to the current room or thread; see [Matrix & Attachments tools](https://docs.mindroom.chat/tools/matrix-and-attachments/).
The `openai`, `eleven_labs`, `cartesia`, and `groq` tools generate speech audio; see [AI & Generation tools](https://docs.mindroom.chat/tools/ai-and-generation/).
# Voice Calls
MindRoom agents can join Element Call voice calls (MatrixRTC, also used by Element X and recent Cinny releases) in their rooms and talk with the caller in real time.
Use this page to set up calls, choose a voice backend, and find out why an agent did or did not join a call.
Voice messages (recorded audio clips) are covered on [Voice Messages](https://docs.mindroom.chat/voice/).
Each calls-enabled agent uses one of three backends:
| Backend | What it does |
|---------|--------------|
| `realtime` | OpenAI realtime speech-to-speech runs the conversation with the agent's prompt and tools. |
| `live` | OpenAI Live handles speech and delegates substantive requests to the normal MindRoom agent. |
| `cascaded` | Separate speech-to-text and text-to-speech services wrap the agent's normal MindRoom response, so any model provider works, including fully local setups. |
## Setup
1. Install the `matrix_calls` extra (`pip install "mindroom[matrix_calls]"` or `uv sync --extra matrix_calls`).
2. Make sure your Matrix deployment has a MatrixRTC backend; see [Server requirements](#server-requirements).
3. Define call profiles and assign one to each calls-enabled agent:
```yaml
calls:
enabled: true
profiles:
openai-realtime:
backend: realtime
model: gpt-realtime-2.1
credentials_service: openai-voice
voice: marin
agents:
assistant: openai-realtime
# livekit_service_url: https://rtc.example.org
```
Calls can also be configured in the dashboard's [Voice tab](https://docs.mindroom.chat/dashboard/#voice).
A calls-enabled agent shows `📞 Voice calls` in its Matrix presence status when the extra is installed and its profile's credentials resolve, so clients can offer the call action only where it will be answered.
## Calls configuration
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `calls.enabled` | bool | `false` | Lets agents join voice calls. |
| `calls.profiles` | map of name to profile | `{}` | Reusable, complete voice pipelines; each has a `backend` and the fields below. |
| `calls.agents` | map of agent name to profile name | `{}` | Each calls-enabled agent uses exactly one profile. |
| `calls.livekit_service_url` | string | discovered | MatrixRTC authorization service URL to use instead of discovering it from the agent homeserver's `.well-known/matrix/client`. |
`enabled` and `livekit_service_url` are global and cannot be set per agent.
Profiles have no inherited defaults and credentials never fall back to another key, so a missing credential service leaves calls unavailable rather than using a different OpenAI key.
Set a dedicated credential service when voice and chat use different OpenAI credentials.
Configuration loading fails with one of these errors when references are wrong:
- `calls.agents references unknown profile(s): ...`
- `calls.agents references unknown agent(s): ...`
- `calls.agents configures multiple agents for room(s): ...`, because a room can have at most one calls-enabled agent.
- `calls.profiles references unknown cascaded model(s): ...` or `calls.profiles references unknown Live agent model(s): ...`, when a profile's model alias is not in the top-level `models` mapping.
### Realtime profile fields
| Field | Required | Description |
|-------|----------|-------------|
| `backend` | yes | `realtime` |
| `model` | yes | OpenAI realtime speech-to-speech model ID. |
| `credentials_service` | yes | Named credential service holding the OpenAI API key. |
| `voice` | yes | Realtime voice preset. |
### Live profile fields
| Field | Required | Description |
|-------|----------|-------------|
| `backend` | yes | `live` |
| `model` | yes | OpenAI Live speech model ID, independent of `agent_model`. |
| `credentials_service` | yes | Named credential service holding the OpenAI API key; Live needs no separate STT or TTS credentials. |
| `voice` | yes | Live voice preset. |
| `agent_model` | no | Name of a top-level `models` entry used for delegated agent turns; omitted keeps normal room and agent model resolution. |
### Cascaded profile fields
| Field | Required | Description |
|-------|----------|-------------|
| `backend` | yes | `cascaded` |
| `model` | no | Name of a top-level `models` entry for call turns; it takes precedence over room and agent models, and omitting it keeps normal model resolution. |
| `stt` | yes | Speech-to-text service. |
| `tts` | yes | Text-to-speech service. |
Each speech service (`stt` and `tts`) has these fields:
| Field | Default | Description |
|-------|---------|-------------|
| `provider` | `openai` | `openai` or `openai_compatible`. |
| `model` | required | Speech model name. |
| `credentials_service` | none | Named credential service holding the API key. |
| `api_key` | none | Inline API key. |
| `host` | none | Service root or its `/v1` base URL; must be an HTTP(S) URL. |
| `extra_kwargs` | `{}` | Provider options such as `language` for STT or `voice` for TTS; must not set `api_key`, `base_url`, `client`, or `model`. |
`openai` services require `credentials_service` or `api_key`.
`openai_compatible` services require `host` and may omit credentials, in which case MindRoom sends a non-secret placeholder key.
STT services must expose `/v1/audio/transcriptions` and TTS services `/v1/audio/speech`.
The two legs may use the same credential service or different ones.
## Choosing a backend
### Realtime
The realtime model runs the whole conversation itself, using the agent's rendered prompt and its tools.
See the example in [Setup](#setup).
### Live with agent delegation
Live answers from the agent's full rendered system prompt, including its context files and caller-specific workspace, and delegates requests that need tools, research, more memory, or actions to the normal MindRoom agent, then relays the result conversationally.
If the agent's prompt plus voice guidance exceeds about 16,000 tokens (a local estimate, not a provider limit), Live instead delegates every substantive request, including questions about identity and preferences, to the normal agent.
Delegated turns keep their history while the call lasts, and each new call starts a fresh delegate session.
This example uses GPT-Live for speech and the `chat` model for delegated turns, with a voice credential independent of the agent's model provider:
```yaml
models:
chat:
provider: anthropic
id: claude-opus-5-5
agents:
assistant:
display_name: Assistant
model: chat
calls:
enabled: true
profiles:
openai-live:
backend: live
model: gpt-live-1
credentials_service: openai-live
voice: marin
agent_model: chat
agents:
assistant: openai-live
```
### Cascaded
Each finalized transcript goes through the agent's normal response path, with the same model resolution, system prompt, instructions, knowledge, skills, hooks, tools, requester identity, and history.
The profile's `model` changes only the LLM; speech services, prompts, history, memory, and tools stay the same.
Turn ends are detected locally, and the caller can interrupt the agent by speaking.
This example uses OpenAI speech services and a faster model for call turns than for text chat:
```yaml
models:
chat:
provider: anthropic
id: claude-opus-5-5
call_fast:
provider: anthropic
id: claude-haiku-4-5
agents:
assistant:
display_name: Assistant
model: chat
calls:
enabled: true
profiles:
fast-cascaded:
backend: cascaded
model: call_fast
stt:
provider: openai
model: gpt-transcribe
credentials_service: openai-voice
extra_kwargs:
language: en
tts:
provider: openai
model: gpt-4o-mini-tts
credentials_service: openai-voice
extra_kwargs:
voice: ash
agents:
assistant: fast-cascaded
```
OpenAI documents [`gpt-transcribe`](https://developers.openai.com/api/docs/models/gpt-transcribe) for transcription and [`gpt-4o-mini-tts`](https://developers.openai.com/api/docs/models/gpt-4o-mini-tts) for text-to-speech.
### Completely local cascaded setup
This configuration sends STT, LLM, and TTS requests only to localhost services and needs no cloud API key:
```yaml
models:
default:
provider: openai
id: local-chat-model
extra_kwargs:
api_key: sk-no-key-required
base_url: http://127.0.0.1:9292/v1
memory: none
agents:
assistant:
display_name: Assistant
role: Help the caller.
rooms: [lobby]
calls:
enabled: true
profiles:
local-cascaded:
backend: cascaded
stt:
provider: openai_compatible
model: whisper-large-v3
host: http://127.0.0.1:9000
extra_kwargs:
language: en
tts:
provider: openai_compatible
model: kokoro
host: http://127.0.0.1:9001
extra_kwargs:
voice: af_heart
agents:
assistant: local-cascaded
```
Different agents can use different profiles, for example one agent on `realtime` and another on this local profile.
## When an agent joins a call
An agent joins a call when it starts in one of the agent's configured rooms, or in an ad-hoc room whose invitation the agent accepted under its [`accept_invites`](https://docs.mindroom.chat/configuration/agents/) setting.
Ad-hoc rooms let a Matrix client create a private voice room and invite one agent without adding the room to `config.yaml`.
A configured room assignment wins over invites; if several calls-enabled agents were only invited to the same room, none of them answers calls there.
The agent stays in a call only while one Matrix user is in it (that user may join from several devices) and only while that user passes the normal room and per-agent reply permissions.
That user is the requester for tools, and requester-private agents use that user's workspace, memory, credentials, history, and knowledge.
Tools that need confirmation, user input, external execution, or [`tool_approval`](https://docs.mindroom.chat/tool-approval/) are hidden during calls in every backend, because a call has no approval UI.
[Deferred tools](https://docs.mindroom.chat/tools/dynamic-tools/) are available from the start of a call in every backend, with no search or loading step.
The agent leaves the call when the caller leaves, a second Matrix user joins, the voice session ends, or MindRoom shuts down.
A restart also drops it from the call, and so does any configuration change applied while the agent is in a call.
If the agent joins but cannot hear or speak, look for a `Voice call error:` notice in the room, which names the failing service and how to fix it.
For a rejected credential, update the credential MindRoom uses, restart MindRoom, then leave and rejoin the call; retrying with the same credential does not help.
## Calling an agent about a thread
In MindRoom Chat, start the call from a thread's header, or from the agent's profile while a thread is open.
When the agent picks up, it receives a snapshot of that conversation, plus the thread title when the thread has one.
The snapshot is the newest part of the thread that fits the call budget (about 6,000 tokens), with a note when older messages were left out.
Each message is cut to 2,000 characters.
Starting a call from a room's main timeline gives the agent the newest unthreaded messages of that room instead.
The snapshot is taken once, when the agent joins; messages sent during the call are not added.
It works with all three call profiles; with `live`, the voice model skips it when the agent's prompt leaves too little room, but the delegated agent always gets it.
The agent gets the snapshot only when you are a member of the room the call came from, the agent's `access` admits you there, and the agent has joined it.
Otherwise, or when reading the conversation takes longer than 5 seconds, the call starts without it.
When you hang up, the agent posts the call back into that conversation: as a reply in the same thread, or as a new room message for a call started from the main timeline.
The message reads `📞 Voice call · N min` with the spoken transcript collapsed underneath, so later replies in the thread know what was said.
Calls shorter than 10 seconds, calls in which the caller said nothing, calls that started without a conversation snapshot, and calls cut off by a MindRoom restart post nothing.
The transcript holds only what was said; tool use is left out.
Before posting, the agent checks the caller's access to the origin room again, and posts nothing if the caller lost that access during the call.
If the agent's media connection drops and it rejoins the same call, each part of the call posts its own message.
An agent with the `matrix_message` tool is also told how to start longer work during a call.
It sends a self-contained task to the thread or room the call came from, and names itself or another agent as `recipient`, so the work runs there while you keep talking.
A call without an origin makes it ask you which room to use.
Other Matrix clients ask for a conversation snapshot with the `origin` field of the call room's `io.mindroom.agent_call` state event:
```json
{
"version": 1,
"agent_user_id": "@mindroom_assistant:example.org",
"creator_user_id": "@alice:example.org",
"ephemeral": false,
"origin": { "room_id": "!abc:example.org", "thread_id": "$root" }
}
```
`thread_id` is `null` when the call starts from the room's main timeline, and `origin` may be left out entirely.
The agent uses `origin` only when the caller sent the event with an empty state key and `version: 1`, with `creator_user_id` and `agent_user_id` naming the caller and this agent, `thread_id` is the thread's root event, and `room_id` is not the call room.
Write `origin` before each call, because the agent reads it when it joins.
## Transcripts and memory
Every call writes a markdown transcript as it goes.
| Agent | Transcript location |
|-------|---------------------|
| Shared, file memory | `calls/` in the agent's workspace, readable later by its file tools |
| Shared, other memory | `<storage>/calls/<agent>/` |
| Requester-private, file memory | `calls/` in the requester's workspace |
| Requester-private, other memory | `calls/` in the requester-scoped state directory |
When the call ends, file memory stores a reference to the transcript, Mem0 stores the transcript as recallable context, and `memory: none` keeps only the transcript file.
## Server requirements
Matrix carries only call signaling; audio flows through a LiveKit SFU deployed next to the homeserver.
Your Matrix deployment needs the standard Element Call backend:
- A [LiveKit SFU](https://github.com/livekit/livekit) reachable by call participants.
- The [MatrixRTC authorization service](https://github.com/element-hq/lk-jwt-service) (`lk-jwt-service`).
- A `.well-known/matrix/client` on the Matrix server-name domain that advertises the service:
```json
{
"org.matrix.msc4143.rtc_foci": [
{ "type": "livekit", "livekit_service_url": "https://rtc.example.org" }
]
}
```
On Kubernetes, the [MatrixRTC chart](https://github.com/mindroom-ai/mindroom/tree/main/cluster/k8s/matrixrtc) deploys LiveKit and the authorization service, and the [client chart](https://github.com/mindroom-ai/mindroom/tree/main/cluster/k8s/client) publishes the `.well-known` announcement and proxies `/livekit/jwt` and `/livekit/sfu` to them.
LiveKit media still needs a static public IP and open TCP and UDP media ports, which the chart README describes.
Element's [self-hosting guide](https://github.com/element-hq/element-call/blob/main/docs/self_hosting.md) covers the full setup, and [matrix-docker-ansible-deploy](https://github.com/spantaleev/matrix-docker-ansible-deploy) enables it with `matrix_rtc_enabled: true`.
The agent joins only calls started on your own MatrixRTC backend, meaning the one in `calls.livekit_service_url` or the agent homeserver's `.well-known`; calls started through a different backend are ignored.
[Managed rooms](https://docs.mindroom.chat/rooms/#room-management) already let every member join calls.
In other rooms, such as ad-hoc rooms, the power levels must let members send `org.matrix.msc3401.call.member` state events, which Element Call-capable clients set up when they create rooms.
Calls work in both encrypted and unencrypted rooms.
Synapse supports the full MatrixRTC stack, including automatic cleanup of stale call memberships.
Tuwunel works with Element Call but does not yet support delayed events ([tuwunel#178](https://github.com/matrix-construct/tuwunel/issues/178)), so memberships of crashed clients linger until they expire.
## Limitations
- Audio only: the agent neither sends nor receives video or screen shares.
- One human Matrix user per call, possibly on several devices.
- Cascaded speech services must be OpenAI-compatible transcription and speech endpoints.
- Legacy 1:1 `m.call.*` calls (non-MatrixRTC) are not supported.
# Image Messages
This page covers how agents and teams see images sent in Matrix rooms, which image formats they receive, and what happens when a model cannot accept an image.
Images follow the same rules as other attachments for captions, routing, encryption, size limits, attachment IDs, and retention; see [Attachments](https://docs.mindroom.chat/attachments/).
## Sending Images
Send an image in a room and mention the agent or team in the caption, for example `@assistant What does this diagram show?`.
No configuration is needed; the image is passed to the responder's model as vision input, so that model must support vision (for example Claude or GPT-6 Astra).
A model without vision answers through the [media fallback](#media-fallback).
Captions from bridges trigger a response when they mention the agent through Matrix mention metadata, an HTML mention pill, or plain `@name` text.
## Image Formats
MindRoom recognizes PNG, JPEG, GIF, WebP, BMP, and TIFF images from their content and sends the recognized type to the model, logging a warning when the client declared a different MIME type.
Other image formats are sent with the client's declared MIME type, and the provider may reject them.
## Media Fallback
When a provider rejects a request containing inline media (images, audio, video, or documents), MindRoom retries it once without that media.
The retry adds `[Inline media unavailable for this model]` and tells the agent the content was not inspected, so the agent can still open the file through the [`attachments` tool](https://docs.mindroom.chat/attachments/#the-attachments-tool) or explain the limitation.
If the provider error says the model does not support that kind of input, such as `does not support image input` or `is not a multimodal model`, later requests to the same model leave that media kind out from the start until MindRoom restarts.
Other rejections, such as an image the provider could not decode, drop the media from that one request only.
Once a streamed reply has produced text, tool calls, or reasoning, a later provider error is reported instead of retried without media, and provider safeguard refusals are never retried without media.
# Attachments
This page covers how agents and teams receive files, images, and videos sent in Matrix rooms, how attachment IDs work, how long attachments are kept, and how to use the `attachments` tool to view, save, and register files.
Attachment handling works automatically for agents and teams in direct messages and threads; no configuration is needed.
Image-specific behavior is on [Image Messages](https://docs.mindroom.chat/images/), and audio messages are transcribed as described on [Voice Messages](https://docs.mindroom.chat/voice/).
## Sending Files to an Agent
Send a file, image, or video in a Matrix room and mention the agent or team in the caption:
- **With caption**: `@assistant Summarize this document` uses the caption as the prompt.
- **Without caption**: the responder receives `[Attached file]`, `[Attached image]`, or `[Attached video]` as the prompt.
A media event's `body` counts as a caption only when the event also has a `filename` field with a different value, following [MSC2530](https://github.com/matrix-org/matrix-spec-proposals/pull/2530), so a body that only repeats the filename is not a caption.
The responder answers only when it would answer a text message there (mention, thread participation, or DM).
Without an `@mention`, the router uses the caption to choose among several eligible agents or teams.
Both unencrypted and end-to-end encrypted media are supported.
The responder's model receives the media directly, so it must support that input type (vision for images, file or video input for documents and videos).
Models without that support can still work with the file through the [`attachments` tool](#the-attachments-tool).
When a provider rejects inline media, MindRoom retries without it and tells the agent the content was not inspected; see [Media Fallback](https://docs.mindroom.chat/images/#media-fallback).
Some provider integrations never send certain media kinds, so MindRoom leaves those out from the start with the same note.
Only models using the `google` provider receive video, Claude and OpenAI Responses models (including Codex) also receive no audio, Ollama and Groq models receive only images, and Cerebras models receive no media.
## Attachment IDs
Each received or registered file gets an attachment ID such as `att_abc123`.
Attachments sent with the current message are listed in the prompt with their kind, filename, sender, send time, and event ID:
```
Attachments sent with the current message (use tool calls to inspect or process them by ID):
- att_abc123 (image, "car.jpg", from @user:example.org, sent 2026-06-06 09:00 UTC, event $abc)
```
Only current-message attachments are sent to the model as media.
Earlier attachments appear in the conversation history as annotations, and the agent can open them again by ID with the `attachments` tool:
```text
@user:example.org: check this out
[attachments: att_def456 (image, "house.jpg")]
```
Attachment IDs are scoped to their room and thread, so an ID from one conversation cannot be used in another.
Within a conversation, an authorized response can open files uploaded by any participant.
When a message's file is replaced by an edit, later turns use the new file under a new attachment ID.
## The `attachments` Tool
The optional `attachments` tool lets an agent list, view, save, and register files in the current conversation, including with models that cannot take file input directly.
Add it to the agent's tools; it has no configuration fields, and enabling [`matrix_message`](https://docs.mindroom.chat/tools/matrix-message/) also enables it:
```yaml
agents:
assistant:
tools:
- attachments
```
| Function | What it does |
|----------|--------------|
| `list_attachments(target=None)` | List the attachment IDs available in the current context with their metadata, plus any `missing_attachment_ids`; `target` returns one attachment |
| `get_attachment(attachment_id, mindroom_output_path=None, view=False)` | Return metadata, save the file into the workspace, or show its content to the model |
| `view_file(path=None, attachment_id=None)` | Show an image from the workspace or an attachment to the model |
| `register_attachment(file_path)` | Turn a local file into a new attachment ID for this conversation |
```python
list_attachments()
get_attachment("att_abc123")
get_attachment("att_abc123", view=True)
get_attachment("att_abc123", mindroom_output_path="incoming/plan.pdf")
view_file(path="plots/result.png")
register_attachment("exports/report.csv")
matrix_message(message="Here is the report.", attachments=["att_abc123", "exports/report.csv"])
```
Attachment arguments must be `att_*` IDs available in the current conversation or registered earlier in the same tool run.
Metadata includes the kind, filename, MIME type, size, room ID, thread ID, sender, timestamps, and an `available` flag that reports whether the file still exists.
It also includes the runtime-local path, except for agents whose workspace tools run on a worker, where that path does not exist; their metadata has a `usage` note saying to save the file with `mindroom_output_path` instead.
To post files into Matrix, pass attachment IDs or file paths to `matrix_message`; see [`matrix_message` attachments](https://docs.mindroom.chat/tools/matrix-message/#attachments).
### Viewing Content
`get_attachment(attachment_id, view=True)` sends an image, audio, video, or document (including PDF and plain text) to the model, up to 20 MiB.
The model and its provider must support that media type and may have stricter limits.
`view=True` cannot be combined with `mindroom_output_path`.
If the model cannot take the media, the agent is told so and can save the file and use other extraction or transcription tools instead.
`view_file` shows one image to the calling model in one call; supply exactly one of `path` or `attachment_id`, and use `read_file` for ordinary text and code.
Workspace paths resolve inside the agent's worker when it has one, otherwise inside its workspace.
It accepts PNG, JPEG, GIF, and WebP images up to 20 MiB and 40 million pixels.
Images larger than 2048 pixels on the longest edge or 5 MiB are scaled down, animated images show only the first frame, and the result metadata reports these changes.
Image viewing through `get_attachment(view=True)` follows the same limits.
Viewing does not post anything to Matrix; to share the image, pass the returned attachment ID to `matrix_message`.
That ID works within the same tool run; in later turns, view the original path again.
Conversation history keeps up to four recently viewed images within 10 MiB in total, and older ones are replaced by a notice.
### Saving Files to the Workspace
`get_attachment(attachment_id, mindroom_output_path="incoming/file.ext")` saves the file into the agent workspace and returns a receipt with the path, byte count, and SHA-256.
Save attachments this way before processing them with `file`, `coding`, `python`, or `shell` on a worker, because attachment storage is not visible inside the worker.
The path must be a workspace-relative file path; it cannot be absolute, contain `..`, start with `~`, or contain `$` or `%`.
Saves into a worker are limited by [`MINDROOM_ATTACHMENT_INLINE_SAVE_MAX_BYTES`](https://docs.mindroom.chat/deployment/sandbox-proxy/#environment-variable-reference), which defaults to 64 MiB so that every attachment MindRoom accepts can be saved.
See [Sandbox Proxy](https://docs.mindroom.chat/deployment/sandbox-proxy/) for how the workspace appears as `$MINDROOM_AGENT_WORKSPACE` and `~` inside worker tools.
### Registering Local Files
`register_attachment(file_path)` copies a local file into attachment storage and returns a new attachment ID for the current room and thread, usable by later calls in the same run.
Later changes to the source file do not change the attachment.
Registered files are limited to 64 MiB.
Paths, including the targets of symbolic links, follow the agent's [`file_access`](https://docs.mindroom.chat/architecture/security-posture/#file-access) setting:
- With the default `workspace`, paths resolve from the agent workspace and must stay inside it, so pass workspace-relative paths such as `incoming/file.txt`.
`~` expands to the MindRoom process home, not the worker workspace, so `~/incoming/file.txt` is rejected.
Without a configured workspace, path registration is refused.
- With `unrestricted`, any file the MindRoom process can read is accepted, including absolute paths.
## Retention
Attachment bytes are stored under `incoming_media/` and metadata under `attachments/` in the storage directory (`mindroom_data/` by default).
MindRoom prunes attachments older than 30 days; deletion is not immediate at the 30-day mark.
Pruning never deletes workspace files, the source files of registered attachments, or copies on the Matrix homeserver.
## Limits
- **Incoming media size**: received files must be at most 64 MiB (67,108,864 bytes), including after decryption; send a smaller file if one is rejected.
Homeservers and model providers may set lower limits.
- **Earlier media per turn**: a turn fetches at most 10 earlier files, images, or videos that are not stored yet, newest first, and leaves the rest for later turns.
An earlier file that fails to download is not tried again for an hour.
# Interactive Q&A
Agents can ask users a multiple-choice question that they answer by clicking an emoji reaction or typing the option number.
Use this when an agent needs the user to pick between a few concrete options before it continues.
<video controls playsinline preload="metadata" aria-label="The agent asks a multiple-choice question before it decides" style="width: 100%" poster="https://github.com/user-attachments/assets/0a47822d-348e-4ca1-9ab6-a704861f1327" data-poster-light="https://github.com/user-attachments/assets/0a47822d-348e-4ca1-9ab6-a704861f1327" data-poster-dark="https://github.com/user-attachments/assets/ba161463-03d9-41f7-bd99-7369c5542619">
<source src="https://github.com/user-attachments/assets/f49c4ff4-b0fe-4f4f-a36b-b8a3481f8147" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/6f31e382-0a78-4415-a610-a207744d4b73" type="video/mp4">
</video>
## Asking a Question
Any agent can ask a question without extra tools or configuration by including an `interactive` code block with JSON in its response:
````markdown
```interactive
{
"question": "What approach would you prefer?",
"options": [
{"emoji": "🚀", "label": "Fast and automated", "value": "fast"},
{"emoji": "🔍", "label": "Careful and manual", "value": "careful"}
]
}
```
````
MindRoom replaces the block with a numbered list and adds each option's emoji as a reaction button:
```
What approach would you prefer?
1. 🚀 Fast and automated
2. 🔍 Careful and manual
React with an emoji or type the number to respond.
```
While a response streams, the question appears once its code block is complete.
To make an agent use questions, describe the format in its `instructions` or `role`:
```yaml
agents:
assistant:
display_name: Assistant
role: A helpful assistant
instructions:
- >
When the user needs to choose between options, present them using
an interactive code block with JSON containing question and options
(each with emoji, label, and value fields).
```
### Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `question` | string | No | Question text shown above the options. Defaults to `"Please choose an option:"`. |
| `options` | array | Yes | Option objects; options beyond the fifth are dropped without warning. |
| `options[].emoji` | string | No | Reaction button for the option. Defaults to `"❓"`. |
| `options[].label` | string | No | Text shown for the option. Defaults to `"Option"`. |
| `options[].value` | string | No | Value passed back to the agent. Defaults to the label in lowercase. |
Give every option a different emoji; reacting with an emoji that several options share, including the default `❓`, selects the last of them, so the others can only be chosen by number.
## Answering a Question
Users answer where the question was asked, in its thread or in the main room, in either of two ways:
- **Reaction**: click one of the option emojis on the question.
- **Text**: send just the option number, a single digit from `1` to `5`.
When several questions there are unanswered, a number answers the oldest question from each agent that asked one; react to answer a specific question.
Either way, the agent that asked receives the question text and the selected option's label and value, and continues the conversation there.
Each question accepts one answer, and questions stay answerable across restarts.
Only human users can answer; reactions and messages from agents are ignored.
## Limitations
- Only the first valid question in a response gets reaction buttons and numeric answers; later ones are shown as plain text.
- A very large question, roughly a few thousand characters of question text, option labels, and option values, is shown without reaction buttons and cannot be answered by number; shorten the question, labels, or values to keep it answerable.
- Questions only work in an agent's normal responses; sending or editing one with the `matrix_message` tool fails with `Interactive prompts are only supported in normal agent responses.`
# Interactive Canvases
An agent can show the user a web page it wrote, such as a dashboard, report, slide deck, form, or picker, in the Canvas panel beside the conversation in MindRoom Chat.
The user can work in the page and send an answer, which reaches the agent as the user's next message.
Use a canvas when seeing or clicking beats reading or typing; for a quick choice between a few options, a plain reply or an [interactive question](https://docs.mindroom.chat/interactive/) is simpler.
=== "Overview · 27 s"
A narrated film of all four: a scheduling grid, a data fit, a slide deck, and a trip planner.
<video class="only-light" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/77e36a87-9fec-41f9-b626-73b950003845" aria-label="Canvas film: four agent canvases beside the conversation" style="width: 100%">
<source src="https://github.com/user-attachments/assets/381f7395-4f1b-4167-8749-7f85080da8ce" type="video/mp4">
</video>
<video class="only-dark" controls playsinline preload="none" poster="https://github.com/user-attachments/assets/d2b7a4a6-0723-4d22-af2a-6b2ee7213602" aria-label="Canvas film: four agent canvases beside the conversation" style="width: 100%">
<source src="https://github.com/user-attachments/assets/1a820f71-dd19-415f-9301-611310c3d510" type="video/mp4">
</video>
=== "Scheduling"
A week grid of four people's availability; the pick goes back with **Send**, and the agent books the meeting after approval.
<video controls playsinline preload="metadata" aria-label="An agent shows a week grid; the user picks a slot and sends it, and the agent books it" style="width: 100%" poster="https://github.com/user-attachments/assets/c44fdc29-a35d-45ed-9b67-8a8f2d046bef" data-poster-light="https://github.com/user-attachments/assets/c44fdc29-a35d-45ed-9b67-8a8f2d046bef" data-poster-dark="https://github.com/user-attachments/assets/df646508-7bd3-494f-b560-c49bd5ec0982">
<source src="https://github.com/user-attachments/assets/e6698792-c676-4a4f-9824-ae04c1e970da" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/89fb462e-4895-43a0-9cf6-44f91fd7084d" type="video/mp4">
</video>
=== "Data"
An interactive fit drawn in inline SVG with the theme variables; leaving out an outlier refits the curve live.
<video controls playsinline preload="metadata" aria-label="An agent shows a data fit; the user leaves out an outlier and sends back the fit" style="width: 100%" poster="https://github.com/user-attachments/assets/d6a4d93a-2ce0-466a-bca6-8b7b2f84cad3" data-poster-light="https://github.com/user-attachments/assets/d6a4d93a-2ce0-466a-bca6-8b7b2f84cad3" data-poster-dark="https://github.com/user-attachments/assets/f283e9b8-4b9a-40be-a8e9-da758ad163a1">
<source src="https://github.com/user-attachments/assets/39a4fa17-51f4-46df-821d-7391c2418071" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/62d2d1d3-5754-4d6a-a5a4-d70b0a354d43" type="video/mp4">
</video>
=== "Slides"
A deck the agent writes to a workspace file and shows by `path`; after a change request it rewrites the file and the open deck updates in place.
<video controls playsinline preload="metadata" aria-label="An agent shows a slide deck from its workspace and updates it in place after a change request" style="width: 100%" poster="https://github.com/user-attachments/assets/a397afe2-943b-436c-813d-c5a7e03d81cf" data-poster-light="https://github.com/user-attachments/assets/a397afe2-943b-436c-813d-c5a7e03d81cf" data-poster-dark="https://github.com/user-attachments/assets/1517814d-cb7f-47f1-be9f-d2fc52ceffa8">
<source src="https://github.com/user-attachments/assets/fa8b1989-9b8c-4dad-b55d-18dd0412013a" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/e215f9e4-ffdb-4e64-9782-e787d3dd464b" type="video/mp4">
</video>
=== "Trip planner"
One canvas, two steps: pick a stay, then plan the days against a live budget, updated in place with `canvas_event_id`.
<video controls playsinline preload="metadata" aria-label="One canvas, two steps: pick a stay, then plan the days against a live budget" style="width: 100%" poster="https://github.com/user-attachments/assets/57143ac5-9fb7-400d-8ad4-ccf036f16b5e" data-poster-light="https://github.com/user-attachments/assets/57143ac5-9fb7-400d-8ad4-ccf036f16b5e" data-poster-dark="https://github.com/user-attachments/assets/01cf9610-83fc-4752-ac72-64750807af71">
<source src="https://github.com/user-attachments/assets/dd5ab134-eeba-4cd5-93e3-4dd6e8d0a9cd" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/3e772d7a-1acc-44bf-8e6e-f7e3032ee374" type="video/mp4">
</video>
## Turn canvases on
Canvases need two switches, and both are off by default.
First, give the agent the [`chat_ui`](https://docs.mindroom.chat/tools/chat-ui/) toolkit with `enable_show_canvas: true`:
```yaml
agents:
planner:
display_name: Planner
role: Plan trips and compare the options visually.
model: default
tools:
- chat_ui:
enable_show_canvas: true
```
`enable_show_canvas` (boolean, default `false`) adds the `show_canvas` function; the rest of `chat_ui` works without it.
It can also be set in the `chat_ui` tool's saved settings for every agent that uses `chat_ui`; an agent's own entry wins, as described in [How Settings Combine](https://docs.mindroom.chat/tools/#how-settings-combine).
Second, enable canvases in the MindRoom Chat deployment's runtime `config.json`:
```json
{
"mindroom": {
"canvas": {
"enabled": true
}
}
}
```
The shipped MindRoom Chat configuration sets `enabled` to `false`, so only whoever deploys Chat can turn canvases on.
### Let pages load libraries
Pages can also load libraries such as Chart.js, D3, Mermaid, or KaTeX from jsDelivr's npm CDN, `https://cdn.jsdelivr.net/npm/`.
This takes two more switches, both off by default; turn on both, because a page that needs a library breaks where Chat blocks it.
```yaml
agents:
planner:
display_name: Planner
role: Plan trips and compare the options visually.
model: default
tools:
- chat_ui:
enable_show_canvas: true
enable_canvas_libraries: true
```
```json
{
"mindroom": {
"canvas": {
"enabled": true,
"libraries": true
}
}
}
```
`enable_canvas_libraries` (boolean, default `false`) tells the agent it may use the source, and Chat's `libraries` lets pages load from it.
Pages may then load scripts, styles, and fonts from `/npm/` paths only; fetching data, external images, workers, and every other site stay blocked, and libraries that evaluate strings, such as Alpine or Vue in-page templates, do not run.
Opening a page that uses a library tells jsDelivr the viewer's IP address and which files they load, which is why Chat keeps libraries off unless its deployment allows them.
## What the user sees
Each canvas appears in the conversation as a notice with an **Open panel** button.
Chat opens the panel by itself under the same conditions as other [Chat UI actions](https://docs.mindroom.chat/tools/chat-ui/#what-the-user-sees); otherwise the user chooses **Open panel**.
The panel names the agent that made the page, and the user can resize it or expand it to the full width of the conversation.
When the panel cannot open, the **Open panel** button is disabled and a message below it says why:
| Message | Cause |
|---|---|
| Interactive panels are turned off in this app. | The Chat deployment has not enabled canvases. |
| Interactive panels are not available in the app yet. Open this conversation in a browser. | The native mobile app does not show canvases; Chat in a browser does. |
| End the call to open interactive panels. | Chat does not run canvases during a call. |
Other people in the room, and other Matrix clients, see only the notice text, `Interactive panel: <title>. Open it in MindRoom Chat to respond.`
### Find a canvas again
A canvas the user comes back to, such as a landing page an agent keeps current or a checklist used every day, does not have to be found in its thread again.
Where canvases are on, Chat's sidebar gets a **Canvases** button once the user has a canvas; it lists the canvases agents made for the user: pinned ones first, then the most recently updated, with the thread each was shown in (by its summary, as the sidebar names it), the room, the agent, and when each was updated and created.
Choosing a title opens the canvas at its latest version, filling the conversation's column; choosing the thread or the room opens that conversation.
Pins are kept in the user's Matrix account data (`io.mindroom.pinned_canvases`, room and event IDs only), so they show on every device.
The rest of the list holds the canvases this browser has received, so a new device starts with recent canvases and older ones appear once their thread is opened.
Users who don't want the button turn off **Show Canvases in the sidebar** under Settings → General → Interface; the choice follows them to every device.
For a page the user returns to, update the same canvas with `canvas_event_id` rather than showing a new one, so its row and pin keep pointing at it.
## Answering a canvas
Typing, toggling, and moving between steps inside the page send nothing.
When the page submits an answer, Chat shows the user exactly what will be sent, and nothing is sent until the user chooses **Send**.
To change a pending answer, the user chooses **Discard** and answers again.
The answer is an ordinary message from the user in the canvas's thread; it mentions the agent and starts the agent's next turn:
```text
@mindroom_planner:example.org Canvas response ($canvas-event, revision $canvas-event): Pro plan
{"plan":"pro"}
```
The first ID is the canvas and the second is the version the user answered; when that is not the latest version, the user answered an earlier page.
MindRoom Chat shows the answer as a one-line receipt that expands to the exact data.
An answer can carry up to 512 KB of JSON data, enough for a long document the user edited in the canvas; larger or non-JSON data is ignored, so no **Send** prompt appears.
When the page throws an error, fails to load a file, or tries to load something Chat blocks, the panel lists up to five of those errors with a **Tell** *agent* button.
Nothing is sent unless the user chooses it; the report reaches the agent like an answer:
```text
@mindroom_planner:example.org Canvas error ($canvas-event, revision $canvas-event):
Uncaught ReferenceError: drawChart is not defined (line 12)
Blocked https://unpkg.com/chart.js (script-src-elem)
```
### Let the agent read the page without a Send button
For a page whose choices the agent needs later, such as a checklist ticked over a few days, the agent shows the canvas with `share_state=True`.
Chat then keeps a copy of what the page saved (its saved state and kept inputs) in the room, once the user has worked in the page and pauses for a moment, and when the panel closes or the tab is hidden.
The copy never starts the agent's turn and never enters its conversation; the agent reads the newest copy when it wants, for example from a scheduled task:
```python
chat_ui.read_canvas_state(canvas_event_id="$canvas-event")
```
It returns the state, the inputs, and when the user's Chat shared them, or says nothing was shared yet; when the newest copy in the room cannot be read, it returns an error rather than an older copy.
Sharing is decided when a canvas is first shown, and its updates keep it; the panel tells the user "Saved in this room: *agent* and others here can read what you enter."
Each copy stays in the room's history like a message, and logging out does not remove it.
## Update a canvas
`show_canvas` returns the canvas `event_id`.
Calling `show_canvas` again with `canvas_event_id` set to that ID replaces the page in place, for the next step of a flow or a new version of a file the agent edited, and the conversation keeps one card.
An update may leave out `title` to keep the title the canvas was first shown with.
An open panel switches to the new page at once, unless the user has been working in it; then Chat shows "*agent* updated this panel." with a **Load update** button, so unsent work is not lost.
Every update stays available: once a canvas has more than one version, the panel header shows *Version n of m* with buttons to go back and forward, and an earlier version offers **Show latest**.
The user can answer an earlier version; switching is unavailable while an answer waits for **Send** or is sending.
An agent can update only canvases it showed to the same user in the same room and thread, or at room level; otherwise the call fails and the agent shows a new canvas instead.
## Write a page
Pass the page as `html`, or as a `path` to an HTML file, which suits pages the agent builds and refines, such as slides.
Paths follow the same rules as [registering local files](https://docs.mindroom.chat/attachments/#registering-local-files); prefer workspace-relative paths such as `slides/deck.html`.
```python
chat_ui.show_canvas(
title="Choose a plan",
html="""
<style>
.plans { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.plan { background: var(--mr-surface); border: 1px solid var(--mr-border);
border-radius: var(--mr-radius); padding: 16px; }
button { background: var(--mr-accent); color: var(--mr-accent-text); border: 0;
border-radius: 8px; padding: 8px 14px; cursor: pointer; }
</style>
<div class="plans">
<div class="plan"><h3>Basic</h3><p>For trying things out.</p>
<button onclick="mindroom.submit({plan: 'basic'}, {label: 'Basic plan'})">Choose Basic</button></div>
<div class="plan"><h3>Pro</h3><p>For daily work.</p>
<button onclick="mindroom.submit({plan: 'pro'}, {label: 'Pro plan'})">Choose Pro</button></div>
</div>
""",
)
```
- **Self-contained:** write inline CSS and JavaScript. The page cannot fetch data or load external images, and it loads libraries only where [allowed](#let-pages-load-libraries); otherwise draw charts with inline SVG or a `<canvas>` element, and always embed images as `data:` URLs.
- **Submitting:** call `window.mindroom.submit(data, {label})` with JSON-serializable `data` and a short `label`, or use a `<form>`, whose fields become the data and whose `data-mindroom-label` attribute sets the label.
- **Responsive:** the panel ranges from narrow to the full conversation width.
- **Kept inputs:** inputs, selects, and textareas with an `id` or `name` keep their values on their own, across a reload, an update, and a switch to another version, matched by that `id` or `name` (a radio group by its name).
When the page loads, Chat sets the kept values and fires `input` and `change` on each, so a page that redraws on those events shows them.
Give a field a new `id` when its meaning changes between versions.
Never kept: password, file, and hidden inputs, fields with `autocomplete="off"`, and texts over 32K characters, which a page can keep with `saveState`.
- **Saved state:** to keep anything else the user did in the page, call `window.mindroom.saveState(value)` on every change; Chat batches the writes, and a value over 256K characters of JSON throws.
Later loads of the canvas, after a reload, an update, or a switch to another version, start with it in `window.mindroom.state`, which is `undefined` when nothing is saved.
Read it defensively, since an earlier version of the page may have saved it in another shape.
It stays in that browser and reaches the agent only through an answer, or [when the canvas shares it](#let-the-agent-read-the-page-without-a-send-button).
The browser keeps it for the 100 most recently saved canvases and deletes it when the user logs out.
- **Checking a page:** an agent with the [`browser`](https://docs.mindroom.chat/tools/web-scraping-and-browser/#browser) tool can open its page file with `browser_control(action="open", paths=[...])` and take a screenshot before showing it.
Chat's theme variables and `window.mindroom` are not there, so a page that gives its `var(--mr-...)` colors fallbacks looks closest to the panel.
The browser also does not block everything the panel blocks.
- **Limits:** the `title` is one line of at most 120 characters, and the page is UTF-8 text of at most 4 MB.
Each update of a page larger than about 24 KB stores a new copy on the homeserver that users cannot delete, so iterate on large pages sparingly.
Chat exposes its current theme as CSS variables, so a page can match light and dark mode:
| Variable | Use |
|---|---|
| `--mr-bg` | Page background (the default body background) |
| `--mr-surface`, `--mr-surface-raised` | Cards and raised elements |
| `--mr-border` | Borders and dividers |
| `--mr-text`, `--mr-text-muted` | Text (the default body color) and secondary text |
| `--mr-accent`, `--mr-accent-text` | Primary actions and the text on them |
| `--mr-success`, `--mr-warning`, `--mr-danger` | Status colors |
| `--mr-radius`, `--mr-font` | Corner radius and font family |
For choices the variables cannot make, such as a chart palette, `window.mindroom.colorScheme` is `light` or `dark`.
## Privacy and safety
- The page cannot read the user's Matrix account, messages, cookies, or storage, and it cannot open pop-ups or navigate away; a page that tries is stopped, and Chat shows "This panel tried to leave its sandbox and was stopped." with a **Reload panel** button.
- In an encrypted room, the page, the answer, and a shared copy of the page's state are end-to-end encrypted like other messages.
- A canvas shared with `share_state=True` lets its agent, and anyone else in the room, read what the page saved without asking each time; Chat says so in the panel.
Passwords and fields with `autocomplete="off"` are never kept automatically, but whatever the page passes to `saveState` is shared, so pages must keep secrets out of it.
- A canvas is not a safe place for secrets: browsers do not let a page block WebRTC, and a page that loads libraries can put data in the addresses it requests, so a malicious page could leak what the user types into it.
Chat therefore names the agent that made each canvas and reminds the user that what they enter may leave the panel.
- Agents should show only pages they wrote, never downloaded or untrusted pages, because every canvas appears as the agent's own.
# Thread Exports
Thread exports write Matrix conversation history to YAML files that agents and operators can search with ordinary file tools.
Only Matrix threads are exported; plain room messages outside threads, including conversations with agents using `thread_mode: room`, are not.
Set `thread_exports` on an agent to keep a continuously updated copy inside its workspace, so its `file` and `shell` tools can grep past threads without Matrix access.
Use [`mindroom threads export`](#threads-export) for a one-shot or watched export to any directory.
```yaml
agents:
code:
thread_exports: true # defaults below
research:
thread_exports:
invited_rooms: false # config rooms only
private_room_scope: owner # private agents only
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `invited_rooms` | bool | `true` | Also export user-created rooms the agent joined through invites. Current membership is always required |
| `private_room_scope` | `owner_and_agent` or `owner` | `owner_and_agent` | Private agents only. Both values require the requester to be joined to an exported room; `owner_and_agent` also checks the agent's membership. The agent must be joined either way to read the room |
## Export Layout and Contents
Workspace exports land at `<storage_root>/agents/<agent>/workspace/thread_exports/<urlencoded room key>/<urlencoded thread id>.yaml`, which agent tools see as `$MINDROOM_AGENT_WORKSPACE/thread_exports/`.
`mindroom threads export` writes the same layout under its output directory.
Each thread file holds `version`, `room` metadata, `thread` metadata including the latest thread summary as `thread.summary`, and a `messages` list.
Exported messages match the history agents see in their prompts, including edits, redactions, and long messages.
Each room directory also holds an `index.json` mapping every thread file to its message count, participants, latest summary, and last activity, sorted by most recent activity.
A thread file is rewritten only when its content changed, so `exported_at` reflects the last content-changing export.
Size limits:
- A thread file larger than 64 MiB or holding more than 250,000 YAML nodes, roughly 15,000 messages, is indexed without participants or last activity.
- A thread whose messages together pass 128 MiB, or whose file would pass 128 MiB, is not exported; the export reports it as failed and keeps any previous file for it.
- A room whose thread files together pass 256 MiB, or whose index entries together pass 8 MiB of JSON, gets an index of its most recently written threads only, listing the rest under `unindexed_files`, with a logged warning.
## When Workspace Exports Update
MindRoom re-exports a room within about two seconds of a message, edit, redaction, or membership change in it, and runs a full pass at startup and after every config reload.
A full pass removes exports for threads and rooms that no longer exist or that the agent may no longer read, and clears the export tree of any agent whose `thread_exports` was removed.
Agents may edit or delete their exported files; deleted files return on the next pass that touches the room.
If a pass exports no room at all, MindRoom keeps exports of rooms it did not reach, and if a room returns zero threads, it keeps that room's thread files; both cases log a warning.
Rooms excluded by config, such as invited rooms after `invited_rooms: false`, and rooms the agent or requester has left are still removed.
After such a warning, verify the source state and remove the preserved export manually only when the deletion is confirmed.
## Security and Retention
Shared agents export only rooms where the agent's own Matrix account is currently joined.
Private agents (`private:`) get one export tree per instance under `<storage_root>/private_instances/<scope-key>/<agent>/<private root>/thread_exports/`, limited to the agent's configured and invited rooms and to the requester's current room memberships, so one requester's workspace never holds other users' conversations.
A private instance is exported only after MindRoom has created or used it for its requester.
Thread export settings control what future passes write.
Cleanup is not a revocation or data-erasure boundary: previously exported data may remain, or may already have been copied or committed by the agent.
## Semantic Search Over Exports
With an embedder configured (`memory.embedder`), point a knowledge base at the export directory for semantic search through `search_knowledge_base`.
```yaml
knowledge_bases:
code_threads:
path: ./mindroom_data/agents/code/workspace/thread_exports
description: Exported Matrix conversation history for the code agent
exclude_patterns: ["*/index.json"]
agents:
code:
thread_exports: true
knowledge_bases: [code_threads]
```
For a private agent, index the private-root-relative path instead:
```yaml
agents:
secret:
thread_exports: true
private:
per: user
knowledge:
path: thread_exports
description: Your exported conversation history
```
The active thread's file is rewritten on every message, so a watching index re-embeds that thread per message.
This is negligible with a local embedder but costs real money with paid embedding APIs in busy rooms.
## threads export
`mindroom threads export` exports Matrix threads to YAML files through a running MindRoom instance; options are listed in the [CLI reference](https://docs.mindroom.chat/cli/#threads-export).
Keep MindRoom running with its API enabled; there is no offline export mode or separate Matrix login.
The CLI calls `--url`, then `MINDROOM_URL` from the selected runtime environment, then `http://127.0.0.1:8765`.
Set `MINDROOM_API_KEY` when API authentication is enabled; hosted deployments require an authorized bearer token.
With `MINDROOM_API_KEY` set, the CLI refuses a remote `http://` URL with `Use HTTPS when sending MINDROOM_API_KEY to a remote endpoint.`; HTTPS and loopback HTTP work.
The selected `--config` and `--storage-path` must match the running installation, and output paths refer to that runtime's filesystem.
Output defaults to `<storage>/thread_exports`.
Rooms joined through authorized invites are exported with the invited entity's own account unless `--no-invited-rooms` is passed.
A complete pass removes exported room and thread files that are no longer present or authorized; a `--room` pass only cleans up the selected room.
The same zero-room and zero-thread safeguards as [workspace exports](#when-workspace-exports-update) apply.
An interrupted pass keeps completed files; rerun the export to finish it and rebuild indexes.
### Output directory rules
MindRoom claims an empty output directory by writing a `.mindroom-thread-exports` marker file.
A populated directory without that marker is refused, skipped for the whole pass, and reported as a target failure.
To use an existing populated directory, create `.mindroom-thread-exports` inside it containing exactly `{"format":"mindroom-thread-exports","version":1}` followed by a newline.
Cleanup removes only exported room directories and thread files; unrelated entries such as `.DS_Store`, a `.git` directory, or your own notes are never deleted.
Output paths ending in `.`, `..`, or an empty name are rejected, as are symlinked output and room directories.
# Bug Reports
When something goes wrong in a conversation, such as an agent stopping halfway, a reply never arriving, or a tool failing, the person who fixes it needs to know exactly what happened.
Collecting that by hand (screenshots, room and message IDs, app diagnostics, server logs) is slow, and users rarely know what to include.
Bug reports make it one click for the user and give the administrator both sides of the story: what MindRoom Chat saw and what the MindRoom backend did.
This is meant for deployments with an administrator who can already read everything, such as a company or family install.
Users keep their privacy from each other: a report is visible only to the person who sent it and the administrators at the time it was sent, and an administrator removed later keeps the reports they already received.
## How it works
1. In MindRoom Chat, the user opens the menu on any message and chooses **Report a bug**.
2. MindRoom Chat collects the evidence and sends it to a private room shared only with the administrators, then opens that room so the user can add details.
3. The administrators' MindRoom Chat joins that room automatically, so nobody has to accept an invite.
4. The administrator runs [`mindroom debug-report`](https://docs.mindroom.chat/cli/#debug-report) on the attached file to collect the backend side of the same moment.
5. Both files go to whoever fixes the issue, for example a coding agent.
## Enable it
Add the administrators to the homeserver's `/.well-known/matrix/client` file:
```json
{
"m.homeserver": { "base_url": "https://matrix.example.com" },
"io.mindroom.bug_reports": { "admins": ["@admin:example.com"] }
}
```
With the `mindroom-client` Helm chart, list them in `bugReports.admins` and the chart serves that file; see the [chart README](https://github.com/mindroom-ai/mindroom/blob/main/cluster/k8s/client/README.md#bug-reports).
Nothing changes in `config.yaml`.
Without this key, the menu item is called **Download bug report** and saves the report as a file instead.
## What a report contains
- The room, thread, and message it was sent from, with a link.
- The conversation as MindRoom Chat holds it: the thread root and its newest 200 replies, or the last 50 messages when the message is not in a thread, each with its original content, latest edit, and send status.
- App details such as version, platform, browser, and connection state.
- The same data as **Export diagnostics** under **Settings → About**.
Nothing is redacted, and reports from encrypted rooms are stored decrypted in the report room.
## Where reports go
- Each user gets one private room named `Bug reports · <name>`, and each report is a thread in it, so follow-up questions stay next to the report.
- The room is unencrypted so administrator tools such as `matrix-mcp` can read it.
- Administrators are joined automatically only when they run MindRoom Chat and the invite is for a private report room created by someone on their own homeserver; other accounts, such as bots, accept the invite themselves.
- When an administrator is removed from the list, the next report goes to a new room; reports they already received stay with them.
## Collect the backend side
The report carries the IDs the backend uses, so one command on the MindRoom host gathers the agent runs, tool calls, model requests, deliveries, and log lines for that conversation:
```bash
mindroom debug-report mindroom-bug-report-<time>.json --output backend-report.json
```
Enable `debug.log_llm_requests` in advance if you also want full model requests and successful tool calls in it.
See [`mindroom debug-report`](https://docs.mindroom.chat/cli/#debug-report) for every option and data source.
# Usage Tracking
MindRoom records content-free token usage for agent and team replies and the [helper and internal AI work](#token-usage) listed below, plus call duration for GPT-Live voice calls.
View it in the dashboard [Usage tab](#dashboard-usage-tab), fetch it over [HTTP](#usage-report-api) for reporting or cost tools, or let agents read it with the [`usage_stats`](#usage_stats) tool.
Reports show retained usage, not estimated spend or a billing ledger.
## Dashboard Usage Tab
The **Usage** tab shows organization-wide token usage from the [usage report](#usage-report-api) and uses normal dashboard authentication.
- All-time recorded totals for input, output, and cache tokens
- Daily activity with a UTC date range and an expandable data table
- Searchable agent/team, model, and requester breakdowns, sorted by the selected token counter
- Agent/team detail with requesters, cumulative models, and daily activity
- Requester detail across agents, models, and daily activity, including usage of shared agents
- Model detail across agents, requesters, and daily activity, keeping providers separate
The token selector also offers reasoning and audio counters when the provider reports them.
Select a row in any breakdown to open its detail panel.
Date ranges apply only to daily activity; agent and model totals stay cumulative.
Daily and requester detail can be lower than cumulative totals when older attribution is missing, and undated runs appear only in totals.
A run that used several models counts once in each model's run count, so do not add model run counts together.
Cache tokens may already be included in input counts, depending on the provider.
The tab waits automatically while a report is prepared.
**Refresh** requests the latest report; completed reports can be up to one minute old.
## Token Usage
This section describes what every usage view counts.
**Counters.** Each total has nine counters: `input_tokens`, `output_tokens`, `total_tokens`, `cache_read_tokens`, `cache_write_tokens`, `reasoning_tokens`, `audio_input_tokens`, `audio_output_tokens`, and `audio_total_tokens`.
Missing counters are reported as zero, so a zero does not prove a provider used none of that category.
Models are grouped by provider and model; usage that cannot be attributed to a model appears under model `unknown`.
**Runs.** `run_count` counts retained top-level AI replies with usable token metrics, not messages or conversations.
Team member tokens count toward model, requester, daily, and request detail without adding to `run_count`, and a team's session totals already include its members.
Helper work adds tokens without adding runs, including retries and rejected outputs:
| Request `kind` | Work |
| --- | --- |
| `run` | Ordinary agent or team reply |
| `compaction_summary` | Conversation compaction summaries |
| `memory_auto_flush` | Background memory auto-flush extraction |
| `dynamic_workflow` | Embedded Dynamic Workflow participants |
| `skill_learning` | Automatic [skill reviews](https://docs.mindroom.chat/skills/) |
| `routing`, `room_topic`, `schedule_parse`, `thread_summary`, `voice_normalization`, `voice_transcription` | Internal AI work, reported under the entity `system:internal` |
Helpers are attributed to the conversation and requester that triggered them, and stay unattributed when no requester is known.
`system:internal` usage has no human requester, appears only in organization reports, and transcription is counted only when the provider reports tokens.
Embedding calls and calls to separately configured judgment backends, such as participation or mid-turn judges, are not counted.
**Requesters.** Usage is grouped by canonical Matrix user ID, with known aliases combined; `user_id: null` holds unattributed usage.
Shared and private instances of the same agent are combined in entity rows; `private_agent_breakdown` shows the private part separately.
**Retention.** Recorded usage survives compaction, message edits, and regeneration, and a regenerated reply counts as a separate run.
Erasing a whole session removes its usage; deleted sessions are unavailable.
Reports cover only agents in the current configuration, so removing an agent drops its usage from reports even though its sessions stay stored; removed and ad hoc teams stay included.
Usage from session history that predates usage tracking is imported once at startup; history already lost cannot be reconstructed, and old usage is never given invented dates or requesters.
**Coverage.** Each breakdown has a matching coverage object (`coverage`, `model_coverage`, `user_coverage`, `cumulative_model_coverage`, `daily_coverage`, `request_coverage`, `voice_coverage`, `private_agent_coverage`) with `scanned_sources`, `unavailable_sources`, and an explanatory `note`.
`unavailable_sources` counts sources with missing, unreadable, or incomplete data; it is not a missing-token percentage.
Because of these gaps, model, user, and daily rows do not necessarily sum to the top-level totals.
Totals support cost estimates, but provider-specific charging rules and calls outside retained storage are not captured.
## Usage Report API
`GET /api/usage` returns the organization-wide report under standard dashboard authentication, like other administrator APIs.
A collector service can fetch the same report from `GET /api/usage/export` with its own credential; see [Usage Export Service](#usage-export-service).
Both routes accept two optional query parameters, each defaulting to `false`:
| Parameter | Adds |
| --- | --- |
| `include_daily=true` | `daily_breakdown` and `daily_coverage`, plus a `daily_breakdown` inside every requester and private-agent row |
| `include_requests=true` | `request_breakdown` and `request_coverage` |
### Polling for a Report
The first request for a report returns `202` with `{"status":"pending"}` and `Retry-After: 5`.
Poll the same URL with the same parameters after that delay; once ready, the route returns `200` with the report.
Completed reports are cached for 60 seconds, and configuration changes discard cached reports.
A `503` means the report could not be prepared, for example because the committed configuration is unavailable; retry after a few seconds.
All responses use `Cache-Control: no-store` and contain no conversation content.
### Report Fields
Every completed report includes `schema_version: 1` and `generated_at`, the UTC ISO 8601 time the scan finished; cached responses keep that time.
| Field | Contents |
| --- | --- |
| `totals`, `session_count` | All retained usage |
| `breakdown` | One row per agent or team |
| `model_breakdown` | Retained runs by provider and model, with `run_count` |
| `cumulative_model_breakdown` | Session totals by provider and model, with `session_count` |
| `user_breakdown` | Per requester: `user_id`, `totals`, `run_count`, and its own `model_breakdown` |
| `private_agent_breakdown` | Private-agent usage per owner and agent; see [Private-Agent Rows](#private-agent-rows) |
| `voice_breakdown` | GPT-Live call duration; see [Voice Call Duration](#voice-call-duration) |
Each `breakdown` row has session `totals`, `session_count`, and `cumulative_model_breakdown`, plus `retained_run_totals`, `run_count`, and a `user_breakdown` showing which requesters used that agent or team.
Requester totals sum to `retained_run_totals`, which can differ from the cumulative session `totals`.
`cumulative_model_breakdown` comes from per-model totals stored with each session, so it includes compacted history still in retained sessions but has no dates or requesters.
A session using several models counts once in each model's `session_count`.
### Daily Rows
Each daily row has a UTC `date` (`YYYY-MM-DD`), `totals`, `run_count`, and a `model_breakdown`, sorted oldest first.
Dates come from individual request timestamps, falling back to the run's creation date when request detail is missing, which can shift usage across days.
Each run counts once on its first request date, so a later day can show tokens with `run_count: 0`.
Usage with no usable date is left out of daily rows but stays in all-time totals, so a user with only undated runs has an empty `daily_breakdown`.
### Request Rows
`include_requests=true` is available only on the two organization routes.
Each request row has `entity`, `user_id`, `provider`, `model`, `kind`, epoch-seconds `created_at`, and all nine counters in `totals`, sorted by time.
Rows keep individual provider calls apart so a consumer can apply per-request pricing, such as context-length tiers.
Rows contain no prices, prompts, responses, session IDs, or run IDs.
Only requests whose counters match their run's recorded totals are exported; missing detail marks `request_coverage` incomplete while aggregate totals stay available.
### Voice Call Duration
Each `voice_breakdown` row is one GPT-Live provider session, with `entity`, `user_id`, `provider`, `model`, epoch-seconds `created_at`, `duration_seconds`, and `finalized`.
Reconnecting starts a new row, even within the same call, and duration is not split across UTC days.
`finalized: false` means the duration is the last running total the provider reported, for example after a dropped connection.
Sum `duration_seconds` to group voice use by caller, agent, or model, and price it separately from the tokens of agents the call delegated to.
Voice duration does not add to token totals, request rows, or run counts, and rows contain no audio, transcripts, or session IDs.
### Private-Agent Rows
Each `private_agent_breakdown` row has `agent_name`, `user_id`, session `totals`, `session_count`, `cumulative_model_breakdown`, `retained_run_totals`, `run_count`, and `model_breakdown`.
Session totals are attributed to the private instance's owner, while retained runs keep the user who made the request.
Session totals can include older compacted history that has no model or daily detail.
To attribute usage by ownership instead of by requester, compute this per user and counter over the union of users in both breakdowns, summing a user's private-agent rows first and treating missing rows as zero:
```text
user_breakdown.totals - private_agent_breakdown.retained_run_totals + private_agent_breakdown.totals
```
For example, 60 retained tokens including 20 private-agent tokens, plus a private-agent session total of 50, gives `60 - 20 + 50 = 90`.
This view assigns private-instance usage to its owner: if Bob requested 20 tokens from Alice's private instance with 100 session tokens, Alice gets 100 and Bob gets none.
Keep `user_breakdown` unchanged when reporting who made requests.
### Consuming Reports
Tolerate additional response fields, and keep session totals and retained-run breakdowns distinct.
Treat each report as a snapshot; do not add successive all-time totals together.
Counter values can change between reports as coverage improves.
### Personal Private-Agent Usage
`GET /api/usage/me/private-agents` returns the signed-in user's usage across their own private agents, with the same rows as `get_my_private_usage()` but without `user_id` or `user_breakdown`.
The only accepted query parameter is `include_daily` (default `false`); any other parameter returns `400` `Usage target overrides are not accepted`.
The endpoint requires [strict JWT mode](https://docs.mindroom.chat/deployment/trusted-upstream-auth/#strict-jwt-mode) with a verified Matrix identity, like the [Connections portal](https://docs.mindroom.chat/deployment/trusted-upstream-auth/#connections-portal).
Without it, requests fail with `403` `Personal APIs require trusted signed authentication` or `Personal APIs require a verified Matrix identity`; an API key alone cannot select a user.
Any signed-in user can call it, and it grants no administrator or export access.
## Usage Export Service
Strict JWT deployments can let a collector service call `GET /api/usage/export` without giving it a browser or administrator identity.
The route returns the same report, parameters, and polling behavior as [`GET /api/usage`](#usage-report-api).
Configure [trusted-upstream strict JWT mode](https://docs.mindroom.chat/deployment/trusted-upstream-auth/#strict-jwt-mode), including `MINDROOM_TRUSTED_UPSTREAM_USER_ID_HEADER`, then add a dedicated service audience and client ID:
```bash
MINDROOM_USAGE_SERVICE_JWT_AUDIENCE=mindroom-usage-export
MINDROOM_USAGE_SERVICE_CLIENT_ID=usage-export-client.example.org
```
The service sends its assertion in the trusted-upstream JWT header on every request, including polls.
The assertion must be signed with `RS256` by the trusted-upstream issuer and JWKS, and contain valid `exp`, `iat`, `iss`, and `aud` claims, where `aud` is `MINDROOM_USAGE_SERVICE_JWT_AUDIENCE` rather than the browser audience.
It must also contain `type=app`, `common_name` exactly equal to `MINDROOM_USAGE_SERVICE_CLIENT_ID`, and an empty `sub`.
| Status | Meaning |
| --- | --- |
| `503` `Usage export service authentication is not configured` | Trusted-upstream auth, a strict-JWT setting, or a service setting is missing |
| `401` `Invalid usage service JWT` | Missing or invalid assertion |
A service assertion authorizes only `/api/usage/export`, not `/api/usage`, personal usage, configuration, or other administrator routes.
## `usage_stats`
The `usage_stats` tool lets an agent answer usage questions in chat; it is read-only.
| Function | Reports | Availability |
| --- | --- | --- |
| `get_my_usage()` | The caller's usage of the current agent; for a private agent, the caller's own instance | Always |
| `get_my_private_usage()` | Usage across all the caller's currently configured private agents | Always |
| `get_all_usage()` | Organization-wide usage of currently configured agents, all stored teams, and `system:internal` | Requires `admin_scope: true` and a caller listed in `administrators` |
Give an agent the self-service functions by adding the tool:
```yaml
agents:
usage_assistant:
display_name: Usage Assistant
role: Report the caller's retained MindRoom usage
tools:
- usage_stats
```
Enable `get_all_usage()` with the per-agent `admin_scope` option (boolean, default `false`), which cannot be set in `defaults.tools`:
```yaml
administrators:
- "@usage-admin:example.com"
agents:
usage_admin:
display_name: Usage Administrator
role: Report retained MindRoom usage across configured entities
tools:
- usage_stats:
admin_scope: true
```
All three functions accept `include_daily` (default `false`), which adds [daily rows](#daily-rows) and `daily_coverage`.
### Tool Responses
Responses are JSON with `status` and `tool` fields, plus `scope`, `totals`, `session_count`, `breakdown`, `coverage`, `model_breakdown`, and `model_coverage`.
`get_all_usage()` returns the organization report fields described in [Report Fields](#report-fields), except request rows.
Self reports leave `breakdown` empty.
`get_my_private_usage()` adds `cumulative_model_breakdown` and `private_agent_breakdown` without user IDs.
`get_my_usage()` omits cumulative model and private-agent fields and excludes the in-progress tool call.
On a shared agent it counts only the caller's retained runs, so it can miss usage after compaction.
On a private agent it reports the whole session totals, which include compacted usage and can exceed the retained model or daily detail.
Errors use the same envelope with a `code` and `message`:
| Code | Cause |
| --- | --- |
| `authorization_error` | `get_all_usage()` called without `admin_scope`, from another agent, or by a non-administrator |
| `context_unavailable` | No active requester or agent context, such as outside a conversation |
# Matrix Integration
This page covers how MindRoom appears on Matrix: the accounts it creates, mentions, end-to-end encryption, managed avatars, TLS trust, and sync tuning.
Room creation and room policy are covered in [Rooms](https://docs.mindroom.chat/rooms/), and Matrix environment variables in [Configuration](https://docs.mindroom.chat/configuration/#matrix).
## Why Matrix?
Every agent is an ordinary Matrix user, so you can reach it from any Matrix client, on any federated homeserver, in end-to-end encrypted rooms, and from Discord, Slack, Telegram, and other networks through [bridges](https://docs.mindroom.chat/deployment/bridges/).
## Agent Users
Each agent, team, and the router has its own Matrix user, created automatically at startup.
Account credentials are stored in `matrix_state.yaml` in the storage directory (default `mindroom_data/`).
In chat, address an agent or team by its configured key, such as `@assistant`.
MindRoom requests localparts such as `mindroom_assistant`, but the account recorded in `matrix_state.yaml` is authoritative, so an agent's actual Matrix ID (for example `@assistant_live:example.com`) can differ from the requested one.
`MATRIX_MANAGED_ACCOUNT_AUTH` selects how these accounts authenticate:
- `password` (default) generates a separate password for every account and uses normal Matrix registration and login.
- `appservice` registers passwordless accounts inside an exclusive application-service namespace and gives each account its own device token for encryption and sync.
First register an application service with the homeserver whose exclusive user namespace covers every account MindRoom manages, then supply that registration's `as_token`.
Provide exactly one of `MATRIX_APPSERVICE_TOKEN` or `MATRIX_APPSERVICE_TOKEN_FILE`; setting either one without `MATRIX_MANAGED_ACCOUNT_AUTH=appservice` stops startup.
The application-service token is used only to register accounts and log in new devices.
After switching an existing install to `appservice`, stored passwords are removed from `matrix_state.yaml` once each account logs in.
## Internal User
The optional `mindroom_user` section configures MindRoom's internal Matrix user account; omit it for hosted or public profiles.
```yaml
mindroom_user:
username: mindroom_user
display_name: MindRoomUser
```
| Field | Type | Default | Meaning |
| --- | --- | --- | --- |
| `username` | string | `mindroom_user` | Matrix localpart, without `@` or a domain, using lowercase letters, digits, `.`, `_`, `=`, `-`, or `/`; it must not match an agent, team, or router account |
| `display_name` | string | `MindRoomUser` | Display name, changeable at any time |
Set `username` before first startup.
Changing it after the account exists stops startup with `mindroom_user.username cannot be changed after the internal Matrix account has been created.`
Hosted provisioning can return a different actual Matrix ID, which MindRoom then uses.
## Mentions
In agent replies and other messages MindRoom sends, two forms become real Matrix mentions that render as clickable links and notify the agent or team:
- `@calculator`, the configured agent or team key.
- `@actual_calculator:localhost`, the agent's current full Matrix ID.
`@mindroom_calculator`, the `mindroom_` prefix plus the key, also mentions the agent's or team's current account.
Any other bare account localpart, such as `@actual_calculator`, is not a mention.
Any other valid full Matrix ID, such as a human user or an agent's old account like `@mindroom_calculator:localhost`, becomes a mention of that exact account and does not reach the agent's current account.
## End-to-End Encryption
Agents fully participate in encrypted rooms: they read encrypted text, media, and thread history, and they reply encrypted.
To encrypt managed rooms, set `encrypted: true` in their [room policy](https://docs.mindroom.chat/rooms/#room-policy).
Enabling encryption on a Matrix room is irreversible.
Each agent cross-signs its own device, so clients that only share room keys with cross-signed devices (MSC4153) keep sharing them with agents.
### `!encrypt`
Enable end-to-end encryption for the current room.
```
!encrypt
!encrypt confirm
```
`!encrypt` explains what enabling encryption means for the room without changing anything.
`!encrypt confirm` enables encryption and is restricted to Matrix room admins.
The responding bot also needs permission to change room state; if it lacks that permission, a room admin can enable encryption from their own Matrix client.
People joining an encrypted room later cannot read messages sent before they joined.
### `!e2ee`
Show encryption diagnostics for the current room.
```
!e2ee
```
The report includes the room's encryption state, the responding bot account and device, the encryption store status, cross-signing status, and decryption-failure counters since startup.
Use it when an agent seems to ignore messages in an encrypted room.
### Troubleshooting Undecryptable Messages
When an agent cannot decrypt a message from an authorized sender, it logs a `matrix_event_decryption_failed` warning and posts one notice for that message's encryption session asking the user to resend.
Only one agent posts the notice, even in multi-agent rooms.
Resending normally fixes it, because the sender's client then shares a new key with the agent.
Decryption-failure counters also appear on `/api/health` under `e2ee`.
If a bot's encryption store under `mindroom_data/encryption_keys/` is lost, that agent does not start, and `mindroom doctor` reports the missing store.
Restore the matching storage backup before restarting, as described in [Device recovery](https://docs.mindroom.chat/deployment/upgrades/#device-recovery-after-the-upgrade).
### Delivery Policy
Encrypted messages from agents are always shared with the room members' unverified devices.
MindRoom has no device-verification flow, so requiring verified devices would make every reply in an encrypted room fail.
## Managed Avatars
Every agent, team, and managed room gets a Matrix avatar by default, chosen from the painted stock avatars in the [MindRoom assets repository](https://github.com/mindroom-ai/assets/blob/main/avatars/painted/README.md).
- An agent named after a stock avatar (for example `mind`, `code`, `research`, `writer`, or `email`) uses that picture, and any other agent or team receives a stable stock avatar chosen from its name.
- A room served by exactly one agent or team shows that entity's avatar, and any other room receives a stable stock avatar chosen from its key.
- The root Matrix Space uses `avatars/spaces/root_space.png` when present and otherwise the stock `mind-logo` image.
- Avatars are set only where the Matrix profile or room has none, so pictures you set yourself are kept.
- Room avatars are chosen only when a room is created, so run `mindroom avatars sync` to fill in existing rooms.
- A failed stock avatar download is retried at the first start after 24 hours, or immediately for rooms and the root Space by `mindroom avatars sync`.
To choose a picture, place a PNG at `avatars/<agents|teams|rooms|spaces>/<name>.png` next to `config.yaml`; containerized deployments read these overrides from `<storage>/avatars/` instead.
Run `mindroom avatars sync --force` to reset every managed room and the root Space to its default avatar: its own file, its single agent's or team's avatar, or its stock pick.
`mindroom avatars generate` creates a custom avatar file for every entity without a workspace or bundled avatar file, using `gpt-6-astra` to write prompts and `gpt-image-2.5-sunburst` to render them; it requires only `OPENAI_API_KEY` or `OPENAI_API_KEY_FILE`.
Run `mindroom avatars generate --force` to overwrite existing workspace avatar files after changing prompts or styles.
Override the generation styles with the root `prompts` block:
```yaml
prompts:
AVATAR_CHARACTER_STYLE: "professional AI avatar portrait, abstract geometric silhouette"
AVATAR_ROOM_STYLE: "minimalist wayfinding icon, precise geometry, strong silhouette"
AVATAR_AGENT_SYSTEM_PROMPT: "You are creating distinctive visual elements for a professional AI agent avatar."
AVATAR_TEAM_SYSTEM_PROMPT: "You are creating distinctive visual elements for a professional AI team avatar."
AVATAR_ROOM_SYSTEM_PROMPT: "You are creating a refined, minimalist icon design for a room avatar."
```
## TLS Trust
MindRoom trusts OpenSSL's default CA file and directory plus certifi's public roots for the homeserver.
For a homeserver behind a private CA, set `SSL_CERT_FILE` or `SSL_CERT_DIR`; each replaces the matching OpenSSL default location, and setting either one stops MindRoom from adding certifi's roots.
A homeserver certificate that fails verification stops startup with an error naming the homeserver and the verification failure.
Requests to the hosted provisioning service always verify its certificate, whatever `MATRIX_SSL_VERIFY` says.
For a provisioning service behind a private CA, set `SSL_CERT_FILE` or `SSL_CERT_DIR` in the process environment.
## Matrix Sync
```yaml
matrix_sync:
mode: classic
sliding_timeline_limit: 100
max_response_bytes: 16777216
max_pending_bytes: 67108864
```
| Field | Type | Default | Meaning |
| --- | --- | --- | --- |
| `mode` | `classic` or `sliding` | `classic` | `classic` uses `/v3/sync`; `sliding` uses MSC4186 Simplified Sliding Sync and requires a homeserver that advertises it |
| `sliding_timeline_limit` | integer ≥ 1 | `100` | Per-room timeline window for Sliding Sync |
| `max_response_bytes` | integer ≥ 1 | `16777216` (16 MiB) | Maximum HTTP sync response size per bot |
| `max_pending_bytes` | integer ≥ 1 | `67108864` (64 MiB) | Maximum size of received events waiting to be processed per bot |
Choose `mode` before first startup, because each bot's stored sync state stays bound to the mode it first used.
Changing `matrix_sync` through config reload restarts running agents.
If a large initial sync exceeds the response limit, raise `max_response_bytes` enough to fit it.
If processing received events exceeds the pending limit, raise `max_pending_bytes`; stored events can take more space than the HTTP response, so raising the response limit may also require raising the pending limit.
Each bot has its own sync session, so allow enough memory and disk space when raising these limits.
Large initial syncs may also need more startup time: `MINDROOM_MATRIX_SYNC_STARTUP_TIMEOUT_SECONDS` sets the first-sync allowance, and the runtime Helm chart's `probes.startup` values set the Kubernetes startup probe allowance.
# Rooms & Spaces
This page covers the Matrix rooms MindRoom creates and manages, their join, listing, encryption, invitation, and admin settings, and the root Matrix Space that groups them.
Who may talk to an agent in a room is a separate setting covered in [Access Control](https://docs.mindroom.chat/authorization/).
## Configuration
List room keys under an agent's or team's `rooms`, and optionally set per-room policy under `rooms.<key>`:
```yaml
room_defaults:
join_policy: invite
listed: false
invite_users:
- "@owner:example.com"
admins:
- "@owner:example.com"
rooms:
research:
display_name: Research Lab
description: Literature reviews and experiment notes
encrypted: true
invite_users:
- "@owner:example.com"
- "@scientist:example.com"
agents:
assistant:
rooms: [lobby, dev]
teams:
research_team:
rooms: [research]
```
Every room key listed by an agent or team, or under top-level `rooms`, is a managed room, created on startup or config reload if it does not exist yet.
Entries starting with `!` are existing Matrix room IDs, which are joined as they are and are not created or managed.
## Room policy
`room_defaults` sets the policy for every managed room, and `rooms.<key>` overrides it for one room.
| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `join_policy` | `invite`, `knock`, or `public` | `invite` | How people may join the room |
| `listed` | bool | `false` | Publish the room in the server's room directory |
| `encrypted` | bool | `false` | Enable end-to-end encryption; once enabled it cannot be turned off |
| `invite_users` | list of Matrix user IDs | `[]` | Users invited to the room |
| `admins` | list of Matrix user IDs | `[]` | Users granted Matrix admin power (level 100) in the room |
| `rooms.<key>.display_name` | string | the key with underscores as spaces, title-cased | Matrix room name |
| `rooms.<key>.description` | string | `""` | Room purpose shown in the dashboard |
`invite_users` and `admins` accept only concrete Matrix user IDs, no wildcards, plus the pairing owner placeholder.
A field set under `rooms.<key>` replaces the default, and a list replaces the whole default list instead of merging with it, so an empty list removes the inherited invitations or admins for that room.
MindRoom logs `Administrators, room invitees, or room admins are on another homeserver; remove them unless you trust them` when any of these users is on a different homeserver.
MindRoom applies this policy to new and existing managed rooms on startup and on every config reload:
- `invite_users` is the desired invitation list, so a listed user who leaves or is kicked is invited again; remove the user from configuration before intentionally removing access.
- `admins` grants missing admin power but never demotes anyone, so removing a user from `admins` only stops future grants; lowering an existing admin requires a Matrix account with higher power.
- `listed: true` requires the router to have moderator or admin power in the room.
- `encrypted: true` turns on encryption in existing rooms, and setting it back to `false` never disables it.
## Room Management
The router creates and maintains managed rooms:
- Creates missing rooms with the alias `#<key>:<server>` (plus the `MINDROOM_NAMESPACE` suffix when set), an AI-generated topic, and a [managed avatar](https://docs.mindroom.chat/matrix/#managed-avatars).
- Invites the configured agents and teams and the room's `invite_users`.
- Sets the room name from `display_name`, and adds a topic only when the room has none.
- Lets every room member write thread tags and call membership state, which requires the router to be joined and able to edit power levels.
- Applies the [room policy](#room-policy) above.
Agents and teams leave rooms they are no longer configured for, except direct-message rooms and rooms they joined by accepting an invitation.
On a shared homeserver, any account can create or repoint an alias such as `#lobby:<server>`, so MindRoom only uses an aliased room it recorded itself or one the router created and aliased.
Otherwise it logs `managed_alias_target_refused`, never joins that room, and creates its own room without the alias.
A recorded room stays in use even when its alias now points elsewhere, which logs `managed_alias_points_elsewhere`.
If the alias of a recorded room is deleted, the router restores it, and creates a replacement room only when it can no longer read or is no longer joined to the recorded room.
## Room Cleanup
On startup, MindRoom removes Matrix accounts of agents and teams that were deleted from `config.yaml` from the rooms they had joined.
Direct-message rooms are left untouched, and no manual cleanup is needed.
## Matrix Space
MindRoom creates and maintains a root Matrix Space that contains every managed room, so users can find all MindRoom rooms in one place in their Matrix client.
```yaml
matrix_space:
enabled: true
name: MindRoom
```
| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `enabled` | bool | `true` | Create and maintain the root Space |
| `name` | string | `"MindRoom"` | Space display name; cannot be empty |
Rooms added later are linked into the Space automatically, and the name follows the configured value on every startup.
Every user in any managed room's `invite_users` is invited to the Space, without Space admin power.
Room `admins`, `administrators`, and other access settings do not cause Space invitations.
MindRoom never removes existing Space admins, and adding, removing, or reordering Space children in a Matrix client requires sufficient power in the Space; manage those permissions in a Matrix client.
Setting `enabled: false` stops maintaining the Space but does not delete it or remove its child links.
The Space avatar is described in [Managed Avatars](https://docs.mindroom.chat/matrix/#managed-avatars).
# Personal Rooms
The optional `personal_rooms` section gives each eligible human a private, unlisted room with one selected agent, created when they join an onboarding room such as a lobby or send a configured command there.
## Setup
```yaml
rooms:
lobby: {}
agents:
helper:
display_name: Helper
rooms: []
access:
members_of_rooms: [lobby]
personal_rooms:
agent: helper
onboarding_rooms: [lobby]
commands: ["!personal"]
welcome_dispatch: true
```
The router watches the onboarding rooms, so the selected agent does not need to join them.
The human must still be allowed to use the agent under its access rules; listing the onboarding rooms in `access.members_of_rooms`, as above, grants that (see [Responder access](https://docs.mindroom.chat/authorization/#responder-access)).
## Configuration
`personal_rooms` is an object, or `null` (the default) to disable onboarding.
| Field | Type | Default | Meaning |
| --- | --- | --- | --- |
| `agent` | string | Required | Configured agent that owns and answers in personal rooms. |
| `onboarding_rooms` | list of strings | Required | Nonempty list of configured rooms whose human joins trigger onboarding. |
| `commands` | list of strings | `[]` | Exact self-onboarding commands accepted in onboarding rooms; each starts with `!` and contains no whitespace or arguments. |
| `alias_prefix` | string | `"personal"` | Room alias prefix matching `[a-z0-9_-]{1,40}`, followed by a hash of the user ID and the installation namespace. |
| `name` | string | `"Personal room for {user}"` | New room name template, up to 1,000 characters. |
| `topic` | string | `"Private conversation with {agent}."` | New room topic template, up to 1,000 characters. |
| `welcome` | string | `"Welcome {user}! This is your personal room with {agent}."` | Welcome message template, up to 10,000 characters; empty disables the welcome. |
| `welcome_dispatch` | boolean | `false` | Send the welcome to the agent as a trusted message on the human's behalf once the human joins, so the agent starts the conversation; otherwise post it as a notice right away. |
| `confirmation` | string | `""` | Optional one-time notice in the onboarding room where the human was onboarded, visible to everyone there, up to 10,000 characters. |
| `backfill` | boolean | `false` | Also onboard current eligible members of the onboarding rooms on startup and config reload. |
| `auto_join_requester` | boolean | `false` | Join the human into a newly created personal room instead of only inviting them. |
| `requester_admin` | boolean | `false` | Grant the human Matrix room admin; when `false`, no admin is granted and existing power levels, including admin granted earlier, stay unchanged. |
| `avatar` | string or `null` | `null` | Room avatar file, relative to the configuration file; takes priority over `avatar_from_requester`. |
| `avatar_from_requester` | boolean | `false` | Copy the human's profile avatar into the room when `avatar` is not set. |
Templates accept only `{user}` (full Matrix user ID), `{room}` (room alias), and `{agent}` (agent display name); any other placeholder fails config validation.
Avatars are set only on rooms that have none.
The welcome is sent once, and changing `welcome` or `welcome_dispatch` later does not change a welcome that is already pending.
`auto_join_requester: true` requires the router's Matrix account to be allowed to use the homeserver's Synapse-compatible admin join API.
It applies only when MindRoom creates the room, and never joins someone who already joined, left, or was banned.
## Onboarding Behavior
- Joining an onboarding room, or sending one of the `commands` there, onboards only that human.
- MindRoom's own router, agent, and team accounts, accounts listed in `bot_accounts`, and the internal `mindroom_user` account never get personal rooms.
- A human who leaves or is banned from their personal room is not re-added by restarts or backfill.
Leaving and rejoining an onboarding room re-invites them to their existing personal room, except after a ban or for an adopted room.
- In a personal room MindRoom created, the owner may invite other MindRoom agents, and an invited agent sees only messages sent after its invite.
Anyone else invited into such a room is removed with a notice explaining that the room is private.
Adopted rooms instead allow only the participants listed in their record.
- Personal rooms survive restarts and room cleanup, even after `personal_rooms` is removed.
Disabling the feature stops new onboarding but does not remove existing rooms or access.
## Troubleshooting Personal Rooms
An onboarding failure affects only that human, and the onboarding room keeps working for everyone else.
Failed onboarding is retried automatically, first after 30 seconds and then at doubling intervals up to one hour, and a config reload retries it immediately.
A join or command that arrives before the personal-room agent connects is handled once it does.
Revoking the human's access to the agent, or disabling `personal_rooms`, cancels a welcome that has not been sent yet.
| Log message | Meaning |
| --- | --- |
| `Personal-room validation failed for an onboarding trigger` | An existing personal room failed ownership or membership checks, for example because another account already holds the alias, or a guest the agent cannot remove was raised to the agent's power level. |
| `Personal-room imported roster has unattested members` | An adopted room contains members its record does not list; the warning names them, and MindRoom does not change the room. |
| `Personal-room onboarding trigger failed` | Any other failure, such as an invite refused by the human's homeserver. |
| `Personal-room reconciliation failed` | An automatic retry failed; the log shows the attempt number and the delay before the next try. |
## Adopting an Existing Room
Operators can turn an existing room into someone's personal room, keeping its room ID and history.
1. Stop the runtime.
2. Have the selected agent send an `org.mindroom.personal_room` state event in the room with an empty state key and exactly `{"user_id": "<requester>", "agent_user_id": "<agent>"}` as content.
3. Make sure the agent is joined with room admin power, the room is not published in the room directory, and its join rule is invite-only.
4. Write the record with `personal_room_record_path(runtime_paths, agent_name, user_id)` and `write_personal_room(path, record)` from `mindroom.matrix.personal_room_store`.
For a room with shared history and one existing guest, a record looks like this:
```json
{
"user_id": "@alice:example.test",
"alias": "#personal-alice:example.test",
"source_room_id": "!lobby:example.test",
"room_id": "!existing:example.test",
"welcome_completed": true,
"adoption": {
"creator_user_id": "@router:example.test",
"agent_user_id": "@helper:example.test",
"router_user_id": "@router:example.test",
"expected_history_visibility": "shared",
"additional_user_ids": ["@guest:example.test"]
}
}
```
- `room_id` is required; an alias alone never adopts a room.
- `source_room_id` is the onboarding room, and the requester must still be a member of it and allowed to use the agent.
- `creator_user_id` must match the room's creator, and `agent_user_id` must match the selected agent's Matrix ID.
- `router_user_id` (optional) must be this installation's router account and lets it stay in the room, including during room cleanup after onboarding is disabled.
- `expected_history_visibility` is `invited` (default), `joined`, or `shared` and must match the room's current setting; `world_readable` rooms cannot be adopted.
- `additional_user_ids` (default `[]`) lists the only other participants allowed to stay joined, invited, or knocking; it does not invite anyone or grant power.
- Set `welcome_completed: true` to skip the welcome; otherwise MindRoom sends the configured welcome.
If the room's history setting or members stop matching the record, onboarding for that human fails with one of the log messages above until someone fixes the room.
MindRoom does not change an adopted room's name, topic, or history setting, and never removes anyone from it.
It invites the requester if they are not in the room yet and applies the configured `requester_admin`, avatar, and welcome settings.
# Bridges
Bridges connect external messaging platforms to Matrix, so users can talk to MindRoom agents from those platforms.
MindRoom uses [mautrix](https://docs.mau.fi/bridges/) bridges, which run as Matrix [application services](https://spec.matrix.org/latest/application-service-api/) beside the homeserver (Synapse or Tuwunel).
A bridge creates Matrix rooms for external chats, creates ghost Matrix users for external contacts, and relays messages both ways in real time.
In **puppet mode**, you log in with your own account on the external platform, so your messages appear as coming from you on both sides rather than from a bot.
## Available Bridges
| Bridge | Platform | Mode | Status |
|--------|----------|------|--------|
| [Telegram](https://docs.mindroom.chat/deployment/bridges/telegram/) | Telegram | Puppet (login as yourself) | Available |
| Slack | Slack | - | Planned |
| Email | IMAP/SMTP | - | Planned |
## Bridge Manager
Deploy bridges with `./bridge.py` in `local/instances/deploy/`, for an instance created with a Matrix server by `./deploy.py create <name> --matrix tuwunel` or `--matrix synapse`.
Run `./bridge.py --help` there for every command and option.
1. Add the bridge with `./bridge.py add <type> --instance <name>`.
2. Generate its appservice registration with `./bridge.py register <type> --instance <name>`.
3. Register the bridge with the homeserver:
- **Synapse:** `register` adds `/data/bridges/<type>/registration.yaml` to `app_service_config_files` in Synapse's `homeserver.yaml`, but you must place the generated registration file at that path in the Synapse container yourself.
Make that copy readable only by the Synapse container's user (UID 1000), then restart Synapse with `./deploy.py restart <name> --only-matrix`.
- **Tuwunel:** follow the admin-room steps that `register` prints, or run `./bridge.py register-with-matrix <type> --instance <name>`.
4. Start the bridge with `./bridge.py start <type> --instance <name>`.
5. Check it with `./bridge.py status --instance <name>` and `./bridge.py logs <type> --instance <name>`.
Use `./bridge.py stop` to stop bridges, `./bridge.py list` to see bridges across all instances, and `./bridge.py remove` to remove a bridge together with its data.
Each bridge's configuration, registration file, and data live in `bridges/<type>/` under the instance data directory.
# Telegram Bridge
Bridge Telegram and Matrix with `mautrix-telegram` in puppet mode, so MindRoom agents can talk in Telegram groups.
Linked Telegram groups become Matrix rooms, and permitted users can log in with their own Telegram account.
## Prerequisites
Create Telegram API credentials (API ID and API hash) at [my.telegram.org](https://my.telegram.org), and create a bridge bot through [@BotFather](https://t.me/BotFather).
Keep the API hash and bot token secret.
## Deploy
Run the [bridge manager](https://docs.mindroom.chat/deployment/bridges/#bridge-manager) from `local/instances/deploy/`:
```bash
./bridge.py add telegram --instance <instance> --admin @<you>:m-<instance-domain>
./bridge.py register telegram --instance <instance>
./bridge.py start telegram --instance <instance>
./bridge.py status --instance <instance>
./bridge.py logs telegram --instance <instance>
```
Provide the Telegram credentials to `bridge.py add` with `--api-id`, `--api-hash`, and `--bot-token`, through the `TELEGRAM_API_ID`, `TELEGRAM_API_HASH`, and `TELEGRAM_BOT_TOKEN` environment variables, or in `local/instances/deploy/.env.telegram`.
The command prompts for any credential still missing, and for the admin Matrix user ID when `--admin` is omitted.
The manager pins `mautrix-telegram` `v0.15.3`, the legacy Python bridge.
Between `register` and `start`, register the bridge with the homeserver as described in the [bridge manager](https://docs.mindroom.chat/deployment/bridges/#bridge-manager) steps.
On Synapse, place the registration at `/data/bridges/telegram/registration.yaml` in the Synapse container, readable only by the container's user (UID 1000).
## Bridge permissions
The generated bridge configuration grants `admin` only to the `--admin` user and `relaybot` to everyone else, so accounts registered on an open homeserver cannot control the bridge.
To let more users log in with their own Telegram accounts, add their Matrix user IDs with the `puppeting` (or `full`) level under `bridge.permissions` in the generated configuration, then restart the bridge.
Bridges created by older manager versions grant `user` to the whole homeserver domain and `admin` to `@admin:<domain>`.
Fix one by setting `bridge.permissions` to `relaybot` for `*` and `admin` for your own Matrix user ID, then restarting it, or recreate it with `bridge.py remove` and `bridge.py add --admin`, which deletes its data.
## Configure MindRoom
When room access is restrictive, Telegram ghost users must satisfy [responder access](https://docs.mindroom.chat/authorization/#responder-access) like any other sender.
Add a [bridge alias](https://docs.mindroom.chat/authorization/#bridge-aliases) when a ghost should act as an existing Matrix user with the same identity and permissions.
List the bridge bot in [`bot_accounts`](https://docs.mindroom.chat/authorization/#bot-accounts) when it can send messages, and use room-level [thread mode](https://docs.mindroom.chat/configuration/threads/) because Telegram does not preserve Matrix threads:
```yaml
bot_accounts:
- "@telegrambot:matrix.example.com"
authorization:
aliases:
"@owner:matrix.example.com":
- "@telegram_12345:matrix.example.com"
agents:
assistant:
thread_mode: room
```
Replace the owner and Telegram ghost IDs with the ones from your deployment.
Aliases are exact Matrix user IDs, not glob patterns, so list every ghost that should act as that user.
## Log in to Telegram
Start a Matrix DM with the Telegram bridge bot and send `login` for phone authentication or `login-qr` for QR authentication.
Telegram usually sends the login code to an already signed-in Telegram app, and accounts with two-factor authentication are also asked for their password.
Telegram login does not set up Matrix double puppeting; configure that separately with the `double_puppet` settings in the generated bridge configuration.
## Link a room
1. Create a Telegram group and add your Telegram bot to it.
2. Invite the Matrix bridge bot into the MindRoom-managed Matrix room.
3. Create or link the portal with the commands from the bridge bot's `help` output.
Portal commands differ between `mautrix-telegram` versions, so use the running bridge's `help` output rather than commands from other documentation.
## Data and backups
The generated configuration (`data/config.yaml`), registration, and SQLite database live in the bridge data directory under the instance data directory.
The configuration and registration contain the Telegram credentials and appservice tokens.
Deleting the bridge database removes Telegram logins and portal links, and users must log in again, so back up the bridge data directory before any reset.
# Tools
MindRoom includes 100+ built-in tools and presets that agents can use to work with files, services, external APIs, and Matrix-native workflows.
This page covers enabling tools, per-agent tool settings, function filters, presets, update awareness, and dependency installation.
To find a specific tool, see [Browse By Topic](#browse-by-topic).
## Enabling Tools
List tools under an agent's `tools`, or under `defaults.tools` to give them to every agent:
```yaml
defaults:
tools:
- scheduler
agents:
assistant:
display_name: Assistant
role: A helpful assistant with file and web access
model: sonnet
tools:
- file
- shell
- github
- duckduckgo
```
Each agent gets its own `tools` plus `defaults.tools`, without duplicates.
The `defaults.tools` default and the per-agent `include_default_tools` opt-out are described in [Agent Configuration](https://docs.mindroom.chat/configuration/agents/).
Configured MCP servers appear as tools named `mcp_<server_id>`; see [MCP](https://docs.mindroom.chat/mcp/).
When [`config_manager` or `self_config`](https://docs.mindroom.chat/tools/agent-orchestration/#access-redaction-and-saving) replaces an agent's tool list, tools that stay keep their inline settings.
## Per-Agent Tool Configuration
A tool entry can be a plain name or a single-key mapping of the tool name to inline settings.
Inline settings change the tool for that agent only.
Settings under `defaults.tools` apply to every agent that includes default tools.
```yaml
defaults:
tools:
- scheduler
- shell:
enable_run_shell_command: true # every agent
agents:
code:
tools:
- file # no inline settings
- shell: # this agent only
extra_env_passthrough: "DAWARICH_*"
research:
tools:
- shell # uses the defaults.tools settings
- duckduckgo
```
Each tool's page lists the settings it accepts.
### Security Restrictions
Some fields cannot be set inline:
- `password` fields, such as API keys and tokens, must be set through the dashboard or credential store.
- Fields MindRoom manages itself, such as `base_dir`, cannot be overridden.
- Per-agent-only fields, such as the [`usage_stats`](https://docs.mindroom.chat/usage/#usage_stats) tool's `admin_scope`, are rejected in `defaults.tools`.
MindRoom rejects these fields, unknown field names, and values of the wrong type when the config loads, and the unknown-field error lists the allowed fields.
### How Settings Combine
From lowest to highest priority, a tool's settings come from:
1. The tool's built-in defaults.
2. Saved tool settings from the dashboard or credential store.
3. `defaults.tools` inline settings.
4. `agents.<name>.tools` inline settings.
5. Values MindRoom sets for the agent's runtime, such as its workspace directory.
When a tool appears in both `defaults.tools` and an agent's `tools`, the settings merge field by field.
Per-agent values win for the same field, and fields set in only one place are kept.
### Clearing An Inherited Override
Set a field to `__MINDROOM_INHERIT__` to keep a tool but drop one inherited `defaults.tools` setting:
```yaml
defaults:
tools:
- shell:
extra_env_passthrough: "DAWARICH_*"
enable_run_shell_command: true
agents:
research:
tools:
- shell:
extra_env_passthrough: __MINDROOM_INHERIT__
```
`research` still inherits `enable_run_shell_command: true`, while `extra_env_passthrough` falls back to the saved tool setting, or to the tool's default when none is saved.
To drop every default tool and all their settings for an agent instead, set `include_default_tools: false`.
### Filtering Toolkit Functions
Most built-in toolkits accept `include_tools` and `exclude_tools` inline settings to limit which of their functions the agent sees.
`include_tools` is an allowlist, and `exclude_tools` removes functions from what remains.
Use the function names the toolkit exposes.
Tools that do not support filtering reject these fields when the config loads.
```yaml
agents:
research:
tools:
- searxng:
include_tools:
- search_web
- news_search
- image_search
```
A name the toolkit does not provide fails when the tool loads with `Included tool(s) not present in the toolkit: <names>` or `Excluded tool(s) not present in the toolkit: <names>`.
## Browse By Topic
- [Execution & Coding](https://docs.mindroom.chat/tools/execution-and-coding/) - Local files, shell, Python, coding helpers, and worker-routed execution tools.
- [Background Python Scripts](https://docs.mindroom.chat/tools/background-scripts/) - Long-running Python scripts that call the agent's tools and wake it when something changes.
- [Worker Computer](https://docs.mindroom.chat/tools/worker-computer/) - A visible browser in the agent's worker that the user can watch and control.
- [Desktop Bridge](https://docs.mindroom.chat/tools/desktop/) - Operate allowlisted apps, read selected folders, and run approved commands on a local computer.
- [Minimal Agent Mode](https://docs.mindroom.chat/tools/agent-cli/) - One Bash tool instead of full tool schemas, to cut tokens per request.
- [Data & Databases](https://docs.mindroom.chat/tools/data-and-databases/) - SQL, databases, Google Docs and Drive files, spreadsheets, tabular analysis, and financial/business datasets.
- [Web Search](https://docs.mindroom.chat/tools/web-search/) - Search engines and search APIs.
- [Web Scraping & Browser](https://docs.mindroom.chat/tools/web-scraping-and-browser/) - Crawlers, extractors, browser automation, and page-reading tools.
- [Research Sources](https://docs.mindroom.chat/tools/research-sources/) - ArXiv, Google Scholar, Wikipedia, PubMed, and Hacker News.
- [AI & Generation](https://docs.mindroom.chat/tools/ai-and-generation/) - Image, video, speech, and transcription APIs.
- [Media & Content](https://docs.mindroom.chat/tools/media-and-content/) - Media processing, brand/media retrieval, and Spotify.
- [Matrix & Attachments](https://docs.mindroom.chat/tools/matrix-and-attachments/) - Matrix-native messaging and voice messages, thread tags, resolution, summaries, model overrides, low-level Matrix API access, and attachment-aware workflows.
- [Matrix Message Tool](https://docs.mindroom.chat/tools/matrix-message/) - Send, read, edit, and react to messages with `matrix_message`.
- [Agent Chat UI Actions](https://docs.mindroom.chat/tools/chat-ui/) - Bounded requests to reveal an agent computer, open Settings, open Members, or show an [interactive canvas](https://docs.mindroom.chat/canvases/) in MindRoom Chat.
- [Messaging & Social](https://docs.mindroom.chat/tools/messaging-and-social/) - Email, chat, and social/community integrations.
- [Project Management](https://docs.mindroom.chat/tools/project-management/) - Git hosting, issue trackers, docs platforms, per-thread work plans, and task managers.
- [Atlassian Cloud](https://docs.mindroom.chat/tools/atlassian/) - Per-user OAuth Jira and Confluence Cloud access, additional connected sites, and attachment downloads.
- [Calendar & Scheduling](https://docs.mindroom.chat/tools/calendar-and-scheduling/) - Calendar and task APIs and MindRoom scheduling tools.
- [Memory & Storage](https://docs.mindroom.chat/tools/memory-and-storage/) - Mem0 and Zep external memory services; the built-in [`memory`](https://docs.mindroom.chat/memory/#memory) tool is documented with the memory system.
- [Agent Orchestration](https://docs.mindroom.chat/tools/agent-orchestration/) - Delegation, Dynamic Workflows, report publishing, config tools, and Claude Agent sessions.
- [Dynamic Tools](https://docs.mindroom.chat/tools/dynamic-tools/) - Per-tool lazy loading for optional agent capabilities.
- [Automation & Platforms](https://docs.mindroom.chat/tools/automation-and-platforms/) - Infrastructure automation, generic APIs, and platform aggregators.
- [Location, Commerce, & Home](https://docs.mindroom.chat/tools/location-commerce-and-home/) - Maps, weather, commerce, and Home Assistant.
## Tool Presets And Implied Tools
`openclaw_compat` is a preset that expands to a bundle of MindRoom tools; see [OpenClaw Workspace Import](https://docs.mindroom.chat/openclaw/).
Enabling `matrix_message` also enables its [companion tools](https://docs.mindroom.chat/tools/matrix-message/#setup).
## MindRoom Update Awareness
Enable the `update_awareness` tool to tell the agent which MindRoom version is installed and which release is the latest on PyPI.
```yaml
defaults:
tools:
- update_awareness
```
MindRoom checks PyPI at most once every 24 hours and caches the result in `mindroom_data/cache/update_awareness.json`.
When a newer release exists, the agent mentions it briefly at a natural moment, once per conversation, and does not install it unless the user asks.
The agent can also call `get_mindroom_update_status()` to report both versions.
## Automatic Dependency Installation
When an enabled tool's optional Python dependencies are missing, MindRoom installs them the first time the tool loads.
Set `MINDROOM_NO_AUTO_INSTALL_TOOLS=1` to disable this.
When auto-install is disabled or fails, the tool fails to load with `Missing dependencies for tool '<tool>': <packages>`.
Install the tool's extra manually, for example `pip install 'mindroom[<tool>]'` or `uv sync --extra <tool>` in a source checkout.
## Related Docs
- [MCP](https://docs.mindroom.chat/mcp/) - Configure native MCP client servers and expose them as MindRoom tools.
- [Plugins](https://docs.mindroom.chat/plugins/) - Extend MindRoom with custom tools and skills.
- [Sandbox Proxy](https://docs.mindroom.chat/deployment/sandbox-proxy/#worker-routing) - Which tools run in isolated workers and which stay in the primary runtime.
- [OAuth Onboarding In Conversation](https://docs.mindroom.chat/oauth-framework/#mindroom-managed-oauth-onboarding-in-conversation) - How agents send users links to connect OAuth tools.
- [Attachments](https://docs.mindroom.chat/attachments/) - Attachment lifecycle and context scoping.
- [Scheduling](https://docs.mindroom.chat/scheduling/) - Chat command scheduling and task behavior.
# MCP
MindRoom is a Model Context Protocol (MCP) client: it connects to the MCP servers you configure, discovers their tools, and lets agents call them.
MindRoom uses MCP tools only; it does not use MCP resources or prompts.
To go the other way and expose your agents' tools to external MCP clients, use the [MCP Gateway](https://docs.mindroom.chat/deployment/mcp-gateway/).
## Add an MCP Server
Configure servers in the top-level `mcp_servers` block of `config.yaml`.
Each key is a server ID made of letters, numbers, and underscores.
Each enabled server becomes one MindRoom tool named `mcp_<server_id>`; add that name to an agent's `tools:` list to give the agent the server's tools.
```yaml
mcp_servers:
chrome_devtools:
transport: stdio
command: npx
args:
- -y
- chrome-devtools-mcp@latest
tool_prefix: chrome
agents:
browser:
display_name: Browser
role: Debug and inspect web apps in Chrome
model: sonnet
tools:
- mcp_chrome_devtools
```
MCP tools work on every worker scope, including private agents.
## Transports
| `transport` | Use for | Required | Optional | Not allowed |
| --- | --- | --- | --- | --- |
| `stdio` | A local server that MindRoom starts as a subprocess | `command` | `args`, `cwd`, `env` | `url`, `headers`, `auth` |
| `sse` | A remote server with a Server-Sent Events endpoint | `url` | `headers`, `auth` | `command`, `args`, `cwd`, `env` |
| `streamable-http` | A remote server with a streamable HTTP endpoint | `url` | `headers`, `auth` | `command`, `args`, `cwd`, `env` |
```yaml
mcp_servers:
remote_http:
transport: streamable-http
url: https://mcp.example.com/mcp
headers:
Authorization: Bearer ${MCP_API_TOKEN}
```
Remote transports refuse loopback and private-network addresses; run local servers with `stdio` instead.
### Credentials in Server Config
`env` and `headers` values support `${ENV_VAR}` placeholders, resolved from MindRoom's environment when the connection opens.
Pass `stdio` credentials through `env`, never through `args`.
`config_manager` and `!config show` mask `env` and `headers` values, except values that are a whole `${ENV_VAR}` placeholder, but show `args` as written, and `args` support no placeholders.
Without OAuth, every agent and requester shares one server session and the same static `headers`, and MindRoom never passes the requester's identity or credentials to the server.
For per-user or per-agent accounts on a remote server, use [OAuth](#oauth-backed-remote-mcp).
## Tool Names
There are two names to keep apart:
1. The tool entry in an agent's `tools:` list is `mcp_<server_id>`.
2. The function names the model sees are `<prefix>_<remote_tool_name>`, where the prefix is `tool_prefix` or, if unset, the server ID.
With `tool_prefix: chrome`, a remote tool named `navigate_page` becomes `chrome_navigate_page`.
A final function name must be 64 characters or fewer.
MindRoom rejects duplicate function names within one server and across the tools and servers visible to the same agent; agents that do not share the colliding surfaces may use identical names.
## Choose Which Tools an Agent Sees
`include_tools` and `exclude_tools` on the server filter the catalog for every agent.
To narrow it for one agent, set overrides where you assign the tool:
```yaml
agents:
browser:
tools:
- mcp_chrome_devtools:
include_tools:
- new_page
- navigate_page
- take_snapshot
call_timeout_seconds: 180
```
Per-agent overrides accept `include_tools`, `exclude_tools`, and `call_timeout_seconds` (greater than 0).
Filters match remote MCP tool names, not prefixed function names, and a name cannot appear in both `include_tools` and `exclude_tools`.
## Dashboard Name and Icon
`display_name`, `summary`, and `icon` control how the server appears in the dashboard tool catalog and on Connections; they do not change tool names or permissions.
```yaml
mcp_servers:
team_wiki:
display_name: Team Wiki
summary: Search and edit team documentation
icon: SiConfluence
transport: streamable-http
url: https://wiki.example.com/mcp
```
`icon` takes a Lucide icon name such as `Book` or `Calendar`, or a bundled React Icons name such as `SiConfluence` or `SiGooglecalendar`.
Without a usable icon, Connections picks one matching the server's name, or a plug icon.
## Server Options
| Option | Type | Default | Notes |
|--------|------|---------|-------|
| `enabled` | bool | `true` | Set to `false` to disable the server without removing its config |
| `transport` | string | *required* | `stdio`, `sse`, or `streamable-http` |
| `command` | string | `null` | Required for `stdio` |
| `args` | list[string] | `[]` | `stdio` arguments; shown unmasked, so never put credentials here |
| `cwd` | string | `null` | `stdio` working directory |
| `env` | map[string,string] | `{}` | `stdio` environment variables; supports `${ENV_VAR}` |
| `url` | string | `null` | Required for `sse` and `streamable-http` |
| `headers` | map[string,string] | `{}` | Remote request headers; supports `${ENV_VAR}` |
| `auth` | object | `null` | OAuth settings for remote servers; see [OAuth Settings](#oauth-settings) |
| `tool_prefix` | string | server ID | Prefix for model-visible function names; letters, numbers, and underscores |
| `include_tools` | list[string] | `[]` | Allowlist of remote tool names |
| `exclude_tools` | list[string] | `[]` | Denylist of remote tool names; must not overlap `include_tools` |
| `display_name` | string | `null` | Catalog name; falls back to `auth.display_name`, then a name derived from the server ID |
| `summary` | string | `null` | Short capability summary for the dashboard and catalog |
| `icon` | string | `null` | Dashboard and Connections icon name |
| `description` | string | `null` | What the server offers, added to the OAuth bridge tool descriptions the model sees; requires `auth` |
| `required` | bool | `false` | Keep dependent agents and teams from starting while the server is unavailable |
| `startup_timeout_seconds` | float | `20.0` | Time allowed to connect, initialize, and list tools; must be greater than 0 |
| `call_timeout_seconds` | float | `120.0` | Default timeout per tool call; must be greater than 0 |
| `max_concurrent_calls` | int | `1` | Maximum concurrent tool calls to the server; at least 1 |
| `auto_reconnect` | bool | `true` | Reconnect for later calls after a dropped connection or timeout; the failed call is never replayed |
## OAuth-Backed Remote MCP
Use `auth.type: oauth` when a remote MCP server needs an OAuth bearer token, so each connection belongs to the right user or agent.
OAuth requires `sse` or `streamable-http`.
```yaml
mcp_servers:
example:
transport: streamable-http
url: https://mcp.example.com/mcp
tool_prefix: example
description: Example workspace search, documents, and calendar for the signed-in user.
auth:
type: oauth
display_name: Example MCP
discovery: auto
agents:
assistant:
display_name: Assistant
role: Use the user's Example workspace
model: sonnet
worker_scope: user_agent
tools:
- mcp_example
```
The connection follows the agent's effective scope (`private.per`, then `worker_scope`, then `defaults.worker_scope`), as described in [Where Connections Are Stored](https://docs.mindroom.chat/oauth-framework/#where-connections-are-stored).
Changing an agent's scope changes whose connection it uses, and MindRoom never copies a credential into the new scope, so reconnect there.
### Connecting and Bridge Tools
Every OAuth-backed server always exposes three functions:
- `<prefix>_connection_status`
- `<prefix>_list_tools`
- `<prefix>_call_tool`
Before the account is connected, these are the only functions the model sees, so set `description` to tell the model what connecting unlocks.
When no account is connected, they return a connect link (see [OAuth onboarding in conversation](https://docs.mindroom.chat/oauth-framework/#mindroom-managed-oauth-onboarding-in-conversation)).
After connecting, `<prefix>_list_tools` returns the server's tools and `<prefix>_call_tool` calls them with that connection's token.
Once MindRoom has loaded the catalog for that connection, the agent also gets typed `<prefix>_<remote_tool_name>` functions.
A temporary token refresh failure returns `MCP server '<server_id>' OAuth token refresh failed; retry shortly` and keeps the stored credentials.
To reset a stuck or revoked connection, see [Reset A Connection](https://docs.mindroom.chat/oauth-framework/#reset-a-connection).
### Endpoint Discovery
With `discovery: auto`, MindRoom reads the OAuth protected-resource metadata (`/.well-known/oauth-protected-resource`) for `resource`, or `url` when `resource` is unset, then fetches the advertised authorization server's metadata.
If no authorization server is advertised, it looks for authorization-server metadata at the resource's origin.
Setting `authorization_server` skips the protected-resource lookup, and explicit `authorization_url`, `token_url`, or `registration_url` values override the discovered endpoints.
Discovery fails if the authorization server does not support the configured `token_endpoint_auth_method` or PKCE method.
Use `discovery: manual` when the server publishes no metadata or you want fixed endpoints:
```yaml
mcp_servers:
example_manual:
transport: streamable-http
url: https://mcp.example.com/mcp
auth:
type: oauth
discovery: manual
authorization_url: https://mcp.example.com/oauth/authorize
token_url: https://mcp.example.com/oauth/token
registration_url: https://mcp.example.com/oauth/register
```
Discovery requires HTTPS, refuses loopback and private-network hosts, and does not follow redirects.
For local development, set `MINDROOM_MCP_OAUTH_ALLOW_INSECURE_DISCOVERY=1` to allow non-HTTPS discovery URLs and `MINDROOM_MCP_OAUTH_ALLOW_PRIVATE_DISCOVERY=1` to allow loopback or private-network discovery hosts.
These variables do not relax the address rules for the MCP connection itself.
### OAuth Client Registration
With `dynamic_client_registration: true` and no stored client, MindRoom registers a client when the first user connects and reuses it for later users.
See [Built-In Providers](https://docs.mindroom.chat/oauth-framework/#built-in-providers) for when a dynamically registered client works from a hosted address.
If discovery later resolves a different token endpoint, MindRoom registers a new client there and logs `oauth_dynamic_client_reregistered`, and users connected through the old client must reconnect.
With dynamic registration disabled, or when the new server offers no registration endpoint, connecting fails instead.
To use your own OAuth app, store its client config in the credential service `<provider_id>_oauth_client`, or list other services in `client_config_services`.
Tokens are stored in `<provider_id>_oauth`; when `provider_id` does not start with `mcp_`, both service names get an `mcp_` prefix.
Public clients (`token_endpoint_auth_method: none`) need only `client_id`; confidential clients also need `client_secret`.
MindRoom never re-registers an operator-configured client, so for a confidential client pin `authorization_server` or `token_url` to keep the server's metadata from redirecting its secret to another token endpoint.
See [Provider And Credential Service Rules](https://docs.mindroom.chat/oauth-framework/#provider-and-credential-service-rules) for client config service rules.
### OAuth Settings
| `auth` field | Type | Default | Notes |
| --- | --- | --- | --- |
| `type` | string | *required* | Must be `oauth` |
| `provider_id` | string | `mcp_<server_id>` | OAuth provider ID; letters, numbers, and underscores |
| `display_name` | string | `null` | Provider name; defaults to `MCP <Server Id>` |
| `resource` | string | server `url` | Protected resource used for discovery |
| `discovery` | string | `auto` | `auto` or `manual` |
| `authorization_server` | string | `null` | Authorization server issuer or base URL; skips protected-resource discovery |
| `authorization_url` | string | `null` | Authorization endpoint; required for `manual` |
| `token_url` | string | `null` | Token endpoint; required for `manual` |
| `registration_url` | string | `null` | Dynamic client registration endpoint |
| `dynamic_client_registration` | bool | `true` | Allow registering a client automatically |
| `token_endpoint_auth_method` | string | `none` | `none`, `client_secret_post`, or `client_secret_basic` |
| `pkce_code_challenge_method` | string | `S256` | `S256`, or `null` to disable PKCE |
| `scopes` | list[string] | `[]` | Requested OAuth scopes |
| `extra_auth_params` | map[string,string] | `{}` | Extra authorization request parameters, such as `resource` |
| `extra_token_params` | map[string,string] | `{}` | Extra code-exchange and refresh parameters; treated as secret |
| `client_config_services` | list[string] | `[]` | Credential services holding the OAuth client config, in lookup order; defaults to `<provider_id>_oauth_client` |
| `shared_client_config_services` | list[string] | `[]` | Shared client config services checked after `client_config_services` |
## Examples
### Echo Server
A minimal local server, saved as `echo_mcp_server.py`:
```python
from mcp.server.mcpserver import MCPServer
server = MCPServer("Echo Server")
@server.tool()
def echo(text: str) -> str:
return f"echo:{text}"
if __name__ == "__main__":
server.run()
```
```yaml
mcp_servers:
echo:
transport: stdio
command: ./.venv/bin/python
args:
- ./echo_mcp_server.py
agents:
code:
display_name: Code
role: Test MCP tools
model: sonnet
tools:
- mcp_echo
```
The model sees the remote `echo` tool as `echo_echo`.
Use a Python interpreter that has the `mcp` package installed.
To serve it remotely instead, run `server.run(transport="sse")` (endpoint `/sse`) or `server.run(transport="streamable-http")` (endpoint `/mcp`).
### Chrome DevTools
The [Add an MCP Server](#add-an-mcp-server) example starts `chrome-devtools-mcp`, which launches its own Chrome with a dedicated profile.
To attach to an already running debuggable Chrome instead, add `--browser-url`:
```yaml
mcp_servers:
chrome_devtools:
transport: stdio
command: npx
args:
- -y
- chrome-devtools-mcp@latest
- --browser-url=http://127.0.0.1:9222
tool_prefix: chrome
```
If Chrome starts slowly, increase `startup_timeout_seconds`; if browser operations run long, increase `call_timeout_seconds`.
### MemPalace Memory
[MemPalace](https://github.com/milla-jovovich/mempalace) is a local memory store with MCP tools for search and adding memories.
Running it through `uvx` keeps its ChromaDB version separate from MindRoom's:
```yaml
mcp_servers:
mempalace:
transport: stdio
command: uvx
args:
- --from
- mempalace
- python
- -m
- mempalace.mcp_server
- --palace
- /path/to/.mempalace/palace
startup_timeout_seconds: 30
call_timeout_seconds: 60
agents:
assistant:
display_name: Assistant
role: General assistant with persistent memory
model: sonnet
tools:
- mcp_mempalace
```
Initialize and seed the same palace before the server can return results:
```bash
uvx mempalace --palace /path/to/.mempalace/palace init /path/to/content
uvx mempalace --palace /path/to/.mempalace/palace mine /path/to/content
```
See the [MemPalace CLI reference](https://mempalaceofficial.com/reference/cli) for these commands.
## Failures and Catalog Changes
MindRoom connects to MCP servers at startup and whenever `config.yaml` changes, and logs a warning for each server that fails to start, initialize, or list valid tools.
By default a failed server does not block anything: agents and teams that use it start without its tools.
MindRoom keeps retrying a failed server without OAuth in the background and restarts the affected agents and teams once it recovers.
An OAuth-backed server is retried on its next tool call.
Set `required: true` to keep dependent agents and teams from starting until the server is available.
A function-name collision is not retried, and the colliding servers' tools stay unavailable.
Fix the remote tool names or `tool_prefix` values, then reload `config.yaml` or restart MindRoom.
Errors that the MCP server reports for a tool call return to the agent as tool errors and are not retried.
If the connection drops or times out during a call, the call fails even when `auto_reconnect` restores the connection, and the action is never replayed.
Check whether a call that changes something actually completed before retrying it.
When a server reports that its tool list changed, MindRoom reloads the list, at most once a minute per server.
If the tools changed, the agents and teams that use the server restart to pick them up, waiting for active responses like a [config reload](https://docs.mindroom.chat/configuration/#configuration-file).
# Dynamic Tools
Dynamic tools keep an agent's rarely used tools out of the model's tool list until the agent needs them, which saves context on every request.
Use them for agents with many optional tools.
Each authored entry in an agent's `tools:` list loads or unloads as one unit.
## Configuration
| Field | Type | Default | Effect |
| --- | --- | --- | --- |
| `defer` | bool | `false` | Hide the tool until the agent loads it for the current session. |
| `initial` | bool | `false` | Load a deferred tool at session start and keep it loaded; requires `defer: true`. |
A tool with neither flag is eager and appears in every request.
```yaml
agents:
assistant:
display_name: Assistant
role: Help in chat
tools:
- shell
- coding: {defer: true, initial: true}
- searxng: {defer: true, host: https://search.example.test, fixed_max_results: 10}
- name: serper
defer: true
overrides: {num_results: 10}
```
These configurations fail validation:
- `initial: true` without `defer: true` fails with `Tool entry initial=true requires defer=true`.
- Lazy loading is per agent, so `defaults.tools` entries reject both flags with `defaults.tools does not support defer or initial flags: <tools>`.
- Presets such as [`openclaw_compat`](https://docs.mindroom.chat/openclaw/) cannot be deferred; set the flags on the individual member tools instead.
- The control-plane tools `delegate`, `dynamic_tools`, `external_trigger_manager`, `invite_router`, `self_config`, and `skill_manage` cannot be deferred and fail with `'<tool>' is a control-plane tool and cannot be deferred; defer/initial are only valid on runtime tools.`
## Native Server-Side Tool Search
Standard-mode agents on these models use the provider's own tool search instead of MindRoom's loading tools:
- Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and newer on the `anthropic` and `vertexai_claude` providers.
- GPT 5.4 and newer on `openai`, `codex`, and `openai_codex`.
For `openai`, an explicit `api: chat_completions` or a custom endpoint selects runtime loading instead.
The endpoint is a non-empty `extra_kwargs.base_url`, otherwise `OPENAI_BASE_URL`; native search applies only when it is unset or `https://api.openai.com/v1`.
On this path, deferred tools stay out of the model's context until the model searches for them, and discovering a tool does not invalidate the prompt cache.
The system prompt names the deferred toolkits and tells the model to search them before concluding that a tool is unavailable.
Discovered tools are called directly, so there is nothing to load or unload.
Tools with `initial: true` are ordinary always-visible tools.
Toolkit instructions are omitted from the system prompt when every function in the toolkit is deferred and not `initial`.
## Runtime Loading
On other models, an agent with at least one deferred tool gets the `dynamic_tools` toolkit, with `list_tools()`, `tool_search(query)`, `load_tool(tool_name)`, and `unload_tool(tool_name)`.
`tool_search` matches keywords and exact names only.
Tools with `initial: true` cannot be unloaded.
A loaded tool becomes callable in the agent's next tool-call step, not in the same parallel batch as `load_tool()`.
The agent continues the same response with the updated tools and the loaded toolkit's instructions, without waiting for another message.
Loaded tools are tracked per agent and per conversation session, so two agents in the same Matrix thread do not share them.
This state is held in memory, so a restart returns each session to its `initial` tools.
## Minimal Mode
In [minimal mode](https://docs.mindroom.chat/tools/agent-cli/), every request still exposes only Bash.
The agent lists and calls its deferred tools through `mindroom-agent` like its other tools.
# Minimal Agent Mode
Minimal mode gives an existing agent a short prompt and one Bash tool instead of its full system prompt and tool schemas, so each request carries far fewer tokens.
The agent uses `mindroom-agent` in that Bash to discover and call its other tools.
Its identity, model, workspace, memory, history, and tool permissions stay the same, and switching modes does not create a second workspace or memory store.
Standard mode is the default.
You can use minimal mode for one agent in one conversation with `!mode`, or for one subagent run with `run_subagent(minimal=True)`.
Standard-mode agents with the `shell` tool can also call `mindroom-agent` inside their shell commands.
All three need the [deployment requirements](#deployment-requirements).
## Conversation mode
### `!mode`
Switch one agent's tool interface for its next Matrix responses in the current conversation:
```text
!mode helper minimal
!mode helper show
!mode helper standard
!mode helper reset
```
`standard` and `reset` both remove the saved choice and restore standard mode.
You must be authorized to use the named agent.
For agents using threads, run the command inside an existing thread and keep talking to the agent in that thread.
For agents using `thread_mode: room`, the choice applies to the whole room, including commands sent from a thread.
Private agents store the choice separately for each requester.
The choice survives restarts without changing `config.yaml`, and other agents and conversations are unaffected.
Teams and OpenAI-compatible API requests do not use this selection.
A response already in progress keeps the mode it started with.
Selecting minimal mode does not grant shell access or add tools.
If the agent or deployment cannot support minimal mode, the reply lists every missing requirement with its fix, names the `.env` file for deployment settings, and links to the [deployment requirements](#deployment-requirements), without saving the choice.
If shell permissions or deployment settings change after minimal mode was selected, minimal responses fail instead of running; run `!mode helper standard` in the same conversation to return to standard mode.
### Prompt and `minimal_instructions`
The minimal prompt identifies the agent, lists its loaded workspace context files, and names the toolkits available through `mindroom-agent`.
With file memory, it also names the workspace-relative `MEMORY.md` and `memory/` locations.
File contents, the role, ordinary instructions, and tool guidance are not in the prompt; the agent reads them through `mindroom-agent context` when it needs them.
`minimal_instructions` (list of strings, default `[]`) is appended to the minimal prompt on every minimal request:
```yaml
agents:
helper:
display_name: Helper
tools: [shell]
minimal_instructions:
- Read the project instructions before changing files.
```
Because guidance moved out of the prompt is seen only when the agent looks it up, put short guidance that must apply on every request in `minimal_instructions`, and keep durable notes in the agent's memory.
## Minimal subagents
A caller with the [`delegate`](https://docs.mindroom.chat/tools/agent-orchestration/#delegate) tool can pass `minimal=True` to `run_subagent` to run that child in minimal mode, and `continue_subagent` keeps the child's mode.
Use it for self-contained tasks where the child does not need its role, instructions, and tool guidance up front; it can still read them with `mindroom-agent context`.
The option is offered only in Matrix conversations, only for allowed subagents that have the `shell` tool and meet the [deployment requirements](#deployment-requirements), and never while shell commands require approval.
A minimal subagent cannot pause for approval, so approval-gated tools are hidden from it.
A listed child whose shell permissions or workspace still rule out minimal mode fails with the reason and a hint to start a new subagent without minimal.
## Standard mode
A standard-mode agent with the `shell` tool can use `mindroom-agent` inside its shell commands, so one script can combine many tool calls, loop over results, or filter them before anything returns to the model.
It is available automatically when the agent answers a Matrix conversation itself and its shell meets the [deployment requirements](#deployment-requirements); the agent's instructions then mention it.
Team members, call agents, workflow participants, and OpenAI-compatible requests do not get it.
The agent keeps all of its tools as ordinary tools as well.
Tools that may require approval, ask the requester a question, delegate to another agent, or end the turn are not offered through the CLI in standard mode; the agent calls them directly instead.
The CLI is not offered when the agent's shell commands themselves require approval, and after a response pauses for any approval, the rest of that response continues without it.
Media returned by CLI calls reaches the model with the shell command's result, and streamed responses show CLI calls as their own tool-trace entries.
## Discover and call tools
```bash
mindroom-agent --help
mindroom-agent tools list
mindroom-agent tools search calendar
mindroom-agent tools describe TOOLKIT FUNCTION
mindroom-agent tools call TOOLKIT FUNCTION --json '{"argument":"value"}'
mindroom-agent calls get CALL_ID
mindroom-agent calls wait CALL_ID
mindroom-agent context list
mindroom-agent context read NAME --offset 0 --limit 8000
```
Tool names are qualified by toolkit, and `TOOLKIT.FUNCTION` works anywhere `TOOLKIT FUNCTION` does.
Discovery and calls use the current agent's permissions and requester context.
Use command-specific `--help` for arguments and options.
`tools call` waits up to 30 seconds and prints the call's receipt: call ID, status, and the outcome once finished.
Use `--timeout SECONDS` to wait longer, or `--timeout 0` to return at once.
For a call that is still queued, running, or waiting for a decision, `calls wait` polls for up to 30 seconds (or `--timeout SECONDS`) and then returns the current receipt with exit code `3`; reaching the timeout does not cancel the tool.
Waiting pauses that shell command and its response; other conversations continue.
Arguments come from `--json`, a final positional argument (`tools call TOOLKIT FUNCTION '{...}'`), `--json-file arguments.json`, or `--json-stdin`.
Use only one of these; the value must be a JSON object, and omitting all of them sends an empty object.
Use `--call-id UUID` to fix the call ID before submission; reusing an ID with the same tool and arguments joins the existing call, and different arguments are rejected.
| Command | Options |
| --- | --- |
| `tools list` | `--cursor`, `--limit` (default 100) |
| `tools search QUERY` | `--toolkit`, `--limit` (default 20) |
| `tools describe TOOLKIT FUNCTION` | None |
| `tools call TOOLKIT FUNCTION [JSON]` | `--call-id`, `--json`, `--json-file`, `--json-stdin`, `--timeout` (seconds to wait for the result, default 30) |
| `calls get CALL_ID` | None |
| `calls wait CALL_ID` | `--timeout` (polling seconds, default 30) |
| `context list` | `--cursor`, `--limit` (default 100) |
| `context read NAME` | `--offset` (default 0), `--limit` (default 8000) |
`context read` accepts only names returned by `context list` or by other commands, not filesystem paths.
Large schemas return a context name for paged reading.
Large tool results return a preview and a workspace file path holding the full output; for an agent without a workspace, they are shortened instead.
Images, audio, and files are handled like ordinary response attachments.
## Exit codes
| Code | Meaning |
| --- | --- |
| `0` | Discovery succeeded or the call completed |
| `1` | Call failed or was cancelled |
| `2` | Invalid input or rejected request |
| `3` | Call remains queued, running, or waiting |
| `4` | Authority or transport unavailable; submission outcome may be unknown |
Scripts using `set -e` must handle exit code `3` explicitly.
After exit code `4`, check the original call ID before retrying, because submitting with a fresh ID may repeat a side effect.
## Approvals, shells, and limits
CLI calls follow the agent's existing approval rules and interactive questions, and an approval applies to the exact tool and arguments shown.
Each Bash command starts a fresh shell: workspace files persist, but shell variables and directory changes do not carry over.
Shell commands can run in parallel, and each keeps its own calls and media.
A command can submit new calls only while it is running or its earlier calls are finishing; later calls, including those from background commands whose Bash call has returned, are rejected rather than queued.
`calls wait` on earlier receipts works until the response ends.
CLI calls are limited by the agent's `max_tool_calls_per_turn`, counted separately from its direct tool calls; calls past the limit return a failed receipt.
One response keeps at most 1024 call receipts and runs at most 64 CLI operations at once; further submissions are rejected with an error.
Call receipts do not survive a restart.
A pending approval still resumes after a restart once it is decided, but MindRoom does not rerun the Bash script that requested it; when the approval was for the Bash command itself, the agent is told the command did not run and can issue it again.
## Deployment requirements
Minimal Bash runs where the agent's ordinary shell runs.
Every mode that uses `mindroom-agent` needs the `shell` tool on the agent and MindRoom running with its API server, not `--no-api`.
Minimal mode and minimal subagents also need:
- the shell's run, check, and kill commands allowed;
- an agent workspace, which `memory_backend: file` or a `private` agent provides.
`!mode <agent> minimal` lists every missing requirement at once.
Set environment settings in the runtime's `.env` and restart MindRoom.
### Shell in MindRoom itself
When the agent's shell runs in the MindRoom process, which is the default without a worker backend, nothing else is needed.
Such an agent is already fully trusted, as described in [the security posture](https://docs.mindroom.chat/architecture/security-posture/).
### Shell in a worker
When the agent's shell runs in a worker, Bash runs in that same worker, which must use an image from the same MindRoom release.
Worker shells can reach MindRoom's API, so the API must be locked down:
- Set `MINDROOM_API_KEY`; `mindroom run` adds a generated key to `.env` when Docker or Kubernetes workers are configured and the dashboard has no credential, while an explicitly empty `MINDROOM_API_KEY=` keeps open access and leaves minimal mode unavailable.
- With trusted-upstream authentication enabled, set `MINDROOM_TRUSTED_UPSTREAM_REQUIRE_JWT=true`.
- Unset `OPENAI_COMPAT_ALLOW_UNAUTHENTICATED`.
Workers call MindRoom at `MINDROOM_AGENT_CLI_PRIMARY_URL`, a plain `http(s)://host:port` origin, when it is set.
Otherwise, with `MINDROOM_SCRIPT_GATEWAY_ISOLATED=true` and `MINDROOM_SCRIPT_GATEWAY_PORT` set, they call the origin of a `MINDROOM_SCRIPT_GATEWAY_URL` whose path is `/api/script-gateway`, because that [gateway-only listener](https://docs.mindroom.chat/tools/background-scripts/#kubernetes) also serves the CLI routes and keeps workers off the general API port.
The runtime chart's `scriptGateway.enabled` sets this up.
Otherwise MindRoom uses its own API address; with Docker workers and the default API bind on every interface, workers reach it through `host.docker.internal`.
Kubernetes workers and shared static runners need one of these settings unless the API listens on a specific non-loopback address.
An API that listens only on loopback cannot be reached from workers, and a host firewall may drop connections from Docker networks; a `mindroom-agent` call that cannot connect names the address it tried.
Without the gateway-only listener and with the runtime chart's worker egress policy, allow the API through `egressProxy.networkPolicy.extraEgress`, and admit workers in `networkPolicy.apiIngressFrom` when that list is set, because `mindroom-agent` connects directly rather than through the egress proxy.
The shell receives a grant scoped to its own active response, not provider or administrator credentials, and provider credentials stay where the tools already run.
The grant cannot select another agent, requester, or conversation, and it stops working when the response ends.
Other code in the same worker can read the grant while the response runs, and anything that copies it can use the same permissions from any host that reaches MindRoom's API until then; agents and requesters that share a worker already share its trust.
The external MCP gateway keeps its own authentication and tool restrictions; minimal mode does not widen them.
## Compare modes
A smaller initial prompt alone does not establish lower total cost or better task quality.
To evaluate minimal mode, run the same tasks with the same agent, model, tool configuration, and starting workspace in both modes, including tool-heavy work, approval waits, and tasks that depend on long instructions.
Compare task success, input and output tokens, elapsed time, editing failures, and discovery calls, and record the model and configuration versions.
# Background Python Scripts
The `script` tool lets an agent start a Python program that keeps running after the chat turn ends.
Use it for watchers, polling loops, and other small automations that should wake the agent only when something changes.
The script can call a chosen subset of the agent's tools through the `MindRoomTools` SDK, with the same hooks, approval rules, worker routing, and audit trail as an ordinary tool call.
Treat `script` as trusted arbitrary code with authority comparable to `python` or `shell`.
`allowed_tools` limits only calls made through `MindRoomTools`; it does not restrict Python imports, filesystem access, operating-system calls, subprocesses, or direct network clients in the script.
## Enable The Tool
Add `script` to the agent that will own the process, together with the toolkits the script may call.
This example lets a watcher read a URL and send a Matrix message to its own agent when the value changes.
```yaml
models:
default:
provider: anthropic
id: claude-sonnet-5-5
agents:
watcher:
display_name: Watcher
role: Watch configured values and investigate meaningful changes.
model: default
rooms: [operations]
tools:
- script:
allowed_tools: [website, matrix_message]
max_concurrent_runs: 3
max_tool_calls_per_minute: 30
max_runtime_hours: 24
- website
- matrix_message
instructions:
- Use background scripts only for bounded, observable automation.
- Cancel watchers that are no longer needed.
defaults:
tools: []
```
Scripts also need a worker backend or explicit local execution; see [Worker And Network Requirements](#worker-and-network-requirements).
| Option | Default | Meaning |
|--------|---------|---------|
| `allowed_tools` | `[]` | Toolkit names (not function names) the script may call through `MindRoomTools` |
| `max_concurrent_runs` | `3` | Maximum unfinished runs for one requester and agent, at least `1` |
| `max_tool_calls_per_minute` | `30` | Maximum new SDK calls per minute for one run, at least `1`; automatic SDK retries and status polling do not count |
| `max_runtime_hours` | `24` | Maximum lifetime of one run in hours, positive and finite; the deadline holds even while the primary runtime is offline |
Each run keeps the limits and `allowed_tools` value in effect when it started.
### Which tools a script can call and when it needs approval
- A non-empty `allowed_tools` list restricts the script to those toolkits, and their functions run without approval.
- An empty list lets the script call every eligible toolkit on the agent, but each call waits for approval unless a `tool_approval` rule auto-approves it.
- Unknown or ineligible toolkit names, including `*`, make `start_script` fail with an error.
- The `browser`, `script`, `compact_context`, `delegate`, `dynamic_tools`, `dynamic_workflow`, `memory`, `self_config`, and `skill_manage` toolkits are never available to scripts, even when the agent has them.
- Listing `claude_agent`, `config_manager`, or `scheduler` in `allowed_tools` does not auto-approve their calls; only a `tool_approval` rule can.
- Operator [`tool_approval`](https://docs.mindroom.chat/tool-approval/) rules are checked first, so a matching `require_approval` rule still pauses the call, and functions that declare their own confirmation still ask for it.
- Only the original requester can approve or deny a script's call, and approval cards for a cancelled or finished run are settled without running the call.
Access is checked again on every call.
Removing a toolkit or function from the agent, or the requester losing access to the room or agent, takes effect immediately without restarting the script.
Adding toolkits later, including expanding `allowed_tools`, never gives a running script new unapproved access.
## Control Functions
The agent receives five control functions.
```text
start_script(
source: str | None = None,
path: str | None = None,
name: str | None = None,
resource_profile: Literal["small", "standard", "large"] | None = None,
)
get_script_resource_profiles()
get_script(run_id: str)
cancel_script(run_id: str, force: bool = False)
list_scripts(include_finished: bool = True)
```
- `start_script` requires exactly one of `source` (inline Python) or `path` (relative to the agent workspace), limited to 128 KiB.
A `path` file is copied at launch, so later edits do not change the running program.
`name` is an optional label shown in status and list results.
- `resource_profile` selects a Kubernetes CPU and memory profile; omitting it uses the configured default.
`get_script_resource_profiles` shows the default and each profile's exact requests and limits, and start, status, and list results report the selected profile.
An explicit profile fails on a backend that cannot enforce resource profiles.
Operators define the profiles as described in [Kubernetes deployment](https://docs.mindroom.chat/deployment/kubernetes/) and the [environment variable reference](https://docs.mindroom.chat/configuration/#workers-and-background-scripts).
- `get_script` returns the run state plus recent process output when available.
- `list_scripts` returns only runs owned by the current requester and agent.
- `cancel_script` immediately revokes the script's tool access, requests graceful termination, force-kills after a short grace period, and reports `cancelled` once the process has exited.
`force=True` kills the process without the graceful step.
## Calling Agent Tools From A Script
The worker environment includes the `mindroom.script_sdk` client, which reads its connection settings from the environment the launcher provides.
Create one `MindRoomTools` instance and call tools by toolkit name, function name, and JSON-compatible keyword arguments.
```python
from mindroom.script_sdk import MindRoomTools
tools = MindRoomTools()
result = tools.call("website", "read_url", url="https://example.org/status.txt")
print(result, flush=True)
```
`MindRoomTools.call(toolkit_name, function_name, **arguments)` blocks until the call finishes and returns a JSON-compatible value.
Arguments must have an unambiguous strict-JSON representation.
A result larger than about 64 KiB fails the call with kind `result_too_large`.
Calls within one run execute one at a time, in order.
The SDK retries transient failures automatically without repeating the side effect.
Failures raise `MindRoomToolCallError`, which exposes `kind`, `retryable`, and `call_id` so a script can log or stop predictably.
A denied approval raises a non-retryable error with kind `approval_denied`.
An `indeterminate` call means MindRoom accepted the call but cannot prove whether its side effect happened, so the script must not repeat it automatically.
## Complete Watcher Example
This watcher polls a text endpoint and wakes the same agent once per observed value change.
Replace the URL and agent name with values for your deployment.
```python
from __future__ import annotations
import time
from mindroom.script_sdk import MindRoomTools
STATUS_URL = "https://example.org/controlled-status.txt"
AGENT_NAME = "watcher"
POLL_SECONDS = 15
def main() -> None:
tools = MindRoomTools()
previous = tools.call("website", "read_url", url=STATUS_URL)
while True:
time.sleep(POLL_SECONDS)
current = tools.call("website", "read_url", url=STATUS_URL)
if current == previous:
continue
previous = current
tools.call(
"matrix_message",
"matrix_message",
action="send",
message=f"The watched value changed; inspect {STATUS_URL} now.",
recipient=AGENT_NAME,
)
if __name__ == "__main__":
main()
```
The script runs in the room, thread, and requester context it was started from, so omitting `room_id` sends to that conversation, and sending to another room still requires normal Matrix authorization.
Setting `recipient` to the agent's own name starts a new turn for that agent; see [Matrix Message](https://docs.mindroom.chat/tools/matrix-message/#agent-conversations) for recipient rules.
Self-messaging requires a human requester, so start a self-triggering watcher from a turn a person started.
Make the watcher edge-triggered: update its observed value before sending, and never react to its own unchanged output.
## Worker And Network Requirements
Run scripts on a dedicated Docker or Kubernetes worker backend as described in [Sandbox Proxy](https://docs.mindroom.chat/deployment/sandbox-proxy/).
The shared `static_runner` sandbox is not supported.
Workers should run the same MindRoom release as the primary; see [Keeping worker versions matched](https://docs.mindroom.chat/deployment/sandbox-proxy/#keeping-worker-versions-matched).
Without a worker backend or explicit local execution, `start_script` fails with `Background scripts require a worker or an explicitly disabled sandbox.`
Workers must reach the primary's script gateway over the network.
Set `MINDROOM_SCRIPT_GATEWAY_URL` to the complete worker-reachable gateway base, including `/api/script-gateway`.
With Docker, `MINDROOM_PUBLIC_URL` can name the reachable MindRoom origin instead, and MindRoom appends `/api/script-gateway`.
Missing, malformed, credential-bearing, unresolvable, unspecified, or loopback gateway addresses are rejected, as are URLs with a query string or fragment.
```bash
export MINDROOM_WORKER_BACKEND=docker
export MINDROOM_DOCKER_WORKER_IMAGE=mindroom:dev
export MINDROOM_SANDBOX_PROXY_TOKEN=replace-with-a-long-random-token
export MINDROOM_SCRIPT_GATEWAY_URL=https://mindroom.example.org/api/script-gateway
```
### Kubernetes
Kubernetes scripts stay disabled until the gateway runs on a listener that exposes no other primary API routes, because workers that can reach the general API listener get more authority than the script gateway grants.
Until then, `start_script` fails with `Kubernetes background scripts require a gateway-only listener; use Docker or explicit unsafe-local mode until that boundary is configured.`
- `MINDROOM_SCRIPT_GATEWAY_PORT` makes the primary serve a second listener that answers only `/api/script-gateway` and the capability-authenticated [`/api/agent-cli`](https://docs.mindroom.chat/tools/agent-cli/#shell-in-a-worker) routes.
- `MINDROOM_SCRIPT_GATEWAY_URL` must name that listener explicitly; `MINDROOM_PUBLIC_URL` is not used on Kubernetes.
- `MINDROOM_SCRIPT_GATEWAY_ISOLATED=true` attests that workers cannot reach other primary API routes through that listener.
The flag does not create network isolation, and the main API port is unchanged, so network policy must still keep workers off it.
The runtime Helm chart's `scriptGateway.enabled` value configures the listener, its `<fullname>-script-gateway` ClusterIP Service, the worker and control-plane NetworkPolicies, `NO_PROXY`, and all three variables, as described in the [runtime chart README](https://github.com/mindroom-ai/mindroom/blob/main/cluster/k8s/runtime/README.md#background-script-gateway).
```bash
export MINDROOM_WORKER_BACKEND=kubernetes
export MINDROOM_SCRIPT_GATEWAY_PORT=8767
export MINDROOM_SCRIPT_GATEWAY_URL=http://mindroom-runtime-script-gateway.mindroom.svc.cluster.local:8767/api/script-gateway
export MINDROOM_SCRIPT_GATEWAY_ISOLATED=true
```
With Agent Vault enabled, the script's own direct network requests do not receive Agent Vault credential injection, while its `MindRoomTools` calls run through normal tool routing and keep the configured Agent Vault boundary.
### What a script's worker can access
- Each run gets its own dedicated worker and filesystem root, even when other runs belong to the same requester and agent.
- The worker sees the requester-and-agent scoped workspace (see [Filesystem isolation and agent data](https://docs.mindroom.chat/deployment/sandbox-proxy/#filesystem-isolation-and-agent-data)), and the script can read and modify files there; runs of the same requester and agent share that workspace, so they see each other's files in it.
- The script can read operator-provided worker environment values, including backend `extra_env` and workspace environment overlays.
- Global worker credentials are not copied into script workers; `MindRoomTools` calls get their normal authority through the gateway, and each call runs where that tool normally runs, not in the script's worker.
- Worker mode isolates processes and files, not the network: direct network access follows the worker's Docker, host, and egress policy, and `allowed_tools` does not govern it.
- [Private agents](https://docs.mindroom.chat/configuration/agents/#private-instances) must use `private.per: user_agent`; other private scopes fail with `Background-script workers for private agents require private.per=user_agent.`
### Local execution
Setting `MINDROOM_SANDBOX_EXECUTION_MODE` to `off`, `local`, or `disabled` runs scripts in local execution mode instead of a worker.
Local execution is marked unsafe, runs under the primary host account, inherits the primary process environment, and provides no secret isolation.
It requires Linux and fails on other platforms with `Background scripts require Linux process-group containment.`
Use local execution only for trusted development scripts.
## Lifecycle And Failure Semantics
| Run state | Meaning |
|-----------|---------|
| `starting`, `running` | The run is launching or active |
| `exited` | The process returned exit code zero |
| `failed` | Launch failed or the process returned a nonzero exit code |
| `cancelled` | Cancellation was requested and the process has exited |
| `interrupted` | MindRoom stopped or lost the run for one of the reasons below |
Tool calls are `pending`, `completed`, `failed`, or `indeterminate`.
Cancelling a run cannot roll back a side effect a tool already started; such a call is reported `indeterminate` rather than cancelled or failed.
### Restarts, upgrades, and reloads
Kubernetes runs keep running through primary restarts, compatible upgrades, and config reloads that do not affect their owner.
An upgraded image applies only to new runs; existing runs stay on the image they started with.
While MindRoom starts up or replaces its worker backend, new launches return an error and must be retried once MindRoom is ready, while SDK calls from running scripts are retried automatically.
Keep the isolated gateway address stable across upgrades.
Docker and local runs are interrupted by every primary restart.
Worker-backend replacement also interrupts Docker runs.
A run is also interrupted when:
- its worker or supervisor is lost, for example through node loss;
- its owning agent, its `script` tool, or the requester's authorization is removed;
- a reload changes the owning agent's execution isolation or assigned knowledge base paths, or changes `defaults.worker_grantable_credentials`;
- any plugin reload happens, even for plugins the script does not use;
- a restart changes what the run depends on, such as the gateway URL, worker ownership or storage, the selected resource profile's resources, or the `MINDROOM_SCRIPT_GATEWAY_ISOLATED` attestation.
Changing an unused resource profile does not interrupt runs.
MindRoom never relaunches an interrupted script automatically, so design watchers to checkpoint their observed state for a deliberate relaunch.
If the Docker daemon, worker storage root, or worker name prefix changed while MindRoom was offline, script launches stay blocked until the old runs are retired.
Restore the previous settings, restart once so MindRoom can retire those runs, then apply the new settings.
### Output and retention
`get_script(run_id)` keeps returning up to 64 KiB of process output after the run ends.
Finished runs, their tool-call receipts, and approval records are kept for 30 days by default.
Set `MINDROOM_SCRIPT_RETENTION_SECONDS` to change the window; see the [environment variable reference](https://docs.mindroom.chat/configuration/#workers-and-background-scripts).
# Worker Computer
Worker Computer gives an agent a visible, persistent Chromium browser inside its dedicated worker, and lets the user watch it, take control, and hand it back from MindRoom Chat's Computer panel.
Use it when a user wants to see what the agent is doing in a browser, step in for logins or CAPTCHAs, or preview a web app the agent is building.
The browser shares the worker's files with the agent's shell and file tools.
Agents with the [`chat_ui`](https://docs.mindroom.chat/tools/chat-ui/) toolkit can open the panel for the user; see [Control the browser, then show it](https://docs.mindroom.chat/tools/chat-ui/#control-the-browser-then-show-it) for that call.
## Requirements and opt-in
Worker Computer needs a dedicated **Docker** or **Kubernetes** worker running the current MindRoom worker image.
The `static_runner` backend and local process execution do not support it.
It is disabled by default.
Set these values on the **primary MindRoom runtime**, alongside the normal worker settings from [Sandbox Workers](https://docs.mindroom.chat/deployment/sandbox-proxy/):
```dotenv
MINDROOM_WORKER_BACKEND=docker
MINDROOM_DOCKER_WORKER_IMAGE=mindroom:dev
MINDROOM_DOCKER_WORKER_SECURITY_POLICY=computer
MINDROOM_WORKER_COMPUTER_ENABLED=true
MINDROOM_COMPUTER_ALLOWED_ORIGINS=["https://chat.example.org"]
MATRIX_HOMESERVER=https://matrix.example.org
MATRIX_SERVER_NAME=matrix.example.org
```
`MINDROOM_DOCKER_WORKER_SECURITY_POLICY=computer` is required on Docker; see [Browser and container sandboxing](#browser-and-container-sandboxing).
For Docker development, build the image with:
```bash
docker build -t mindroom:dev -f local/instances/deploy/Dockerfile.mindroom .
```
Give the agent exactly one worker-routed browser provider, `browser` or [`browser_mcp`](#native-playwright-mcp-provider), and an effective `user_agent` worker scope, so the browser and shell share one worker per requester and agent.
Shared agents set `worker_scope: user_agent` (directly or through `defaults.worker_scope`); [private agents](https://docs.mindroom.chat/configuration/agents/#private-instances) set `private.per: user_agent` instead, because they cannot also set `worker_scope`:
```yaml
agents:
researcher:
display_name: Researcher
role: Research with a browser and save results.
model: default
tools: [browser, shell, file]
worker_tools: [browser, shell, file]
worker_scope: user_agent
```
Keep the `browser` tool's default `target: host`; the connected-user `target: desktop` is a separate feature and does not run in the Computer.
Browser URL restrictions still apply, so private networks stay blocked unless allowed.
The `browser` tool uses the worker image's bundled Chromium in a Computer unless `BROWSER_EXECUTABLE_PATH` is set.
For worker egress proxies, see [Egress Proxy for Browsers](https://docs.mindroom.chat/tools/web-scraping-and-browser/#egress-proxy-for-browsers); the same rules apply to both browser providers.
With the runtime Helm chart:
```yaml
workers:
backend: kubernetes
computerEnabled: true
env:
extra:
- name: MINDROOM_COMPUTER_ALLOWED_ORIGINS
value: '["https://chat.example.org"]'
```
Use the chart's existing worker image, authentication secret, storage, and RBAC settings.
The hosted instance chart runs no dedicated workers, so Computer is available only through the runtime chart or direct Docker and Kubernetes worker deployments.
Changing `MINDROOM_WORKER_COMPUTER_ENABLED` replaces existing workers; worker files and browser profiles are kept.
### Preview a local web app
The Computer browser can open a web server that the agent's shell started in the same worker.
Bind the server to `127.0.0.1` and open its URL, for example `http://localhost:5173`, with the browser tool.
The user sees the app in the Computer panel without any public port or preview URL.
This works with both `browser` and `browser_mcp` in a Computer, without `allow_private_networks`.
Use `localhost` or a literal loopback address; aliases such as `localhost.localdomain` are treated as private network names and stay blocked.
Other private addresses and cloud metadata endpoints remain blocked by default.
Pages opened in the Computer can reach any service listening on the worker's loopback interface, as in a local development browser.
## Connect MindRoom Chat
Set the trusted origin of the MindRoom runtime API, without a path, in Chat's operator-managed `config.json`:
```json
{
"mindroom": {
"computers": {
"apiUrl": "https://computer.example.org"
}
}
}
```
The shipped value is empty, which hides the Computer action.
Remote origins require HTTPS; loopback HTTP works for local development.
Chat shows the Computer action when this origin is set and the room has a joined MindRoom agent; with several agents, the user picks one first.
Point `apiUrl` at the runtime that owns the agent's workers; a host that only serves Matrix, Chat, or local provisioning (`/v1/local-mindroom/*`) does not serve computers.
On the runtime, `MINDROOM_COMPUTER_ALLOWED_ORIGINS` is a JSON list of exact Chat origins allowed to open computers.
For the bundled MindRoom Chat iOS app, explicitly add `"capacitor://localhost"` alongside the trusted HTTPS web origins, for example `["https://chat.mindroom.chat", "capacitor://localhost"]`.
Other custom-scheme origins and opaque `"null"` origins are refused.
The iOS app uses Matrix OpenID and computer session tokens; it does not need web sign-in cookies.
Each entry must be a scheme and host with an optional port, with no path or wildcard, and HTTP is allowed only for `localhost` and literal loopback addresses.
One invalid entry disables the whole list.
Opening a computer requires that the requester and the agent are both joined to the room, that the agent's [access policy](https://docs.mindroom.chat/authorization/#responder-access) lets the requester use it, and that the requester belongs to the configured Matrix server.
A session lasts at most one hour.
Each requester can hold up to eight concurrent viewer sessions, and a runtime up to 256; closing a viewer frees its slot.
### Reverse proxy and host routing
Route `/api/computers/*`, including WebSocket upgrades, to the **MindRoom runtime API**.
Preserve the `Origin` and `Sec-WebSocket-Protocol` headers and allow long-lived WSS connections.
These routes use their own session authentication, separate from dashboard authentication.
Do not log bearer tokens or WebSocket subprotocols.
For example, a dedicated Caddy origin pointing to a runtime on the same host:
```caddy
computer.example.org {
reverse_proxy /api/computers/* 127.0.0.1:8765
}
```
Use your actual runtime address and port.
Expose only this gateway; the worker's display has no public listener.
## Watch, take control, and resume
<video controls playsinline preload="metadata" aria-label="A user watches the agent's browser, takes control, and hands it back" style="width: 100%" poster="https://github.com/user-attachments/assets/cb907777-89c8-4e0e-9df5-04969e863ec5" data-poster-light="https://github.com/user-attachments/assets/cb907777-89c8-4e0e-9df5-04969e863ec5" data-poster-dark="https://github.com/user-attachments/assets/19244c17-be66-410f-b2cf-b8e3edb4b228">
<source src="https://github.com/user-attachments/assets/6aa0e537-bd5e-462d-89e2-6592cd9e3be9" type="video/mp4" media="(prefers-color-scheme: dark)">
<source src="https://github.com/user-attachments/assets/00f08e39-3b52-4556-860b-3b5b0b2d7287" type="video/mp4">
</video>
- **Watch** shows the browser without input rights.
- **Take control** waits for the agent's current browser action to finish, then gives input to one viewer.
While the user holds control, the agent's browser calls return a blocked result; background shell processes keep running.
- **Resume agent** releases control, returns the screen to watch mode, and sends one ordinary message mentioning the agent in the originating room or thread.
If that message fails to send, Chat shows the error and does not retry.
- **Close** disconnects this viewer and releases its control; the browser and files stay for later work.
- **Stop** closes the browser and display and ends the session.
**Start computer** creates a fresh session; profiles and files remain.
Changing room, thread, account, or selected agent closes the old viewer.
On desktop the panel sits beside the conversation and closes the Members drawer; on mobile it fills the screen and has a close button.
Keyboard input over a controlled screen goes to the browser, not the composer.
The browser keeps running between tool calls, including tabs the user opened.
When the agent focuses a tab or acts on a page, that page comes to the foreground, so the agent's screenshots and snapshots show what the viewer sees.
The `browser` provider identifies tabs by stable target IDs, while `browser_mcp` uses tab indices that can change.
## Native Playwright MCP provider
`browser_mcp` gives the agent native Playwright tools such as `browser_navigate`, `browser_snapshot`, `browser_click`, `browser_type`, `browser_evaluate`, `browser_tabs`, `browser_take_screenshot`, `browser_file_upload`, and `browser_pdf_save` instead of the action-based `browser` tool:
```yaml
agents:
researcher:
display_name: Researcher
role: Research with a browser and save results.
model: default
tools: [browser_mcp, shell, file]
worker_scope: user_agent
```
`browser_mcp` runs in workers by default and works only in an enabled Computer.
It uses the Playwright MCP server and Chromium bundled in the worker image, with vision and PDF capabilities.
The agent cannot install packages, change the server or its settings, run server-side code with `browser_run_code_unsafe`, install browsers, or change request routing.
`browser_evaluate` runs JavaScript in the page only.
Service workers are blocked.
| Option | Type | Default | Notes |
| --- | --- | --- | --- |
| `allow_private_networks` | `boolean` | `false` | Allow trusted private destinations; metadata and link-local addresses stay blocked. |
```yaml
agents:
researcher:
tools:
- browser_mcp:
allow_private_networks: true
worker_scope: user_agent
```
Screenshots without a `filename` are shown to the model and also saved in the workspace; passing a `filename` saves without showing.
Automatic screenshots, PDFs, and downloads go to `browser/` in the workspace, and explicit filenames resolve relative to the workspace, so use names like `browser/page.png` to keep them together.
On later turns, open a saved image with `view_file(path=...)` from the `attachments` toolkit.
Captures are never posted to Matrix automatically.
`mindroom_output_path` can save text results to a file but not images.
Upload and drop paths must name existing regular files inside the worker workspace.
List tabs again before selecting one by index.
`browser_resize` changes the page viewport, not the window size.
Chromium may show a banner about resolver flags; it is expected.
## Storage and lifetime
Browser profiles live under `browser-profiles/<profile>` in the dedicated worker's persistent storage root; `browser_mcp` uses `browser-profiles/native-mcp`.
Completed downloads land in the workspace's `browser/` directory, where the shell and file tools can read them; for `browser`, a custom [`output_dir`](https://docs.mindroom.chat/tools/web-scraping-and-browser/#browser-configuration) replaces that directory.
The `browser` provider adds a unique prefix to download filenames; `browser_mcp` keeps the native name.
Profiles and files survive stopping the computer and recreating the worker while the storage volume remains.
Stopping the computer does not sign out of sites or reset the profile.
To reset a profile, stop the computer and stop or recycle its dedicated worker.
Remove only that worker's `browser-profiles/<profile>` directory from its persistent storage; the next browser action creates a new profile.
Do not remove the whole worker storage root unless you also intend to delete its files.
An open viewer keeps the worker from idling out.
After the last viewer disconnects, the worker's normal idle timeout applies: `MINDROOM_DOCKER_WORKER_IDLE_TIMEOUT_SECONDS` in [Sandbox Workers](https://docs.mindroom.chat/deployment/sandbox-proxy/#dedicated-docker-worker-backend) or `workers.kubernetes.idleTimeoutSeconds` in [Kubernetes Deployment](https://docs.mindroom.chat/deployment/kubernetes/#worker-settings).
Closing the panel does not stop the worker immediately.
## Browser and container sandboxing
Chromium always runs with its Linux process sandbox enabled.
If the sandbox cannot start, the browser call fails instead of running unsandboxed.
### Docker
`MINDROOM_DOCKER_WORKER_SECURITY_POLICY` accepts `runtime_default` (the default) or `computer`.
`computer` drops all Linux capabilities, sets `no-new-privileges`, and applies a packaged seccomp profile that adds only the namespace and `chroot` operations Chromium's sandbox needs to Docker's default policy.
It applies to every dedicated Docker worker, whether or not Computer is enabled or the agent uses a browser.
Changing the policy replaces existing workers.
Configuration fails with `MINDROOM_WORKER_COMPUTER_ENABLED=true requires MINDROOM_DOCKER_WORKER_SECURITY_POLICY=computer.` when Computer is enabled under `runtime_default`.
Computer workers must also run as a non-root user.
`MINDROOM_DOCKER_WORKER_USER=root` or UID 0, including a runtime that itself runs as root and passes its UID to workers, fails configuration, and a worker that starts as root refuses requests.
An empty `MINDROOM_DOCKER_WORKER_USER` uses the image's default user.
### Kubernetes
Kubernetes workers use the pod's `RuntimeDefault` seccomp policy.
If that policy allows unprivileged user namespaces, nothing more is needed.
Otherwise, install the packaged profile `src/mindroom/workers/backends/seccomp/worker-computer.json` on every node that can run workers, under a versioned filename such as:
```text
/var/lib/kubelet/seccomp/profiles/worker-computer-578ef2b662d8e9a8.json
```
Verify its SHA-256 on every node: `578ef2b662d8e9a886132148a0b75f0388efff92ed902b16d7be2777ae3788fa`.
Kubernetes only names the file, so it cannot check the contents for you.
When the profile changes, install it at a new versioned path on all nodes before switching to it.
Select it for the worker container:
```dotenv
MINDROOM_KUBERNETES_WORKER_SECCOMP_PROFILE_JSON={"type":"Localhost","localhostProfile":"profiles/worker-computer-578ef2b662d8e9a8.json"}
```
The value must contain exactly `type: Localhost` and a relative `localhostProfile` path.
With the runtime chart, set the same object at `workers.kubernetes.seccompProfile`:
```yaml
workers:
kubernetes:
seccompProfile:
type: Localhost
localhostProfile: profiles/worker-computer-578ef2b662d8e9a8.json
```
This applies only to the main worker container; init and extra containers keep `RuntimeDefault`.
A node without the profile fails pod startup with `CreateContainerError`.
The node kernel and its security modules must also allow unprivileged user namespaces.
## Troubleshooting
| Symptom or error | Fix |
| --- | --- |
| No Computer action in Chat | Set `mindroom.computers.apiUrl` in Chat's `config.json` and make sure an agent is joined to the room. |
| `Computer stream origin is not allowed.` | Add Chat's exact origin to `MINDROOM_COMPUTER_ALLOWED_ORIGINS` and check every entry is valid. |
| `Requester and agent must both be joined to this room.` or `Requester cannot use this agent.` | Check room membership and the agent's access policy. |
| `Computer requires exactly one browser provider and explicit user_agent worker scope.` | Give the agent exactly one of `browser` or `browser_mcp` and an effective `user_agent` scope: `worker_scope: user_agent`, or `private.per: user_agent` for private agents. |
| `Computer requires browser tools routed to the worker.` | Add the browser provider to `worker_tools`. |
| `Computer requires a dedicated Docker or Kubernetes worker backend.` | Set `MINDROOM_WORKER_BACKEND` to `docker` or `kubernetes`. |
| `Worker computer is not enabled on this dedicated worker.` | Set `MINDROOM_WORKER_COMPUTER_ENABLED=true` on the primary runtime. |
| `Computer requester session capacity reached.` or `Computer session capacity reached.` | Close other viewers or wait for sessions to expire. |
| `...create a new session.` | Access, configuration, or the worker changed, or the session expired; reopen the panel. |
| Empty desktop after startup | Ask the agent to open a page. |
| WebSocket fails | Check the gateway's TLS, WebSocket upgrades, and routing to the runtime. |
Use **Reconnect** after a transient stream failure.
If the browser stops responding, recycle the dedicated worker; profiles and files stay in persistent storage.
# Matrix Desktop Bridge
The `desktop` tool lets a cloud-hosted MindRoom agent use a local computer without opening an inbound port.
It can inspect and operate explicitly allowlisted applications, read explicitly selected folders, and run shell commands that a person at the computer approves.
Applications, [read-only folders](#read-only-folders), and [shell commands](#shell-commands) are separate local choices, and each starts disabled.
The computer runs an outbound Matrix client, and commands and responses are end-to-end encrypted between the paired devices.
Set up and run the bridge from the [macOS app](https://docs.mindroom.chat/installation/macos-app/#computer-access) or from the terminal; both use the same saved setup.
## Requirements
- **Matrix account**: Use your chat account or a dedicated Matrix account for the local bridge.
Setup adds a new device to your chat account when no local Desktop session is saved.
For password login, a dedicated account limits the impact of exposing that password on the local computer.
The desktop account and the cloud MindRoom agent must be able to exchange to-device events and media through the same Matrix federation.
- **Local package**: `mindroom desktop run` installs the `desktop` extra when it is missing, unless `MINDROOM_NO_AUTO_INSTALL_TOOLS=1` is set.
To install it in advance, run `uv tool install 'mindroom[desktop]'` on the computer being controlled.
- **macOS applications**: Accessibility permission is required for state and control, and screenshots require macOS 14 or newer and Screen Recording permission.
When `mindroom desktop run` starts from a terminal, macOS attributes both permissions to that terminal app and applies a new grant only after the app is quit and reopened, even if it already appears enabled; inside tmux, also restart the tmux server with `tmux kill-server`.
- **Linux applications**: Only screenshot observation of the `primary-screen` app ID, plus coordinate input during a control lease, is available on an active X11 desktop; Wayland is not supported.
- **Windows applications**: The terminal commands offer the same `primary-screen` observation and coordinate input, which have not been verified on a real Windows computer.
On Linux and Windows, coordinate input is not bound to an app window, so whatever window covers the point receives it.
- **Read-only folders and shell commands**: These need no application selection or macOS permissions, and they require macOS or Linux.
On Windows, `mindroom desktop access` refuses to save them and `mindroom desktop run` refuses to start while either is saved; run `mindroom desktop access --clear-folders --no-shell` to turn them off.
- **Signed-in browser profile** (optional): Node.js 18 or newer, Chrome or Brave, and the official Playwright MCP Bridge extension in the browser profile MindRoom will use.
Application access needs an unlocked graphical session; folder and shell access also work on a headless computer when no applications are selected.
## 1. Configure the Agent
Add the `desktop` tool to a normal or private agent:
```yaml
agents:
computer:
display_name: Computer Agent
role: Operate my locally authorized applications one step at a time
tools:
- desktop:
defer: true
timeout_seconds: 30
```
| Option | Type | Default | Notes |
| --- | --- | --- | --- |
| `timeout_seconds` | number | `30` | From 1 to 120; bounds each call and each shell-output download. `run_shell` always waits up to 120 seconds so the person at the computer has time to decide. |
Never put device identity fields in agent YAML for the `desktop` tool; each user pairs their own computer through chat.
Pairings are already scoped to one requester and one agent, so add `private: {per: user_agent}` only when the agent's whole runtime and state should also be requester-private.
The tool needs a live Matrix room and runs in the primary agent process, so it is unavailable in [OpenAI-compatible API](https://docs.mindroom.chat/openai-api/) runs.
To drive the user's signed-in browser, also configure the [`browser`](https://docs.mindroom.chat/tools/web-scraping-and-browser/#browser) tool with the bridge's device identity and follow [Use the Signed-In Browser Profile](#use-the-signed-in-browser-profile).
## 2. Pair the Computer
1. In a private Matrix room containing only you and one Desktop-enabled agent, plus the router when it serves the command, send `!desktop setup`.
The reply contains setup data for the macOS app, an equivalent `mindroom desktop setup` command, and a short-lived pairing code.
The pairing code is a secret, so MindRoom refuses `!desktop` when any other member or pending invite is in the room or when it cannot confirm the room's membership.
2. In the macOS app, paste the reply's JSON setup data into **Computer access** and follow the [Computer Access steps](https://docs.mindroom.chat/installation/macos-app/#computer-access).
In a terminal, run the full `mindroom desktop setup` command from the reply once; it reuses a saved Desktop Matrix session or logs in first, then claims the pairing.
Add `--allow-app com.apple.TextEdit` to save an app choice at the same time.
3. Copy the printed `!desktop confirm <code> <verification>` command back into the same chat.
The verification value ensures that only the device that claimed the code can confirm it.
Only the same requester with the same agent can confirm or use the pairing.
Until pairing is confirmed, `desktop` calls return a setup-required result while the agent's other tools keep working, and the model cannot register or replace a device itself.
Repeating setup for the same controller keeps saved browser, capture, folder, and shell choices, and keeps app choices unless you supply new app IDs.
Setup for a different controller starts without saved folders or shell access.
If the saved session belongs to a different homeserver or Matrix user than the setup command names, setup exits without pairing; pass `--storage-path` for a separate setup or run `mindroom desktop login --replace`.
The separate `mindroom desktop login` and `mindroom desktop pair` commands remain available for manual recovery.
### Log In Manually
`mindroom desktop login` creates the local Desktop Matrix device.
By default it opens Matrix SSO in the browser when the homeserver offers it and otherwise uses password login; `--login-method password` or `--login-method sso` selects one explicitly.
```bash
# SSO
mindroom desktop login --homeserver https://matrix.example.org
# Password login for a dedicated account such as @my-laptop:example.org
mindroom desktop login \
--user-id @my-laptop:example.org \
--homeserver https://matrix.example.org \
--login-method password
```
Password login requires `--user-id` and prompts for the password with hidden input unless `MINDROOM_DESKTOP_MATRIX_PASSWORD` is set.
During SSO, `--user-id` is an optional identity check, and MindRoom rejects the new session if SSO returns a different Matrix user.
Use `--sso-idp ID` to pick one of several SSO providers, and `--no-open-browser` to print the URL instead of opening it.
MindRoom does not create cross-signing keys for the device; the bridge trusts the exact device ID and Ed25519 key that login prints:
```text
User: @my-laptop:example.org
Device: ABCDEFGHIJ
Ed25519: desktop-device-fingerprint
```
All `mindroom desktop` commands use the `~/.mindroom` runtime regardless of the current directory.
An explicit `--config`, `--storage-path`, `MINDROOM_CONFIG_PATH`, or `MINDROOM_STORAGE_PATH` selects another runtime and must be reused for login, setup, pairing, and `mindroom desktop run`.
On Unix, the bridge refuses to load a saved session file that group or other users can read; keep it owner-only (`0600`).
Run `mindroom desktop login --replace` to replace a saved session with a fresh device.
### Homeservers Behind an Identity-Aware Proxy
For a homeserver protected by Cloudflare Access, install the [`cloudflared` CLI](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) and add `--cloudflare-access` to `mindroom desktop login` or `mindroom desktop setup`:
```bash
mindroom desktop login \
--homeserver https://matrix.example.org \
--cloudflare-access
```
`cloudflared` opens the browser whenever Access needs authentication, and MindRoom never saves the Access token.
The session remembers the choice, so later `mindroom desktop run` commands and the macOS app need no flag.
For a session saved without it, `mindroom desktop run --cloudflare-access` enables Access for that run only.
Two environment variables on the MindRoom server change what `!desktop setup` prints:
- `MINDROOM_DESKTOP_MATRIX_HOMESERVER`: the public Matrix URL local Desktop clients should use when the server reaches Matrix through an internal address; server traffic keeps using `MATRIX_HOMESERVER`.
- `MINDROOM_DESKTOP_CLOUDFLARE_ACCESS=true`: add `--cloudflare-access` to the printed setup command.
For unattended proxies that issue machine credentials instead, put the exact request headers the proxy requires in a JSON object of string keys and values:
```json
{
"X-Access-Client-Id": "client-id",
"X-Access-Client-Secret": "client-secret"
}
```
Restrict the file to its owner and pass it to both login and the bridge, or set `MINDROOM_DESKTOP_MATRIX_HTTP_HEADERS_FILE` to its path:
```bash
chmod 600 ~/.config/mindroom/matrix-http-headers.json
mindroom desktop login \
--user-id @my-laptop:example.org \
--homeserver https://matrix.example.org \
--matrix-http-headers-file ~/.config/mindroom/matrix-http-headers.json
```
MindRoom refuses group-readable or world-readable header files on Unix, adds the headers to every Matrix request the desktop client makes, and does not copy them into the saved session.
During SSO, the browser handles interactive proxy authentication while the header file authenticates the command-line requests.
Accept these machine credentials only for the Matrix endpoints the desktop device needs, keep normal Matrix authentication enabled, and do not combine `--cloudflare-access` with a static `cf-access-token` header.
## 3. Choose Local Access
Applications, read-only folders, and shell commands are saved separately, and the bridge exposes only what is saved.
### Choose Applications
Save applications in the macOS app's **Access** step or with repeated `--allow-app` on `mindroom desktop setup`; `--allow-app` on `mindroom desktop run` applies to that run only.
On macOS, use exact bundle identifiers such as `com.apple.TextEdit` or `com.brave.Browser`; you can look one up without granting access:
```bash
mdls -name kMDItemCFBundleIdentifier /System/Applications/TextEdit.app
```
Add only the applications needed for the current task.
The special app ID `primary-screen` exposes the whole primary display without semantic elements; on Linux and Windows it is the only usable target.
Controlling `primary-screen`, a terminal emulator, a scripting or automation app, or a browser or Matrix client signed in as you hands the agent your own authority, as the [Security Model](#security-model) warning explains.
### Choose Folders and Shell Access from the Terminal
Choose folders and shell access in the macOS app's **Access** step, or save them from the terminal:
```bash
mindroom desktop access --allow-folder ~/Documents/project-notes --shell
```
Repeat `--allow-folder` to add more existing folders, use `--clear-folders` to remove every saved folder, and use `--no-shell` to turn shell requests off.
Omitted options keep the saved values, and the command prints the saved applications, folders, and shell setting.
It requires completed setup and never starts the bridge or grants auto-approval.
## 4. Run the Local Bridge
Start the bridge from the macOS app or with:
```bash
mindroom desktop run
```
The command uses the same saved controller, allowlists, folders, shell setting, browser settings, and capture settings as the macOS app.
Stop the bridge in the interface that started it before switching interfaces.
Saved changes take effect on the next start.
Wait for `Desktop bridge online` before sending work when you need confirmation that startup completed.
Flags override saved settings for one run without changing them; [`mindroom desktop run`](https://docs.mindroom.chat/cli/#desktop-run) lists every option.
`--allow-requester`, `--allow-agent`, and `--allow-app` take exact Matrix user IDs, agent names, and app IDs, can be repeated, and do not accept wildcards.
Changing the controller requires `--controller-user-id`, `--controller-device-id`, `--controller-ed25519`, and all three allowlist options, and such a run starts without saved folders or shell access.
The `!desktop confirm` reply prints a `mindroom desktop run` command with these values filled in except the app ID.
### Grant Application Control
Applications start observe-only.
To allow input, a person at the computer grants a control lease with **Grant Control…** in the macOS app or by restarting the terminal bridge with `--allow-control`:
```bash
mindroom desktop run --allow-control --lease-minutes 15
```
`--lease-minutes` defaults to 15 and accepts 1 to 60.
After the lease expires, the bridge keeps observing but rejects every control action until a person grants another lease.
The macOS app can grant or revoke without restarting; the terminal requires a new invocation.
Leases are never saved or renewed automatically, so a restarted bridge is observe-only again.
### Approve Shell Commands in the Terminal
With shell requests saved, each command appears in the terminal running `mindroom desktop run` with its requester, agent, working directory, length, expiry, and command, and waits for one answer:
```text
[a]pprove once, [r]eject, [5]/[15]/[60] minutes, [u]ntil stopped:
```
If standard input is not an interactive terminal or the bridge runs as a background job, requests are rejected with guidance instead of waiting.
Start with `--shell-auto-approve-minutes`, from 1 to 60, to approve commands without asking for part of the run; this requires saved shell access and is never saved.
The terminal has no separate revoke command; press `Ctrl+C` to stop the bridge instead.
See [Local Approval](#local-approval) for what each choice covers.
### Use the Signed-In Browser Profile
The `browser` tool's desktop target drives the user's real browser profile through the official [Playwright MCP Bridge extension](https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm).
Install the extension in the local browser profile, then start the bridge with `--browser-extension`.
The bridge also needs at least one allowed application, saved or passed with `--allow-app`; without one, starting browser control fails with `Desktop GUI is unavailable for browser control`.
For Brave on macOS, also pass its executable and user-data root:
```bash
mindroom desktop run \
--allow-control \
--browser-extension \
--browser-executable "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser" \
--browser-user-data-dir "$HOME/Library/Application Support/BraveSoftware/Brave-Browser"
```
For Chrome, omit the two path options to use normal Chrome discovery, or provide the matching Chrome paths.
`browser_control(action="start", target="desktop")` requires the local control lease, starts Playwright MCP locally through `npx`, and opens the extension's connection page, where the user chooses an initial tab.
To reconnect after bridge restarts without another browser prompt, store the reconnect token that page shows as `PLAYWRIGHT_MCP_EXTENSION_TOKEN` in the local MindRoom `.env` file with owner-only permissions.
Treat that token as a browser-control credential, never commit it, and regenerate it from the extension page if it is exposed.
See [`browser`](https://docs.mindroom.chat/tools/web-scraping-and-browser/#browser) for the desktop target's configuration and supported actions.
For app-level control of the browser window, or for Safari and other browsers, allowlist the browser as an application.
## Security Model
- **Control is local**: Applications are observe-only until a person at the computer grants a control lease in the macOS app's **Computer access** section or the local terminal.
- **Exact identities**: The bridge accepts commands only from the paired cloud agent device, for locally allowed requesters, agents, and apps, and rejects expired or replayed commands.
- **Local allowlists**: Only applications selected locally can be listed, launched, inspected, captured, or controlled.
An allowed app can still open a link or document in another app, which the bridge cannot then inspect or control unless that app is also allowlisted.
Allowlisting a browser exposes whichever window and tab is selected, not one website.
- **MindRoom is excluded**: MindRoom itself (`chat.mindroom.menubar`) and its desktop helper (`chat.mindroom.desktophelper`) can never be allowlisted, because their windows grant shell auto-approval, control leases, and app access.
- **No remote authority**: Cloud configuration, chat messages, and model output cannot enable control, extend a lease, change local allowlists or folders, enable shell commands, or approve one.
- **Emergency stop**: Moving the pointer to the upper-left corner of the primary display stops control and keeps it off until the bridge restarts or a person selects **Reset Emergency Stop** in the macOS app; the reset does not grant control.
- **Local audit log**: The bridge logs each completed or rejected command without its parameters, values, or typed text.
- **One bridge per session**: While a shell command waits for local approval, the bridge refuses every control action except `launch_app`, so its own agents cannot click or type into the approval.
Another bridge's agents could, so run at most one bridge in each logged-in graphical session.
- **Not exposed**: The bridge offers no clipboard, microphone, webcam, unlock, privilege elevation, or arbitrary local RPC, and it cannot bypass operating-system permission prompts.
!!! warning "Some allowlisted apps give an agent your own authority"
Controlling a terminal emulator, a scripting or automation app such as Script Editor, Shortcuts, or Automator, or the `primary-screen` target lets an agent run anything your account can, without any shell approval.
The agent can type commands into a terminal or script, and `primary-screen` input reaches whatever app is under the pointer or has focus, including MindRoom's own windows while no shell request is pending.
Controlling a web browser or Matrix client signed in as you, such as MindRoom Chat in a browser or Element, or a browser with a local MindRoom dashboard session, lets an agent act as you: it can answer its own Matrix tool approvals, send `!` commands, and instruct other agents.
Allowlist these only when you would also approve everything the agent could run or send as you.
Enabling the browser extension grants access to every tab and the signed-in state of the connected profile, not one tab or origin.
It is not a network sandbox: MindRoom validates URLs passed to `open`, but redirects and page scripts keep the profile's normal network reach.
### What Leaves the Computer
The Matrix homeserver sees routing metadata, timing, and encrypted media size, but not commands, screenshots, file contents, or output.
Accessibility state, screenshots, file contents, and command output become model input in the cloud, so your model provider receives them.
Accessibility data can include labels, document text, and form values not obvious from the screenshot; macOS secure text fields are suppressed and cannot be changed semantically.
Screenshots and other results can remain in agent session storage, tool traces, and automatically saved workspace files, so protect and expire that storage according to the sensitivity of the controlled applications.
Action arguments, shell commands, and paths appear in model context, approval cards, and Matrix tool traces, so never use `set_value`, `type_text`, or `run_shell` with passwords, tokens, recovery codes, or other secrets.
Screenshots, labels, web content, file contents, and command output are untrusted data and are never user authorization or instructions.
Locally, the bridge keeps command arguments and outcomes, including shell commands, file text, and inline shell output, in the owner-only `<storage>/desktop_bridge/commands.sqlite3`; it stores no plaintext screenshots.
## Applications
On macOS, `get_app_state` returns the app's accessibility tree with roles, names, values, bounds, and available actions, plus a screenshot of the app window.
The agent normally acts on an element from that state instead of guessing a coordinate, and every completed action returns fresh state for the next step.
Taking a screenshot on macOS brings the selected app to the front.
Observation actions are `status` (screen, lease, enabled capabilities, pending shell request, auto-approval time, and the caller's shell handles), `list_apps`, `get_app_state`, `screenshot`, and `request_status` (see [Uncertain Outcomes](#uncertain-outcomes)).
With `return_attachment=true`, `screenshot` also returns an `att_*` handle that `matrix_message` can send in the same turn.
Control actions require a control lease:
- `launch_app` launches or foregrounds one allowlisted app.
- `click_element`, `perform_action`, `scroll_element`, and `set_value` act on an element from the latest state; `set_value` works only on elements that report they are writable.
- `click`, `double_click`, `hover`, and `drag` use coordinates from `0` to `1000` inside the app window, not raw screen pixels, and `scroll` scrolls a bounded number of pages.
- `type_text` types up to 2,000 characters; line breaks and tabs need an element target, otherwise send Enter or Tab with `keypress`.
- `keypress` supports navigation keys, shift plus navigation, command or ctrl plus a, c, x, v, z, or f, and command or ctrl plus shift plus z.
App-switching, quit, launch, and address-bar shortcuts are rejected because they could reach apps outside the allowlist.
Pass `observation="tree"` to skip the screenshot when semantic state is enough, or `observation="screenshot"` to omit the element list; the default is `both`.
Element references expire after 120 seconds or when the app's window or target element changes; when the bridge reports stale state, observe again instead of reusing the old reference or coordinate.
Coordinate input, typing without an element, `scroll`, and `keypress` need a fresh, complete, stable observation, so let the UI settle and observe again first.
On macOS, keyboard input fails if the app has lost focus, and pointer input fails if another window, such as a notification banner, floating panel, or Picture in Picture, covers the target point.
Windows on secondary displays are supported when the window lies on one display; move a window that spans displays fully onto one.
## Read-Only Folders
The agent can list and read inside locally selected folders, and it cannot write, create, rename, or delete anything there.
- `list_folders` returns an ID, name, and absolute path for each selected folder.
- `list_directory` takes a folder `root_id` and an optional relative `path` and returns at most 200 entries.
- `read_file` takes a `root_id` and relative `path` and returns at most 16 KiB of UTF-8 text per call, continuing from an `offset` for longer files.
Paths are relative to the selected folder, and symbolic links are never followed, so nothing outside the folder can be reached.
Only regular UTF-8 text files are read; binary files and other file types are rejected.
Local file permissions still apply, and macOS may still ask before MindRoom reads protected folders such as Desktop, Documents, or Downloads; MindRoom never requests Full Disk Access.
A saved folder that no longer exists makes startup fail with `Cannot open local folder`.
## Shell Commands
!!! warning "Shell commands run with your full account access"
An approved command runs as your user account, with the network and every file that account can read or change, including files outside the selected folders.
Neither the selected folders nor the working directory confine it, and it is not a sandbox.
Approve only commands you would run yourself, and run the bridge in a dedicated operating-system account when you need stronger isolation.
Enable shell requests locally with **Allow shell command requests** in the macOS app's **Access** step or with `mindroom desktop access --shell`.
- `run_shell` runs `command`, up to 8,192 characters, with `/bin/sh -c` in `cwd`, an absolute local directory that defaults to the home directory.
`timeout_seconds`, from 1 to 60 with a default of 30, is how long the call waits for the command to finish before returning a handle.
- `check_shell` returns a handle's newest output while it runs, and its complete output and exit code once it finishes.
Pass `offset=0` to read a running command's output from the beginning, then continue from the returned `next_offset`.
- `kill_shell` asks a handle's command to terminate, or kills it immediately with `force=true`.
Commands or working directories padded with long runs of whitespace, invisible characters, blank lines, or combining marks are refused before approval, because padding could hide part of the request from the approver.
### Local Approval
Every `run_shell` request waits for a decision from the person at the computer, on the macOS app's approval card or at the `mindroom desktop run` terminal prompt, unless auto-approval is active.
The approver sees the exact command, working directory, requester, agent, expiry, and command length, with invisible and control characters escaped and a warning for look-alike non-ASCII characters.
The choices are reject, approve once, or approve and also auto-approve later commands for 5, 15, or 60 minutes or until shell access is revoked or the bridge stops.
A chat message, the agent, or cloud configuration cannot approve a command or grant auto-approval.
A request nobody answers within 120 seconds expires, and rejected or expired requests never run.
!!! warning "Auto-approval covers every allowed caller"
Timed and until-stopped auto-approval approves every shell command from all locally allowed requesters and agents, not only the command that prompted it.
Auto-approval is never saved: it ends when its time runs out, when you revoke shell access, or when the bridge stops, and a restarted bridge asks for each command again.
In the macOS app, **Allow Without Asking…** grants auto-approval before any request arrives; in the terminal, use `--shell-auto-approve-minutes`.
Revoking shell access or stopping the bridge also rejects a waiting request and kills every running command.
### Handles
A command still running after its inline wait keeps running as a handle; the agent polls it with `check_shell` and stops it with `kill_shell`.
Handles belong to the requester and agent that started them, and checking or killing your own handle needs no approval.
The macOS app lists every handle with its requester, agent, command preview, elapsed time, and state, and can kill running ones.
TDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

