Skip to content

Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.

feat(commands): one slash-command catalog for every surface, with descriptions

Salman Qureshi4d48ef894d73
diff --git a/src/autocomplete-sync.test.ts b/src/autocomplete-sync.test.ts
index c2ed37df..f3494df9 100644
--- a/src/autocomplete-sync.test.ts
+++ b/src/autocomplete-sync.test.ts
@@ -6,7 +6,7 @@ import { dirname, join } from 'node:path';
// This test lives in src/, so dirname is already the src directory.
const root = dirname(fileURLToPath(import.meta.url));
const appSrc = readFileSync(join(root, 'ui', 'App.tsx'), 'utf8');
-const composerSrc = readFileSync(join(root, 'ui', 'input-composer.tsx'), 'utf8');
+const slashListSrc = readFileSync(join(root, 'core', 'commands', 'slash-list.ts'), 'utf8');
const attachSrc = readFileSync(join(root, 'ui', 'attach-tui.tsx'), 'utf8');
const manualSrc = readFileSync(join(root, 'utils', 'manual.ts'), 'utf8');
@@ -35,7 +35,7 @@ describe('slash autocomplete & help stay in sync', () => {
'/code chat',
'/code back',
]) {
- expect(composerSrc).toContain(`'${cmd}'`);
+ expect(slashListSrc).toContain(`'${cmd}'`);
}
});
diff --git a/src/core/commands/catalog.test.ts b/src/core/commands/catalog.test.ts
new file mode 100644
index 00000000..ab0204b2
--- /dev/null
+++ b/src/core/commands/catalog.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from 'vitest';
+import { commandCatalog } from './catalog.js';
+import { SLASH_COMMANDS } from './slash-list.js';
+
+/** The desktop's "/" picker offers every command the terminal does, with the manual's words. */
+describe('command catalog', () => {
+ const catalog = commandCatalog();
+ const find = (cmd: string) => catalog.find((c) => c.command === cmd);
+
+ it('has every canonical command, in order, marking the ones that take an argument', () => {
+ expect(catalog.map((c) => c.command)).toEqual([...SLASH_COMMANDS]);
+ expect(find('/bots create ')?.takesArgument).toBe(true);
+ expect(find('/help')?.takesArgument).toBe(false);
+ });
+
+ it('describes commands from the manual, by their words before any argument', () => {
+ expect(find('/help')?.description).toBe('Show this manual');
+ expect(find('/models use ')).toMatchObject({ usage: '/models use <provider>' });
+ expect(find('/models use ')?.description).toBeTruthy();
+ // Most commands are documented; an undocumented one still appears, without words.
+ const described = catalog.filter((c) => c.description).length;
+ expect(described / catalog.length).toBeGreaterThan(0.6);
+ });
+
+ it('adds the commands running plugins contribute, once, after Mercury\'s own', () => {
+ const withPlugins = commandCatalog([{ name: 'weather', description: 'Forecast for a city', plugin: 'Weather' }, { name: 'help', description: 'shadow', plugin: 'Bad' }]);
+ expect(withPlugins.at(-1)).toMatchObject({ command: '/weather ', description: 'Forecast for a city', source: 'plugin', plugin: 'Weather' });
+ expect(withPlugins.filter((c) => c.command.trim() === '/help')).toHaveLength(1);
+ });
+});
diff --git a/src/core/commands/catalog.ts b/src/core/commands/catalog.ts
new file mode 100644
index 00000000..e10e5623
--- /dev/null
+++ b/src/core/commands/catalog.ts
@@ -0,0 +1,58 @@
+import { SLASH_COMMANDS } from './slash-list.js';
+import { CHAT_COMMAND_HELP } from '../../utils/manual.js';
+
+/**
+ * The "/" picker's catalog: every slash command a surface can offer, with
+ * what it does. The commands are the canonical list (the terminal's), the
+ * descriptions are the manual's, and plugins add their own commands.
+ */
+export interface CommandEntry {
+ /** What the picker inserts, e.g. "/bots create " (a trailing space: it takes an argument). */
+ command: string;
+ /** How it reads, e.g. "/bots create <id> <name>". */
+ usage: string;
+ description: string;
+ takesArgument: boolean;
+ source: 'mercury' | 'plugin';
+ /** The plugin that adds it. */
+ plugin?: string;
+}
+
+/** "/models use <provider>" → "/models use": the words before the first argument or choice. */
+function keyOf(usage: string): string {
+ const words: string[] = [];
+ for (const w of usage.trim().split(/\s+/)) {
+ if (/[<[|]/.test(w)) break;
+ words.push(w);
+ }
+ return words.join(' ');
+}
+
+export function commandCatalog(pluginCommands: Array<{ name: string; description: string; plugin: string }> = []): CommandEntry[] {
+ const help = new Map<string, { usage: string; description: string }>();
+ for (const [usage, description] of CHAT_COMMAND_HELP) {
+ const key = keyOf(usage);
+ if (key.startsWith('/') && !help.has(key)) help.set(key, { usage, description });
+ }
+ const describe = (command: string) => {
+ const words = command.trim().split(/\s+/);
+ // The command itself, else its nearest documented parent ("/session archive" → "/session").
+ for (let n = words.length; n > 0; n--) {
+ const hit = help.get(words.slice(0, n).join(' '));
+ if (hit) return n === words.length ? hit : { usage: command.trim(), description: hit.description };
+ }
+ return { usage: command.trim(), description: '' };
+ };
+ const out: CommandEntry[] = SLASH_COMMANDS.map((command) => {
+ const d = describe(command);
+ return { command, usage: d.usage, description: d.description, takesArgument: command.endsWith(' '), source: 'mercury' as const };
+ });
+ const seen = new Set(out.map((c) => c.command.trim()));
+ for (const p of pluginCommands) {
+ const command = `/${p.name}`;
+ if (seen.has(command)) continue;
+ seen.add(command);
+ out.push({ command: `${command} `, usage: `${command} …`, description: p.description, takesArgument: true, source: 'plugin', plugin: p.plugin });
+ }
+ return out;
+}
diff --git a/src/core/commands/slash-list.ts b/src/core/commands/slash-list.ts
new file mode 100644
index 00000000..1b315b4e
--- /dev/null
+++ b/src/core/commands/slash-list.ts
@@ -0,0 +1,145 @@
+/**
+ * The canonical slash-command list: what every Mercury surface offers after
+ * "/" — the terminal (main TUI and attach TUI, via ui/input-composer.tsx) and
+ * the desktop app (GET /api/chat/commands). A plain module, no UI imports, so
+ * the web server can serve it. An entry ending in a space takes an argument.
+ */
+export const SLASH_COMMANDS: readonly string[] = [
+ '/help',
+ '/whatsnew',
+ '/update ignore',
+ '/log',
+ '/sessions',
+ '/session new',
+ '/session current',
+ '/session ',
+ '/session archive ',
+ '/session delete ',
+ '/bots',
+ '/bots list',
+ '/bots open ',
+ '/bots create ',
+ '/bots send ',
+ '/bots persona ',
+ '/bots budget ',
+ '/bots edit ',
+ '/bots delete ',
+ '/bots journal ',
+ '/bots inbox ',
+ '/bots storage',
+ '/bots enable ',
+ '/bots disable ',
+ '/bots stop ',
+ '/bots stop all',
+ '/bots start ',
+ '/bots start all',
+ '/bots run ',
+ '/bots cost',
+ '/bots show ',
+ '/bots outputs',
+ '/bots folder ',
+ '/bots fetch ',
+ '/bots tasks ',
+ '/bots dlq',
+ '/bots dlq clear',
+ '/bots replay ',
+ '/bots crew ',
+ '/bots promote ',
+ '/bots demote ',
+ '/bots permissions ',
+ '/bots add-crew ',
+ '/bots remove-crew ',
+ '/bots export ',
+ '/bots import ',
+ '/bots doctor',
+ '/bots help',
+ '/status',
+ '/progress',
+ '/menu',
+ '/chat',
+ '/code',
+ '/code plan',
+ '/code execute',
+ '/code build',
+ '/code diff',
+ '/code init',
+ '/code workspace',
+ '/code agent ',
+ '/code off',
+ '/code toggle',
+ '/code exit',
+ '/code chat',
+ '/code back',
+ '/research',
+ '/research on',
+ '/research off',
+ '/research toggle',
+ '/research ',
+ '/spotify',
+ '/budget',
+ '/permissions',
+ '/memory',
+ '/models',
+ '/models use ',
+ '/cloud',
+ '/cloud models',
+ '/cloud use ',
+ '/agents',
+ '/agents stop ',
+ '/agents pause ',
+ '/agents resume ',
+ '/bg',
+ '/bg current',
+ '/bg list',
+ '/bg cancel ',
+ '/bg clear',
+ '/bg killall',
+ '/stop',
+ '/halt',
+ '/reset',
+ '/tools',
+ '/mcp',
+ '/mcp tools ',
+ '/skills',
+ '/skills search ',
+ '/skills view ',
+ '/skills install ',
+ '/skills remove ',
+ '/skills help',
+ '/call ',
+ '/calls',
+ '/calls cancel ',
+ '/plugins',
+ '/plugins search ',
+ '/plugins info ',
+ '/plugins install ',
+ '/plugins enable ',
+ '/plugins disable ',
+ '/plugins update',
+ '/plugins rollback ',
+ '/plugins uninstall ',
+ '/plugins set ',
+ '/plugins pair ',
+ '/plugins unlink ',
+ '/plugins help',
+ '/stream',
+ '/saver',
+ '/saver on',
+ '/saver off',
+ '/saver toggle',
+ '/saver threshold ',
+ '/saver auto on',
+ '/saver auto off',
+ '/saver routing on',
+ '/saver routing off',
+ '/view',
+ '/view balanced',
+ '/view detailed',
+ '/ws',
+ '/ws open ',
+ '/ws exit',
+ '/ws refresh',
+ '/ws stage all',
+ '/ws commit ',
+ '/ws help',
+] as const;
diff --git a/src/plugins/manager.ts b/src/plugins/manager.ts
index 3235b6b8..f21cb4f8 100644
--- a/src/plugins/manager.ts
+++ b/src/plugins/manager.ts
@@ -543,6 +543,11 @@ export class PluginManager {
}
}
+ /** Slash commands the running plugins add, for the "/" picker. */
+ commandHelp(): Array<{ name: string; description: string; plugin: string }> {
+ return [...this.running.values()].flatMap((r) => r.manifest.contributes.commands.map((c) => ({ name: c.name, description: c.description, plugin: r.manifest.name })));
+ }
+
// ── devices (the app's microphone and permissions screen) ────────────
/** Plugins that use this computer (`permissions.desktop`) and are running. */
diff --git a/src/ui/input-composer.tsx b/src/ui/input-composer.tsx
index 46c12482..e7726c0e 100644
--- a/src/ui/input-composer.tsx
+++ b/src/ui/input-composer.tsx
@@ -20,150 +20,9 @@ import stringWidth from 'string-width';
// ─── Canonical command list ─────────────────────────────────────────────────
-/**
- * Canonical slash-command list, shared by the main TUI (App.tsx) and the
- * attach TUI. Kept deliberately as a plain exported constant so the
- * autocomplete-sync contract test can assert on it.
- */
-export const SLASH_COMMANDS: readonly string[] = [
- '/help',
- '/whatsnew',
- '/update ignore',
- '/log',
- '/sessions',
- '/session new',
- '/session current',
- '/session ',
- '/session archive ',
- '/session delete ',
- '/bots',
- '/bots list',
- '/bots open ',
- '/bots create ',
- '/bots send ',
- '/bots persona ',
- '/bots budget ',
- '/bots edit ',
- '/bots delete ',
- '/bots journal ',
- '/bots inbox ',
- '/bots storage',
- '/bots enable ',
- '/bots disable ',
- '/bots stop ',
- '/bots stop all',
- '/bots start ',
- '/bots start all',
- '/bots run ',
- '/bots cost',
- '/bots show ',
- '/bots outputs',
- '/bots folder ',
- '/bots fetch ',
- '/bots tasks ',
- '/bots dlq',
- '/bots dlq clear',
- '/bots replay ',
- '/bots crew ',
- '/bots promote ',
- '/bots demote ',
- '/bots permissions ',
- '/bots add-crew ',
- '/bots remove-crew ',
- '/bots export ',
- '/bots import ',
- '/bots doctor',
- '/bots help',
- '/status',
- '/progress',
- '/menu',
- '/chat',
- '/code',
- '/code plan',
- '/code execute',
- '/code build',
- '/code diff',
- '/code init',
- '/code workspace',
- '/code agent ',
- '/code off',
- '/code toggle',
- '/code exit',
- '/code chat',
- '/code back',
- '/research',
- '/research on',
- '/research off',
- '/research toggle',
- '/research ',
- '/spotify',
- '/budget',
- '/permissions',
- '/memory',
- '/models',
- '/models use ',
- '/cloud',
- '/cloud models',
- '/cloud use ',
- '/agents',
- '/agents stop ',
- '/agents pause ',
- '/agents resume ',
- '/bg',
- '/bg current',
- '/bg list',
- '/bg cancel ',
- '/bg clear',
- '/bg killall',
- '/stop',
- '/halt',
- '/reset',
- '/tools',
- '/mcp',
- '/mcp tools ',
- '/skills',
- '/skills search ',
- '/skills view ',
- '/skills install ',
- '/skills remove ',
- '/skills help',
- '/call ',
- '/calls',
- '/calls cancel ',
- '/plugins',
- '/plugins search ',
- '/plugins info ',
- '/plugins install ',
- '/plugins enable ',
- '/plugins disable ',
- '/plugins update',
- '/plugins rollback ',
- '/plugins uninstall ',
- '/plugins set ',
- '/plugins pair ',
- '/plugins unlink ',
- '/plugins help',
- '/stream',
- '/saver',
- '/saver on',
- '/saver off',
- '/saver toggle',
- '/saver threshold ',
- '/saver auto on',
- '/saver auto off',
- '/saver routing on',
- '/saver routing off',
- '/view',
- '/view balanced',
- '/view detailed',
- '/ws',
- '/ws open ',
- '/ws exit',
- '/ws refresh',
- '/ws stage all',
- '/ws commit ',
- '/ws help',
-] as const;
+// The list lives in a plain module so the web API (the desktop's / picker) serves the same one.
+export { SLASH_COMMANDS } from '../core/commands/slash-list.js';
+import { SLASH_COMMANDS } from '../core/commands/slash-list.js';
/** Suggestion cap for the slash picker. */
const MAX_SUGGESTIONS = 5;
diff --git a/src/utils/manual.ts b/src/utils/manual.ts
index fc15b072..4a9e20cf 100644
--- a/src/utils/manual.ts
+++ b/src/utils/manual.ts
@@ -1,5 +1,164 @@
import chalk from 'chalk';
+/** In-chat commands and what they do: the manual's table, and the descriptions in the desktop's / picker. */
+export const CHAT_COMMAND_HELP: ReadonlyArray<readonly [string, string]> = [
+ ['/bots', 'List your bots and fleets with their state'],
+ ['/bots list', 'List your bots and fleets with their state'],
+ ['/bots open <id>', "Open a bot's own chat"],
+ ['/bots create <id> "Name" "Description"', 'Create a bot (then set its persona, permissions, fleet and budget)'],
+ ['/bots send <id> <message>', 'Give a bot a task'],
+ ['/bots persona <id> <text>', "Replace a bot's persona"],
+ ['/bots budget <id> <tokens|suggest|none>', "Set a bot's daily token budget"],
+ ['/bots edit <id> <field> <value>', 'Change one setting: name, description, model, memory, tools, autonomy'],
+ ['/bots delete <id>', 'Delete a bot (a lead takes its crew with it)'],
+ ['/bots journal <id>', "A bot's recent runs and what each produced"],
+ ['/bots inbox <id>', "Mail waiting in a bot's mailbox"],
+ ['/bots storage', 'Disk used by each bot'],
+ ['/bots enable <id>', 'Turn a bot on'],
+ ['/bots disable <id>', 'Turn a bot off'],
+ ['/bots stop <id>', 'Stop a bot now and hold its queued work'],
+ ['/bots stop all', 'Stop every bot'],
+ ['/bots start <id>', 'Start a stopped bot again'],
+ ['/bots start all', 'Start every stopped bot'],
+ ['/bots run <id>', 'Run a bot now'],
+ ['/bots cost', 'Token spend per bot'],
+ ['/bots show <id> [runId]', 'What a run did: its tool steps and reply'],
+ ['/bots outputs', 'Files your bots delivered'],
+ ['/bots folder <id>', "Open a bot's deliverables folder"],
+ ['/bots fetch <id> [name|latest]', 'Send a delivered file to this chat'],
+ ['/bots tasks <leadId>', 'Tasks a fleet lead handed out, and what came back'],
+ ['/bots dlq', 'Runs that failed for good (dead-letter queue)'],
+ ['/bots dlq clear', 'Clear the dead-letter queue'],
+ ['/bots replay <id> <jobId>', 'Run a dead-lettered job again'],
+ ['/bots crew <leadId>', "A fleet lead's crew"],
+ ['/bots promote <id>', 'Make a bot a fleet lead'],
+ ['/bots demote <id>', 'Make a fleet lead a bot on its own again'],
+ ['/bots permissions <id> [tier]', "Show or set a bot's permission level"],
+ ['/bots add-crew <leadId> <id> "Name" "Description" "persona"', 'Add a crew member to a fleet'],
+ ['/bots remove-crew <leadId> <id>', 'Remove a crew member from a fleet'],
+ ['/bots export <id>', 'Export a bot as a bundle'],
+ ['/bots import <file>', 'Import a bot bundle'],
+ ['/bots doctor', 'Check bots for problems and suggest fixes'],
+ ['/bots help', 'All bot commands'],
+ ['/cloud', 'Mercury Cloud status and models'],
+ ['/ws', 'Workspace IDE mode: the file tree and git panel'],
+ ['/ws help', 'Workspace IDE commands'],
+ ['/start', 'Start Telegram pairing or request Telegram access'],
+ ['/pair', 'Start Telegram pairing or request Telegram access'],
+ ['/', 'Open the CLI command picker with arrow-key navigation'],
+ ['/menu', 'Open the CLI command picker with arrow-key navigation'],
+ ['/whatsnew', "See what's new in this Mercury version"],
+ ['/update ignore', 'Silence the offered update notice permanently'],
+ ['/help', 'Show this manual'],
+ ['/status', 'Show config and budget info'],
+ ['/sessions', 'List active canonical sessions'],
+ ['/session new', 'Create and switch to a new session'],
+ ['/session <ref>', 'Switch by UUID/prefix/alias'],
+ ['/session current', 'Show the current session'],
+ ['/session archive <ref>', 'Archive a session'],
+ ['/session delete <ref>', 'Permanently delete a session after confirmation'],
+ ['/progress', 'Show live status for the current long task'],
+ ['/log', 'Print the last finished task’s step log'],
+ ['/bg', 'Show background tasks and current task status'],
+ ['/bg current', 'Move the current task to the background (keeps running)'],
+ ['/bg list', 'List background tasks'],
+ ['/bg cancel <id>', 'Cancel a background task'],
+ ['/bg clear', 'Remove finished background tasks from the list'],
+ ['/bg killall', 'Cancel all background tasks'],
+ ['/budget', 'Show token budget status'],
+ ['/budget override', 'Allow one request past the budget'],
+ ['/budget reset', 'Reset daily usage to zero'],
+ ['/budget set <n>', 'Set the daily token budget'],
+ ['/telegram', 'CLI chat only: open the Telegram management menu'],
+ ['/telegram pending', 'CLI chat only: list pending Telegram requests'],
+ ['/telegram users', 'CLI chat only: list approved Telegram users'],
+ ['/telegram approve <code|id>', 'CLI chat only: approve the first pairing code or a later request'],
+ ['/telegram reject <id>', 'CLI chat only: reject a pending Telegram request'],
+ ['/telegram remove <id>', 'CLI chat only: remove an approved Telegram user'],
+ ['/telegram promote <id>', 'CLI chat only: promote a Telegram member to admin'],
+ ['/telegram demote <id>', 'CLI chat only: demote a Telegram admin to member'],
+ ['/telegram reset', 'CLI chat only: reset all Telegram access'],
+ ['/tools', 'List currently loaded tools'],
+ ['/mcp', 'Show MCP servers and whether they are connected'],
+ ['/mcp tools <server>', 'List the tools of an MCP server and which ones the agent may use'],
+ ['/skills', 'List installed skills'],
+ ['/skills search <query>', 'Search skills.mercuryagent.sh'],
+ ['/skills view <id>', 'Show details + registry URL for a skill'],
+ ['/skills install <id|url>', 'Install from the registry or a raw SKILL.md URL'],
+ ['/skills remove <id>', 'Uninstall a skill'],
+ ['/call <when> [about …]', 'Schedule Mercury to call you on WhatsApp (9pm, in 20m, tomorrow 8:30am)'],
+ ['/calls', 'List or cancel scheduled calls'],
+ ['/plugins', 'Installed and available plugins, with status'],
+ ['/plugins install <id|path|url>', 'Install a plugin (shows what it needs first)'],
+ ['/plugins enable|disable <id>', 'Turn a plugin on or off'],
+ ['/plugins update [id]', 'Update plugins from the catalog'],
+ ['/plugins rollback <id>', 'Go back to the previous version'],
+ ['/plugins uninstall <id> [--purge]', 'Remove a plugin (keeps data unless --purge)'],
+ ['/plugins pair <id> <phone>', 'Link a channel plugin (e.g. WhatsApp) with a pairing code'],
+ ['/permissions', 'Change permission mode (Ask Me / Allow All)'],
+ ['/models', 'List configured providers and their models'],
+ ['/models use <provider>', 'Switch the default model (saved across restarts)'],
+ ['/cloud models', 'List Mercury Cloud models for your tier'],
+ ['/cloud use <model-id>', 'Switch to a Mercury Cloud model'],
+ ['/view', 'Toggle progress view (balanced/detailed)'],
+ ['/view balanced', 'Set compact progress view'],
+ ['/view detailed', 'Set full progress view'],
+ ['/memory', 'View and manage second brain memory'],
+ ['/stream', 'Toggle text streaming on/off (Telegram)'],
+ ['/stream on', 'Enable streaming (live text updates)'],
+ ['/stream off', 'Disable streaming (single message)'],
+ ['/saver', 'Show Token Saver Mode status and tokens saved'],
+ ['/saver on', 'Manually enable Token Saver Mode (terser, faster, cheaper)'],
+ ['/saver off', 'Disable Token Saver Mode'],
+ ['/saver toggle', 'Toggle Token Saver Mode on/off'],
+ ['/saver threshold <0-100>', 'Auto-engage threshold (default 75%; 0 to disable)'],
+ ['/saver auto on|off', 'Enable/disable automatic engagement at threshold'],
+ ['/saver routing on|off', 'Prefer cheap providers when saver is active (opt-in)'],
+ ['/agents', 'List all sub-agents and their status'],
+ ['/agents stop <id|all>', 'Stop a sub-agent or all sub-agents'],
+ ['/agents pause <id>', 'Pause a running sub-agent'],
+ ['/agents resume <id>', 'Resume a paused sub-agent'],
+ ['/agents config', 'Show sub-agent resource allocation'],
+ ['/agents set max <n>', 'Set max concurrent sub-agents'],
+ ['/code', 'Enter Mercury Code (full-screen coding TUI in current dir)'],
+ ['/code auto', 'Auto mode (default): plans and builds in one flow, confirms only large changes'],
+ ['/code plan', 'Switch to plan mode (analyze, present options, no coding)'],
+ ['/code execute', 'Switch to execute mode (implement plan step by step)'],
+ ['/code build', 'Alias of execute mode for build-focused coding'],
+ ['/code diff', 'Show the working-tree diff vs HEAD with syntax colors'],
+ ['/code init', 'Scan the repo and write/refresh AGENTS.md'],
+ ['/code workspace', 'Open current directory in workspace IDE mode'],
+ ['/code agent <task>', 'Delegate a coding task to a sub-agent in background'],
+ ['/code off', 'Exit programming mode (leaves Mercury Code screen)'],
+ ['/code exit', 'Leave Mercury Code (asks for confirmation)'],
+ ['/code chat', 'Switch back to regular chat instantly (alias: /code back)'],
+ ['/chat', 'Return to chat mode (tears down Mercury Code if active)'],
+ ['/code toggle', 'Cycle through: off → auto → plan → execute → off'],
+ ['/research', 'Show research mode status'],
+ ['/research on', 'Enable deep research mode (web research + rich markdown article)'],
+ ['/research off', 'Exit research mode'],
+ ['/research toggle', 'Toggle research mode on/off'],
+ ['/research <topic>', 'Enable research mode for a specific topic'],
+ ['/ws exit', 'Exit workspace IDE mode back to general chat'],
+ ['/ws open <path>', 'Open a workspace directory in IDE mode'],
+ ['/ws refresh', 'Refresh file tree + git status panel'],
+ ['/ws stage <file|all>', 'Stage a file or all changes'],
+ ['/ws commit <message>', 'Commit staged changes (Mercury co-authored)'],
+ ['/ws undo <file>', 'Revert file changes with git checkout -- <file>'],
+ ['/halt', 'Emergency: stop all agents + clear queue'],
+ ['/stop', 'Stop all agents + clear queue + release locks + clear task board'],
+ ['/reset', 'Full reset: stop all + clear context (requires confirmation)'],
+ ['/spotify', 'Show Spotify connection status'],
+ ['/spotify auth', 'Connect Spotify (browser or manual code flow)'],
+ ['/spotify code <code>', 'Complete auth with a pasted authorization code (for SSH/Telegram)'],
+ ['/spotify player', 'Interactive music player (CLI only: arrow-key controls, search, queue)'],
+ ['/spotify devices', 'List available Spotify devices'],
+ ['/spotify device <id>', 'Set active Spotify device'],
+ ['/spotify now', 'Show what is currently playing'],
+ ['/spotify logout', 'Disconnect Spotify and clear saved tokens'],
+ ['/unpair', 'Reset all Telegram access for this Mercury instance (admins only)'],
+];
+
export function getManual(): string {
const sections: string[] = [];
@@ -109,122 +268,7 @@ export function getManual(): string {
sections.push(chalk.dim(' Type these during a conversation (no API calls).'));
sections.push('');
- const chat = [
- ['/start', 'Start Telegram pairing or request Telegram access'],
- ['/pair', 'Start Telegram pairing or request Telegram access'],
- ['/', 'Open the CLI command picker with arrow-key navigation'],
- ['/menu', 'Open the CLI command picker with arrow-key navigation'],
- ['/whatsnew', "See what's new in this Mercury version"],
- ['/update ignore', 'Silence the offered update notice permanently'],
- ['/help', 'Show this manual'],
- ['/status', 'Show config and budget info'],
- ['/sessions', 'List active canonical sessions'],
- ['/session new', 'Create and switch to a new session'],
- ['/session <ref>', 'Switch by UUID/prefix/alias'],
- ['/session current', 'Show the current session'],
- ['/session archive <ref>', 'Archive a session'],
- ['/session delete <ref>', 'Permanently delete a session after confirmation'],
- ['/progress', 'Show live status for the current long task'],
- ['/log', 'Print the last finished task’s step log'],
- ['/bg', 'Show background tasks and current task status'],
- ['/bg current', 'Move the current task to the background (keeps running)'],
- ['/bg list', 'List background tasks'],
- ['/bg cancel <id>', 'Cancel a background task'],
- ['/bg clear', 'Remove finished background tasks from the list'],
- ['/bg killall', 'Cancel all background tasks'],
- ['/budget', 'Show token budget status'],
- ['/budget override', 'Allow one request past the budget'],
- ['/budget reset', 'Reset daily usage to zero'],
- ['/budget set <n>', 'Set the daily token budget'],
- ['/telegram', 'CLI chat only: open the Telegram management menu'],
- ['/telegram pending', 'CLI chat only: list pending Telegram requests'],
- ['/telegram users', 'CLI chat only: list approved Telegram users'],
- ['/telegram approve <code|id>', 'CLI chat only: approve the first pairing code or a later request'],
- ['/telegram reject <id>', 'CLI chat only: reject a pending Telegram request'],
- ['/telegram remove <id>', 'CLI chat only: remove an approved Telegram user'],
- ['/telegram promote <id>', 'CLI chat only: promote a Telegram member to admin'],
- ['/telegram demote <id>', 'CLI chat only: demote a Telegram admin to member'],
- ['/telegram reset', 'CLI chat only: reset all Telegram access'],
- ['/tools', 'List currently loaded tools'],
- ['/mcp', 'Show MCP servers and whether they are connected'],
- ['/mcp tools <server>', 'List the tools of an MCP server and which ones the agent may use'],
- ['/skills', 'List installed skills'],
- ['/skills search <query>', 'Search skills.mercuryagent.sh'],
- ['/skills view <id>', 'Show details + registry URL for a skill'],
- ['/skills install <id|url>', 'Install from the registry or a raw SKILL.md URL'],
- ['/skills remove <id>', 'Uninstall a skill'],
- ['/call <when> [about …]', 'Schedule Mercury to call you on WhatsApp (9pm, in 20m, tomorrow 8:30am)'],
- ['/calls', 'List or cancel scheduled calls'],
- ['/plugins', 'Installed and available plugins, with status'],
- ['/plugins install <id|path|url>', 'Install a plugin (shows what it needs first)'],
- ['/plugins enable|disable <id>', 'Turn a plugin on or off'],
- ['/plugins update [id]', 'Update plugins from the catalog'],
- ['/plugins rollback <id>', 'Go back to the previous version'],
- ['/plugins uninstall <id> [--purge]', 'Remove a plugin (keeps data unless --purge)'],
- ['/plugins pair <id> <phone>', 'Link a channel plugin (e.g. WhatsApp) with a pairing code'],
- ['/permissions', 'Change permission mode (Ask Me / Allow All)'],
- ['/models', 'List configured providers and their models'],
- ['/models use <provider>', 'Switch the default model (saved across restarts)'],
- ['/cloud models', 'List Mercury Cloud models for your tier'],
- ['/cloud use <model-id>', 'Switch to a Mercury Cloud model'],
- ['/view', 'Toggle progress view (balanced/detailed)'],
- ['/view balanced', 'Set compact progress view'],
- ['/view detailed', 'Set full progress view'],
- ['/memory', 'View and manage second brain memory'],
- ['/stream', 'Toggle text streaming on/off (Telegram)'],
- ['/stream on', 'Enable streaming (live text updates)'],
- ['/stream off', 'Disable streaming (single message)'],
- ['/saver', 'Show Token Saver Mode status and tokens saved'],
- ['/saver on', 'Manually enable Token Saver Mode (terser, faster, cheaper)'],
- ['/saver off', 'Disable Token Saver Mode'],
- ['/saver toggle', 'Toggle Token Saver Mode on/off'],
- ['/saver threshold <0-100>', 'Auto-engage threshold (default 75%; 0 to disable)'],
- ['/saver auto on|off', 'Enable/disable automatic engagement at threshold'],
- ['/saver routing on|off', 'Prefer cheap providers when saver is active (opt-in)'],
- ['/agents', 'List all sub-agents and their status'],
- ['/agents stop <id|all>', 'Stop a sub-agent or all sub-agents'],
- ['/agents pause <id>', 'Pause a running sub-agent'],
- ['/agents resume <id>', 'Resume a paused sub-agent'],
- ['/agents config', 'Show sub-agent resource allocation'],
- ['/agents set max <n>', 'Set max concurrent sub-agents'],
- ['/code', 'Enter Mercury Code (full-screen coding TUI in current dir)'],
- ['/code auto', 'Auto mode (default): plans and builds in one flow, confirms only large changes'],
- ['/code plan', 'Switch to plan mode (analyze, present options, no coding)'],
- ['/code execute', 'Switch to execute mode (implement plan step by step)'],
- ['/code build', 'Alias of execute mode for build-focused coding'],
- ['/code diff', 'Show the working-tree diff vs HEAD with syntax colors'],
- ['/code init', 'Scan the repo and write/refresh AGENTS.md'],
- ['/code workspace', 'Open current directory in workspace IDE mode'],
- ['/code agent <task>', 'Delegate a coding task to a sub-agent in background'],
- ['/code off', 'Exit programming mode (leaves Mercury Code screen)'],
- ['/code exit', 'Leave Mercury Code (asks for confirmation)'],
- ['/code chat', 'Switch back to regular chat instantly (alias: /code back)'],
- ['/chat', 'Return to chat mode (tears down Mercury Code if active)'],
- ['/code toggle', 'Cycle through: off → auto → plan → execute → off'],
- ['/research', 'Show research mode status'],
- ['/research on', 'Enable deep research mode (web research + rich markdown article)'],
- ['/research off', 'Exit research mode'],
- ['/research toggle', 'Toggle research mode on/off'],
- ['/research <topic>', 'Enable research mode for a specific topic'],
- ['/ws exit', 'Exit workspace IDE mode back to general chat'],
- ['/ws open <path>', 'Open a workspace directory in IDE mode'],
- ['/ws refresh', 'Refresh file tree + git status panel'],
- ['/ws stage <file|all>', 'Stage a file or all changes'],
- ['/ws commit <message>', 'Commit staged changes (Mercury co-authored)'],
- ['/ws undo <file>', 'Revert file changes with git checkout -- <file>'],
- ['/halt', 'Emergency: stop all agents + clear queue'],
- ['/stop', 'Stop all agents + clear queue + release locks + clear task board'],
- ['/reset', 'Full reset: stop all + clear context (requires confirmation)'],
- ['/spotify', 'Show Spotify connection status'],
- ['/spotify auth', 'Connect Spotify (browser or manual code flow)'],
- ['/spotify code <code>', 'Complete auth with a pasted authorization code (for SSH/Telegram)'],
- ['/spotify player', 'Interactive music player (CLI only: arrow-key controls, search, queue)'],
- ['/spotify devices', 'List available Spotify devices'],
- ['/spotify device <id>', 'Set active Spotify device'],
- ['/spotify now', 'Show what is currently playing'],
- ['/spotify logout', 'Disconnect Spotify and clear saved tokens'],
- ['/unpair', 'Reset all Telegram access for this Mercury instance (admins only)'],
- ];
+ const chat = CHAT_COMMAND_HELP;
for (const [cmd, desc] of chat) {
sections.push(` ${chalk.white(cmd.padEnd(16))} ${desc}`);
diff --git a/src/web/api/chat.ts b/src/web/api/chat.ts
index 67612414..8f5b1d6c 100644
--- a/src/web/api/chat.ts
+++ b/src/web/api/chat.ts
@@ -1,4 +1,6 @@
import { Hono } from 'hono';
+import { commandCatalog } from '../../core/commands/catalog.js';
+import { getPluginManager } from '../../plugins/manager.js';
import { artifactStore } from '../../artifacts/store.js';
import { scopedProgrammingState } from '../../core/programming-mode.js';
import { isInsideWorkspace } from './workspace-ide.js';
@@ -131,6 +133,14 @@ const chat = new Hono();
// ─── SSE Events ──────────────────────────────────────────────
/** The conversation's latest plan checklist (update_plan), for a client opening the thread. */
+// The "/" picker: every slash command, with what it does (the terminal's list, the manual's words,
+// and the commands running plugins add). Sent as a message, a command runs exactly as typed.
+chat.get('/api/chat/commands', (c) => {
+ let plugins: Array<{ name: string; description: string; plugin: string }> = [];
+ try { plugins = getPluginManager().commandHelp(); } catch { /* plugins not started */ }
+ return c.json({ commands: commandCatalog(plugins) });
+});
+
chat.get('/api/chat/plan', (c) => {
if (!webChannel) return c.json({ plan: null });
const id = c.req.query('sessionId');