Planning with Files (Codex)
Use persistent markdown files as working memory on disk.
Important for Codex
Codex skills do not run Claude-style hooks automatically.
You must do these steps manually:
- •Re-read
.codex-plans/index.mdand currentplan.mdbefore major decisions. - •After each phase, update
plan.md,findings.md, andprogress.md. - •Before ending the task, run
scripts/check-complete.sh(or.ps1).
First: Session Catchup
Before starting work, check for unsynced context:
$(command -v python3 || command -v python) ~/.codex/skills/planning-with-files/scripts/session-catchup.py "$(pwd)"
python "$env:USERPROFILE\.codex\skills\planning-with-files\scripts\session-catchup.py" (Get-Location)
If catchup reports unsynced context:
- •Run
git diff --stat. - •Read
.codex-plans/index.mdand the active task files. - •Sync the files before continuing.
Directory Structure
All planning files live in .codex-plans/:
.codex-plans/
├── index.md
├── dark-mode-toggle/
│ ├── plan.md
│ ├── findings.md
│ └── progress.md
└── fix-login-bug/
├── plan.md
├── findings.md
└── progress.md
Quick Start
Before any complex task:
- •Read or create
.codex-plans/index.md. - •Create
.codex-plans/<task-slug>/. - •Create
plan.md,findings.md, andprogress.mdin that task directory. - •Update index
Current Focusto the task slug. - •Re-read plan before major decisions.
- •Update files after each phase.
Manual invocation: $planning-with-files
Core Pattern
Context Window = RAM (volatile, limited) Filesystem = Disk (persistent, unlimited) Anything important gets written to disk.
File Roles
| File | Purpose | Update When |
|---|---|---|
index.md | Active/completed task registry | Start, switch, complete |
plan.md | Goal, phases, decisions, errors | After each phase |
findings.md | Research and discoveries | After any discovery |
progress.md | Session log and test evidence | Throughout task |
index.md Template
Use assets/templates/index.md as your base.
Critical Rules
1. Use .codex-plans/
Do not put planning files in the project root.
2. One Directory Per Task
Each task has its own subdirectory and 3 files.
3. Maintain index.md
Always update Active Tasks, Current Focus, and Completed Tasks.
4. Create Plan First
Do not start complex work without a plan.md.
5. The 2-Action Rule
After every 2 view/browser/search operations, immediately write findings to disk.
6. Read Before Decide
Re-read the current plan.md before major decisions.
7. Update After Act
After each phase, update status and note changed files.
8. Log Every Error
Every error goes into plan.md.
9. Never Repeat Failures
if action_failed:
next_action != same_action
3-Strike Error Protocol
ATTEMPT 1: Diagnose and fix root cause. ATTEMPT 2: Use a different approach or tool. ATTEMPT 3: Rethink assumptions and search broader. AFTER 3 FAILURES: Escalate to user with what was tried.
Switching Tasks
Read .codex-plans/index.md Read .codex-plans/<other-task>/plan.md Edit .codex-plans/index.md # update Current Focus
Context Recovery
Read .codex-plans/index.md Read .codex-plans/<active-task>/plan.md
When to Use
Use for:
- •Multi-step tasks (3+ steps)
- •Research tasks
- •Builds/refactors spanning many tool calls
- •Multiple concurrent tasks
Skip for:
- •Simple questions
- •Small one-file edits
- •Quick lookups
Templates
- •
assets/templates/index.md - •
assets/templates/plan.md - •
assets/templates/findings.md - •
assets/templates/progress.md
Scripts
- •
scripts/init-session.sh/scripts/init-session.ps1Usage: initialize.codex-plans/and a task directory. - •
scripts/check-complete.sh/scripts/check-complete.ps1Usage: verify all phases in activeplan.mdare complete. - •
scripts/session-catchup.pyUsage: recover unsynced context from previous session logs.
References
- •
references/reference.md- Context engineering principles - •
references/examples.md- End-to-end examples
Anti-Patterns
| Don't | Do Instead |
|---|---|
| Put plans in project root | Use .codex-plans/ |
| Mix multiple tasks in one plan | One task directory each |
| Forget index updates | Maintain index.md |
| Repeat same failing action | Log attempts and mutate approach |
| Keep findings only in context | Write to findings.md |