Skip to main content

Module m0026_registry_agent_id_rekey

Module m0026_registry_agent_id_rekey 

Source
Expand description

Re-key the named-agent registry from launch ids to agent ids.

Agent-concept consolidation, Phase 3b PR 2 (SPEC_AGENT_ARCHITECTURE_2026_05_27.md): the cross-version/cross-channel registry under <home>/shared/agents/registry/ names one file per named agent. It used to be keyed by the LAUNCH id (db_agent_instances.id); now that an agent is one db_agents row, it is keyed by the AGENT id.

Without this pass an upgraded install keeps its old files under the old keys, and every one of them is a duplicate the picker shows next to the agent’s real entry — and worse, “Forget agent” retires the NEW key while the stale file stays active, so the forgotten agent reappears.

Mapping (read-only against the legacy table, which still exists until Phase 3c drops it): a record keyed by launch L maps to the agent row that launch folded into — the launch’s definition when that definition is a user agent, otherwise the root of L’s continuation chain. Records whose launch id is not in THIS channel’s db_agent_instances are left alone: the registry is shared across channels, so another channel owns them and will re-key them when it upgrades.

Global scope: the registry is one host-global tree, and re-keying it twice (once per channel) would be wasted work — but each channel only resolves its own launches, so the pass is written to be safely repeatable and is recorded per install.

Structs§

LaunchRow 🔒
One legacy launch row, reduced to what the mapping needs.
M0026RegistryAgentIdRekey
RekeyStats 🔒
How many records moved, and how many were left for another channel.

Functions§

agent_id_for_launch 🔒
The agent id a launch folded into, or None when this channel cannot resolve it. Mirrors instance_create’s rule: a launch of a USER agent is that agent; a launch of a template is its own agent, and a continuation belongs to the launch at the root of its chain.
rekey_registry 🔒