Remove legacy skill prompt cleanup

Delete the empty active-skills prompt extension and its unused prompt template now that selected skills are loaded through chat history instead of protocol. Stop clearing legacy loaded_skills keys from protocol/extras in the loaded-skills hook while keeping history reattachment for compacted skill bodies.
This commit is contained in:
Alessandro 2026-07-08 12:42:43 +02:00
parent 0de0fcec0e
commit f8b06e0b12
6 changed files with 5 additions and 39 deletions

View file

@ -2,14 +2,14 @@
## Purpose
- Own prompt protocol and extras appended around primary message-loop prompt construction.
- Own prompt protocol, prompt extras, and history reattachment around primary message-loop prompt construction.
## Ownership
- Ordered Python files own current datetime, skill recall/load context, agent info, parallel job status, and workdir extras injection.
- Ordered Python files own current datetime, relevant-skill hints, loaded-skill history reattachment, agent info, parallel job status, and workdir extras injection.
- Explicitly loaded skill bodies belong in tool-result history with metadata so they can survive persistence and be reattached after compaction.
- Explicitly loaded skill IDs are chat-wide context data, not agent-local state.
- Legacy active-skill prompt protocol injection must stay empty; selected skills are loaded through history.
- Skills must not write selected or loaded skill bodies into protocol or extras.
## Local Contracts

View file

@ -14,9 +14,6 @@ class IncludeLoadedSkills(Extension):
if not self.agent:
return
loop_data.protocol_persistent.pop("loaded_skills", None)
loop_data.extras_persistent.pop("loaded_skills", None)
skill_names = skills.get_loaded_skill_names(self.agent)
if not skill_names:
return

View file

@ -8,7 +8,6 @@
- `hooks.py` owns skill config normalization.
- `api/skills_catalog.py` owns skill catalog access and loading selected skills into chat history.
- `prompts/agent.system.active_skills.md` is retained only for legacy prompt-protocol compatibility.
- `webui/` owns skill settings UI and store.
- `default_config.yaml`, `plugin.yaml`, `README.md`, and `LICENSE` own defaults, metadata, docs, and license.

View file

@ -1,23 +0,0 @@
from __future__ import annotations
from helpers import skills
from agent import LoopData
from helpers.extension import Extension
class IncludeActiveSkills(Extension):
async def execute(self, loop_data: LoopData = LoopData(), **kwargs):
if not self.agent:
return
protocol = loop_data.protocol_persistent
protocol.pop("active_skills", None)
content = skills.build_active_skills_prompt(self.agent)
if not content:
return
protocol["active_skills"] = self.agent.read_prompt(
"agent.system.active_skills.md",
skills=content,
)

View file

@ -1,5 +0,0 @@
## active skills
The following skills were explicitly activated for this chat.
Treat them as already loaded instructions and follow them when relevant.
{{skills}}

View file

@ -430,8 +430,8 @@ def test_loaded_skills_extension_reattaches_missing_body_after_compaction(
module = _load_loaded_skills_extension(monkeypatch, tmp_path)
agent = _FakeLoadedSkillAgent()
loop_data = types.SimpleNamespace(
protocol_persistent={"loaded_skills": "legacy"},
extras_persistent={"loaded_skills": "legacy"},
protocol_persistent={},
extras_persistent={},
history_output=[
{
"ai": False,
@ -442,8 +442,6 @@ def test_loaded_skills_extension_reattaches_missing_body_after_compaction(
asyncio.run(module.IncludeLoadedSkills(agent).execute(loop_data))
assert "loaded_skills" not in loop_data.protocol_persistent
assert "loaded_skills" not in loop_data.extras_persistent
assert len(agent.added_tool_results) == 1
added = agent.added_tool_results[0]
assert added["tool_name"] == "skills_tool"