AgentSkillsCN

skogai-planning

以持久化的Markdown文件作为磁盘上的工作记忆,进行手稿式规划。支持多项目协同、项目切换,以及通过task_plan.md、findings.md和progress.md进行阶段性任务计划。

SKILL.md
--- frontmatter
name: skogai-planning
description: Manus-style planning with persistent markdown files as working memory on disk. Supports multi-project coordination, project switching, and phase-tracked task plans with task_plan.md, findings.md, and progress.md.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch
hooks:
  PreToolUse:
    - matcher: "Write|Edit|Bash"
      hooks:
        - type: command
          command: "cat task_plan.md 2>/dev/null | head -30 || true"

Planning with Files

Work like Manus: Use persistent markdown files as your "working memory on disk."

Multi-Project Support

This skill supports multiple project contexts via a coordinator file.

On Skill Activation

FIRST, check for a coordinator file:

  1. Check if .skogai/plan/index.md exists (walking up from CWD like git finds .git)
  2. If found, determine active project using priority cascade:
    • Priority 1: $MANUS_PROJECT environment variable (explicit override)
    • Priority 2: .skogai/plan/.active.override.$CLAUDE_CODE_SESSION_ID (session-local state)
    • Priority 3: active: field in index.md (workspace default)
  3. Look up that project's path in the Projects table
  4. Expand ~ to the user's home directory in paths
  5. Use that path as {project_path} for all planning files
  6. Create the directory if it doesn't exist
  7. Report: "Planning context: [project-name] at [path]"

If no .skogai/plan/ found:

  • Use current directory as {project_path} (backward compatible)
  • Planning files go directly in CWD

Session ID:

Claude Code exposes $CLAUDE_CODE_SESSION_ID (a UUID) in all execution contexts. Use this for session-local override files. TTY detection doesn't work because Claude Code's Bash tool runs without a TTY attached.

Planning File Locations

All planning files use {project_path}:

  • {project_path}/task_plan.md
  • {project_path}/findings.md
  • {project_path}/progress.md

Project Commands

Recognize these natural language patterns:

User SaysAction
"switch to [name]"Write to session override file, read new project's task_plan.md
"set default [name]"Update active: in index.md (workspace default for new sessions)
"list projects" / "show projects"Display all projects from index.md table
"which project?" / "current context"Show active project name, source, and resolved path
"add project [name]"Interactive flow to create new project (see below)
"set default path [path]"Update default_path in index.md
"where are planning files?"Show resolved {project_path}
"where is source?"Show source path for current project

Adding a Project

When user says "add project [name]":

First, check if project already exists in the Projects table:

  • If exists: "Project '[name]' already exists. Would you like to update it, use a different name, or switch to it?"
  • If not exists: continue with creation flow
  1. Ask for planning location using AskUserQuestion:

    • Option 1: "Default location ({default_path}/[name]/)" [Recommended]
    • Option 2: "Somewhere else (I'll specify)"
  2. If "somewhere else", ask for the custom planning path

  3. Ask for source/working folder:

    • "What's the source/working folder for this project?"
    • This is where the actual code lives
  4. Create the project:

    • Create the planning directory if it doesn't exist
    • Create task_plan.md with Source header (see template)
    • Create findings.md
    • Create progress.md
    • Add row to Projects table in index.md
    • Set as active project
  5. Report:

    code
    Created project "[name]":
    - Planning: [resolved planning path]
    - Source: [source path]
    - Files: task_plan.md, findings.md, progress.md
    

Switching Projects (Session-Local)

When user requests a project switch with "switch to [name]":

  1. Read .skogai/plan/index.md
  2. Verify the requested project exists in the Projects table
  3. Get session ID from $CLAUDE_CODE_SESSION_ID environment variable
  4. Write the project name to .skogai/plan/.active.override.$CLAUDE_CODE_SESSION_ID
    • This is session-local - does NOT modify index.md
    • Other Claude Code sessions are unaffected
  5. Read the new project's task_plan.md if it exists
  6. Report: "Switched to [name] (this session). Current task: [summary from task_plan.md or 'No active task']"

If the requested project doesn't exist, offer to create it.

Setting Workspace Default

When user says "set default [name]":

  1. Verify the requested project exists in the Projects table
  2. Update the active: field in .skogai/plan/index.md
  3. Report: "Set [name] as workspace default. New sessions will start with this project."

This changes the default project for all new sessions in this workspace.

Intent Mismatch Detection

If the user mentions working on a project different from the active one:

  • Example: Active is "bracket" but user says "let's work on the college advisor"
  • Prompt: "You mentioned college-advisor but we're in bracket context. Switch projects?"

Example index.md

markdown
# Planning Coordinator

active: my-project
default_path: .skogai/plan

## Projects

| Name       | Planning Path      | Source Path          | Description         |
| ---------- | ------------------ | -------------------- | ------------------- |
| my-project | {default}/my-project | ~/code/my-project  | Main project        |
| side-proj  | {default}/side-proj  | ~/code/side-proj   | Side project        |

Path Resolution:

  • {default} expands to the default_path value
  • ~ expands to user's home directory
  • Planning Path = where planning files live
  • Source Path = where project code lives

Quick Start

Before ANY complex task:

  1. Check for coordinator — Read .skogai/plan/index.md if it exists
  2. Create task_plan.md — See templates/task_plan.md
  3. Create findings.md — See templates/findings.md
  4. Create progress.md — See templates/progress.md
  5. Re-read plan before decisions — Refreshes goals in attention window
  6. Update after each phase — Mark complete, log errors

The Core Pattern

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

→ Anything important gets written to disk.

File Purposes

FilePurposeWhen to Update
task_plan.mdPhases, progress, decisionsAfter each phase
findings.mdResearch, discoveriesAfter ANY discovery
progress.mdSession log, test resultsThroughout session

Critical Rules

1. Create Plan First

Never start a complex task without task_plan.md. Non-negotiable.

2. 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.

3. Read Before Decide

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

4. Update After Act

After completing any phase:

  • Mark phase status: in_progresscomplete
  • Log any errors encountered
  • Note files created/modified

5. Log ALL Errors

Every error goes in the plan file. This builds knowledge and prevents repetition.

markdown
## Errors Encountered

| Error             | Attempt | Resolution             |
| ----------------- | ------- | ---------------------- |
| FileNotFoundError | 1       | Created default config |
| API timeout       | 2       | Added retry logic      |

6. Never Repeat Failures

code
if action_failed:
    next_action != same_action

Track what you tried. Mutate the approach.

The 3-Strike Error Protocol

code
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

Read vs Write Decision Matrix

SituationActionReason
Just wrote a fileDON'T readContent still in context
Viewed image/PDFWrite findings NOWMultimodal → text before lost
Browser returned dataWrite to fileScreenshots don't persist
Starting new phaseRead plan/findingsRe-orient if context stale
Error occurredRead relevant fileNeed current state to fix
Resuming after gapRead all planning filesRecover state

The 5-Question Reboot Test

If you can answer these, your context management is solid:

QuestionAnswer Source
Where am I?Current phase in task_plan.md
Where am I going?Remaining phases
What's the goal?Goal statement in plan
What have I learned?findings.md
What have I done?progress.md

When to Use This Pattern

Use for:

  • Multi-step tasks (3+ steps)
  • Research tasks
  • Building/creating projects
  • Tasks spanning many tool calls
  • Anything requiring organization

Skip for:

  • Simple questions
  • Single-file edits
  • Quick lookups

Templates

Copy these templates to start:

Scripts

Helper scripts for automation:

  • scripts/init-session.sh — Initialize all planning files
  • scripts/check-complete.sh — Verify all phases complete

Advanced Topics

Anti-Patterns

Don'tDo Instead
Use TodoWrite for persistenceCreate task_plan.md file
State goals once and forgetRe-read plan before decisions
Hide errors and retry silentlyLog errors to plan file
Stuff everything in contextStore large content in files
Start executing immediatelyCreate plan file FIRST
Repeat failed actionsTrack attempts, mutate approach