Files
openclaw/docs/tools/slash-commands.md
Thomas Krohnfuß b48238aa88 feat(commands): add /name to rename the current session from chat (#88581)
* Add /name chat command to rename the current session

Adds a `/name <title>` slash command so users can name or rename the
current session directly from any chat channel, instead of only through
the web/admin session manager. This keeps parallel sessions easy to tell
apart from within the chat flow.

Behaviour:
- `/name <title>` sets the session label, reusing the canonical
  `parseSessionLabel` validation (trim, non-empty, max 512 chars) and the
  same cross-store uniqueness rule enforced by the web `sessions.patch`
  path, so chat naming behaves identically to the session manager.
- `/name` with no argument shows the current name plus a locally derived
  `deriveSessionTitle` suggestion without mutating anything (no LLM).
- Only authorized senders can rename (rejectUnauthorizedCommand), matching
  /goal. The label surfaces everywhere sessions.list is shown (TUI, web,
  CLI, MCP).

The handler resolves the session via resolveSessionStoreEntry so renames
land on the canonical entry even when the store still holds a legacy or
case-folded key alias, and excludes those aliases from the uniqueness scan
to avoid false conflicts. Failed renames skip the store write.

Registers the command in commands-registry.shared.ts and the handler in
loadCommandHandlers, documents it in docs/tools/slash-commands.md, and adds
unit tests covering rename, no-arg suggestion, duplicate-label rejection,
unauthorized senders, disabled text commands, and persisted-name re-read.

Part of the chat-native session naming feature (follows the web in-chat
rename PR). Relates to openclaw#85502 and openclaw#54397.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(name): seed native sessions and persist renames via canonical key

Address Codex review on PR #88581:
- Fall back to the in-memory params.sessionEntry when the store has no row
  yet, so a brand-new native slash session can be named from its first
  /name command instead of failing with 'no active session to name'.
- Persist the rename through resolved.normalizedKey and drop legacy/
  case-folded alias keys (mirroring persistResolvedSessionEntry) so the
  canonical entry is updated and sessions.list stops surfacing the stale
  alias row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(name): emit session metadata changes

Route successful /name renames through the shared command session metadata seam so subscribed session lists receive sessions.changed like /goal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(commands): add /name to rename the current session from chat

* fix(docs): document the /name slash command

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Agent <agent@example.com>
Co-authored-by: openclaw-clownfish[bot] <280122609+openclaw-clownfish[bot]@users.noreply.github.com>
2026-06-19 10:04:28 +08:00

23 KiB

title, sidebarTitle, summary, read_when
title sidebarTitle summary read_when
Slash commands Slash commands All available slash commands, directives, and inline shortcuts — configuration, routing, and per-surface behavior.
Using or configuring chat commands
Debugging command routing or permissions
Understanding how skill commands are registered

The Gateway handles commands sent as standalone messages starting with /. Host-only bash commands use ! <cmd> (with /bash <cmd> as an alias).

When a conversation is bound to an ACP session, normal text routes to the ACP harness. Gateway management commands remain local: /acp ... always reaches the OpenClaw command handler, and /status plus /unfocus stay local whenever command handling is enabled for the surface.

Three command types

Standalone `/...` messages handled by the Gateway. Must be sent as the only content in the message. `/think`, `/fast`, `/verbose`, `/trace`, `/reasoning`, `/elevated`, `/exec`, `/model`, `/queue` — stripped from the message before the model sees it. Persist session settings when sent alone; act as inline hints when sent with other text. `/help`, `/commands`, `/status`, `/whoami` — run immediately and are stripped before the model sees the remaining text. Authorized senders only. - Directives are stripped from the message before the model sees it. - In **directive-only** messages (the message is only directives), they persist to the session and reply with an acknowledgement. - In **normal chat** messages with other text, they act as inline hints and do **not** persist session settings. - Directives only apply for **authorized senders**. If `commands.allowFrom` is set, it is the only allowlist used; otherwise authorization comes from channel allowlists/pairing plus `commands.useAccessGroups`. Unauthorized senders see directives treated as plain text.

Configuration

{
  commands: {
    native: "auto",
    nativeSkills: "auto",
    text: true,
    bash: false,
    bashForegroundMs: 2000,
    config: false,
    mcp: false,
    plugins: false,
    debug: false,
    restart: true,
    ownerAllowFrom: ["discord:123456789012345678"],
    ownerDisplay: "raw",
    ownerDisplaySecret: "${OWNER_ID_HASH_SECRET}",
    allowFrom: {
      "*": ["user1"],
      discord: ["user:123"],
    },
    useAccessGroups: true,
  },
}
Enables parsing `/...` in chat messages. On surfaces without native commands (WhatsApp, WebChat, Signal, iMessage, Google Chat, Microsoft Teams), text commands work even when set to `false`. Registers native commands. Auto: on for Discord/Telegram; off for Slack; ignored for providers without native support. Override per-channel with `channels..commands.native`. On Discord, `false` skips slash-command registration; previously registered commands may stay visible until removed. Registers skill commands natively when supported. Auto: on for Discord/Telegram; off for Slack. Override with `channels..commands.nativeSkills`. Enables `! ` to run host shell commands (`/bash ` alias). Requires `tools.elevated` allowlists. How long bash waits before switching to background mode (`0` backgrounds immediately). Enables `/config` (reads/writes `openclaw.json`). Owner-only. Enables `/mcp` (reads/writes OpenClaw-managed MCP config under `mcp.servers`). Owner-only. Enables `/plugins` (plugin discovery/status plus install + enable/disable). Owner-only for writes. Enables `/debug` (runtime-only config overrides). Owner-only. Enables `/restart` and gateway restart tool actions. Explicit owner allowlist for owner-only command surfaces. Separate from `commands.allowFrom` and DM pairing access. Per-channel: requires owner identity for owner-only commands. When `true`, sender must match `commands.ownerAllowFrom` or hold internal `operator.admin` scope. A wildcard `allowFrom` entry is **not** sufficient. Controls how owner ids appear in the system prompt. HMAC secret used when `commands.ownerDisplay: "hash"`. Per-provider allowlist for command authorization. When configured, it is the **only** authorization source for commands and directives. Use `"*"` for a global default; provider-specific keys override it. Enforces allowlists/policies for commands when `commands.allowFrom` is not set.

Command list

Commands come from three sources:

  • Core built-ins: src/auto-reply/commands-registry.shared.ts
  • Generated dock commands: src/auto-reply/commands-registry.data.ts
  • Plugin commands: plugin registerCommand() calls

Availability depends on config flags, channel surface, and installed/enabled plugins.

Core commands

| Command | Description | | --- | --- | | `/new [model]` | Archive the current session and start a fresh one | | `/reset [soft [message]]` | Reset the current session in place. `soft` keeps the transcript, drops reused CLI backend session ids, and reruns startup | | `/name