Skip to main content

Module slug

Module slug 

Source
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 gets definition_slug’s rule without lowercasing, so a fork’s automatic name Loap #3 routes as Loap-3 instead 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 called agent2-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 named Claude may hold claude-2 (a template owns claude), and its Claude #3 is still claude-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, unlike path_slug; no collapsing. The regex has no u flag, 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, Ä → ä.