Skip to main content

Module skill_scope

Module skill_scope 

Source
Expand description

Skill-scoped tool filtering — hard enforcement of allowed_tools. Skill-scoped tool filtering.

When a skill with allowed_tools is activated, only those tools (plus meta-tools like ActivateSkill, ListSkills, ListAgents, InvokeAgent) are sent to the LLM. This is the “hard enforcement” counterpart to the prompt hint in activate_skill().

§How it works

  1. The inference loop creates a SkillToolScope (initially empty).
  2. After each tool dispatch round, if an ActivateSkill call was made, the loop calls update_from_tool_calls() with the tool call names and args.
  3. SkillToolScope inspects the skill registry to check if the activated skill has allowed_tools.
  4. On the next iteration, filter_tool_defs() returns only the in-scope tools.

§Meta-tools

These tools are always available regardless of scope, so the model can switch skills, delegate, ask the user for help, or manage its own background work even when scoped to a restricted tool set:

  • ActivateSkill, ListSkills
  • ListAgents, InvokeAgent
  • AskUser
  • ListBackgroundTasks, CancelTask, WaitTask (#996 Phase G)

§Lifecycle

  • Activating a skill with allowed_tools → scope is set
  • Activating a skill without allowed_tools → scope is cleared
  • No ActivateSkill call → scope unchanged

Structs§

SkillToolScope
Tracks the active skill’s tool scope during an inference loop.