Skip to content

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

fix(skills): use private directories for scratch files (#266)

Yash Dayani3dba384e798c
diff --git a/distributions/claude/docs/claude.md b/distributions/claude/docs/claude.md
index f4e1eda..30cb9a1 100644
--- a/distributions/claude/docs/claude.md
+++ b/distributions/claude/docs/claude.md
@@ -60,7 +60,10 @@ Claude Code's normal permission prompts; current versions can surface background
reviewer prompts in the parent session. For headless runs, the user must grant
read access to the resolved plugin's `agents/`, `docs/`, `resources/`, and
`skills/` folders using Claude Code's permission settings. Keep write access
-limited to the project and intended output directory. Do not disable permission
+limited to the project, the intended output directory, and the session or
+private scratch directory used for temporary files. A `mktemp -d` path can't be
+named in a rule in advance, so a headless run can't use one without a rule for
+its parent folder. Do not disable permission
checks or grant access to every installed plugin. A reviewer that cannot read
its persona or standard must report the limitation and stop; it has not reviewed.
diff --git a/distributions/claude/resources/execution_instructions.md b/distributions/claude/resources/execution_instructions.md
index 068fb84..7c56d2c 100644
--- a/distributions/claude/resources/execution_instructions.md
+++ b/distributions/claude/resources/execution_instructions.md
@@ -5,10 +5,13 @@
`.h`, `.cc`, `.py`, `.go`) in the source tree. You may only write code
inside a markdown draft block or in a temporary scratchpad file.
* **Scratchpad Location (CRITICAL)**: You MUST write any temporary
- scratchpad code files ONLY outside the project source tree (e.g.,
- under `/tmp/` or your conversation's active scratch directory). You
- are STRICTLY FORBIDDEN from creating `.h`, `.cc`, `.py`, `.go`, or any
- other code files anywhere inside the project source tree.
+ scratchpad code files ONLY outside the project source tree, in your
+ conversation's active scratch directory or, if your harness has none,
+ a new private directory created with `mktemp -d`. If neither is
+ available, keep the code in a markdown draft block. Do not use fixed,
+ shared paths such as `/tmp/scratch.py`. You are STRICTLY FORBIDDEN
+ from creating `.h`, `.cc`, `.py`, `.go`, or any other code files
+ anywhere inside the project source tree.
* **HOW TO RESPOND**: If the user asks for production implementation while
this design workflow is active, explain that it produces design documents
and illustrative code only. Label any markdown or scratchpad example
diff --git a/distributions/claude/skills/egm-bootstrap/SKILL.md b/distributions/claude/skills/egm-bootstrap/SKILL.md
index 8ca24f7..8ef9431 100644
--- a/distributions/claude/skills/egm-bootstrap/SKILL.md
+++ b/distributions/claude/skills/egm-bootstrap/SKILL.md
@@ -54,9 +54,9 @@ If your harness has no subagent tool, run the scout steps inline.
`git add`). All filesystem changes must be written locally using standard
file-writing tools. Tracking
and submitting is deferred to the human user.
-3. **Temporary File Isolation**: Parallel workers sharing the workspace must
- perform all status tracking, check-pointing, and log writing in independent,
- worker-specific directories outside the project repository workspace.
+3. **Temporary File Isolation**: Each worker keeps its status, checkpoint,
+ and log files in its own directory outside the workspace (host scratch or
+ `mktemp -d`), never a fixed, shared path. If neither exists, skip them.
4. **Tool Usage (CRITICAL)**: Use your shell, file-reading, file-writing, and file-editing tools for directory discovery and contract/README
generation. Adhere to clean Markdown formatting directly during generation
(standard headers, tables, and fenced code blocks). If a project markdown
diff --git a/docs/claude.md b/docs/claude.md
index f4e1eda..30cb9a1 100644
--- a/docs/claude.md
+++ b/docs/claude.md
@@ -60,7 +60,10 @@ Claude Code's normal permission prompts; current versions can surface background
reviewer prompts in the parent session. For headless runs, the user must grant
read access to the resolved plugin's `agents/`, `docs/`, `resources/`, and
`skills/` folders using Claude Code's permission settings. Keep write access
-limited to the project and intended output directory. Do not disable permission
+limited to the project, the intended output directory, and the session or
+private scratch directory used for temporary files. A `mktemp -d` path can't be
+named in a rule in advance, so a headless run can't use one without a rule for
+its parent folder. Do not disable permission
checks or grant access to every installed plugin. A reviewer that cannot read
its persona or standard must report the limitation and stop; it has not reviewed.
diff --git a/docs/designs/bootstrap.md b/docs/designs/bootstrap.md
index 8bc83e1..d6105f0 100644
--- a/docs/designs/bootstrap.md
+++ b/docs/designs/bootstrap.md
@@ -723,9 +723,11 @@ All changes will be housed within the open-source repository structure:
perform all status tracking, check-pointing, and log writing in independent,
worker-specific directories using their unique `conversationId` under the
application data directory (e.g.
- `<appDataDir>/brain/<conversation_id>/scratch/`). They must not write any
+ `<appDataDir>/brain/<conversation_id>/scratch/`), or in private
+ `mktemp -d` directories on other hosts. They must not write any
temporary files inside the source repository workspace, leaving the
- source tree unmodified.
+ source tree unmodified, and never use a fixed, shared path. If neither
+ directory is available, they skip these files.
* **Antigravity Framework**: Antigravity is the agent SDK ecosystem and
runtime framework for autonomous coding assistants.
* **Token Optimization**: Goldfish scouts are read-only, ephemeral, and only
@@ -749,8 +751,9 @@ All changes will be housed within the open-source repository structure:
executing any VCS tracking/commit commands (`jj`/`g4`), deferring operations
to EGM session completion.
* **State Collision on Shared Workspace**: Mitigated by storing execution
- checkpoints in worker-specific scratchpad directories under `<appDataDir>`,
- avoiding modifications to the workspace.
+ checkpoints in worker-specific scratchpad directories under `<appDataDir>`
+ (or private `mktemp -d` directories on other hosts), avoiding modifications
+ to the workspace. If neither is available, workers skip these files.
* **Worker failures leaving partial files**: Handled as an incremental
progress feature. The Correction & Modification Policy preserves partial
progress and corrects existing files on subsequent runs, allowing developers
diff --git a/resources/execution_instructions.md b/resources/execution_instructions.md
index 068fb84..7c56d2c 100644
--- a/resources/execution_instructions.md
+++ b/resources/execution_instructions.md
@@ -5,10 +5,13 @@
`.h`, `.cc`, `.py`, `.go`) in the source tree. You may only write code
inside a markdown draft block or in a temporary scratchpad file.
* **Scratchpad Location (CRITICAL)**: You MUST write any temporary
- scratchpad code files ONLY outside the project source tree (e.g.,
- under `/tmp/` or your conversation's active scratch directory). You
- are STRICTLY FORBIDDEN from creating `.h`, `.cc`, `.py`, `.go`, or any
- other code files anywhere inside the project source tree.
+ scratchpad code files ONLY outside the project source tree, in your
+ conversation's active scratch directory or, if your harness has none,
+ a new private directory created with `mktemp -d`. If neither is
+ available, keep the code in a markdown draft block. Do not use fixed,
+ shared paths such as `/tmp/scratch.py`. You are STRICTLY FORBIDDEN
+ from creating `.h`, `.cc`, `.py`, `.go`, or any other code files
+ anywhere inside the project source tree.
* **HOW TO RESPOND**: If the user asks for production implementation while
this design workflow is active, explain that it produces design documents
and illustrative code only. Label any markdown or scratchpad example
diff --git a/skills/egm-bootstrap/SKILL.md b/skills/egm-bootstrap/SKILL.md
index 8ca24f7..8ef9431 100644
--- a/skills/egm-bootstrap/SKILL.md
+++ b/skills/egm-bootstrap/SKILL.md
@@ -54,9 +54,9 @@ If your harness has no subagent tool, run the scout steps inline.
`git add`). All filesystem changes must be written locally using standard
file-writing tools. Tracking
and submitting is deferred to the human user.
-3. **Temporary File Isolation**: Parallel workers sharing the workspace must
- perform all status tracking, check-pointing, and log writing in independent,
- worker-specific directories outside the project repository workspace.
+3. **Temporary File Isolation**: Each worker keeps its status, checkpoint,
+ and log files in its own directory outside the workspace (host scratch or
+ `mktemp -d`), never a fixed, shared path. If neither exists, skip them.
4. **Tool Usage (CRITICAL)**: Use your shell, file-reading, file-writing, and file-editing tools for directory discovery and contract/README
generation. Adhere to clean Markdown formatting directly during generation
(standard headers, tables, and fenced code blocks). If a project markdown
diff --git a/tests/unit/test_harnesses.py b/tests/unit/test_harnesses.py
index 3e5530d..0883b1e 100644
--- a/tests/unit/test_harnesses.py
+++ b/tests/unit/test_harnesses.py
@@ -177,6 +177,22 @@ def test_claude_bootstrap_adapter_routes_to_skill() -> None:
assert "./agents/bootstrap_orchestrator.md" not in manifest
+def test_scratch_files_use_private_directories() -> None:
+ for path in ("resources/execution_instructions.md",
+ "skills/egm-bootstrap/SKILL.md"):
+ text = " ".join((ROOT / path).read_text(encoding="utf-8").split())
+ assert "mktemp -d" in text, f"{path} does not name a private directory"
+ instructions = " ".join(
+ (ROOT / "resources/execution_instructions.md").read_text(
+ encoding="utf-8").split())
+ assert "keep the code in a markdown draft block" in instructions
+ assert "Do not use fixed, shared paths" in instructions
+ skill = " ".join((ROOT / "skills/egm-bootstrap/SKILL.md").read_text(
+ encoding="utf-8").split())
+ assert "never a fixed, shared path" in skill
+ assert "If neither exists, skip them." in skill
+
+
def test_claude_permissions_remain_under_user_control() -> None:
"""Bundled resources must not carry an automatic permission override."""
manifest = read_json(".claude-plugin/plugin.json")