Expand description
Slugs and the name-keyed rows (KEY_NAMEs) an agent’s names map to:
collision-free slugs, tombstoning a renamed agent’s keys, and finding
agents by name.
Structs§
- Agent
Name Match - One row
agents_matching_namefound (identity M3).
Functions§
- agent_
open_ 🔒fallback_ id agent.open’s id for a definition with no slug (agent_open.rs).- delete_
key_ 🔒rows - Delete one name’s rows from the three name-keyed key tables.
- former_
names 🔒 - Every display / instance name
idhas had before its current ones (db_agent_former_names, recorded by trigger on every rename path). - frontend_
fallback_ 🔒id - The frontend’s id for a launch with no slug — a template-created agent’s
first session. ASCII only, one dash per UTF-16 code unit
(
agentmux_common::slug::js_ascii_slug, Codex P1 on #3633). - key_
name_ 🔒used_ by_ another - Whether another row may sign under
folded: holds it as its slug, or its display name orinstance_namegives that fallback id (agent.open’s or the frontend’s). Any row, whatever its slug: a template-created agent’s first session signs under the fallback id although its row has a derived slug (review of #3633), so two same-named agents share that key. Such a key is left. Templates count:agent.openof a template and template-based continuations sign under the template’s slug. Folded as the key tables fold (to_lowercase), not SQLite’s ASCII-onlylower(): slugsÄandäshare the key filed underä(Codex P2 on #3575). - key_
names_ 🔒of - Every name a key row could be filed under for this agent, folded as the
key tables fold (
to_lowercase) — identity M4d-1 (spec §6.5.10). The slug exactly as sent (M4a-3); the display name andinstance_name, trimmed, as the tombstone records them; andagent.open’s fallback id, the display name lowercased with non-alphanumerics made-(used when a definition has no slug:Zed Botis keyedzed-bot). - purge_
name_ 🔒keyed_ keys - Delete the signing keys filed under every name
idmay have signed as — its jekt HMAC key and its LAN and WAN keypairs, which are keyed by name, not UID. M4a-3 (spec §6.5.4) deleted them under the slug; M4d-1 (§6.5.10) also under the display name,instance_nameand the fallback ids (key_names_of). Without this a later agent that takes a name is handed the dead agent’s keys byensure’sINSERT OR IGNORE, and signs as it. Read before the row is deleted; a name another row may sign under (key_name_used_by_another) is that agent’s key and is left alone. Folded as the key tables fold (to_lowercase). A template row is skipped, as intombstone_key_names. Idempotent. - resolve_
slug_ 🔒collision - The first of
base,base-2,base-3, … that nodb_agentsrow holds. - tombstone_
key_ 🔒names - Every table keyed to an agent id that a deleted
db_agentsrow leaves behind, purged explicitly (docs/specs/SPEC_AGENT_DELETE_2026_09_16.md §5.1). Called with the caller’s connection lock already held, inside the same critical section as thedb_agentsDELETE. Returns rows removed.