From 2879561695d4c8fb18d1872482a761b972cd6a29 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Thu, 26 Mar 2026 12:19:05 -0600 Subject: [PATCH] fix: explicit plan content embedding for codex sandbox visibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex runs sandboxed to repo root (-C) and cannot access ~/.claude/plans/. The template already instructed content embedding but wasn't explicit enough — Claude sometimes shortcut to referencing the file path, causing Codex to waste 10+ tool calls searching before giving up. Strengthen the instruction to make embedding unambiguous: "embed FULL CONTENT, do NOT reference the file path." Also extract referenced source file paths from the plan so Codex reads them directly instead of discovering via rg/find. Co-Authored-By: Claude Opus 4.6 (1M context) --- codex/SKILL.md | 16 ++++++++++++++-- codex/SKILL.md.tmpl | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/codex/SKILL.md b/codex/SKILL.md index a737bc4b..d1386e85 100644 --- a/codex/SKILL.md +++ b/codex/SKILL.md @@ -602,14 +602,26 @@ ls -t ~/.claude/plans/*.md 2>/dev/null | xargs grep -l "$(basename $(pwd))" 2>/d ``` If no project-scoped match, fall back to `ls -t ~/.claude/plans/*.md 2>/dev/null | head -1` but warn: "Note: this plan may be from a different project — verify before sending to Codex." -Read the plan file and prepend the persona to the user's prompt: + +**IMPORTANT — embed content, don't reference path:** Codex runs sandboxed to the repo +root (`-C`) and cannot access `~/.claude/plans/` or any files outside the repo. You MUST +read the plan file yourself and embed its FULL CONTENT in the prompt below. Do NOT tell +Codex the file path or ask it to read the plan file — it will waste 10+ tool calls +searching and fail. + +Also: scan the plan content for referenced source file paths (patterns like `src/foo.ts`, +`lib/bar.py`, paths containing `/` that exist in the repo). If found, list them in the +prompt so Codex reads them directly instead of discovering them via rg/find. + +Prepend the persona to the user's prompt: "You are a brutally honest technical reviewer. Review this plan for: logical gaps and unstated assumptions, missing error handling or edge cases, overcomplexity (is there a simpler approach?), feasibility risks (what could go wrong?), and missing dependencies or sequencing issues. Be direct. Be terse. No compliments. Just the problems. +Also review these source files referenced in the plan: . THE PLAN: -" +" 4. Run codex exec with **JSONL output** to capture reasoning traces (5-minute timeout): diff --git a/codex/SKILL.md.tmpl b/codex/SKILL.md.tmpl index 97c99a5a..0f5a30b7 100644 --- a/codex/SKILL.md.tmpl +++ b/codex/SKILL.md.tmpl @@ -241,14 +241,26 @@ ls -t ~/.claude/plans/*.md 2>/dev/null | xargs grep -l "$(basename $(pwd))" 2>/d ``` If no project-scoped match, fall back to `ls -t ~/.claude/plans/*.md 2>/dev/null | head -1` but warn: "Note: this plan may be from a different project — verify before sending to Codex." -Read the plan file and prepend the persona to the user's prompt: + +**IMPORTANT — embed content, don't reference path:** Codex runs sandboxed to the repo +root (`-C`) and cannot access `~/.claude/plans/` or any files outside the repo. You MUST +read the plan file yourself and embed its FULL CONTENT in the prompt below. Do NOT tell +Codex the file path or ask it to read the plan file — it will waste 10+ tool calls +searching and fail. + +Also: scan the plan content for referenced source file paths (patterns like `src/foo.ts`, +`lib/bar.py`, paths containing `/` that exist in the repo). If found, list them in the +prompt so Codex reads them directly instead of discovering them via rg/find. + +Prepend the persona to the user's prompt: "You are a brutally honest technical reviewer. Review this plan for: logical gaps and unstated assumptions, missing error handling or edge cases, overcomplexity (is there a simpler approach?), feasibility risks (what could go wrong?), and missing dependencies or sequencing issues. Be direct. Be terse. No compliments. Just the problems. +Also review these source files referenced in the plan: . THE PLAN: -" +" 4. Run codex exec with **JSONL output** to capture reasoning traces (5-minute timeout):