MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _load_skill_commands_cached

Function _load_skill_commands_cached

src/command_system/aggregator.py:53–68  ·  view source on GitHub ↗

Load filesystem skills for ``cwd`` and convert them to PromptCommands. Cached by cwd because skill discovery does disk I/O + frontmatter parsing. Builtins are intentionally NOT cached here (they're cheap and their is_enabled gates must stay fresh). Failures degrade to an empty tupl

(cwd: str)

Source from the content-addressed store, hash-verified

51
52@lru_cache(maxsize=32)
53def _load_skill_commands_cached(cwd: str) -> tuple[Command, ...]:
54 """
55 Load filesystem skills for ``cwd`` and convert them to PromptCommands.
56
57 Cached by cwd because skill discovery does disk I/O + frontmatter parsing.
58 Builtins are intentionally NOT cached here (they're cheap and their is_enabled
59 gates must stay fresh). Failures degrade to an empty tuple — skills are
60 non-critical and must never break command listing (mirrors TS).
61 """
62 try:
63 from ..skills.loader import get_all_skills
64 skills = get_all_skills(project_root=cwd)
65 return tuple(skill_to_prompt_command(s) for s in skills)
66 except Exception as exc: # noqa: BLE001 — skills are non-critical
67 logger.debug("skill loading failed for %s: %s", cwd, exc)
68 return ()
69
70
71@lru_cache(maxsize=32)

Callers 1

get_commandsFunction · 0.85

Calls 2

get_all_skillsFunction · 0.85
skill_to_prompt_commandFunction · 0.85

Tested by

no test coverage detected