fix(planning): ensure planner agent writes implementation_plan.json

- Add explicit Write tool instructions to planner.md prompt
- Clarify that agent must use Write tool, not just describe file contents
- Fix PROMPTS_DIR path in prompts.py to correctly reference prompts/ directory
- Add checkpoint reminder in Phase 4 to verify Write tool was used
- Add critical instructions for all file creation phases (init.sh, build-progress.txt)

Fixes #38

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
AndyMik90
2025-12-20 12:37:00 +01:00
parent f0a6a0a0af
commit 9ab5a4f2cc
2 changed files with 47 additions and 9 deletions
+36 -4
View File
@@ -90,9 +90,9 @@ Find these critical sections:
cat project_index.json
```
**IF THIS FILE DOES NOT EXIST, YOU MUST CREATE IT.**
**IF THIS FILE DOES NOT EXIST, YOU MUST CREATE IT USING THE WRITE TOOL.**
Based on your Phase 0 investigation, create `project_index.json`:
Based on your Phase 0 investigation, use the Write tool to create `project_index.json`:
```json
{
@@ -130,9 +130,9 @@ This contains:
cat context.json
```
**IF THIS FILE DOES NOT EXIST, YOU MUST CREATE IT.**
**IF THIS FILE DOES NOT EXIST, YOU MUST CREATE IT USING THE WRITE TOOL.**
Based on your Phase 0 investigation and the spec.md, create `context.json`:
Based on your Phase 0 investigation and the spec.md, use the Write tool to create `context.json`:
```json
{
@@ -203,6 +203,15 @@ Minimal overhead - just subtasks, no phases.
## PHASE 3: CREATE implementation_plan.json
**🚨 CRITICAL: YOU MUST USE THE WRITE TOOL TO CREATE THIS FILE 🚨**
You MUST use the Write tool to save the implementation plan to `implementation_plan.json`.
Do NOT just describe what the file should contain - you must actually call the Write tool with the complete JSON content.
**Required action:** Call the Write tool with:
- file_path: `implementation_plan.json` (in the spec directory)
- content: The complete JSON plan structure shown below
Based on the workflow type and services involved, create the implementation plan.
### Plan Structure
@@ -631,8 +640,26 @@ Include parallelism analysis, verification strategy, and QA configuration in the
---
**🚨 END OF PHASE 4 CHECKPOINT 🚨**
Before proceeding to PHASE 5, verify you have:
1. ✅ Created the complete implementation_plan.json structure
2. ✅ Used the Write tool to save it (not just described it)
3. ✅ Added the summary section with parallelism analysis
4. ✅ Added the verification_strategy section
5. ✅ Added the qa_acceptance section
If you have NOT used the Write tool yet, STOP and do it now!
---
## PHASE 5: CREATE init.sh
**🚨 CRITICAL: YOU MUST USE THE WRITE TOOL TO CREATE THIS FILE 🚨**
You MUST use the Write tool to save the init.sh script.
Do NOT just describe what the file should contain - you must actually call the Write tool.
Create a setup script based on `project_index.json`:
```bash
@@ -735,6 +762,11 @@ Note: If the commit fails (e.g., nothing to commit, or in a special workspace),
## PHASE 7: CREATE build-progress.txt
**🚨 CRITICAL: YOU MUST USE THE WRITE TOOL TO CREATE THIS FILE 🚨**
You MUST use the Write tool to save build-progress.txt.
Do NOT just describe what the file should contain - you must actually call the Write tool with the complete content shown below.
```
=== AUTO-BUILD PROGRESS ===
+11 -5
View File
@@ -9,7 +9,8 @@ import json
from pathlib import Path
# Directory containing prompt files
PROMPTS_DIR = Path(__file__).parent / "prompts"
# prompts/ is a sibling directory of prompts_pkg/, so go up one level first
PROMPTS_DIR = Path(__file__).parent.parent / "prompts"
def get_planner_prompt(spec_dir: Path) -> str:
@@ -38,10 +39,15 @@ def get_planner_prompt(spec_dir: Path) -> str:
Your spec file is located at: `{spec_dir}/spec.md`
Store all build artifacts in this spec directory:
- `{spec_dir}/implementation_plan.json` - Subtask-based implementation plan
- `{spec_dir}/build-progress.txt` - Progress notes
- `{spec_dir}/init.sh` - Environment setup script
🚨 CRITICAL FILE CREATION INSTRUCTIONS 🚨
You MUST use the Write tool to create these files in the spec directory:
- `{spec_dir}/implementation_plan.json` - Subtask-based implementation plan (USE WRITE TOOL!)
- `{spec_dir}/build-progress.txt` - Progress notes (USE WRITE TOOL!)
- `{spec_dir}/init.sh` - Environment setup script (USE WRITE TOOL!)
DO NOT just describe what these files should contain. You MUST actually call the Write tool
with the file path and complete content to create them.
The project root is the parent of auto-claude/. Implement code in the project root, not in the spec directory.