fix: enable SDK skill auto-discovery and unify skill directories

The Claude Agent SDK backend was not loading skills because
`setting_sources` and the `Skill` tool were missing from the options
passed to `ClaudeAgentOptions`.

- Add `setting_sources=["user", "project"]` so the SDK discovers
  SKILL.md files from `~/.claude/skills/` and `.claude/skills/`
- Add `"Skill"` to `allowed_tools` and the `_SDK_TO_POLICY` mapping
- Add `"skill"` to `group:skills` in the policy system
- Add `~/.claude/skills/` to SkillLoader search paths
- Write agent-created skills to `~/.claude/skills/` (SDK-standard
  location) instead of `~/.pocketpaw/skills/`

Closes #177

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Rohit Kushwaha
2026-02-17 01:53:45 +05:30
parent 2be2bc5c45
commit 4f897a7d8e
4 changed files with 12 additions and 3 deletions

View File

@@ -170,6 +170,7 @@ class ClaudeAgentSDK:
"Grep": "shell", # search is shell-adjacent
"WebSearch": "browser",
"WebFetch": "browser",
"Skill": "skill",
}
def __init__(self, settings: Settings, executor: ExecutorProtocol | None = None):
@@ -739,6 +740,7 @@ class ClaudeAgentSDK:
"Grep",
"WebSearch",
"WebFetch",
"Skill",
]
allowed_tools = [
t
@@ -763,6 +765,7 @@ class ClaudeAgentSDK:
options_kwargs = {
"system_prompt": final_prompt,
"allowed_tools": allowed_tools,
"setting_sources": ["user", "project"],
"hooks": hooks,
"cwd": str(self._cwd),
"max_turns": 25, # Safety net against runaway tool loops

View File

@@ -22,6 +22,7 @@ logger = logging.getLogger(__name__)
# Skill search paths in priority order (later overrides earlier)
SKILL_PATHS = [
Path.home() / ".agents" / "skills", # From skills.sh (central)
Path.home() / ".claude" / "skills", # Claude Code / SDK standard
Path.home() / ".pocketpaw" / "skills", # PocketPaw-specific
]

View File

@@ -14,8 +14,13 @@ logger = logging.getLogger(__name__)
def _get_skills_dir() -> Path:
"""Get (and create) the PocketPaw skills directory."""
d = get_config_dir() / "skills"
"""Get (and create) the user skills directory.
Writes to ``~/.claude/skills/`` — the standard location used by the
Claude Agent SDK for auto-discovery. PocketPaw's SkillLoader also
scans this directory so skills are available in both systems.
"""
d = Path.home() / ".claude" / "skills"
d.mkdir(parents=True, exist_ok=True)
return d

View File

@@ -28,7 +28,7 @@ TOOL_GROUPS: dict[str, list[str]] = {
"group:memory": ["remember", "recall", "forget"],
"group:desktop": ["desktop"],
"group:search": ["web_search", "url_extract"],
"group:skills": ["create_skill"],
"group:skills": ["create_skill", "skill"],
"group:gmail": ["gmail_search", "gmail_read", "gmail_send"],
"group:calendar": ["calendar_list", "calendar_create", "calendar_prep"],
"group:voice": ["text_to_speech", "speech_to_text"],