Sigilsdoc/{zh,en}/design/runtime/sigils.md

Sigils: One Grammar for /, !, @ and $

简体中文 · Status: 2026-11-18, designed with the owner's decisions (section 12); slices S1–S4 built the same day (pkg/sigil, internal/host/engine/sigils.go, plugins/chat, the agent's d

简体中文 · Status: 2026-11-18, designed with the owner's decisions (section 12); slices S1–S4 built the same day (pkg/sigil, internal/host/engine/sigils.go, plugins/chat, the agent's direct tool call, Feishu mention spans); S5 built 2026-11-21 with the owner's changes of that day (section 13). The trigger contract is in the input contract, section 3; workspace commands come from the workspace design (P83).

1. Problem

A user's message can contain markers that change what happens to it: /new resets the session, $code-review loads a skill, !ls runs a shell command, @codex fix it sends the request to another runtime. Today these are separate string matches spread over several packages (section 3). There is no shared grammar or registry, and nothing limits a marker to a channel, a runtime or a person. Four cases are missing:

  • ◆Runtime choice. After a Claude Code or Codex runtime adapter exists, @codex <request> should move the conversation to Codex.
  • ◆Channel limits. ! means a local shell command. It belongs in the console, not in a Feishu group.
  • ◆Plugin contributions. A plugin, or an operator, adds directives, such as a fixed instruction $standup, without touching the Host or the chat trigger.
  • ◆Combinations. One message combines markers anywhere in its text: $dt @codex use the Feishu digital twin loads the digital twin's skill and runs on Codex.

Goal: one grammar and one directive table, shared by every channel. The Host filters the table per event. A directive works in a channel only where its scope makes it visible.

2. What Other Systems Do

SystemMarkersPositionGatingSource
Codex$name plaintext tool and skill mentions, @ plugin mentions, structured Mention{path} input, [$name] followed by (path) linked form, ! shell, / commands! and / only when they start the composer text; $ anywhere at a word boundary! is refused in Cloud conversations: "Shell commands starting with ! are unavailable in Cloud conversations."codex-rs/utils/plugins/src/mention_syntax.rs, codex-rs/tui/src/mention_codec.rs:216-305, codex-rs/tui/src/app/thread_routing.rs:978-990, commit 665b147
Claude Code/ command or skill (plugin skills as /plugin:skill, a bare name matches when it is unique), ! shell mode, @ file path and live sessionThe command runs only when it starts the message! runs outside the sandbox unless strict sandboxing is oncode.claude.com/docs/en/interactive-mode, /slash-commands
OpenClaw/command with leading chained directives (/think high /verbose on …), ! <cmd> or /bashOnly at the start, after the channel's own bot addressing; prose such as Please explain /status is textcommands.bash (default false), commands.allowFrom per provider, owner-only commands, channels.<provider>.commands.*; names a-z0-9_, at most 32docs.openclaw.ai/tools/slash-commands
Slack, FeishuPlatform mentions as entities (<@U…>, @_user_N)AnywhereThe platform decides—

The systems agree on four points:

  1. Acting markers (/, !) count only at the start of the message.
  2. Reference markers ($) may appear inline, but only at word boundaries, and only for known names.
  3. A platform mention is a structured entity, not text that matches a pattern.
  4. Gating is configuration per channel and per sender, and a disabled marker is refused, not passed to the model.

Orquelo departs from points 1 and 4 by the owner's decisions: tokens may stand anywhere, the text rules of section 6 keep prose such as how do I /cancel a run from acting, and a disabled marker is ordinary text.

3. What the Repository Does Today

#WhereWhat it parsesProblem
1plugins/chat/chat.go:68-94Exact matches, lowercased: /cancel /stop /new /reset /compact /help/cancel please is not cancel. It falls through to skill lookup and then reaches the model as text
2plugins/chat/chat.go:96CutPrefix("/compact ")Only a space works: /compact followed by a newline and a focus becomes an ordinary request
3plugins/chat/chat.go:99-108/name args against the skill Commands, case-sensitiveA skill named new or help is silently shadowed; /Deploy does not find deploy
4plugins/chat/chat.go:152-167/bug /suggest /arch, with its own split on spaces, tabs and newlinesA third tokenizer, with rules that differ from #2
5plugins/chat/chat.go:139-150/approve /approve-chat /reject mixed with natural-language approval wordsCommands and words share one table
6plugins/console/console.go:99/approve <id> /reject <id> inside the TransportKept: it answers an interaction by its id through TransportHost.Answer, as a card button does, also for a question asked in another conversation
7plugins/agent/compact/sessioncompact.go:147Strips /compact againWhen Decision.Text is empty the Host falls back to the event text, so the Runtime parses the command a second time
8plugins/feishu/inbound.go:101-103Replaces other people's mentions with the text @NameA colleague named "codex" would become @codex, indistinguishable from a typed directive
9plugins/chat/workspace.go (P83, built)/ws, /ws <name> worktree base=main, /ws off, split with strings.Fields; the workspace design also had /done and repo= in the messageA fourth tokenizer; repo= inside prose was a free-text marker without a grammar

The convergence in section 9 replaces #1–#7 with the shared parser. #8 gets a span contract. #9 is built on the directive table.

4. Model

  • ◆Sigil: one of four marker characters, each with a fixed meaning: / an action on the session, the Host or the runtime; ! a shell command; @ a runtime route; $ a skill. The set is fixed by this design. A plugin adds directives under these sigils, never a new sigil.
  • ◆Directive: a name under a sigil, such as /new, /compact, @codex, $code-review, or ! (no name). It has an owner, a kind, a target and a text rule (section 6).
  • ◆Directive table: every directive the deployment knows. It is one table for all channels.
  • ◆Visible table: the part of the table the Host computes for one event, from its connection, conversation kind, principal and target runtime (section 7). Only visible directives can match.

5. Grammar

The parser reads the sender's own text and the platform spans the Transport marks. It never reads the quoted message (Event.Quote), history or attachments. A sigil token may stand anywhere in the text. What a directive does with the text around it depends on the directive's text rule (section 6), not on its position.

ebnf
message  = { text | token } ;
token    = route | action | skill | bang ;
route    = "@", name ;
action   = "/", name ;
skill    = "$", name ;
bang     = "!", cmdstart, line ;                (* line: the rest of its line, raw *)
cmdstart = letter | digit | "." | "/" | "~" | '"' | "'" ;
name     = segment, [ ":", segment ] ;          (* owner:name; at most 64 bytes *)
segment  = letter, { letter | digit | "_" | "-" | "." } ;  (* ASCII; may not end in "." *)

Lexical rules:

  1. Position and boundaries. A token may stand anywhere in the text: at the start, in the middle or at the end. It starts at a boundary: the start of the text, whitespace, an opening bracket or quote, or any non-ASCII character such as Chinese text; never after an ASCII letter, digit or other ASCII punctuation, so http://x.io holds no /x.io. After the name, the token ends at the end of the text or at the first character that is not a name character. A final . is not part of the name. So 总结一下/new and 请用$dt回答 contain a token, while a@b.com, $5, and/or and http://… contain none.
  2. Paths are not actions. If a / name runs into another / before whitespace (/usr/bin/ls), the token is text.
  3. Exclamations are not shell. ! must be followed directly by a cmdstart character. !!, !?, and ! followed by a space are text.
  4. Case. Names are matched case-insensitively and stored in lowercase.
  5. Opaque regions. Inline code, fenced blocks, quoted lines (>) and platform spans (section 8) are text. A sigil inside them is never parsed.
  6. Escape. A backslash before a sigil (\/new, \@codex) makes that one token literal text. The backslash is removed.
  7. Arguments. A directive that takes arguments declares raw (the default) or fields. fields splits them into shell-style words with "…" quoting and key=value pairs, for example /ws orquelo worktree base=main. Arguments that do not fit produce the diagnostic args.
  8. ASCII only. Only the ASCII characters /, !, @ and $ are sigils. Full-width forms (/!@$) are ordinary text.

Result of a parse:

go
type Parse struct {
	Tokens []Token // every sigil token in text order, with its byte span and line
	Text   string  // the text outside the tokens, with the space at a removed token collapsed
	Diags  []Diag  // Code: unmatched (logged only) | ambiguous | args; with the byte span
}

Resolution (section 6) turns the tokens into at most one route, at most one action (/ or !), and any number of skills.

6. Directives

KindSigilTargetTrigger decisionExamples
control/A decision actioncancel, reset, reply (help), feedback, answer (/approve), workspace (/ws)/new, /bug, /ws
command/A runtime commandstart with Command/compact
tool! or /A tool, instance/toolstart with Command: "tool"; the Runtime calls the tool without the model! → localenv/bash
route@A runtime instance the connection listsDecision.Runtime, and the session key is bound to it (below)@codex, @claude
skill$A skill the target runtime offersstart with Skills$code-review, $dt, $standup
  • ◆/ acts, $ brings a skill. Every skill uses $. That includes the runtime's skills, imported Claude Code commands (internal/manage/importer_skills.go) and fixed instructions such as $standup, which are skills with $ARGUMENTS substitution; their arguments are the message text. / is only for actions. The switch is hard: once S1 lands, /code-review is ordinary text, with no compatibility period.
  • ◆Text rules. Each / and ! directive declares what happens to the rest of the message:
  • ◆args: all text outside the tokens is the directive's arguments, wherever the token stands. the answer dropped the table /bug reports "the answer dropped the table". /compact and /bug use it.
  • ◆request: the arguments are the rest of the token's own line. The other text, if any, runs as a request after the action, in the same decision. /ws orquelo, then a newline and fix the flaky test, binds the workspace and starts the run; /new summarize today resets and starts. /ws and /new use it.
  • ◆none: the directive stands alone, and any other text makes the combination invalid. how do I /cancel a run is therefore text. /cancel, /help and /approve use it.
  • ◆! takes the rest of its own line as the command and combines with nothing.

A route token is removed from the text. A $name token stays in the text as written, so the sentence keeps its meaning, and the skill is loaded as well.

  • ◆Resolution. The order of tokens in the text does not matter: $dt @codex … and @codex … $dt mean the same.
  1. Routes come first. The @ tokens are resolved against the visible routes. The target runtime is the route, else the conversation's binding, else the connection's default.
  2. /, ! and $ are resolved against the visible table of the target runtime. That table holds the runtime-independent directives (control, tool) plus the target's own commands and skills.
  3. An unmatched token is text. The other tokens still apply.
  4. The combination is checked: at most one route, at most one action (/ or !), any number of skills, and the text rules above. A violation makes the whole message ordinary text, as if it had no sigil, on the bound or default runtime.
MessageResult
$dt @codex use the Feishu digital twin to answer Li's questionRuns on codex with the skill dt; binds codex
@codex /compact keep the API namescompact on codex, if codex declares it, with the focus "keep the API names"
$review $tests fix the parserOne run with two skills
/new $standupReset, then a run with standup
$dt @codex …, where codex does not offer dt$dt is unmatched and stays text; the run is on codex
@codex @claude which is better?Two routes: the whole message is text
/new /cancel, or @codex !lsTwo actions, or ! with something else: text
/bug /help lists nothing/bug: a / action that starts the message and takes the rest as raw arguments takes it as written, so a command a report quotes is not a second action (Feishu #178)
how do I /cancel a run/cancel is none: text
  • ◆Owners. Directives come from:
  • ◆the Trigger's manifest: control directives;
  • ◆the Runtime's manifest: commands such as compact;
  • ◆the Runtime's skills: today's Commands, each one as $name;
  • ◆other plugins' manifests, under a new directives: key, for example localenv contributing !. A plugin's skills reach a runtime through its uses, and works_with limits them: the digital twin's dt (scenario B01) is visible only in Feishu connections.
  • ◆the operator's configuration, for example a route for each runtime instance a connection lists.

The Host does not define any directive itself.

  • ◆Names. Each directive has a qualified name owner:name. A bare name works when it is unique in the visible table. For /, owners rank as Trigger, then Runtime command, then other plugin. A collision within one rank, or between two skills, is the diagnostic ambiguous.
  • ◆Unsupported means text. A token that matches no visible directive is ordinary text. That covers an unknown name, an invisible directive, and a sigil turned off for the event, such as ! in Feishu. A hidden directive is never revealed. The parser records the diagnostic unmatched for logs only.
  • ◆Ambiguity is the one reply. It gets sigil.ambiguous, which lists the qualified names.
  • ◆! follows the unified approval rules. The Runtime calls the tool through CallTool, with the same grants, guards, rules (plugins/agent/rules), reviewers and approvals as a call the model proposes. Typing ! approves nothing by itself. The command runs in the run's resolved workspace (P83), and its output becomes a session entry the model sees on the next turn.
  • ◆Approval words. Approval words such as 批准 and approve are natural language, not directives. They stay in the chat trigger's answer logic. /approve and /reject become control directives.

Route Binding and Exit

  • ◆Binding. @codex <request> runs the request on codex and binds the session key to codex. The key is the one of P83's workspace binding: the connection, the conversation, the thread and, in a group, the sender. @codex with no other text only binds, and replies with the notice route.bound. A route in a combination binds as well.
  • ◆While bound. A message without @ runs on the bound runtime. The Trigger is not bound. The chat trigger still reads every message first, so /new, /cancel, /help and the login commands always work. Runtime commands and skills resolve against the bound runtime.
  • ◆Exit. Each exit replies with the notice route.unbound, which names the runtime the conversation is back on:
  1. @orquelo (or the default runtime's id) returns to the connection's default runtime; there is no /exit (section 13);
  2. @<other> switches to another listed runtime;
  3. /new starts a new session without the binding;
  4. the binding expires after route_idle (a connection option, default 24 h) without a message;
  5. the Host ends it when the runtime leaves runtimes, a rule hides the route, or the person loses the grant. The next message then runs on the default runtime, and the notice gives the reason.
  • ◆Runs in flight. A switch or an exit never cancels or reruns a run. An active run finishes on its own runtime, and a new message queues behind it as today.
  • ◆State. The Host owns the binding, in a table route_bindings next to workspace_bindings. It is written in the same transaction as the inbox mark. Its terminal state is the deleted row, logged as route.unbound with the reason.

7. Scope and Configuration

Each contribution declares a default visibility. Control directives, commands, skills and routes are on by default. Directives of kind tool are on by default only in a connection that accepts local paths (allow_paths, which defaults to the transport's paths, P83), where the person sits at the Host's own terminal; elsewhere they are off (as OpenClaw's commands.bash). The operator narrows or widens visibility in one place, and the same rules apply to every channel:

yaml
sigils:
  rules:                                   # evaluated for every event; any deny wins
    - {deny: "!"}                          # no shell anywhere ...
    - {allow: "!", connections: [console], conversation: [direct], principals: [role:owner]}
    - {deny: "/bug", connections: [feishu-customers]}
    - {allow: "@codex", connections: [feishu-dev, console], runtimes: [agent]}
  aliases: {"$cr": "$skill-demo:code-review"}
connections:
  - id: feishu-dev
    runtime: agent                         # the default runtime
    runtimes: [codex, claude]              # what @route may choose (P84)
  • ◆Dimensions.
  • ◆connections: the channel instance.
  • ◆conversation: direct or group.
  • ◆principals: a principal or role:<name> from the Host's identity.
  • ◆runtimes: the runtime instance that would run the request, which is the "which agent" scope.

A rule matches a sigil ("!"), a directive ("/bug", "@codex") or a qualified name.

  • ◆Order of evaluation. The contribution's default comes first, then allow rules, then deny rules, so a matching deny always wins. The result is the visible table. The Host parses once, during routing, and puts the resolution in TriggerInput.Sigils and the visible table in TriggerInput.Directives (for /help). The Trigger never parses text; it decides what a resolved action means now, for example /approve while an approval is pending. Directives replaces Commands, with no compatibility period. After S5 the resolution also names the target runtime.
  • ◆Trust.
  • ◆The Trigger sees only the resolution. A decision whose Skills, Command or Tool differ from the resolution is refused: the Host logs route.directive_refused and replies with the notice sigil.refused.
  • ◆Visibility never grants anything. A ! call still passes CallTool's grants, guards and approvals.
  • ◆A route still needs the person's grants on the chosen runtime.

8. Platform Mentions

A Transport that carries mentions marks them as spans: Event.Spans []TextSpan{Start, End, Kind: "mention", ID, IsBot, IsYou}, with byte offsets into Text. The bot's own leading mention is addressing, and the Transport removes it, as today. Every other mention stays visible as @Name and is opaque to the parser (section 5, rule 5). A typed @codex without a platform entity is a route. A picked @codex person or bot is a mention. Feishu fills the spans in inbound.go. A Transport without mentions fills none.

9. Convergence Plan

Each slice is committed separately with the checks of AGENTS.md section 9 and veruqelo cases (section 11).

SliceChangeBehavior change
S1pkg/sigil (definition layer: types, grammar, Resolve, no I/O). Manifest directives:; the Host builds the visible table, resolves once and passes TriggerInput.Sigils; the chat trigger declares its control directives with their text rules and maps the resolution to decisions (#1–#5, #9). Skills move to $, with Decision.Skills replacing Decision.Skill. The Host stops falling back to the event text when a decision has a directive, and the agent's second /compact strip is removed (#7). Documents that show /skill are updated/compact with a newline and focus works; $Deploy finds deploy; several skills in one message; /code-review is text; how do I /cancel a run is text
S2sigils.rules and aliases, Host check of decisions; /help from the visible tableDirectives can be turned off per connection, conversation, person and runtime
S3Spans on Event, filled by Feishu (#8)A person's mention can no longer trigger a route
S4The tool kind, ! from localenv, on by default only where the connection accepts local paths (section 7); the agent runs it as a direct tool call!cmd in the console, under the unified approval rules; ! in Feishu is ordinary text
S5The route kind, connections[].runtimes, BoundRuntime, per-runtime resolution, route_bindings, @orquelo and route_idle, together with the first Codex or Claude Code runtime adapter@codex anywhere binds the conversation until an exit; $dt @codex … combines. Built only with that adapter (AGENTS.md section 11: no mechanism without a scenario)

P83's /ws and /done are control directives with fields arguments and the text rule request, built on S1, which replaces the strings.Fields split in plugins/chat/workspace.go. repo= in prose is dropped: a workspace is named only through the arguments of /ws, and the workspace design says so.

10. Traces

  • ◆Feishu group, @bot /compact then a newline and "keep the API names". The Transport removes the bot mention. The parser finds the token /compact, whose text rule args makes "keep the API names" its arguments. The table resolves it to the chat trigger's command compact. The decision is start{Command: compact, Text: "keep the API names"}, and the agent uses Text as given.
  • ◆Feishu, !rm -rf build. ! is not in the visible table, because of the rule deny: "!". The token is text, and the message starts an ordinary run with the text !rm -rf build. Any shell call the model then proposes passes the same approvals as every other call.
  • ◆Console, !go test ./.... ! is visible. The decision is start{Command: tool, Tool: localenv/bash, Text: "go test ./..."}. The Runtime calls the tool through CallTool with key user:<event>, under the unified approval rules. The output is a session entry the model sees on the next turn. A restart replays the same key, so the command is not run twice.
  • ◆Feishu dev group, @codex fix the flaky test. After S5, the route resolves to the runtime instance codex, which the connection lists. The Host checks the person's grants on it and starts the run on codex, with the conversation's workspace (P83), and binds the session key. The next message, now run the tests, also runs on codex. @orquelo replies route.unbound and the following message runs on agent. A failed delivery retries only its delivery.
  • ◆Feishu dev group, @bot $dt @codex use the Feishu digital twin to answer Li's question. After S5:
  1. The Transport removes the bot mention. @codex is typed, not picked from the member list, so it is not a span.
  2. The tokens are $dt and @codex. The route resolves first: codex is listed and visible, so it is the target.
  3. $dt resolves against codex's table. The twin plugin is in codex's uses, its works_with includes Feishu, and the adapter offers skills, so it matches.
  4. The combination is one route and one skill, which is valid. The decision is start{Runtime: codex, Skills: [twin:dt], Text: "$dt use the Feishu digital twin to answer Li's question"}.
  5. The Host resolves again, checks the person's grant on codex, and writes the run and route_bindings in one transaction. The twin's tool calls from codex pass CallTool and its approvals.
  6. The next message, also tell her the date, runs on codex without dt, because skills apply to one run. @orquelo returns to agent.
  • ◆Failure. Two plugins both offer $deploy: the diagnostic is ambiguous, and the reply lists ops:deploy and infra:deploy.

11. Acceptance

  • ◆Unit tests for pkg/sigil, table-driven, cover:
  • ◆tokens at the start, in the middle and at the end of the text, and in any order;
  • ◆every boundary of rules 1–3, plus emails, money, paths, URLs and exclamations;
  • ◆case, opaque code, quotes and spans, escape per token, raw and fields arguments, the text rules args, request and none;
  • ◆unknown, invisible and turned-off directives as text; every invalid combination of the section 6 table as text; full-width sigils as text; ambiguous and alias.
  • ◆Host tests: the visible table for each dimension and target runtime; deny wins; a decision outside the table, or with a skill the decided runtime does not offer, is refused.
  • ◆Chat trigger tests: every row of section 3 #1–#5, with the behavior changes of S1.
  • ◆veruqelo interface and e2e cases through the console with a real model, and through Feishu once its runner exists:
  • ◆/compact with a newline and focus;
  • ◆! as ordinary text in Feishu, and in the console under the approval rules;
  • ◆a person's mention named like a runtime;
  • ◆$skill anywhere in the text, and /skill as text;
  • ◆after S5, $dt @codex in either order, @codex choosing and binding the runtime; each exit (@orquelo, @agent, /new, idle expiry, a revoked grant); a delivery retry without a rerun; and a principal without the grant refused.

12. The Owner's Decisions, 2026-11-18

  1. A sigil that is not supported is ordinary text: unknown, invisible or turned off, it goes on as text (section 6).
  2. Full-width sigils are not supported (section 5, rule 8).
  3. @codex binds the conversation, with exits: @orquelo, another route, /new, idle expiry and loss of access (section 6, route binding).
  4. Unified: workspaces are named only through /ws arguments, with no repo= in prose (section 9).
  5. ! follows the unified approval rules, with no exemption for typed commands (section 6).
  6. Skills use $; / is only for actions (section 6).
  7. Hard switch with no compatibility period: what no longer matches is text (sections 6, 7 and 9).
  8. Sigils may stand anywhere in the text; an invalid combination makes the whole message ordinary text (sections 5 and 6).

13. Built: S5, the @ routes (2026-11-21)

Built with the owner's changes of 2026-11-21 (session r1a; external runtimes 5.3):

  • ◆No /exit. It was too generic to mean leaving a runtime, so it is ordinary text. Switching is only by @: @<id> switches to a runtime the connection lists in runtimes and pins the conversation (route_bindings, keyed as workspace bindings are); a message without @ goes to the pinned runtime, or to the connection's own. The connection's own runtime always answers to @orquelo, the agent's name, and to its instance id, without being listed; that switches back and clears the pin. A bare @<id> only pins, with the notice route.bound; @orquelo alone replies route.unbound.
  • ◆Every reply names its runtime (the owner's choice: the default too). plugin.Output carries Runtime and RuntimeName (orquelo for the connection's own runtime, the instance id otherwise), filled by the Host for every output of a run. The console prefixes replies and progress with [name] and prints a status line of its own, ── runtime: <name> ──, when the runtime changes; Feishu cards carry the name as their header; httpapi messages carry runtime.
  • ◆/help lists, after the commands and skills, the runtimes the person may switch to (TriggerInput.Runtimes), marking the current one; routes the person may not use are not listed.
  • ◆Authorization. A route runs only when the runtime is listed, ready and its instance scope covers the person; otherwise route.forbidden, and nothing runs or pins. A pin ends with the notice route.ended and its reason when it is idle for route_idle (default 24 h), when its runtime leaves runtimes, or when the person may no longer use it.
  • ◆Runtime for non-admins. A connection's user_runtime (optional, a runtime instance; preflight refuses an unknown or non-runtime one by name) runs the messages of people who are not the connection's admins wherever they would get the connection's own runtime, @orquelo included; their routes to other listed runtimes follow the rules above, and admins keep runtime. Example: a Feishu digital twin opened to colleagues, with the owner in admins and a user_runtime without a shell (2026-11-27).
  • ◆What stays. /login, /logins and /logout run on the connection's own runtime while pinned. /new closes the sessions of both runtimes and clears the pin in one transaction. A message for a pinned runtime never steers a run of another runtime; it queues behind it.
  • ◆Simpler than section 6. The pin is written in its own transaction just before the event is handled, not in the transaction of its inbox mark; handling the event again finds it written and gives the same result. The echo runtime gained a prefix option, so two instances can be told apart in tests.