agentleFS
kimgoetzkekimgoetzke/coding-agent-configs/skills/planning-mode/SKILL.md

planning-mode

Skill2 starsChanged 7 months agoMITView on GitHub

Toggle persistent planning mode on/off. When on, hook support can remind the agent to keep planning documents updated throughout the conversation, with manual fallback if unavailable. Combines the full planning workflow with persistent mode for long-running planning and implementation sessions. Use with a topic to start, with "continue" to resume an existing plan, or with "off" to stop.

The file

Show its rules and text

We split this skill into the rules it gives an agent

37 rules. About 0 are common, 18 are distinctive, and 19 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 19

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you cannot determine which tool you are, ask the user.

    line 26
  2. Distinctive:

    Use persistent markdown files as your "working memory on disk." Context windows are volatile and limited.

    line 30
  3. Very specific:

    Before creating the planning files, you must read the starting templates in ./templates/

    line 38
  4. Distinctive:

    If the skill was invoked with the argument "off", skip this step and go directly to Step 2.

    line 54
  5. Very specific:

    If running in Claude Code, run bash {skill-dir}/scripts/check-hooks.sh and parse the structured output.

    line 58
  6. Very specific:

    If running in Copilot, run bash {skill-dir}/scripts/check-hooks.sh copilot and parse the structured output.

    line 59
  7. Distinctive:

    When the user provides a topic, continue to Step 3b.

    line 85
  8. Very specific:

    Create the plan folder at {repo root}/.ai/planning/{yyyy-mm-dd} {task-name}/ where:

    line 90
  9. Very specific:

    If the flag file doesn't exist yet, create {repo root}/.ai/.active-mode with:

    line 94
  10. Very specific:

    If it already exists (from Step 3a), update the folder: line.

    line 100
  11. Very specific:

    If the directory is missing or contains no plan folders, stop and tell the user: "No existing plans found in .ai/planning/.

    line 106
  12. Distinctive:

    If the input is a number, resolve it against the numbered list.

    line 116
  13. Distinctive:

    If the input is text, try exact folder-name match first.

    line 117
  14. Distinctive:

    If no exact match, allow a single unambiguous case-insensitive partial match.

    line 118
  15. Distinctive:

    If the input is invalid, ambiguous, or out of range, stop and tell the user the selection was invalid.

    line 119
  16. Distinctive:

    Read the planning files in the selected folder so their contents are in context.

    line 120
  17. Very specific:

    If plan.md is missing, tell the user the plan is incomplete and continue with whatever does exist.

    line 126
  18. Very specific:

    If running in GitHub Copilot, recommend: "You can run /rename {task name} to rename this conversation." where {task name} is the folder …

    line 136
  19. Very specific:

    If running in Claude Code or Pi, recommend: "You can run /name {task name} to name this conversation." where {task name} is the folder name …

    line 137
  20. Very specific:

    Create findings.md in the plan folder following the template: templates/findings.md

    line 144
  21. Very specific:

    Document findings in findings.md as you go.

    line 146
  22. Very specific:

    Document your determination and reasoning at the top of findings.md under a ## Plan Size heading.

    line 156
  23. Very specific:

    If running in GitHub Copilot, recommend: "You can run /rename {task name} to rename this conversation."

    line 169
  24. Very specific:

    If running in Claude Code or Pi, recommend: "You can run /name {task name} to name this conversation."

    line 170
  25. Distinctive:

    If you've learned something new since the last update, update the relevant planning document(s) on disk

    line 179
  26. Distinctive:

    If you haven't learned anything new, carry on — don't update for the sake of it

    line 180
  27. Distinctive:

    Keep documents well-structured and up-to-date with the templates

    line 181
  28. Distinctive:

    ALWAYS tell the user if you have updated any planning docs or that you decided no updates to any planning documents were required

    line 182
  29. Very specific:

    When /planning-mode off is invoked:

    line 186
  30. Distinctive:

    Every plan — single-phase or multi-phase — must conclude with all planning files up-to-date

    line 199
  31. Distinctive:

    When updating planning files, do so in line with the templates for these files

    line 202
  32. Distinctive:

    Before major decisions, read the plan file.

    line 219
  33. Distinctive:

    After completing any phase:

    line 223
  34. Very specific:

    Update ## Status in plan.md

    line 225
  35. Very specific:

    Every error goes in plan.md (the single home for errors across all planning files).

    line 232
  36. Distinctive:

    If that extension is installed, planning mode gets equivalent reminder and stale-flag cleanup behaviour automatically.

    line 339
  37. Very specific:

    If you need to persist planning mode across sessions, re-enable it with /planning-mode at the start of the new session.

    line 359

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Usage

  • /planning-mode — Enable planning mode, then prompt for a topic
  • /planning-mode <topic> — Enable planning mode and start planning
  • /planning-mode continue — List existing plan folders and resume one
  • /planning-mode off — Disable planning mode

Configuration

Planning mode works best with automated reminders, but it can still run with manual planning-doc updates when hook support is unavailable.

ToolHook config location / equivalentScript format argument
Claude Code~/.claude/settings.json(none — default)
Copilot~/.copilot/hooks.jsoncopilot
PiBundled active-mode extension in .pi/agent/extensions/active-mode/(extension-driven)

Claude Code and Copilot support the bundled PostToolUse and SessionStart hook scripts directly. Pi does not use the same standalone hook configuration files in this repository's starter config. Instead, this starter config now ships a Pi-native active-mode extension that reads .ai/.active-mode, clears stale flags on fresh session start, injects reminder context before LLM calls, and shows mode status in the UI. If that extension is not installed, fall back to manual planning-doc updates.

If you cannot determine which tool you are, ask the user.

Planning files

Use persistent markdown files as your "working memory on disk." Context windows are volatile and limited; anything important gets written to disk.

  • For any plan, you must create the following files in the plan folder:
    • plan.md — Track work breakdown and progress
    • questions.md — Track your questions and the user's responses and vice versa
    • findings.md — Store research and discoveries
  • For multi-phase plans, you must also create:
    • progress.md — Session log and test results
  • Before creating the planning files, you must read the starting templates in ./templates/
  • You must use the starting templates when creating or updating planning files to guide the structure and content of these files
FilePurposeWhen to UpdateScope
plan.mdWork breakdown, decisionsAfter each phaseAll plans
findings.mdResearch, discoveriesPer 2-action ruleAll plans
questions.mdLog of questions and user responsesThroughout planningAll plans
progress.mdSession log, test resultsThroughout sessionMulti-phase only

Workflow

You must follow these steps in order:

Step 1: Check hook configuration

If the skill was invoked with the argument "off", skip this step and go directly to Step 2.

Otherwise:

  • If running in Claude Code, run bash {skill-dir}/scripts/check-hooks.sh and parse the structured output.
  • If running in Copilot, run bash {skill-dir}/scripts/check-hooks.sh copilot and parse the structured output.
  • If running in Pi, skip the standalone hook check. Explain that this repository's Pi starter config uses the bundled active-mode extension instead of standalone hook files. If that extension is installed, planning mode gets equivalent reminder/cleanup behaviour automatically. Otherwise planning mode will rely on manual update discipline only. Then continue to Step 2.

For Claude Code and Copilot:

  • If STATUS: YES: continue to Step 2.
  • If STATUS: NO or STATUS: PARTIAL: offer to install the missing hooks now (see Hook Setup below) before proceeding. If the user declines, note that planning mode will rely on manual update discipline only — no PostToolUse reminders and no SessionStart cleanup — then continue.

Step 2: Determine action

Parse the arguments:

  • No arguments → go to Step 3a
  • "off" → go to Step 9
  • "continue" → go to Step 3c
  • Any other text → treat as the planning topic, go to Step 3b

Step 3a: Enable without topic

  1. Create {repo root}/.ai/.active-mode with:
    mode: planning
    folder: (pending)
    started: {yyyy-mm-dd HH:mm}
  2. Tell the user: "Planning mode is on. What would you like to plan?"
  3. When the user provides a topic, continue to Step 3b.

Step 3b: Enable with topic

  1. Derive {task-name} — an extremely succinct name for the task, use kebab-case e.g. refactor-mfa-flow.
  2. Create the plan folder at {repo root}/.ai/planning/{yyyy-mm-dd} {task-name}/ where:
    • {repo root} is the root of the current repository
    • {yyyy-mm-dd} is the date of the plan creation
    • {task-name} is the name derived in the previous step
  3. If the flag file doesn't exist yet, create {repo root}/.ai/.active-mode with:
    mode: planning
    folder: {repo root}/.ai/planning/{yyyy-mm-dd} {task-name}/
    started: {yyyy-mm-dd HH:mm}
    If it already exists (from Step 3a), update the folder: line.
  4. Continue to Step 4.

Step 3c: Continue an existing plan

  1. List directories in {repo root}/.ai/planning/.
    • If the directory is missing or contains no plan folders, stop and tell the user: "No existing plans found in .ai/planning/. Use /planning-mode <topic> to start a new one."
    • On Windows, if Glob fails to list the directory, fall back to ls "{repo root}/.ai/planning/" via Bash.
  2. Sort newest first (the {yyyy-mm-dd} folder prefix sorts correctly lexicographically).
  3. Show the folder names exactly as stored in a numbered list. Example:
    1. 2026-04-10 refactor-auth-flow
    2. 2026-04-08 add-retry-metrics
  4. Prompt the user to reply with either the list number or the folder name.
  5. Resolve the selection:
    • If the input is a number, resolve it against the numbered list.
    • If the input is text, try exact folder-name match first.
    • If no exact match, allow a single unambiguous case-insensitive partial match.
    • If the input is invalid, ambiguous, or out of range, stop and tell the user the selection was invalid. Do not re-prompt.
  6. Read the planning files in the selected folder so their contents are in context. Read in this order, only what exists:

    1. plan.md
    2. progress.md (multi-phase plans only)
    3. findings.md
    4. questions.md

    If plan.md is missing, tell the user the plan is incomplete and continue with whatever does exist.

  7. Create {repo root}/.ai/.active-mode with:
    mode: planning
    folder: {repo root}/.ai/planning/{selected folder}/
    started: {yyyy-mm-dd HH:mm}
  8. Briefly summarise the plan's current state to the user — current phase, status, any open questions or blockers — based only on the loaded docs.
  9. Confirm: "Planning mode is on. Continuing {folder path}. Use /planning-mode off when done. Planning mode will be auto-disabled by starting a new session when supported by your harness configuration."
  10. Recommend renaming the conversation:
    • If running in GitHub Copilot, recommend: "You can run /rename {task name} to rename this conversation." where {task name} is the folder name with the date prefix removed.
    • If running in Claude Code or Pi, recommend: "You can run /name {task name} to name this conversation." where {task name} is the folder name with the date prefix removed.
    • Otherwise, recommend: "Consider renaming this conversation to {task name} if your tool supports it."
  11. Skip Steps 4–7 (the plan already exists). Continue with Step 8 (keep planning documents updated).

Step 4: Research & discover

  1. Gather requirements from the user's request.
  2. Create findings.md in the plan folder following the template: templates/findings.md
  3. Explore the codebase to understand the scope of the change.
  4. Document findings in findings.md as you go.

Step 5: Determine plan size

Based on your research, explicitly determine whether this is a multi-phase plan. A plan is multi-phase if it meets ANY of the following:

  • More than 5 files will likely be modified
  • More than 5 tool uses are expected
  • More than 150 lines of code will change

Document your determination and reasoning at the top of findings.md under a ## Plan Size heading.

Step 6: Create remaining planning files

Create the remaining planning files from the templates based on the determination in step 5 (see Planning files). Populate plan.md with the plan and questions.md with any unresolved questions. Keep questions.md scaffolded even if you have no questions yet, as they may come up later. For multi-phase plans, also create progress.md as a stub — it will be populated during execution.

You must use the starting templates (see Planning files) when creating or updating planning files to guide the structure and content of these files.

Step 7: Respond

  1. Return a summarised version of the plan to the user. Highlight if there are unresolved questions or if the plan is ready for implementation.
  2. Confirm to the user: "Planning mode is on. I'll keep updating the planning docs in {plan folder path} as we go. Use /planning-mode off when done. Planning mode will be auto-disabled by starting a new session when supported by your harness configuration."
  3. Recommend to the user that they rename this conversation:
    • If running in GitHub Copilot, recommend: "You can run /rename {task name} to rename this conversation."
    • If running in Claude Code or Pi, recommend: "You can run /name {task name} to name this conversation."
    • Otherwise, recommend: "Consider renaming this conversation to {task name} if your tool supports it."

Step 8: Keep planning documents updated

This step repeats until the planning mode is off.

While planning mode is active, if your harness has PostToolUse hook support configured, the hook outputs reminders after each tool use. When you see these reminders:

  • If you've learned something new since the last update, update the relevant planning document(s) on disk
  • If you haven't learned anything new, carry on — don't update for the sake of it
  • Keep documents well-structured and up-to-date with the templates
  • ALWAYS tell the user if you have updated any planning docs or that you decided no updates to any planning documents were required

Step 9: Disable

When /planning-mode off is invoked:

  1. Delete {repo root}/.ai/.active-mode
  2. Confirm: "Planning mode is off."

Step 10: Session startup cleanup

For harnesses with SessionStart hook support configured, stale flag files from previous sessions are cleared automatically. In Pi, the bundled active-mode extension clears stale flags on fresh session start when installed. Without that extension, delete a stale .ai/.active-mode file before re-enabling planning mode if one is left behind.

Critical rules

1. Keep docs up-to-date

  • Every plan — single-phase or multi-phase — must conclude with all planning files up-to-date
  • For multi-phase plans, this applies at the end of every phase, not just the final one
  • The plan must have explicit actions to this effect that specifically refer to this planning skill (in each phase, for multi-phase plans)
  • When updating planning files, do so in line with the templates for these files

2. Reference relevant skills

  • During planning, you must check the skills available to you that apply to the work in that phase (e.g. rust-bevy-standards, java-conventions, tdd)
  • Each phase must have a task to read the relevant skills, followed by a list of those skills
  • Any development work must follow test-driven development practices i.e. you have to use your tdd skill for any code you write and task descriptions featuring development work must make this clear
  • Do not edit any file in a phase until you have read every skill listed for that phase

3. The 2-action rule

"After every 2 view/browser/search operations, IMMEDIATELY save key findings to text files."

This prevents visual/multimodal information from being lost.

4. Read before decide

Before major decisions, read the plan file. This keeps goals in your attention window.

5. Update after act

After completing any phase:

  • Update ## Status in plan.md
  • Mark phase status: In progress → Complete
  • Log any errors encountered
  • Note files created/modified

6. Log ALL errors

Every error goes in plan.md (the single home for errors across all planning files). This builds knowledge and prevents repetition.

7. Never repeat failures

if action_failed:
    next_action != same_action

Track what you tried. Mutate the approach.

The 3-strike error protocol

ATTEMPT 1: Diagnose & Fix
  → Read error carefully
  → Identify root cause
  → Apply targeted fix

ATTEMPT 2: Alternative Approach
  → Same error? Try different method
  → Different tool? Different library?
  → NEVER repeat exact same failing action

ATTEMPT 3: Broader Rethink
  → Question assumptions
  → Search for solutions
  → Consider updating the plan

AFTER 3 FAILURES: Escalate to User
  → Explain what you tried
  → Share the specific error
  → Ask for guidance

Hook Setup

Planning mode relies on two hooks to function fully. Without the PostToolUse hook, only the manual update discipline (Step 8) applies.

Step 1 runs scripts/check-hooks.sh to verify configuration automatically for Claude Code and Copilot. If that reports STATUS: NO or STATUS: PARTIAL, offer to add the missing hooks using the appropriate format below.

Claude Code

Merge into ~/.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "bash ~/.claude/skills/planning-mode/scripts/planning-mode-hook.sh"
          }
        ]
      }
    ],
    "SessionStart": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "bash ~/.claude/skills/planning-mode/scripts/clear-mode.sh"
          }
        ]
      }
    ]
  }
}

Copilot

Merge into ~/.copilot/hooks.json:

{
  "hooks": {
    "postToolUse": [
      {
        "type": "command",
        "bash": "~/.copilot/skills/planning-mode/scripts/planning-mode-hook.sh copilot"
      }
    ],
    "sessionStart": [
      {
        "type": "command",
        "bash": "~/.copilot/skills/planning-mode/scripts/clear-mode.sh copilot"
      }
    ]
  }
}

Note: The copilot argument tells the scripts to output JSON with additionalContext for Copilot's context injection format.

Pi

This repository's Pi starter config includes the active-mode extension under .pi/agent/extensions/active-mode/. That extension uses Pi lifecycle events:

  • fresh-session cleanup via session_start
  • per-turn / post-tool-style reminders via before_agent_start and context
  • visible mode state via ctx.ui.setStatus()

If that extension is installed, planning mode gets equivalent reminder and stale-flag cleanup behaviour automatically. If it is not installed, use manual document updates.

Bundled scripts

  • scripts/planning-mode-hook.sh — PostToolUse reminder
  • scripts/clear-mode.sh — SessionStart cleanup
  • scripts/check-hooks.sh — verifies the two hooks above are configured in the relevant settings file

Templates

  • templates/plan.md — Work breakdown and progress template
  • templates/findings.md — Research storage template
  • templates/progress.md — Session logging template
  • templates/questions.md — Questions and responses template

Notes

  • Mutual exclusivity: There are other modes and they are mutually exclusive. They all share the .ai/.active-mode flag file. If another mode is active (check mode: field in .ai/.active-mode), disable it before enabling planning-mode.
  • For harnesses with SessionStart hook support configured, the flag file is automatically cleared at session startup.
  • In Pi, the bundled active-mode extension provides the equivalent behaviour without standalone hook files.
  • If you need to persist planning mode across sessions, re-enable it with /planning-mode at the start of the new session.
  • Both hook scripts are silent when the flag file doesn't exist — no impact on normal conversations.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.