From 3ec369ddf6e4eff5fbe8fdc3157d381d81289f13 Mon Sep 17 00:00:00 2001 From: Nick Nikolakakis Date: Thu, 28 May 2026 09:39:45 +0300 Subject: [PATCH] fix: expose plugin root to claude -p via --add-dir The action spawned `claude -p` with `cwd` set to a per-case `tempfile.mkdtemp(...)` working directory and no `--add-dir` flag, so the subprocess could only read files inside that temp dir. Skills that reference plugin-shipped reference files via the documented `${CLAUDE_PLUGIN_ROOT}` plugin convention (e.g. shared registries under `${CLAUDE_PLUGIN_ROOT}/data/*.yaml` or per-feature config under `${CLAUDE_PLUGIN_ROOT}/spaces/*/*.md`) had every Read and Grep denied because the resolved path was outside the allowed working directory. The agent could never get past the first step of any non-trivial skill that loads its own reference data. Fix: resolve `PLUGIN_ROOT = SKILL_PATH.resolve().parent.parent` (e.g. `plugins//skills/` -> `plugins/`) at module load and pass `--add-dir ` to the `claude -p` subprocess. `.resolve()` is required because `--add-dir` is interpreted relative to the subprocess cwd (the per-case temp dir); a relative `SKILL_PATH` (as set by the composite action input when callers pass a workspace-relative path) would otherwise expand to a nonexistent path inside that temp dir. --- scripts/eval.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/eval.py b/scripts/eval.py index 8742d42..12f84c0 100644 --- a/scripts/eval.py +++ b/scripts/eval.py @@ -25,6 +25,7 @@ SKILL_NAME = os.environ["SKILL_NAME"] SKILL_PATH = Path(os.environ["SKILL_PATH"]) +PLUGIN_ROOT = SKILL_PATH.resolve().parent.parent WORKSPACE = Path(os.environ["WORKSPACE"]) EVAL_TIMEOUT = int(os.environ.get("EVAL_TIMEOUT", "120")) PASS_THRESHOLD = float(os.environ.get("PASS_THRESHOLD", "80")) @@ -200,7 +201,7 @@ def _run_claude(prompt: str, work_dir: Path, timeout: int) -> subprocess.Complet for attempt in range(1, MAX_RETRIES + 1): try: result = subprocess.run( - ["claude", "-p", prompt, "--output-format", "stream-json", "--verbose"], + ["claude", "-p", prompt, "--add-dir", str(PLUGIN_ROOT), "--output-format", "stream-json", "--verbose"], capture_output=True, text=True, timeout=timeout, cwd=str(work_dir), env=env, )