@-mention autocomplete in the chat composer

Overview

The chat composer supports @ autocomplete: typing @ followed by text shows a popup listing files, agents, project actions, native tools, MCP tools, and the current model. Actions, native tools, and MCP server tools have separate categories so their roles remain clear. The user can select an item with the keyboard (Arrow keys + Enter/Tab) or a tap, and the selection is inserted as @<item> into the composer text.

Usage

Direct agent invocation

When the composer text starts with @ followed by a defined agent name and a non-empty task, pressing Enter dispatches that agent directly via POST /api/tools/subagent — no model round-trip decides whether to delegate:

@reviewer Check the staged changes for regressions.

The run renders as a subagent tool_call/tool_result card pair (like @shell), and the agent's final text is appended to the transcript as an assistant message so it persists across reloads. The call passes through the same authorization gate as a model-initiated subagent call, and honors the agent's tool allowlist and model pin. A leading @<agent> with no task, or an @ in the middle of the text, falls through to a normal model send.

Direct tool invocation with arguments

When the composer text starts with @ followed by a directly-invocable tool name (shell or MCP tool), pressing Enter dispatches the tool immediately instead of sending the message to the model. Supported argument formats:

FormatExampleResult
JSON@mcp__fs__list { "path": "/etc" }{ path: "/etc" }
key=value@mcp__fs__read path=/etc recursive=true{ path: "/etc", recursive: true }
Picker syntax@mcp__fs__read:path=`/etc/my file`{ path: "/etc/my file" }
Positional@shell ls -la{ cmd: "ls -la" } (shell only)

Rules:

The popup is a mixed list, filtered either by the category bar at the top or by typing a query. The categories are defined in frontend/src/components/chat/atMention.js (CATEGORY).

SectionSource
FilesTagged files from .mouaif.json (via GET /api/projects/:id/tags), then scanned files from POST /api/projects/:id/tags/scan
AgentsProject agents (GET /api/agents?projectDir=…)
ActionsProject custom actions from GET /api/actions?projectDir=…
ToolsNative entries from the project tool catalog (state.tools.catalog)
MCPkind: "mcp" entries from the project tool catalog, grouped separately from Actions and Tools
ModelCurrent chat model (state.chat.modelId)