Skip to main content

Module skill_seed

Module skill_seed 

Source
Expand description

Starter Skills catalog seed: preloads a small set of curated global skills (db_skills, the v1 standalone catalog) on fresh install.

The actual “run exactly once, ever” gating lives in migrations::m0015_seed_starter_skills, tracked in the channel’s db_migrations table — NOT in this module. An earlier version gated on “is the catalog currently empty,” which couldn’t distinguish “never seeded” from “seeded then the user deleted every starter skill on purpose,” silently resurrecting the defaults on the next restart after a full deletion (reagent P2, PR #2141 round 2). This module now exposes only the pure insert logic; the migration owns once-ever invocation.

Distinct from agent_seed.rs, which seeds legacy per-agent skills into db_agent_skills and re-seeds on every manifest version bump.

Ids are deterministic, not randomly minted (Phase 1 of SPEC_DURABLE_BINDINGS_2026_09_10.md). Every store that seeds “Systematic Debugging” produces the exact same row id for it, derived from the manifest entry’s trigger — the stable slash-command slug, not name (display text; changing it must not change identity) and not content (edited over time for typos/clarity; a wording fix is not a new skill). This is what a later cross-store reconciliation needs to recognize “these are the same seeded skill” without a name-matching heuristic that a user-created private skill sharing that name could collide with — see starter_skill_id’s own doc comment for why a bare name match is unsafe in general. Existing installs, already seeded under this migration before this change shipped, keep whatever random id they already have; this only changes what a FUTURE seed produces.

Structs§

StarterSkill 🔒
One entry in the embedded starter-skills manifest. Field names mirror Skill minus the store-generated id/is_global/timestamps.

Constants§

STARTER_SKILLS_JSON 🔒
The embedded starter-skills manifest JSON. Content is authored externally and must not be edited here — see crates/srv/src/config/starter-skills.json.

Functions§

any_starter_skill_name_exists 🔒
True if any global skill whose name matches a starter-skill’s name already exists — i.e. this channel already effectively has the starter set (or a name collision with it), whether from a prior run of this migration, the retired pre-migration startup-seed path (#2141, shipped before this migration existed — every channel that has already booted once has these names present), or the user coincidentally naming their own skill the same thing.
reject_duplicate_triggers 🔒
Guard against a manifest-authoring mistake: two entries sharing a trigger.
seed_starter_skills 🔒
Parse the embedded manifest and insert every entry as a global skill via the validated skill_upsert_unique_global path. Does NOT check whether the catalog is already populated — the caller (migrations::m0015_seed_starter_skills) owns run-once gating via db_migrations tracking, not catalog contents. Exposed at pub(crate) so the migration and tests can call it directly.
starter_skill_id 🔒
Deterministic row id for a starter skill, derived from its trigger.