Planning with Files (v2.2.0)
The Core Pattern:
Context Window = RAM (Volatile, Limited)
Filesystem = Disk (Persistent, Unlimited)
Rule: Anything important MUST be written to disk immediately.
1. Critical Rules (Non-Negotiable)
1.1 Create Plan First
Never start a complex task (coding, research, refactoring) without creating or updating task_plan.md. This is your anchor.
1.2 The 2-Action Rule
"After every 2 view/browser/search operations, IMMEDIATELY save key findings to findings.md."
- Prevents "context window washouts" where new tokens push out old insights.
- If you read a file and find a bug, log it in
findings.md before trying to fix it.
1.3 Read Before Decide
Before making a major decision (architecture change, deletion, new library), read the plan file.
- This refreshes your "Attention Window" with the original goals and constraints.
1.4 Update After Act
After completing a phase or a significant step:
- Mark the item as
[x] in task_plan.md or progress.md.
- Log any errors encountered in
task_plan.md (Errors Section).
- Note new files created.
1.5 The 3-Strike Error Protocol
If an action fails (e.g., test failure, API error, file not found):
- Attempt 1: Diagnose & Fix: Read error, identify root cause, apply fix.
- Attempt 2: Alternative Approach: If the exact same error happens, STOP. Do not try the same thing again. Use a different tool, library, or method.
- Attempt 3: Broader Rethink: Question your assumptions. Is the file path wrong? Is the logic flawed?
- AFTER 3 FAILURES: Escalate to User. Stop spinning your wheels.
2. File Goals
task_plan.md (The Strategy)
- Purpose: Defines what we are doing and how.
- Contains: Objectives, Step-by-step implementation plan, Current Status, Error Log.
- Update Frequency: At the start of a task, and after every major phase completion.
findings.md (The Memory)
- Purpose: Stores raw information, code snippets, documentation, and "aha!" moments.
- Contains: Relevant file content summaries, API references, decisions made, bug causes.
- Update Frequency: High. Every 2-3 tool calls during research/debugging.
progress.md (The Journal)
- Purpose: A chronological log of actions taken (optional if using
task.md heavily/Agentic Mode).
- Contains: Timestamps, specific commands run, test results.
3. Workflow Implementation
Phase 1: Initialization / Planning
- Check Context: Run
ls -R or list_dir to see if planning files exist.
- Create/Read:
- Task Plan: Create
task_plan.md using templates/task_plan.md as a guide.
- Findings: Create
findings.md using templates/findings.md for research notes.
- Note: You can use
read_file .agent/skills/planning-with-files/templates/task_plan.md to see the structure.
Phase 2: Execution (The Loop)
- Read code/docs.
- Write findings to
findings.md (2-Action Rule).
- Update
task_plan.md if the plan changes based on findings.
- Act (Write code, run command).
- Verify result.
- Log outcome to
progress.md or task_plan.md.
4. When to Use
- USE FOR: Multi-step tasks, Debugging complex bugs, Feature implementation, Refactoring.
- SKIP FOR: Trivial one-shot questions (e.g., "What time is it?", "Fix this typo on line 10").
5. Anti-Patterns (What NOT to do)
- Storing everything in RAM: Relying on your context window to remember what you read 10 turns ago.
- "I'll remember that": You won't. Write it down.
- Looping on Errors: Retrying the same failing command 5 times hoping it works. (Use 3-Strike Protocol).
1---2name: planning-with-files3description: A comprehensive context management system for AI agents. Enforces externalizing memory to disk to prevent hallucinations and maintain long-term coherence.4---56# Planning with Files (v2.2.0)78> **The Core Pattern**: 9> `Context Window = RAM` (Volatile, Limited) 10> `Filesystem = Disk` (Persistent, Unlimited) 11> **Rule**: Anything important MUST be written to disk immediately.1213## 1. Critical Rules (Non-Negotiable)1415### 1.1 Create Plan First16Never start a complex task (coding, research, refactoring) without creating or updating `task_plan.md`. This is your anchor.1718### 1.2 The 2-Action Rule19"After every **2** view/browser/search operations, **IMMEDIATELY** save key findings to `findings.md`."20- Prevents "context window washouts" where new tokens push out old insights.21- If you read a file and find a bug, log it in `findings.md` *before* trying to fix it.2223### 1.3 Read Before Decide24Before making a major decision (architecture change, deletion, new library), **read the plan file**.25- This refreshes your "Attention Window" with the original goals and constraints.2627### 1.4 Update After Act28After completing a phase or a significant step:291. Mark the item as `[x]` in `task_plan.md` or `progress.md`.302. Log any errors encountered in `task_plan.md` (Errors Section).313. Note new files created.3233### 1.5 The 3-Strike Error Protocol34If an action fails (e.g., test failure, API error, file not found):351. **Attempt 1: Diagnose & Fix**: Read error, identify root cause, apply fix.362. **Attempt 2: Alternative Approach**: If the exact same error happens, **STOP**. Do not try the same thing again. Use a different tool, library, or method.373. **Attempt 3: Broader Rethink**: Question your assumptions. Is the file path wrong? Is the logic flawed?384. **AFTER 3 FAILURES**: **Escalate to User**. Stop spinning your wheels.3940## 2. File Goals4142### `task_plan.md` (The Strategy)43- **Purpose**: Defines *what* we are doing and *how*.44- **Contains**: Objectives, Step-by-step implementation plan, Current Status, Error Log.45- **Update Frequency**: At the start of a task, and after every major phase completion.4647### `findings.md` (The Memory)48- **Purpose**: Stores raw information, code snippets, documentation, and "aha!" moments.49- **Contains**: Relevant file content summaries, API references, decisions made, bug causes.50- **Update Frequency**: **High**. Every 2-3 tool calls during research/debugging.5152### `progress.md` (The Journal)53- **Purpose**: A chronological log of actions taken (optional if using `task.md` heavily/Agentic Mode).54- **Contains**: Timestamps, specific commands run, test results.5556## 3. Workflow Implementation5758### Phase 1: Initialization / Planning591. **Check Context**: Run `ls -R` or `list_dir` to see if planning files exist.602. **Create/Read**:61 - **Task Plan**: Create `task_plan.md` using `templates/task_plan.md` as a guide.62 - **Findings**: Create `findings.md` using `templates/findings.md` for research notes.63 - *Note*: You can use `read_file .agent/skills/planning-with-files/templates/task_plan.md` to see the structure.6465### Phase 2: Execution (The Loop)661. **Read** code/docs.672. **Write** findings to `findings.md` (2-Action Rule).683. **Update** `task_plan.md` if the plan changes based on findings.694. **Act** (Write code, run command).705. **Verify** result.716. **Log** outcome to `progress.md` or `task_plan.md`.7273## 4. When to Use74- **USE FOR**: Multi-step tasks, Debugging complex bugs, Feature implementation, Refactoring.75- **SKIP FOR**: Trivial one-shot questions (e.g., "What time is it?", "Fix this typo on line 10").7677## 5. Anti-Patterns (What NOT to do)78- **Storing everything in RAM**: Relying on your context window to remember what you read 10 turns ago.79- **"I'll remember that"**: You won't. Write it down.80- **Looping on Errors**: Retrying the same failing command 5 times hoping it works. (Use 3-Strike Protocol).