Skip to main content

Module template

Module template 

Source

Functions§

agent_def_hide 🔒
agentdefhide → set user_hidden = 1 on a seeded template, so it disappears from the picker’s “+ New from template” tier. Phase 2 (Q2 Decision Y) of SPEC_AGENT_PICKER_TWO_TIER_2026_05_24.md.
agent_def_unhide 🔒
agentdefunhide → set user_hidden = 0 on a seeded template, bringing it back into the picker. Same validation + broadcast as agentdefhide. Phase 2 of the two-tier picker spec.
copied_row 🔒
The copy’s row before it is inserted: what the source keeps, a fresh id, and the opt-in settings reset. lineage is whether it is a fork, and its label.
copy_content_and_skills 🔒
Deep-copy content blobs + skills from source. Cascade foreign keys on the source are unaffected — we’re copying out, not moving.
copy_definition 🔒
A new agent built from source_id’s definition, as fork_definition builds one, but not a fork (as_fork: false): no lineage, so it isn’t among the source’s forks, a slug of its own name (required), and no account link, which the caller makes. The Agents spawn action’s workers (app_api/agent_spawn.rs): a worker is a new agent, not a fork. It gets the leader’s definition and a brief, never the leader’s conversation (“Fork, spawn and worker” in mod.rs).
copy_name 🔒
The new definition’s name: the label it was given (checked against the reserved and taken names), or the next free lineage-wide “Name #N” when none was.
fork_agent_definition 🔒
forkagentdefinition → a copy of the source definition under a branch label.
fork_definition 🔒
Fork source_id into a new definition: its content, skills, provider and flags, linked to its account, with a fresh id, workspace, bus id and own bundle, recorded as the source’s fork. branch_label is the fork’s name; empty picks the next free Name #N. The forkagentdefinition RPC (the user’s forks) creates forks here; the history is copied separately, by copyforkhistory, once the fork is known to continue the parent’s conversation (“Fork, spawn and worker” in mod.rs). The caller publishes AgentsChanged.
fork_lineage_root 🔒
The definition at the root of source’s fork lineage (see fork_lineage_root_id); source itself if the root can’t be found.
fork_lineage_root_id 🔒
Resolve a definition’s fork-lineage root by walking parent_id.
fork_suggest 🔒
forkagentdefinitionsuggest → the branch label a fork of the source would get (read-only — no mutation).
former_name_of_another 🔒
Whether name addresses an agent other than own_id as a name it was renamed from, so no other agent may take it as a display name.
inherit_source_account_links 🔒
Link a new fork to the account its source runs on, for the fork’s own provider: the source’s own links, or its template’s when it has none (effective_identity_links, the spawn gate’s rule). Every caller of forkagentdefinition launches the fork on its source’s account (quick-fork.ts; AgentPicker.tsx’s handleFork), but the launch wrote that link only after its first spawn. A quick fork resumes its source’s conversation, so that spawn runs at launch, and it was refused with “no credentials” until the link landed. Writing it here means a fork never exists without it.
list_hidden_templates 🔒
agentdeflisthiddentemplates → templates the user has hidden (is_seeded = 1 AND user_hidden = 1). Used by the settings panel to render the unhide list. The picker proper never calls this — it uses listagents with the default-filter-out behaviour.
name_available 🔒
Whether no agent goes by name and no agent was renamed from it: the name a new agent may take.
name_in_use 🔒
name_taken, or the store’s own name resolution finds it (slug, name, a launched agent’s instance name, or a slug an agent was renamed from): every name a fork could take is checked against both, automatic or typed (#4746). So is the name it would be addressed by, its route name: a former slug or display name stays reserved for its agent (SPEC_FORK_SLUG_MIGRATION_2026_10_22.md Phase 1; former_names).
name_taken 🔒
Whether a user agent (not a seeded template) already goes by name, case-insensitively: as its name, or as its branch label, which is what a renamed fork shows. Names are unique among user agents: the picker lists them by name, and name-keyed registrations collide otherwise. A launched agent’s instance name is the store’s to check (agents_matching_name).
register
renamed_note 🔒
The [AgentMux] note an agent gets when it is renamed. Both names come from the user, so they are quoted.
suggest_fork_name 🔒
Build the flat, lineage-wide “#N” auto-suggestion for forking source.