Sandbox
@OthmanAdi/planning-with-files

Planning files and hooks for AI coding agents

This repo packages a file-based planning system that keeps execution state on disk instead of only in the context window. It uses hooks and skill files to restore the plan on each turn, detect tampering, and gate completion until the active phases are done.

26,779 starsβ€’2.2k forksβ€’Pythonβ€’Updated 7d ago
Who it's for

Builders who want their agent to remember the current task plan across long sessions and resets.

What it delivers

You can keep a task moving with the same plan, findings, and progress even after context loss.

What it does

Three-file planning pattern

Keeps task state in `task_plan.md`, research in `findings.md`, and session logs in `progress.md`.

Turn-by-turn plan reinjection

Uses hooks to read the plan from disk and put the current phase back into the prompt each turn.

Recovery after context loss

Resumes work after `/clear`, compaction, or a crash by rebuilding context from project files.

Completion gate

Holds stop only while an `in_progress` phase remains, so the agent does not declare done too early.

Tamper attestation

Checks plan hashes and refuses to inject a plan that no longer matches the approved body.

Multi-agent and multi-editor support

Ships plugin and skill layouts for Claude Code, Codex, Cursor, Gemini CLI, Copilot, OpenCode, Hermes, Pi, and others.

How to get it

  1. 1Claude Code, plugin route (ships everything: skill, hooks, slash commands)
    /plugin marketplace add OthmanAdi/planning-with-files
    /plugin install planning-with-files@planning-with-files
  2. 2Every other agent, one line, 60+ agents via the Agent Skills standard
    npx skills add OthmanAdi/planning-with-files --skill planning-with-files -g
  3. 3npm, to pin an exact version into a project or vendor it
    npm install planning-with-files
  4. 4Pi Coding Agent, same npm package, wired up for you (skill, extension, status bar)
    pi install npm:planning-with-files
  5. 5Hermes Agent (Nous Research), native plugin plus skill bundle, CLI and Desktop
    hermes skills install OthmanAdi/planning-with-files/.hermes/skills/planning-with-files --yes
    hermes plugins install OthmanAdi/planning-with-files/.hermes/plugins/planning-with-files
    hermes plugins enable planning-with-files
  6. 6πŸ‡ΈπŸ‡¦ Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ© / Arabic
    npx skills add OthmanAdi/planning-with-files --skill planning-with-files-ar -g

README

planning-with-files: task_plan.md, findings.md, and progress.md as three stone tablets

Planning with FilesΒ Β Β Trendshift: #1 Repository of the Day across all languages

The planning skill your agent cannot ignore.
Not a prompt it might follow. A hook that fires every turn, a plan on disk that survives /clear, and 3 out of 3 blind A/B wins to show it works.

Your agent's context window dies. The plan does not.

Persistent file-based planning for AI coding agents and long-running agent tasks: the skill keeps task_plan.md, findings.md, and progress.md on disk. Activated lifecycle hooks inject selected project planning context, so the plan survives context loss, /clear, crashes, and compaction. Automatic recovery reads project files only. Reading same-project local agent session records for aggregate counts or bounded replay requires an explicit catchup mode. Installs across 60+ agents via the Agent Skills standard, with native plugins for Claude Code, Codex CLI, Pi and Hermes Agent.

Stars Latest release Skills Playground installs Downloads

Benchmark: 96.7 percent assertion pass rate with skill Blind A/B: 3 of 3 wins MIT license

See it survive /clear Β· Install Β· Long-running tasks Β· Hermes Agent Β· Multi-agent Β· The numbers

Proof, comparisons and the repository reference are further down Β· Full install guide


Before and after /clear

Every coding agent loses its working memory when the context window resets. The plan does not have to die with it.

Without planning files

Terminal after /clear without planning files: the user types continue, the agent replies that it has no context from an earlier session and asks the user to describe the task and where they left off

The agent re-reads the repo, asks you to restate the goal, and rediscovers work it already finished.


With planning-with-files

Terminal after /clear with planning-with-files: the hook injects a plan data block showing Phase 2 complete and Phase 3 in progress, and the agent resumes Phase 3 by adding the expiry edge-case tests

The transcript is illustrative; the ===BEGIN PLAN DATA=== block is the skill's real injection format, written into context by the UserPromptSubmit hook from task_plan.md on disk. In the project's internal recovery benchmark, a fresh session with the files on disk resumed in 5.0 turns on average against 13.3 for a raw agent (internal v1, author-run; method and limits in docs/evals.md). That benchmark used the earlier default transcript-catchup behavior. Current automatic recovery uses project files only, so the figure is historical evidence rather than a fresh measurement of the current default.

At a glance
Plan files3
Agents covered60+
Pass rate (with skill)96.7%
Test suite706 tests
Survives /clearyes

Built for long-running agent tasks

[!IMPORTANT] Most harnesses ship a to-do list that lives inside the context window. planning-with-files ships a plan that lives on disk, is re-injected every turn, is hash-attested, and can hold the agent's stop until the plan reports complete.

That is the difference between an agent that forgets after /clear, compaction or a crash and one that resumes at the current phase. In the project's own measurements the plan on disk turned a 13.3-turn re-orientation into 5.0 turns, and the skill won 3 of 3 blind A/B comparisons (numbers and limits). Every mechanism below is a file on disk plus a hook, so it works the same on hour ten as on turn one.

What breaks long agent runsWhat the skill does about it
The context window is wiped by /clear, compaction, or a crashThe plan is re-read from disk on the next turn; SessionStart, UserPromptSubmit and PreCompact hooks carry the current phase back in
Goal drift after 50+ tool callsThe plan head is re-injected every turn; PWF_INJECT=smart keeps the goal, the next step and the active phase in the window late in a long plan
The agent declares "done" earlyGated mode: the Stop gate holds the stop only while an in_progress phase remains, with a block cap and stall detection so an incomplete plan alone never traps a session
The plan is silently rewritten by a tool result, a collaborator, or a bugSHA-256 attestation: a plan body that no longer matches the approved hash is refused at injection with [PLAN TAMPERED]
Two sessions overwrite each other's phasesThe parallel-write guard reports when checked items or completed phases go down between turns
Autonomous loops burn tokens on recitationAutonomous mode drops the per-tool-call recitation and replaces the raw progress tail with a fixed-shape ledger summary; injection is KV-cache stable and one hook fire costs about 289 ms
Hooks that quietly stop firing/plan-doctor self-checks resolution, injection, attestation, install surfaces and per-fire latency

Everything in that table is opt-in per plan and byte-identical to the previous behavior when no mode marker is set. Details: v3 Long-Running Agent Features and docs/long-running-agent-tasks.md.

The Problem

Claude Code and most AI agents suffer from:

  • Volatile memory: the TodoWrite list disappears on context reset
  • Goal drift: after 50+ tool calls, the original goals get crowded out
  • Hidden errors: failures are not tracked, so the same mistakes repeat
  • Context stuffing: everything crammed into the window instead of stored

The Solution: 3-File Pattern

For every complex task, create THREE files:

task_plan.md      β†’ Track phases and progress
findings.md       β†’ Store research and findings
progress.md       β†’ Session log and test results

The Core Principle

Context Window = RAM (volatile, limited)
Filesystem = Disk (persistent, unlimited)

β†’ Anything important gets written to disk.

In your project, exactly this lands on disk and nothing else:

your-project/
β”œβ”€β”€ task_plan.md   ← phases + checkboxes; the resume point after /clear
β”œβ”€β”€ findings.md    ← research notes and decisions, appended as you go
└── progress.md    ← session log and test results

Parallel tasks get isolated directories instead: .planning/YYYY-MM-DD-slug/ with the same three files, selected via .active_plan (v2.36.0+). Plain markdown, gitignored by default, no runtime state anywhere else.

Why This Skill?

On December 29, 2025, Meta acquired Manus for $2 billion. In just 8 months, Manus went from launch to $100M+ revenue. Their secret? Context engineering.

"Markdown is my 'working memory' on disk. Since I process information iteratively and my active context has limits, Markdown files serve as scratch pads for notes, checkpoints for progress, building blocks for final deliverables." β€” Manus AI

This skill packages that exact pattern for your coding agent.

The Manus Principles

PrincipleImplementation
Filesystem as memoryStore in files, not context
Plan recitationRe-read plan before decisions (hooks)
Error persistenceLog failures in plan file
Goal trackingCheckboxes show progress
Completion verificationStop hook checks all phases

Quick Install

Claude Code, plugin route (ships everything: skill, hooks, slash commands):

/plugin marketplace add OthmanAdi/planning-with-files
/plugin install planning-with-files@planning-with-files

Every other agent, one line, 60+ agents via the Agent Skills standard:

npx skills add OthmanAdi/planning-with-files --skill planning-with-files -g

npm, to pin an exact version into a project or vendor it:

npm install planning-with-files

The package carries SKILL.md, scripts/ and templates/, so this is the route for locking a version into a repo's dependencies or copying the skill in yourself. It does not register hooks on its own.

Pi Coding Agent, same npm package, wired up for you (skill, extension, status bar):

pi install npm:planning-with-files

Hermes Agent (Nous Research), native plugin plus skill bundle, CLI and Desktop:

hermes skills install OthmanAdi/planning-with-files/.hermes/skills/planning-with-files --yes
hermes plugins install OthmanAdi/planning-with-files/.hermes/plugins/planning-with-files
hermes plugins enable planning-with-files

OpenCode, native plugin plus the skill (the npx skills add command above lands in ~/.agents/skills/, which OpenCode reads):

{ "plugin": ["opencode-planning-with-files"] }

in opencode.json or ~/.config/opencode/opencode.json; OpenCode installs it on the next start.

Under a minute. Safe to re-run. Trigger it by typing /plan (plugin) or asking the agent to "plan this task"; the skill also self-triggers on multi-step tasks.

What each route actually ships:

RouteSkill + scripts + templatesSlash commandsHooks
Claude Code pluginyesyesyes
npx skills addyesnofrontmatter hooks, see note
npm installyes, under node_modules/nono, copy the skill in yourself
pi install npm:yesyes, Pi commandsyes, via the Pi extension
hermes plugins installyes, with the skill bundleyes, /pwf, /pwf-statusyes, plugin hooks incl. the gate
OpenCode opencode.json pluginyes, with the skillyes, /pwf, /pwf-status (two copied command files)yes, plugin hooks incl. the gate
ClawHub / manual copyyesnofrontmatter hooks, see note

Skill-route installs can end up silently hook-less (project trust not accepted, or frontmatter hooks not registering on project-level installs). The hooks are the differentiating mechanism, so if they matter to you, use the plugin route, then verify with /plan-doctor. Full matrix and the two silent killers: docs/installation.md.

Install acting up? Open your agent and say: "Read docs/installation.md and docs/troubleshooting.md from OthmanAdi/planning-with-files and fix my install." Then run /plan-doctor.

🌐 Available in 5 other languages

πŸ‡ΈπŸ‡¦ Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ© / Arabic

npx skills add OthmanAdi/planning-with-files --skill planning-with-files-ar -g

πŸ‡©πŸ‡ͺ Deutsch / German

npx skills add OthmanAdi/planning-with-files --skill planning-with-files-de -g

πŸ‡ͺπŸ‡Έ EspaΓ±ol / Spanish

npx skills add OthmanAdi/planning-with-files --skill planning-with-files-es -g

πŸ‡¨πŸ‡³ δΈ­ζ–‡η‰ˆ / Chinese (Simplified)

npx skills add OthmanAdi/planning-with-files --skill planning-with-files-zh -g

πŸ‡ΉπŸ‡Ό ζ­£ι«”δΈ­ζ–‡η‰ˆ / Chinese (Traditional)

npx skills add OthmanAdi/planning-with-files --skill planning-with-files-zht -g

These are real translations, not an English body with a translated description: the SKILL.md prose, the templates, and the user-facing output of check-complete, init-session and session-catchup are all localized. The status tokens stay literal English (**Status:** complete) on purpose, because check-complete.sh matches them with grep -F, so translating them would disable the completion gate.

Since v3.10.0 the variants also ship the full script surface: attestation, the Stop gate, the ledger, phase status and plan-doctor used to be canonical-only, which quietly made every non-English install a subset install. Full details, including what changed on the plugin route in v3.11.0, are in docs/languages.md.

They live under skills/i18n/, one directory deeper than the canonical skill. The install commands above are unchanged, because npx skills add resolves --skill by skill name across the whole repository. The Claude Code plugin scan reads skills/*/SKILL.md without recursing, so the plugin route registers the canonical skill alone and no longer carries five extra descriptions in every session's system prompt. On that route the /plan-ar, /plan-de, /plan-es, /plan-zh and /plan-zht commands read the translated skill from disk instead of invoking it by name.

Prefer /planning-with-files with no prefix?

Copy the skill to your local folder:

macOS/Linux:

cp -r ~/.claude/plugins/cache/planning-with-files/planning-with-files/*/skills/planning-with-files ~/.claude/skills/

Windows (PowerShell):

Copy-Item -Recurse -Path "$env:USERPROFILE\.claude\plugins\cache\planning-with-files\planning-with-files\*\skills\planning-with-files" -Destination "$env:USERPROFILE\.claude\skills\"
Enhanced Support: per-IDE setup guides
IDEInstallation GuideIntegration
Claude CodeInstallationPlugin + SKILL.md + Hooks
CursorCursor SetupSkills + hooks.json
GitHub CopilotCopilot SetupHooks (incl. errorOccurred)
Mastra CodeMastra SetupSkills + Hooks
Gemini CLIGemini SetupSkills + Hooks
KiroKiro SetupAgent Skills
CodexCodex SetupSkills + Hooks
Hermes AgentHermes SetupSkill + native plugin (tools, /pwf, pre_llm_call, post_tool_call, pre_verify gate), CLI and Desktop
CodeBuddyCodeBuddy SetupSkills + Hooks
FactoryAI DroidFactory SetupSkills + Hooks
OpenCodeOpenCode SetupNative plugin opencode-planning-with-files (chat.message injection, write reminders, compaction flush, session.idle gate, pwf_* tools, /pwf commands) + skill
Standard Agent Skills: discovery paths
IDEInstallation GuideSkill Discovery Path
ContinueContinue Setup.continue/skills/ + .prompt files
Pi AgentPi Agent Setup.pi/skills/ (npm package)
OpenClawOpenClaw Setup.openclaw/skills/ (docs)
Autohand CodeAutohand Code Setup~/.autohand/skills/ or .autohand/skills/
AntigravityAntigravity Setup.agent/skills/ (docs)
KilocodeKilocode Setup.kilocode/skills/ (docs)
AdaL CLI (Sylph AI)AdaL Setup.adal/skills/ (docs)

Note: If your IDE uses the legacy Rules system instead of Skills, see the legacy-rules-support branch.

Sandbox runtimes
RuntimeStatusGuideNotes
BoxLiteβœ… DocumentedBoxLite SetupRun Claude Code + planning-with-files inside hardware-isolated micro-VMs

BoxLite is a sandbox runtime, not an IDE. Skills load via ClaudeBox, BoxLite's official Claude Code integration layer.

❓ FAQ

How do I stop my coding agent from losing its plan after /clear or a crash?

The plan lives on disk in task_plan.md, findings.md, and progress.md, not only in the context window. At the start of each turn the UserPromptSubmit hook re-injects selected active-plan context, and after a /clear or a new session the skill re-reads project files from disk. This automatic path does not inspect agent transcript stores.

What is the difference between planning-with-files and an agent memory tool?

Agent memory tools (vector stores, knowledge graphs) help an agent recall facts from past sessions. planning-with-files manages active execution state: the phases, status, dependencies, and completion check for the task the agent is working on right now. The problem it solves is planning continuity, not retrieval, and the two are complementary.

How does this prevent context rot?

Context rot is the drift that sets in as the context window fills and earlier instructions get crowded out. Because the plan is re-injected at the start of each turn from disk, the goals and phase status stay in the model's attention window as the conversation grows. This is an implementation of what Anthropic calls structured note-taking: write durable state to files outside the window, then read it back in when needed.

Which coding agents does this work with?

Claude Code, OpenAI Codex CLI, Cursor, GitHub Copilot, Kiro, OpenCode, Continue, Pi, Hermes Agent, CodeBuddy, Factory, Mastra, and 70+ others via the SKILL.md open standard (the npx skills installer alone targets 71 agents). Since v3.7.0 the repo also ships the cross-tool .agents/skills/planning-with-files/ layout in-tree, so tools that read the Agent Skills standard path natively (Zed, Amp, Warp, Devin, Antigravity, Gemini CLI, Cursor) discover the current skill from a plain git clone with no per-tool setup. Installation is one command; see Quick Install above.

How does this work with Claude Code's plan mode?

They are complementary stages, not alternatives. Plan mode is where you design and approve the approach before execution. planning-with-files persists the live execution state (phase status, findings, errors, progress) on disk while the work runs and re-injects it every turn. The handoff is one step: after accepting a plan-mode plan, tell the agent to write it into task_plan.md as phases (or invoke /plan and let the skill create the files from it), then execute in normal mode. From that point the hooks keep the phases in the attention window, and the files survive /clear, compaction, and session death.

What happens to the plan files after a task is complete?

They are working memory, not a tracked deliverable. task_plan.md, findings.md, progress.md, and the .planning/ directory are gitignored by default and are not archived automatically: the next task overwrites the root plan, and a slug directory just stops being active. Anything worth keeping should be promoted into code, a commit, or a doc. See After Completion: What Happens to the Plan Files for the full lifecycle and how to retain a completed plan. This is a deliberate default, not a missing feature; a completion-triggered archive step is a welcome opt-in extension.

How fast are the hooks?

One hook fire measures 289ms wall-clock since the v3.6.0 optimization, down from 2.0 to 2.4 seconds before it, and the injected plan block is KV-cache stable by construction. The plan stays in the attention window every turn, and /clear stops being fatal.

πŸ“¦ Releases
VersionHighlights
v3.17.2Fixes #241: the native Codex manifest disables legacy command migration, removing 13 redundant source-command-* skills from plugin installs. The canonical planning skill, Codex hooks, and Claude commands remain available.
v3.17.1Fixes #240: two named plans in the same project now require PLAN_ID, even without .planning/sessions/. A shared pointer or newest-plan guess cannot redirect a Codex session across compaction. Ambiguous hooks inject no plan and Stop does not gate against a guessed plan.
v3.17.0Every Claude Code hook fire forked about 130 processes, and under Git Bash on Windows that took 7 to 12 seconds against the 10 second hook timeout. Claude Code discarded the plan context ("UserPromptSubmit hook timed out after 10s") and every Bash, Read, Grep and Edit call waited 5 more seconds in PreToolUse before it ran. Linux and macOS never showed it because a fork costs milliseconds there. The events now run in one Python process, scripts/inject-plan.py, a byte-identical twin of the shell chain proven by a parity suite on all three CI legs, with the shell chain kept as the reference and as the fallback for hosts without Python: 0.3 s per prompt and per tool call on the reporting machine. Hook interpreters now start in isolated mode, so a repository's own secrets.py or hashlib.py is never imported by a hook. PWF_FAST_PATH=0 forces the shell chain.
v3.16.1Attached Codex, Hermes and Pi sessions require an explicit plan when several tasks share an armed project. Standalone hooks deliver model

Files in the repo

Repository payloadβ€’36 top-level entries
  • .agents
  • .claude-plugin
  • .codebuddy
  • .codex
  • .codex-plugin
  • .continue
  • .cursor
  • .factory
  • .gemini
  • .github
  • .hermes
  • .kiro
  • .mastracode
  • .opencode
  • .pi
  • commands
  • docs
  • examples
  • hooks
  • media
  • scripts
  • skills
  • templates
  • tests
  • .gitattributes
  • .gitignore
  • AGENTS.md
  • CHANGELOG.md
  • CITATION.cff
  • CONTRIBUTING.md
  • CONTRIBUTORS.md
  • LICENSE
  • llms.txt
  • MIGRATION.md
  • README.md
  • SECURITY.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More plugins

Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.

138k
1 add

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

82k
code-yeongyu/
oh-my-openagent

OmO: Just type "mass ulw" keyword with your prompt. Now you are the master of graph engineering.

69k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

94k

Opinionated Oxlint rules for rejecting low-evidence TypeScript and JavaScript patterns

4.3k