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 twinloads 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
| System | Markers | Position | Gating | Source |
|---|---|---|---|---|
| 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 session | The command runs only when it starts the message | ! runs outside the sandbox unless strict sandboxing is on | code.claude.com/docs/en/interactive-mode, /slash-commands |
| OpenClaw | /command with leading chained directives (/think high /verbose on …), ! <cmd> or /bash | Only at the start, after the channel's own bot addressing; prose such as Please explain /status is text | commands.bash (default false), commands.allowFrom per provider, owner-only commands, channels.<provider>.commands.*; names a-z0-9_, at most 32 | docs.openclaw.ai/tools/slash-commands |
| Slack, Feishu | Platform mentions as entities (<@U…>, @_user_N) | Anywhere | The platform decides | — |
The systems agree on four points:
- Acting markers (
/,!) count only at the start of the message. - Reference markers (
$) may appear inline, but only at word boundaries, and only for known names. - A platform mention is a structured entity, not text that matches a pattern.
- 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
| # | Where | What it parses | Problem |
|---|---|---|---|
| 1 | plugins/chat/chat.go:68-94 | Exact 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 |
| 2 | plugins/chat/chat.go:96 | CutPrefix("/compact ") | Only a space works: /compact followed by a newline and a focus becomes an ordinary request |
| 3 | plugins/chat/chat.go:99-108 | /name args against the skill Commands, case-sensitive | A skill named new or help is silently shadowed; /Deploy does not find deploy |
| 4 | plugins/chat/chat.go:152-167 | /bug /suggest /arch, with its own split on spaces, tabs and newlines | A third tokenizer, with rules that differ from #2 |
| 5 | plugins/chat/chat.go:139-150 | /approve /approve-chat /reject mixed with natural-language approval words | Commands and words share one table |
| 6 | plugins/console/console.go:99 | /approve <id> /reject <id> inside the Transport | Kept: it answers an interaction by its id through TransportHost.Answer, as a card button does, also for a question asked in another conversation |
| 7 | plugins/agent/compact/sessioncompact.go:147 | Strips /compact again | When Decision.Text is empty the Host falls back to the event text, so the Runtime parses the command a second time |
| 8 | plugins/feishu/inbound.go:101-103 | Replaces other people's mentions with the text @Name | A colleague named "codex" would become @codex, indistinguishable from a typed directive |
| 9 | plugins/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 message | A 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.
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:
- 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.ioholds 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总结一下/newand请用$dt回答contain a token, whilea@b.com,$5,and/orandhttp://…contain none. - Paths are not actions. If a
/name runs into another/before whitespace (/usr/bin/ls), the token is text. - Exclamations are not shell.
!must be followed directly by acmdstartcharacter.!!,!?, and!followed by a space are text. - Case. Names are matched case-insensitively and stored in lowercase.
- Opaque regions. Inline code, fenced blocks, quoted lines (
>) and platform spans (section 8) are text. A sigil inside them is never parsed. - Escape. A backslash before a sigil (
\/new,\@codex) makes that one token literal text. The backslash is removed. - Arguments. A directive that takes arguments declares
raw(the default) orfields.fieldssplits them into shell-style words with"…"quoting andkey=valuepairs, for example/ws orquelo worktree base=main. Arguments that do not fit produce the diagnosticargs. - ASCII only. Only the ASCII characters
/,!,@and$are sigils. Full-width forms (/!@$) are ordinary text.
Result of a parse:
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
| Kind | Sigil | Target | Trigger decision | Examples |
|---|---|---|---|---|
control | / | A decision action | cancel, reset, reply (help), feedback, answer (/approve), workspace (/ws) | /new, /bug, /ws |
command | / | A runtime command | start with Command | /compact |
tool | ! or / | A tool, instance/tool | start with Command: "tool"; the Runtime calls the tool without the model | ! → localenv/bash |
route | @ | A runtime instance the connection lists | Decision.Runtime, and the session key is bound to it (below) | @codex, @claude |
skill | $ | A skill the target runtime offers | start 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$ARGUMENTSsubstitution; their arguments are the message text./is only for actions. The switch is hard: once S1 lands,/code-reviewis 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 /bugreports "the answer dropped the table"./compactand/buguse 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 andfix the flaky test, binds the workspace and starts the run;/new summarize todayresets and starts./wsand/newuse it. - ◆
none: the directive stands alone, and any other text makes the combination invalid.how do I /cancel a runis therefore text./cancel,/helpand/approveuse 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 … $dtmean the same.
- 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. /,!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.- An unmatched token is text. The other tokens still apply.
- 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.
| Message | Result |
|---|---|
$dt @codex use the Feishu digital twin to answer Li's question | Runs on codex with the skill dt; binds codex |
@codex /compact keep the API names | compact on codex, if codex declares it, with the focus "keep the API names" |
$review $tests fix the parser | One run with two skills |
/new $standup | Reset, 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 !ls | Two 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 examplelocalenvcontributing!. A plugin's skills reach a runtime through itsuses, andworks_withlimits them: the digital twin'sdt(scenario B01) is visible only in Feishu connections. - ◆the operator's configuration, for example a
routefor 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 diagnosticambiguous. - ◆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 diagnosticunmatchedfor 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 throughCallTool, 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
批准andapproveare natural language, not directives. They stay in the chat trigger's answer logic./approveand/rejectbecome control directives.
Route Binding and Exit
- ◆Binding.
@codex <request>runs the request oncodexand binds the session key tocodex. The key is the one of P83's workspace binding: the connection, the conversation, the thread and, in a group, the sender.@codexwith no other text only binds, and replies with the noticeroute.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,/helpand 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:
@orquelo(or the default runtime's id) returns to the connection's default runtime; there is no/exit(section 13);@<other>switches to another listed runtime;/newstarts a new session without the binding;- the binding expires after
route_idle(a connection option, default 24 h) without a message; - 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_bindingsnext toworkspace_bindings. It is written in the same transaction as the inbox mark. Its terminal state is the deleted row, logged asroute.unboundwith 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:
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:directorgroup. - ◆
principals: a principal orrole:<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
allowrules, thendenyrules, so a matching deny always wins. The result is the visible table. The Host parses once, during routing, and puts the resolution inTriggerInput.Sigilsand the visible table inTriggerInput.Directives(for/help). The Trigger never parses text; it decides what a resolved action means now, for example/approvewhile an approval is pending.DirectivesreplacesCommands, with no compatibility period. After S5 the resolution also names the target runtime. - ◆Trust.
- ◆The Trigger sees only the resolution. A decision whose
Skills,CommandorTooldiffer from the resolution is refused: the Host logsroute.directive_refusedand replies with the noticesigil.refused. - ◆Visibility never grants anything. A
!call still passesCallTool'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).
| Slice | Change | Behavior change |
|---|---|---|
| S1 | pkg/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 |
| S2 | sigils.rules and aliases, Host check of decisions; /help from the visible table | Directives can be turned off per connection, conversation, person and runtime |
| S3 | Spans on Event, filled by Feishu (#8) | A person's mention can no longer trigger a route |
| S4 | The 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 |
| S5 | The 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 /compactthen a newline and "keep the API names". The Transport removes the bot mention. The parser finds the token/compact, whose text ruleargsmakes "keep the API names" its arguments. The table resolves it to the chat trigger's commandcompact. The decision isstart{Command: compact, Text: "keep the API names"}, and the agent usesTextas given. - ◆Feishu,
!rm -rf build.!is not in the visible table, because of the ruledeny: "!". 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 isstart{Command: tool, Tool: localenv/bash, Text: "go test ./..."}. The Runtime calls the tool throughCallToolwith keyuser:<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 instancecodex, which the connection lists. The Host checks the person's grants on it and starts the run oncodex, with the conversation's workspace (P83), and binds the session key. The next message,now run the tests, also runs oncodex.@orquelorepliesroute.unboundand the following message runs onagent. 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:
- The Transport removes the bot mention.
@codexis typed, not picked from the member list, so it is not a span. - The tokens are
$dtand@codex. The route resolves first:codexis listed and visible, so it is the target. $dtresolves againstcodex's table. The twin plugin is incodex'suses, itsworks_withincludes Feishu, and the adapter offers skills, so it matches.- 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"}. - The Host resolves again, checks the person's grant on
codex, and writes the run androute_bindingsin one transaction. The twin's tool calls fromcodexpassCallTooland its approvals. - The next message,
also tell her the date, runs oncodexwithoutdt, because skills apply to one run.@orqueloreturns toagent.
- ◆Failure. Two plugins both offer
$deploy: the diagnostic isambiguous, and the reply listsops:deployandinfra: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,
rawandfieldsarguments, the text rulesargs,requestandnone; - ◆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:
- ◆
/compactwith 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;
- ◆
$skillanywhere in the text, and/skillas text; - ◆after S5,
$dt @codexin either order,@codexchoosing 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
- A sigil that is not supported is ordinary text: unknown, invisible or turned off, it goes on as text (section 6).
- Full-width sigils are not supported (section 5, rule 8).
@codexbinds the conversation, with exits:@orquelo, another route,/new, idle expiry and loss of access (section 6, route binding).- Unified: workspaces are named only through
/wsarguments, with norepo=in prose (section 9). !follows the unified approval rules, with no exemption for typed commands (section 6).- Skills use
$;/is only for actions (section 6). - Hard switch with no compatibility period: what no longer matches is text (sections 6, 7 and 9).
- 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 inruntimesand 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 noticeroute.bound;@orqueloalone repliesroute.unbound. - ◆Every reply names its runtime (the owner's choice: the default too).
plugin.OutputcarriesRuntimeandRuntimeName(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 carryruntime. - ◆
/helplists, 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
scopecovers the person; otherwiseroute.forbidden, and nothing runs or pins. A pin ends with the noticeroute.endedand its reason when it is idle forroute_idle(default 24 h), when its runtime leavesruntimes, 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 ownruntime,@orqueloincluded; their routes to other listed runtimes follow the rules above, and admins keepruntime. Example: a Feishu digital twin opened to colleagues, with the owner inadminsand auser_runtimewithout a shell (2026-11-27). - ◆What stays.
/login,/loginsand/logoutrun on the connection's own runtime while pinned./newcloses 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
echoruntime gained aprefixoption, so two instances can be told apart in tests.