Without an API key, the Skill executes whichever claude program resolves from PATH
Source references: 4The fallback locates an executable with shutil.which("claude") and runs it. The fixed argument list and absence of a shell reduce command injection, but the program's identity still depends on the current PATH.
If an untrusted project environment, installation, or compromised program places a same-named executable earlier in PATH, it runs with the Skill user's privileges and receives file content embedded in the compression prompt.
Supported, conditionally. Without ANTHROPIC_API_KEY, the skill resolves a program named claude from the current PATH and executes it. If another program or a low-trust directory has poisoned PATH, that executable receives the full prompt and runs with the process's permissions. The fixed argument list and absence of a shell reduce command-injection risk from file content, but executable identity is not verified. Users can restrict PATH, confirm the resolved Claude location, or ask the author to pin and verify a trusted executable.
""" api_key = os.environ.get("ANTHROPIC_API_KEY") if api_key: try: import anthropic client = anthropic.Anthropic(api_key=api_key, timeout=CLAUDE_CALL_TIMEOUT_SECONDS) msg = client.messages.create( model=os.environ.get("CAVEMAN_MODEL", "claude-sonnet-4-5"), max_tokens=8192, messages=[{"role": "user", "content": prompt}], ) # Tool-heavy models can put a tool_use or thinking block first; take # the first text block instead of trusting content[0]. text = next((block.text for block in msg.content if getattr(block, "type", None) == "text"), "") return strip_llm_wrapper(text.strip()) except ImportError: pass # anthropic not installed, fall back to CLI # Fallback: use claude CLI (handles desktop auth).Show 3 other places
pass # anthropic not installed, fall back to CLI # Fallback: use claude CLI (handles desktop auth). # Resolve binary via shutil.which so Windows .cmd/.bat shims (e.g. # %APPDATA%\npm\claude.CMD) work without shell=True. On POSIX, # shutil.which returns the same absolute path as the implicit lookup, # so this is a no-op there. Falls back to bare "claude" if not found # on PATH so subprocess raises a clear FileNotFoundError. claude_bin = shutil.which("claude") or "claude" try: result = subprocess.run( [ claude_bin, "--print", "--setting-sources", "", "--strict-mcp-config", ], input=prompt, text=True, Prefers the Anthropic SDK when ANTHROPIC_API_KEY is set; otherwise falls back to the ``claude --print`` CLI (which handles desktop auth). ], input=prompt, text=True, capture_output=True, check=True, encoding="utf-8", errors="replace", timeout=CLAUDE_CALL_TIMEOUT_SECONDS, )