Skip to main content

Overview

An agent in Mux owns two things for a given turn:
  • System prompt — what the assistant is and how it should behave
  • Tool policy — which tools it can call (and which it must call)
The same definition can be used in two places:
  • Selected in the UI as the workspace’s current mode (Exec, Plan, or your own)
  • Spawned via the task tool as a subagent in a child workspace
An agent definition is a Markdown file: YAML frontmatter declares metadata, policy, and AI defaults; the body becomes the agent’s instruction prompt.

Quick Start

Drop a Markdown file in .mux/agents/ (project) or ~/.mux/agents/ (global):
The filename (without .md) is the agent id, used by base: and task({ agentId }). IDs must match ^[a-z0-9]+(?:[a-z0-9_-]*[a-z0-9])?$ (1–64 chars, lowercase). Switch agents in the UI: Cmd/Ctrl+Shift+A opens the agent picker; Cmd/Ctrl+. cycles through visible agents.

Discovery and Precedence

Mux scans three roots, non-recursive (only direct .md children):
LocationScopePriority
.mux/agents/*.mdProjectHighest
~/.mux/agents/*.mdGlobalMedium
Built-inSystemLowest
Higher-priority definitions override lower-priority ones with the same id. Definitions larger than 1 MB are rejected at parse time. Filenames that don’t match the id schema are skipped with a warning.

File Format

Frontmatter

Markdown body

The body becomes the agent’s instruction prompt, layered with Mux’s base prelude, the workspace environment context, and AGENTS.md.
  • With prompt.append: true (default), a child’s body is appended to its base’s body, separated by a blank line.
  • With prompt.append: false, the child’s body replaces the base’s body. Tool policy, AI defaults, and other frontmatter still inherit normally.

Inheritance and Tool Policy

Base resolution

base: <id> walks the same discovery roots, with two non-obvious rules:
  • Same name as the current file — Mux skips the current file’s scope, so a project exec.md with base: exec resolves to the global or built-in exec (not itself).
  • Different name — Mux anchors the lookup at the current scope or lower. A built-in’s base: foo cannot pull in a project-level foo.md.
The chain is followed up to 10 levels deep. Cycles are detected and logged.

Tool patterns are anchored regex

Patterns in tools.add and tools.remove are regular expressions implicitly anchored as ^pattern$. task_.* matches task_await but not task — list task separately if you need both. If no agent in the resolved chain declares any tools, the agent has no tools.

Layer ordering

For each layer in the chain, from base → child:
  1. Apply every tools.add pattern as enable.
  2. Apply every tools.remove pattern as disable.
  3. If tools.require is present, the last literal entry becomes that layer’s effective required tool; child layers fully replace base layers.
Later rules win, so a child’s remove can drop something the base enabled, and a child’s add can re-enable something the base removed.

tools.require semantics

require is not the same as add:
  • It enables the tool and forces the model to emit a call to it this turn.
  • The value must be a literal tool name. Regex metacharacters cause the entry to be dropped silently.
  • Only one tool can be required per turn. Multiple entries collapse to the last one; child layers fully override the base layer.
  • The required tool must be one the agent is otherwise allowed to call — subagent hard-denies still apply.

Runtime restrictions

These rules are applied last and cannot be overridden by frontmatter:
ConditionEffect
Subagent workspaceask_user_question is disabled.
Subagent + plan-like chainpropose_plan is required, agent_report is disabled.
Subagent + non-plan chainagent_report is available for incremental updates, propose_plan is disabled.
Task depth ≥ Max Task Nesting Depthtask and task_.* are disabled.
Plan agent calling taskOnly agentId: "explore" may be spawned.
Plan agent editing filesfile_edit_* is restricted to the plan file path.
A chain is “plan-like” when the resolved tool policy enables propose_plan.

Disabling and Extending Built-ins

Disable a built-in by creating a same-name file with disabled: true:
exec, plan, and compact are always enabled and cannot be disabled this way. Extend a built-in by giving your file the same id and using base:
This works because same-name base resolution skips the current scope. Use it to add repo-specific guidance (CI commands, test patterns) without copying the built-in body.

Using Agents

As the workspace agent

Switch via the agent picker in the chat input, Cmd/Ctrl+Shift+A, or Cmd/Ctrl+. to cycle. If a workspace’s stored agent has been disabled or deleted, top-level workspaces silently fall back to exec; subagent workspaces error out instead.

As a subagent via the task tool

For the normal task tool, the agent must have subagent.runnable: true. Workflow-owned agent steps may also use agents with subagent.workflow_runnable: true, such as the built-in Plan agent. Subagents see the body plus subagent.append_prompt. Non-plan subagents complete with their final assistant message and may call agent_report multiple times for incremental parent wake-ups; plan-like chains still complete via propose_plan.

Run-context AI defaults

Each agent has two independent default slots, configured in Settings → Agents:
  • UI defaults (agentAiDefaults) — used when you select the agent in the workspace.
  • Subagent defaults (subagentAiDefaults) — used when the agent is spawned via task.
Subagent defaults inherit per field from UI defaults; UI defaults inherit per field from the agent’s frontmatter ai block. You can override one field (e.g. only thinkingLevel) and leave the other inherited. Subagent settings are resolved at task creation and frozen on the child workspace. Changing defaults later only affects future spawns.

Examples

Security audit (read-only)

Documentation-only

Built-in Agents

Exec

Implement changes in the repository

Plan

Create a plan before coding

Compact (internal)

History compaction (internal)

Desktop (internal)

Visual desktop automation agent for GUI-heavy, screenshot-intensive workflows

Dream (internal)

Background memory consolidation (internal)

Explore (internal)

Read-only exploration of repository, environment, web, etc. Useful for investigation before making changes.

Name Workspace (internal)

Generate workspace name and title from user message