Expand description
Name → slug / id / path-component rules, one named function per rule.
These rules differ ON PURPOSE (a display slug and a path component are different things), so they are not merged. They used to be written inline at each call site, which is how the same rule was derived two different ways (PR #2901: a work dir computed two ways broke Personal Bundle) and how a key purge that must reproduce every naming rule ever used missed some (#3633). Here each rule has a name, one body, and a table test that runs every rule over the same inputs so the differences are stated, not discovered (docs/specs/SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md §5.1 #2).
Changing a rule’s output moves existing agents’ directories, registry files or signing-key names. Don’t.
Constants§
- AGENT_
ID_ MAX_ LEN - The longest agent id the registry accepts.
Functions§
- agent_
route_ name - The name an agent is registered and addressed by:
AGENTMUX_AGENT_ID, the registry’s display binding, a message’s target. A valid agent id stays as it is, natural casing included (Agent2, which PR titles and git authors carry); anything else getsdefinition_slug’s rule without lowercasing, so a fork’s automatic nameLoap #3routes asLoap-3instead of being refused (REPORT_FORK_AGENT_ISOLATION_2026_10_12.md F3). A name with an@is an address (agent2@narko), not a name: it is left as it is, so it fails as an id instead of resolving to a local agent calledagent2-narko. - definition_
slug - A definition’s slug: lowercase; ASCII alphanumerics,
-and_kept, everything else-; runs of dashes collapsed and trimmed; at most 64 chars;"agent"if nothing is left. - file_
stem - A registry file stem:
path_slug’s rule, but everything else becomes_, so it can never introduce a path separator or... - fork_
slug - A fork’s slug: its lineage root’s slug and its own label, never its
source’s slug, so forking a fork doesn’t chain every generation
(
loap-loap-2-loap-3, REPORT_FORK_AGENT_ISOLATION_2026_10_12.md F4). A label that already starts with the root’s name isn’t prefixed twice (Loap #3→loap-3), whether it matches the root’s slug or its display name’s: a root namedClaudemay holdclaude-2(a template ownsclaude), and itsClaude #3is stillclaude-3. Capped like any definition slug. - is_
agent_ id - A valid agent id: 1 to 64 ASCII alphanumerics,
-or_. What the registry, MuxBus and a message’s target accept. - js_
ascii_ slug - The frontend’s id for a launch with no slug: JavaScript’s
name.toLowerCase().replace(/[^a-z0-9-_]/g, "-"). ASCII only, unlikepath_slug; no collapsing. The regex has nouflag, so it replaces each UTF-16 code unit: a character outside the BMP becomes two dashes (Agent 🚀→agent---), which signing-key names depend on (Codex P1 on #3633). - path_
slug - A path component, and
agent.open’s id for a definition with no slug: lowercase; Unicode alphanumerics,-and_kept, everything else-; no collapsing, no cap.Zed Bot→zed-bot,Ä→ä.