Skip to content

Agent Zero AI framework

remove skills activation state

3clyp50804125a00c3c
diff --git a/python/api/skills.py b/python/api/skills.py
index b8fc3328a..33d2c3345 100644
--- a/python/api/skills.py
+++ b/python/api/skills.py
@@ -2,14 +2,6 @@ from python.helpers.api import ApiHandler, Input, Output, Request, Response
from python.helpers import skills
-def _coerce_bool(value) -> bool:
- if isinstance(value, bool):
- return value
- if isinstance(value, str):
- return value.strip().lower() in ("1", "true", "yes", "on")
- return bool(value)
-
-
class Skills(ApiHandler):
async def process(self, input: Input, request: Request) -> Output:
action = input.get("action", "")
@@ -17,8 +9,6 @@ class Skills(ApiHandler):
try:
if action == "list":
data = self.list_skills(input)
- elif action == "toggle":
- data = self.toggle_skill(input)
elif action == "delete":
data = self.delete_skill(input)
else:
@@ -42,23 +32,6 @@ class Skills(ApiHandler):
profile_name=profile_name
)
- def toggle_skill(self, input: Input):
- skill_id = str(input.get("skill_id") or "").strip()
- if not skill_id:
- raise Exception("skill_id is required")
-
- enabled = _coerce_bool(input.get("enabled", True))
- project_name = (input.get("project_name") or "").strip() or None
- profile_name = (input.get("profile_name") or "").strip() or None
-
- skills.set_skill_activation(
- skill_id,
- enabled=enabled,
- project_name=project_name,
- profile_name=profile_name,
- )
- return {"enabled": enabled}
-
def delete_skill(self, input: Input):
skill_id = str(input.get("skill_id") or "").strip()
if not skill_id:
diff --git a/python/extensions/system_prompt/_10_system_prompt.py b/python/extensions/system_prompt/_10_system_prompt.py
index 272ec7e8a..ef4c18de6 100644
--- a/python/extensions/system_prompt/_10_system_prompt.py
+++ b/python/extensions/system_prompt/_10_system_prompt.py
@@ -85,7 +85,7 @@ def get_project_prompt(agent: Agent):
return result
def get_skills_prompt(agent: Agent):
- available = skills.list_skills(agent=agent, enabled_only=True)
+ available = skills.list_skills(agent=agent)
result = []
for skill in available:
name = skill.name.strip().replace("\n", " ")[:100]
diff --git a/python/helpers/skills.py b/python/helpers/skills.py
index 7b2ad8d38..fba71ec93 100644
--- a/python/helpers/skills.py
+++ b/python/helpers/skills.py
@@ -286,9 +286,8 @@ def skill_from_markdown(
def list_skills(
agent:Agent|None=None,
include_content: bool = False,
- enabled_only: bool = False,
) -> List[Skill]:
- """List skills, optionally filtered by agent scope and enabled status."""
+ """List skills, optionally filtered by agent scope."""
skills: List[Skill] = []
roots = get_skill_roots(agent)
@@ -301,8 +300,6 @@ def list_skills(
# no deduplication for global skills
if not agent:
- if enabled_only:
- skills = filter_enabled_skills(skills, agent=None)
return skills
# Dedupe by normalized name, preserving root_order priority (earlier wins)
@@ -312,47 +309,7 @@ def list_skills(
if key and key not in by_name:
by_name[key] = s
- result = list(by_name.values())
-
- if enabled_only:
- result = filter_enabled_skills(result, agent=agent)
-
- return result
-
-
-def _get_activation_file(project_name: str | None, profile_name: str | None) -> str:
- """Get the activation file path for the given scope."""
- if project_name and profile_name:
- return files.deabsolute_path(
- projects.get_project_meta_folder(project_name, "agents", profile_name, "skills.json")
- )
- elif project_name:
- return files.deabsolute_path(
- projects.get_project_meta_folder(project_name, "skills.json")
- )
- elif profile_name:
- return files.get_abs_path(subagents.USER_AGENTS_DIR, profile_name, "skills.json")
- return files.get_abs_path(subagents.USER_DIR, "skills", "skills.json")
-
-
-def _load_activation_map(path: str) -> Dict[str, bool]:
- try:
- if not files.exists(path):
- return {}
- parsed = dirty_json.parse(files.read_file(path))
- if not isinstance(parsed, dict):
- return {}
- result: Dict[str, bool] = {}
- for key, value in parsed.items():
- result[str(key)] = bool(value)
- return result
- except Exception:
- return {}
-
-
-def _write_activation_map(path: str, data: Dict[str, bool]) -> None:
- content = dirty_json.stringify(data, indent=2)
- files.write_file(path, content)
+ return list(by_name.values())
def _get_skill_roots_for_list(
@@ -424,10 +381,8 @@ def get_skills_list(
project_name: str | None = None,
profile_name: str | None = None,
) -> List[Dict[str, Any]]:
- """Get list of all skills with activation status."""
+ """Get list of all skills."""
roots = _get_skill_roots_for_list(project_name, profile_name)
- activation_file = _get_activation_file(project_name, profile_name)
- activation_map = _load_activation_map(activation_file)
entries: List[Dict[str, Any]] = []
for root in roots:
@@ -441,7 +396,6 @@ def get_skills_list(
# generate skill_id
rel_path = os.path.relpath(str(skill.path), root).replace("\\", "/")
skill_id = f"{root}:{rel_path}"
- enabled = activation_map.get(skill_id, True)
entries.append(
{
@@ -453,39 +407,11 @@ def get_skills_list(
"scope": scope_info["scope"],
"scope_name": scope_info["scope_name"],
"origin": scope_info["origin"],
- "enabled": bool(enabled),
}
)
return entries
-def set_skill_activation(
- skill_id: str,
- enabled: bool,
- project_name: str | None = None,
- profile_name: str | None = None,
-) -> None:
- """Toggle skill activation."""
- if not skill_id or ":" not in skill_id:
- raise ValueError("Invalid skill_id")
-
- root, _ = skill_id.split(":", 1)
- allowed_roots = _get_skill_roots_for_list(project_name, profile_name)
-
- if root not in allowed_roots:
- raise ValueError("Skill root not in current scope")
-
- activation_file = _get_activation_file(project_name, profile_name)
- activation_map = _load_activation_map(activation_file)
-
- if enabled:
- activation_map.pop(skill_id, None)
- else:
- activation_map[skill_id] = False
-
- _write_activation_map(activation_file, activation_map)
-
-
def delete_skill(
skill_id: str,
project_name: str | None = None,
@@ -517,63 +443,6 @@ def delete_skill(
# delete directory
files.delete_dir(skill_path)
- # clean up activation map
- activation_file = _get_activation_file(project_name, profile_name)
- activation_map = _load_activation_map(activation_file)
- activation_map.pop(skill_id, None)
- _write_activation_map(activation_file, activation_map)
-
-
-def filter_enabled_skills(skills: List[Skill], agent: Agent|None=None) -> List[Skill]:
- """Filter skills based on activation status."""
- if not skills:
- return skills
-
- roots = get_skill_roots(agent)
- if not roots:
- return skills
-
- # sort by path length (longest first) for proper matching
- roots.sort(key=len, reverse=True)
-
- # cache activation files to avoid repeated reads
- activation_cache: Dict[str, Dict[str, bool]] = {}
-
- enabled_skills: List[Skill] = []
- for skill in skills:
- # find matching root
- skill_root = None
- for root in roots:
- try:
- Path(str(skill.path)).relative_to(Path(root))
- skill_root = root
- break
- except Exception:
- continue
-
- if not skill_root:
- # skill not in any known root, include by default
- enabled_skills.append(skill)
- continue
-
- # determine which activation file to use for this root
- # note: we use global scope here since agent context doesn't map cleanly to project/profile
- activation_file = _get_activation_file(None, None)
-
- if activation_file not in activation_cache:
- activation_cache[activation_file] = _load_activation_map(activation_file)
-
- activation_map = activation_cache[activation_file]
-
- # check activation
- rel_path = os.path.relpath(str(skill.path), skill_root).replace("\\", "/")
- skill_id = f"{skill_root}:{rel_path}"
-
- if activation_map.get(skill_id, True):
- enabled_skills.append(skill)
-
- return enabled_skills
-
def find_skill(
skill_name: str,
diff --git a/python/tools/skills_tool.py b/python/tools/skills_tool.py
index f5f225e58..d059e8af9 100644
--- a/python/tools/skills_tool.py
+++ b/python/tools/skills_tool.py
@@ -60,7 +60,6 @@ class SkillsTool(Tool):
skills = skills_helper.list_skills(
agent=self.agent,
include_content=False,
- enabled_only=True,
)
if not skills:
return "No skills found."
diff --git a/webui/components/settings/skills/list.html b/webui/components/settings/skills/list.html
index 30f4499ff..0639e68a9 100644
--- a/webui/components/settings/skills/list.html
+++ b/webui/components/settings/skills/list.html
@@ -61,18 +61,6 @@
<div class="skill-header">
<div class="skill-title" x-text="skill.name || '(unnamed skill)'"></div>
<div class="skill-actions">
- <template x-if="skill.enabled">
- <button type="button" class="button cancel" title="Disable" style="width:9em"
- @click="$store.skillsListStore.toggleSkill(skill, false)">
- <span class="icon material-symbols-outlined">close</span> Disable
- </button>
- </template>
- <template x-if="!skill.enabled">
- <button type="button" class="button confirm" title="Enable" style="width:9em"
- @click="$store.skillsListStore.toggleSkill(skill, true)">
- <span class="icon material-symbols-outlined">play_arrow</span> Enable
- </button>
- </template>
<button type="button" class="button confirm" title="Open in browser"
@click="$store.skillsListStore.openSkill(skill)">
<span class="icon material-symbols-outlined">folder_open</span> Open
diff --git a/webui/components/settings/skills/skills-list-store.js b/webui/components/settings/skills/skills-list-store.js
index eca605db7..dc7ff383e 100644
--- a/webui/components/settings/skills/skills-list-store.js
+++ b/webui/components/settings/skills/skills-list-store.js
@@ -89,35 +89,6 @@ const model = {
}
},
- async toggleSkill(skill, enabled) {
- if (!skill) return;
- const previous = skill.enabled;
- skill.enabled = enabled;
- try {
- const response = await fetchApi("/skills", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({
- action: "toggle",
- skill_id: skill.skill_id,
- enabled,
- project_name: this.projectName || null,
- profile_name: this.profileName || null,
- }),
- });
- const result = await response.json().catch(() => ({}));
- if (!result.ok) {
- throw new Error(result.error || "Toggle failed");
- }
- } catch (e) {
- skill.enabled = previous;
- const msg = e?.message || "Toggle failed";
- if (window.toastFrontendError) {
- window.toastFrontendError(msg, "Skills");
- }
- }
- },
-
async deleteSkill(skill) {
if (!skill) return;
try {