Restore load_skill + surface skill catalog in system prompt

Main's load_skill tool was deleted during the SDK migration along
with the prompt-mutation pattern it relied on. Re-add the capability
without the mutation: load_skill(skills=[...]) now returns the skill
markdown bodies as a tool result, so the content lands in conversation
history as in-context reference rather than as patched-in system
prompt content. Same source of truth (load_skills + skill files),
same validation (validate_requested_skills) as create_agent.

Tool result format is plain markdown (## Skill: <name> headers joined
with ---), not the <specialized_knowledge> XML wrapping used at
agent-build time. The XML framing was deliberately reserved for
prompt-level privileged context; tool-loaded skills are honestly
labelled as just-fetched reference material.

Close the discovery loop by surfacing the full skill catalog in the
system prompt. Without it the model could only guess skill names —
discovering them via validation errors on misses. Now every agent
sees a categorised <available_skills> block right after the
<specialized_knowledge> block with a short hint pointing at
create_agent / load_skill.

Skills module: factored _iter_user_skill_files() so get_all_skill_names
(set, for validation) and get_available_skills (dict by category,
for the prompt) share one source of truth on what counts as
user-selectable. Internal categories (scan_modes, coordination) stay
excluded from both.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
0xallam
2026-05-25 15:02:24 -07:00
co-authored by Claude Opus 4.7
parent 418eedcd41
commit a451766d97
6 changed files with 71 additions and 14 deletions
+3
View File
@@ -40,6 +40,7 @@ from strix.tools.agents_graph.tools import (
wait_for_message,
)
from strix.tools.finish.tool import finish_scan
from strix.tools.load_skill.tool import load_skill
from strix.tools.notes.tools import (
create_note,
delete_note,
@@ -342,6 +343,8 @@ def _finish_tool_use_behavior(
_BASE_TOOLS: tuple[Tool, ...] = (
# Thinking + planning
think,
# On-demand skill reference (returns the skill markdown inline)
load_skill,
# Per-agent todos
create_todo,
list_todos,
+2 -1
View File
@@ -12,7 +12,7 @@ from typing import Any
from jinja2 import Environment, FileSystemLoader, select_autoescape
from strix.skills import load_skills
from strix.skills import get_available_skills, load_skills
from strix.utils.resource_paths import get_strix_resource_path
@@ -114,6 +114,7 @@ def render_system_prompt(
rendered = env.get_template("system_prompt.jinja").render(
loaded_skill_names=list(skill_content.keys()),
available_skills=get_available_skills(),
interactive=interactive,
system_prompt_context=system_prompt_context or {},
**skill_content,
+10
View File
@@ -437,3 +437,13 @@ Default user: pentester (sudo available)
{% endfor %}
</specialized_knowledge>
{% endif %}
{% if available_skills %}
<available_skills>
On-demand specialist skills. Spawn a specialist via `create_agent(skills=[...])`, or pull guidance inline for yourself via `load_skill(skills=[...])`. Anything wrapped in `<specialized_knowledge>` above is already loaded for you.
{% for category, names in available_skills | dictsort -%}
- {{ category }}: {{ names | join(', ') }}
{% endfor -%}
</available_skills>
{% endif %}