# /planning-with-files: Keep agent plans on disk so long tasks survive /clear

Source: https://trendhub.net/skills/othmanadi-planning-with-files/planning-with-files
Skill folder: https://github.com/OthmanAdi/planning-with-files/tree/master/skills/planning-with-files
Pack: Planning with Files (https://trendhub.net/skills/othmanadi-planning-with-files)
Works with: Claude Code (plugin), Any Agent Skills agent, npm, Pi Coding Agent, Hermes Agent, OpenCode, DeepSeek Harness

planning-with-files treats the context window as volatile memory and the filesystem as durable storage. The agent writes a phased task_plan.md, a findings.md for research and a progress.md log, and hooks bring the selected plan back into context each turn. Optional autonomous and gated modes add hash-checked plans, a ledger and a stop gate for unattended runs.

## When to use it

- A task will take many tool calls or span more than one session.
- You keep losing track of where the agent was after /clear or compaction.
- Several agents or terminals work on separate tasks in the same repository.

## How it works

1. **Restore before creating**: The agent resolves the plan directory for this task, reads the three files and checks git diff for changes not yet recorded.
2. **Initialise with the script**: For new work it runs the bundled init script and keeps each phase as a heading with exactly one pending, in-progress or complete status line, then validates the format.
3. **Write as you go**: Findings are saved after every two viewing or search actions, progress is logged throughout, and the next step is refreshed whenever a phase changes.
4. **Handle errors in three strikes**: Each failure is recorded; the agent fixes, then tries a different method, then rethinks, and after three failures explains what it tried and asks you.
5. **Finish against the plan**: Completion is judged from the plan file, and in gated mode the stop is held only while a phase is still marked in progress.

## What it steers the agent away from

- Relying on an in-context to-do list that disappears on reset
- Retrying the same failing action without changing approach
- Copying untrusted web content into the plan file that hooks re-inject

## What it can touch

Creates and edits Markdown planning files and a .planning/ directory in your project, runs bundled shell, PowerShell and Python helper scripts through lifecycle hooks, and only reads local agent session records when you explicitly ask for catch-up.

## Questions

### Can two agents work on different tasks in one repo?

Yes. Each task gets its own named plan under .planning/, and you pin each agent to it with the PLAN_ID variable or use separate worktrees.

### What stops a tampered plan from steering the agent?

Plan content is wrapped in data delimiters, and you can lock the approved plan with a SHA-256 attestation so hooks refuse to inject a changed body. The skill notes this is tamper detection, not a full defence against prompt injection.
