Skip to main content

suggest_fork_name

Function suggest_fork_name 

Source
fn suggest_fork_name(
    defs: &[AgentDefinition],
    retired: &[String],
    root_former: &[String],
    source: &AgentDefinition,
    taken: impl Fn(&str) -> bool,
) -> String
Expand description

Build the flat, lineage-wide “#N” auto-suggestion for forking source.

The name is built from the lineage root’s name, not source’s own (possibly already-suffixed) name — forking “AgentX #2” gives “AgentX #3”, not “AgentX #2 #3” (SPEC_AGENT_NAMING_AND_ADDRESSING_HOST_LAN_WAN_2026_08_22.md §4.5). The number is one past the highest “#N” any fork in the lineage already carries, or any deleted agent carried (retired, the store’s retired_agent_names), not a count of the live ones: a count handed a deleted fork’s number to the next fork, so two agents could share a name over time, and live ones too while a later fork still had it (REPORT_FORK_AGENT_ISOLATION_2026_10_12.md F4). A live fork’s number is its name’s trailing “ #N“, whatever its prefix, so renaming the root keeps the count; a deleted name counts under the root’s current name, compared lowercased as it was tombstoned, and under each of the root’s former names (root_former), so renaming the root after deleting forks keeps them counted too. A name taken says is in use is skipped.