Skip to content

Commit 8bbb1fb

Browse files
committed
feat(codex-plan): add file references and wait-for-plan step
- Add "File references" section in Step 4 for Codex context - Include template for listing important files to read - Change Step 5 to save prompt instead of executing - Add Step 7: Wait for user to send the generated plan - Update task flow to reflect new workflow
1 parent 2840f27 commit 8bbb1fb

1 file changed

Lines changed: 83 additions & 12 deletions

File tree

commands/codex-plan.md

Lines changed: 83 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,67 @@ Create a detailed prompt that includes:
8383
2. **All requirements** - Everything learned from clarifying questions
8484
3. **Constraints** - Technology choices, timeline, team size
8585
4. **Context** - Relevant codebase info, existing patterns
86-
5. **Plan structure** - What sections the plan should include
87-
6. **Output instructions** - Write to `codex-plan.md` in current directory
86+
5. **File references** - List of important files/docs the Codex should read for context
87+
6. **Plan structure** - What sections the plan should include
88+
7. **Output instructions** - Write to `codex-plan.md` in current directory
89+
90+
### Including File References (IMPORTANT)
91+
92+
Always include a section in the prompt telling Codex which files to read first for context:
93+
94+
```
95+
## Files to Read for Context
96+
97+
Before creating the plan, read these files to understand the current codebase:
98+
99+
**Architecture & Config:**
100+
- `README.md` - Project overview
101+
- `package.json` / `pyproject.toml` - Dependencies and scripts
102+
- `.env.example` - Environment variables needed
103+
104+
**Existing Code Patterns:**
105+
- `src/lib/db.ts` - How database connections are handled
106+
- `src/middleware/auth.ts` - Existing auth patterns (if any)
107+
- `src/types/index.ts` - Type definitions
108+
109+
**Documentation:**
110+
- `docs/architecture.md` - System architecture
111+
- `docs/api.md` - API documentation
112+
113+
Read these files FIRST to understand existing patterns before creating the plan.
114+
```
115+
116+
Adapt this list based on what you discovered in Step 3 (Gather Context). Include:
117+
- Config files relevant to the task
118+
- Existing code that will be modified or extended
119+
- Documentation about architecture/patterns
120+
- Type definitions or schemas
121+
- Test files showing testing patterns used
88122

89123
**Critical instruction to include:** Tell Codex to NOT ask any further clarifying questions - it has all the information it needs and should just write the plan and save the file.
90124

91-
## Step 5: Execute Codex
125+
## Step 5: Save Prompt for Manual Execution
126+
127+
Save the crafted prompt to `prompt_to_codex.md` for manual execution.
128+
129+
The user will execute Codex manually using:
92130

93131
```bash
132+
# --full-auto: Executa automaticamente sem interação humana
133+
# --skip-git-repo-check: Pula verificação se está em um repositório git
134+
# -c model=gpt-5.2-codex: Usa o modelo GPT-5.2 Codex (mais avançado)
135+
# -c model_reasoning_effort=high: Ativa raciocínio de alto nível (deep thinking)
136+
# --output-last-message: Salva a última mensagem do Codex em arquivo
94137
codex exec --full-auto --skip-git-repo-check \
95138
-c model=gpt-5.2-codex \
96139
-c model_reasoning_effort=high \
97140
--output-last-message /tmp/codex-plan-result.txt \
98-
"YOUR_CRAFTED_PROMPT_HERE"
141+
"$(cat prompt_to_codex.md)"
99142
```
100143

101-
Then show the results:
144+
Or read the prompt and execute it:
102145
```bash
103-
cat /tmp/codex-plan-result.txt
146+
cat prompt_to_codex.md # Review the prompt first
104147
```
105148

106149
## Example Full Flow
@@ -234,15 +277,43 @@ Break large tasks into smaller ones:
234277
Begin immediately.
235278
```
236279

237-
**Execute and return results.**
280+
**Save the prompt to `prompt_to_codex.md` for manual execution.**
238281

239282
## Important Notes
240283

241284
- **Always ask clarifying questions first** - Don't skip this step
242285
- **Use AskUser tool** - This is interactive planning
243-
- **Always use gpt-5.2-codex with high reasoning** - No exceptions
286+
- **Save prompt to `prompt_to_codex.md`** - User will execute manually
244287
- **Tell Codex not to ask questions** - It should just execute
245-
- **Output file:** `codex-plan.md` in current working directory
246-
- **Use --full-auto**
247-
248-
Now analyze the user's planning request above, ask your clarifying questions, and then generate and execute the Codex plan.
288+
- **Expected output file:** `codex-plan.md` in current working directory (created by Codex)
289+
- **Model to use:** `gpt-5.2-codex` with `high` reasoning effort
290+
291+
## Your Task Flow
292+
293+
1. Analyze the user's planning request above
294+
2. Ask clarifying questions using AskUser
295+
3. Gather context from codebase if needed
296+
4. Craft a detailed prompt for Codex
297+
5. **Save the prompt to `prompt_to_codex.md`** (do NOT execute)
298+
6. Show the user they can now execute it manually with:
299+
```bash
300+
codex exec --full-auto --skip-git-repo-check \
301+
-c model=gpt-5.2-codex \
302+
-c model_reasoning_effort=high \
303+
--output-last-message /tmp/codex-plan-result.txt \
304+
"$(cat prompt_to_codex.md)"
305+
```
306+
7. **STOP and wait** - Ask the user to send you the final plan (`codex-plan.md`) when Codex finishes. Do NOT do anything else until the user sends the plan.
307+
308+
## Step 7: Wait for the Plan
309+
310+
After showing the execution command, you MUST:
311+
312+
1. **Ask the user to send the plan** - Say something like:
313+
> "Quando o Codex terminar, me envie o conteúdo do arquivo `codex-plan.md` para eu revisar."
314+
315+
2. **Do NOT proceed** - Do not take any other action
316+
3. **Do NOT assume** - Do not guess what the plan contains
317+
4. **Just wait** - The user will paste or send the plan when ready
318+
319+
**IMPORTANT:** Your job is DONE after step 6. Just wait for the user to send the generated plan.

0 commit comments

Comments
 (0)