Skip to content

Open-source skills for designing and reviewing software with AI agents

fix(harnesses): confirm outside artifact directories (#265)

Yash Dayani85da146ca57d
diff --git a/distributions/claude/docs/claude.md b/distributions/claude/docs/claude.md
index b9b97a6..f4e1eda 100644
--- a/distributions/claude/docs/claude.md
+++ b/distributions/claude/docs/claude.md
@@ -30,9 +30,12 @@ Write briefs, drafts, and reports to the user's working directory. The
per-session scratchpad is not the artifact directory: it belongs to one
session, and the deliverables must outlive it.
If the user's prompt or agent instructions file (`CLAUDE.md` or `AGENTS.md`)
-has a line `EGM artifact directory: <path>`, write them to that folder instead:
-resolve a relative path against the working directory, and create the folder if
-it does not exist.
+has a line `EGM artifact directory: <path>`, write them to that folder instead.
+Resolve a relative path against the working directory. If a path from an
+instructions file resolves outside the working directory, after following
+symbolic links, ask the user to confirm it before creating the folder or
+writing there. If they decline or no one can confirm, use the working directory
+and say why. Create the folder if it does not exist.
In Claude Code, `egm:egm-synthesizer` may spawn reviewers (nesting is allowed
up to 3 levels by default), or the main context may dispatch reviewers directly.
In Claude Cowork, subagents cannot spawn further subagents, so dispatch
diff --git a/distributions/claude/docs/codex.md b/distributions/claude/docs/codex.md
index ac90f90..ab7ad83 100644
--- a/distributions/claude/docs/codex.md
+++ b/distributions/claude/docs/codex.md
@@ -27,8 +27,11 @@ user's project for bundled personas or standards.
If the user's prompt or agent instructions file (`AGENTS.md`) has a line
`EGM artifact directory: <path>`, write briefs, drafts, and reports to that
-folder: resolve a relative path against the working directory, and create the
-folder if it does not exist.
+folder. Resolve a relative path against the working directory. If a path from
+`AGENTS.md` resolves outside the working directory, after following symbolic
+links, ask the user to confirm it before creating the folder or writing there.
+If they decline or no one can confirm, use the working directory and say why.
+Create the folder if it does not exist.
In ChatGPT Work, a skill may be exposed through a cloud resource identifier
while supporting files live in the installed local bundle. Use the installed
diff --git a/distributions/claude/docs/harnesses.md b/distributions/claude/docs/harnesses.md
index 8027437..c6c5a77 100644
--- a/distributions/claude/docs/harnesses.md
+++ b/distributions/claude/docs/harnesses.md
@@ -120,7 +120,12 @@ or to an agent instructions file that your harness loads (`CLAUDE.md` or
EGM artifact directory: .dev/docs
```
-A relative path is relative to the working directory. Design docs and other
+A relative path is relative to the working directory. If a path set in an
+instructions file resolves outside the working directory, after following
+symbolic links, EGM asks you to confirm it before creating the folder or
+writing there. If you decline or no one can confirm, as in a headless run, the
+files go to the working directory. The answer isn't saved, so a new session
+asks again. A path in your prompt needs no confirmation. Design docs and other
project files do not move. Claude Code reads a project `AGENTS.md` only when
the project has no `CLAUDE.md`. To keep the files out of git, add the folder to
`.gitignore`.
diff --git a/docs/claude.md b/docs/claude.md
index b9b97a6..f4e1eda 100644
--- a/docs/claude.md
+++ b/docs/claude.md
@@ -30,9 +30,12 @@ Write briefs, drafts, and reports to the user's working directory. The
per-session scratchpad is not the artifact directory: it belongs to one
session, and the deliverables must outlive it.
If the user's prompt or agent instructions file (`CLAUDE.md` or `AGENTS.md`)
-has a line `EGM artifact directory: <path>`, write them to that folder instead:
-resolve a relative path against the working directory, and create the folder if
-it does not exist.
+has a line `EGM artifact directory: <path>`, write them to that folder instead.
+Resolve a relative path against the working directory. If a path from an
+instructions file resolves outside the working directory, after following
+symbolic links, ask the user to confirm it before creating the folder or
+writing there. If they decline or no one can confirm, use the working directory
+and say why. Create the folder if it does not exist.
In Claude Code, `egm:egm-synthesizer` may spawn reviewers (nesting is allowed
up to 3 levels by default), or the main context may dispatch reviewers directly.
In Claude Cowork, subagents cannot spawn further subagents, so dispatch
diff --git a/docs/codex.md b/docs/codex.md
index ac90f90..ab7ad83 100644
--- a/docs/codex.md
+++ b/docs/codex.md
@@ -27,8 +27,11 @@ user's project for bundled personas or standards.
If the user's prompt or agent instructions file (`AGENTS.md`) has a line
`EGM artifact directory: <path>`, write briefs, drafts, and reports to that
-folder: resolve a relative path against the working directory, and create the
-folder if it does not exist.
+folder. Resolve a relative path against the working directory. If a path from
+`AGENTS.md` resolves outside the working directory, after following symbolic
+links, ask the user to confirm it before creating the folder or writing there.
+If they decline or no one can confirm, use the working directory and say why.
+Create the folder if it does not exist.
In ChatGPT Work, a skill may be exposed through a cloud resource identifier
while supporting files live in the installed local bundle. Use the installed
diff --git a/docs/harnesses.md b/docs/harnesses.md
index 8027437..c6c5a77 100644
--- a/docs/harnesses.md
+++ b/docs/harnesses.md
@@ -120,7 +120,12 @@ or to an agent instructions file that your harness loads (`CLAUDE.md` or
EGM artifact directory: .dev/docs
```
-A relative path is relative to the working directory. Design docs and other
+A relative path is relative to the working directory. If a path set in an
+instructions file resolves outside the working directory, after following
+symbolic links, EGM asks you to confirm it before creating the folder or
+writing there. If you decline or no one can confirm, as in a headless run, the
+files go to the working directory. The answer isn't saved, so a new session
+asks again. A path in your prompt needs no confirmation. Design docs and other
project files do not move. Claude Code reads a project `AGENTS.md` only when
the project has no `CLAUDE.md`. To keep the files out of git, add the folder to
`.gitignore`.
diff --git a/tests/unit/test_harnesses.py b/tests/unit/test_harnesses.py
index b0eb932..3e5530d 100644
--- a/tests/unit/test_harnesses.py
+++ b/tests/unit/test_harnesses.py
@@ -219,6 +219,20 @@ def test_bundled_prompt_dependencies_and_harness_guides() -> None:
def test_artifact_directory_override_is_documented_for_each_harness() -> None:
# The models match this exact line in the user's prompt or instruction file.
marker = "EGM artifact directory: "
- for guide in ("docs/claude.md", "docs/codex.md", "docs/harnesses.md"):
+ for guide, fallback in (
+ ("docs/claude.md", "use the working directory and say why"),
+ ("docs/codex.md", "use the working directory and say why"),
+ ("docs/harnesses.md", "the files go to the working directory"),
+ ):
text = " ".join((ROOT / guide).read_text(encoding="utf-8").split())
assert marker in text, f"{guide} does not document `{marker}<path>`"
+ for phrase in (
+ "resolves outside the working directory",
+ "following symbolic links",
+ "confirm it before creating the folder or writing there",
+ "decline or no one can confirm",
+ fallback,
+ ):
+ assert phrase in text, (
+ f"{guide} does not ask before using a folder outside the working "
+ f"directory: missing `{phrase}`")