Holds all skill-related state for a running agent.
Two concerns live here:
- System prompt index —
pool,ranked, andtop_nare frozen at session start and used bySystemPrompt.build/1on every turn without calling any external function (cache-friendly). - Tool dispatch —
namesandrefresh_fnare used by theload_skillandlist_skillstools to resolve and hot-reload the skill pool.
Summary
Functions
Build a SkillIndex from agent start opts.
Return an empty skill index.
Refresh pool and ranked by calling index_refresh_fn.
Types
@type t() :: %Planck.Agent.SkillIndex{ index_refresh_fn: (-> {[Planck.Agent.Skill.t()], [String.t()]}) | nil, names: [String.t()], pool: [Planck.Agent.Skill.t()], ranked: [String.t()], refresh_fn: (-> [Planck.Agent.Skill.t()]) | nil, top_n: pos_integer() }
:pool— frozen list ofSkill.t()for the system prompt index; set at session start, refreshed at compaction:ranked— skill names ordered by usage history (from SQLite); used by the index to determine the "last used" section:top_n— maximum number of ranked skills shown in the index:names— skill names declared in TEAM.json"skills"array; used byAgentSpec.to_start_opts/2for tool resolution:refresh_fn— returns the live skill pool; called byload_skillandlist_skillstools only, never by the system prompt:index_refresh_fn— called after compaction to rebuildpoolandranked; returns{[Skill.t()], [String.t()]}.nilmeans the index stays frozen for the entire session.
Functions
Build a SkillIndex from agent start opts.
@spec new() :: t()
Return an empty skill index.
Refresh pool and ranked by calling index_refresh_fn.
Called after compaction — the right moment to pick up newly created skills
and updated usage rankings without busting the prefix cache on normal turns.
Returns the index unchanged when no index_refresh_fn is set.