pi-planning-with-files 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # Pi Planning With Files
2
+
3
+ > **Work like Manus** — Use persistent markdown files as your "working memory on disk."
4
+
5
+ A [Pi Coding Agent](https://pi.dev) skill that transforms your workflow to use persistent markdown files for planning, progress tracking, and knowledge storage.
6
+
7
+ ## The Problem
8
+
9
+ Most AI agents suffer from:
10
+ - **Volatile memory** — Context resets lose history
11
+ - **Goal drift** — Long tasks lose focus
12
+ - **Hidden errors** — Failures aren't tracked
13
+
14
+ ## The Solution
15
+
16
+ For every complex task, create THREE files:
17
+ - `task_plan.md` (Phases & Progress)
18
+ - `findings.md` (Research & Notes)
19
+ - `progress.md` (Session Log)
20
+
21
+ ---
22
+
23
+ ## Installation
24
+
25
+ ### Pi Install
26
+
27
+ ```bash
28
+ pi install npm:pi-planning-with-files
29
+ ```
30
+
31
+ ### Manual Install
32
+
33
+ 1. Navigate to your project root.
34
+ 2. Create the `.pi/skills` directory if it doesn't exist.
35
+ 3. Copy the `planning-with-files` skill folder into `.pi/skills/`.
36
+
37
+ ---
38
+
39
+ ## Usage
40
+
41
+ Pi Agent automatically discovers skills in `.pi/skills` or installed via NPM.
42
+
43
+ ### Start Planning
44
+
45
+ Ask Pi:
46
+ ```
47
+ Use the planning-with-files skill to help me with this task.
48
+ ```
49
+ Or:
50
+ ```
51
+ Start by creating task_plan.md.
52
+ ```
53
+
54
+ ## Important Limitations
55
+
56
+ > **Note:** Hooks (PreToolUse, PostToolUse, Stop) are **Claude Code specific** and are not currently supported in Pi Agent.
57
+
58
+ ### What works in Pi Agent:
59
+ - Core 3-file planning pattern
60
+ - Templates (task_plan.md, findings.md, progress.md)
61
+ - All planning rules and guidelines
62
+ - The 2-Action Rule
63
+ - The 3-Strike Error Protocol
64
+ - Session Recovery (via `session-catchup.py`)
65
+
66
+ ### Session Recovery
67
+ If you clear context, recover your state:
68
+ ```bash
69
+ python3 .pi/skills/planning-with-files/scripts/session-catchup.py .
70
+ ```
71
+
72
+ ## File Structure
73
+
74
+ When installed, the skill provides templates to create:
75
+
76
+ ```
77
+ your-project/
78
+ ├── task_plan.md
79
+ ├── findings.md
80
+ ├── progress.md
81
+ ```
package/SKILL.md ADDED
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: planning-with-files
3
+ description: Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls
4
+ ---
5
+
6
+ # Planning with Files
7
+
8
+ Work like Manus: Use persistent markdown files as your "working memory on disk."
9
+
10
+ ## FIRST: Check for Previous Session
11
+
12
+ **Before starting work**, check for unsynced context from a previous session:
13
+
14
+ > **Note:** The `scripts/` directory is inside this skill's installation folder.
15
+
16
+ ```bash
17
+ # Linux/macOS
18
+ python scripts/session-catchup.py "$(pwd)"
19
+ ```
20
+
21
+ ```powershell
22
+ # Windows PowerShell
23
+ python scripts\session-catchup.py" (Get-Location)
24
+ ```
25
+
26
+ **If you cannot find the script:**
27
+ Ask Pi to locate it for you:
28
+ `Run the session-catchup.py script from the planning-with-files skill`
29
+
30
+ If catchup report shows unsynced context:
31
+ 1. Run `git diff --stat` to see actual code changes
32
+ 2. Read current planning files
33
+ 3. Update planning files based on catchup + git diff
34
+ 4. Then proceed with task
35
+
36
+ ## Important: Where Files Go
37
+
38
+ - **Templates** are in `templates/` inside this skill
39
+ - **Your planning files** go in **your project directory**
40
+
41
+ | Location | What Goes There |
42
+ |----------|-----------------|
43
+ | Skill directory | Templates, scripts, reference docs |
44
+ | Your project directory | `task_plan.md`, `findings.md`, `progress.md` |
45
+
46
+ ## Quick Start
47
+
48
+ Before ANY complex task:
49
+
50
+ 1. **Create `task_plan.md`** — Use [templates/task_plan.md](templates/task_plan.md) as reference
51
+ 2. **Create `findings.md`** — Use [templates/findings.md](templates/findings.md) as reference
52
+ 3. **Create `progress.md`** — Use [templates/progress.md](templates/progress.md) as reference
53
+ 4. **Re-read plan before decisions** — Refreshes goals in attention window
54
+ 5. **Update after each phase** — Mark complete, log errors
55
+
56
+ > **Note:** Planning files go in your project root, not the skill installation folder.
57
+
58
+ ## The Core Pattern
59
+
60
+ ```
61
+ Context Window = RAM (volatile, limited)
62
+ Filesystem = Disk (persistent, unlimited)
63
+
64
+ → Anything important gets written to disk.
65
+ ```
66
+
67
+ ## File Purposes
68
+
69
+ | File | Purpose | When to Update |
70
+ |------|---------|----------------|
71
+ | `task_plan.md` | Phases, progress, decisions | After each phase |
72
+ | `findings.md` | Research, discoveries | After ANY discovery |
73
+ | `progress.md` | Session log, test results | Throughout session |
74
+
75
+ ## Critical Rules
76
+
77
+ ### 1. Create Plan First
78
+ Never start a complex task without `task_plan.md`. Non-negotiable.
79
+
80
+ ### 2. The 2-Action Rule
81
+ > "After every 2 view/browser/search operations, IMMEDIATELY save key findings to text files."
82
+
83
+ This prevents visual/multimodal information from being lost.
84
+
85
+ ### 3. Read Before Decide
86
+ Before major decisions, read the plan file. This keeps goals in your attention window.
87
+
88
+ ### 4. Update After Act
89
+ After completing any phase:
90
+ - Mark phase status: `in_progress` → `complete`
91
+ - Log any errors encountered
92
+ - Note files created/modified
93
+
94
+ ### 5. Log ALL Errors
95
+ Every error goes in the plan file. This builds knowledge and prevents repetition.
96
+
97
+ ```markdown
98
+ ## Errors Encountered
99
+ | Error | Attempt | Resolution |
100
+ |-------|---------|------------|
101
+ | FileNotFoundError | 1 | Created default config |
102
+ | API timeout | 2 | Added retry logic |
103
+ ```
104
+
105
+ ### 6. Never Repeat Failures
106
+ ```
107
+ if action_failed:
108
+ next_action != same_action
109
+ ```
110
+ Track what you tried. Mutate the approach.
111
+
112
+ ## The 3-Strike Error Protocol
113
+
114
+ ```
115
+ ATTEMPT 1: Diagnose & Fix
116
+ → Read error carefully
117
+ → Identify root cause
118
+ → Apply targeted fix
119
+
120
+ ATTEMPT 2: Alternative Approach
121
+ → Same error? Try different method
122
+ → Different tool? Different library?
123
+ → NEVER repeat exact same failing action
124
+
125
+ ATTEMPT 3: Broader Rethink
126
+ → Question assumptions
127
+ → Search for solutions
128
+ → Consider updating the plan
129
+
130
+ AFTER 3 FAILURES: Escalate to User
131
+ → Explain what you tried
132
+ → Share the specific error
133
+ → Ask for guidance
134
+ ```
135
+
136
+ ## Read vs Write Decision Matrix
137
+
138
+ | Situation | Action | Reason |
139
+ |-----------|--------|--------|
140
+ | Just wrote a file | DON'T read | Content still in context |
141
+ | Viewed image/PDF | Write findings NOW | Multimodal → text before lost |
142
+ | Browser returned data | Write to file | Screenshots don't persist |
143
+ | Starting new phase | Read plan/findings | Re-orient if context stale |
144
+ | Error occurred | Read relevant file | Need current state to fix |
145
+ | Resuming after gap | Read all planning files | Recover state |
146
+
147
+ ## The 5-Question Reboot Test
148
+
149
+ If you can answer these, your context management is solid:
150
+
151
+ | Question | Answer Source |
152
+ |----------|---------------|
153
+ | Where am I? | Current phase in task_plan.md |
154
+ | Where am I going? | Remaining phases |
155
+ | What's the goal? | Goal statement in plan |
156
+ | What have I learned? | findings.md |
157
+ | What have I done? | progress.md |
158
+
159
+ ## When to Use This Pattern
160
+
161
+ **Use for:**
162
+ - Multi-step tasks (3+ steps)
163
+ - Research tasks
164
+ - Building/creating projects
165
+ - Tasks spanning many tool calls
166
+ - Anything requiring organization
167
+
168
+ **Skip for:**
169
+ - Simple questions
170
+ - Single-file edits
171
+ - Quick lookups
172
+
173
+ ## Templates
174
+
175
+ Copy these templates to start:
176
+
177
+ - [templates/task_plan.md](templates/task_plan.md) — Phase tracking
178
+ - [templates/findings.md](templates/findings.md) — Research storage
179
+ - [templates/progress.md](templates/progress.md) — Session logging
180
+
181
+ ## Scripts
182
+
183
+ Helper scripts for automation:
184
+
185
+ - `scripts/init-session.sh` — Initialize all planning files
186
+ - `scripts/check-complete.sh` — Verify all phases complete
187
+ - `scripts/session-catchup.py` — Recover context from previous session (v2.2.0)
188
+
189
+ ## Advanced Topics
190
+
191
+ - **Manus Principles:** See [reference.md](reference.md)
192
+ - **Real Examples:** See [examples.md](examples.md)
193
+
194
+ ## Anti-Patterns
195
+
196
+ | Don't | Do Instead |
197
+ |-------|------------|
198
+ | Use TodoWrite for persistence | Create task_plan.md file |
199
+ | State goals once and forget | Re-read plan before decisions |
200
+ | Hide errors and retry silently | Log errors to plan file |
201
+ | Stuff everything in context | Store large content in files |
202
+ | Start executing immediately | Create plan file FIRST |
203
+ | Repeat failed actions | Track attempts, mutate approach |
204
+ | Create files in skill directory | Create files in your project |
package/examples.md ADDED
@@ -0,0 +1,202 @@
1
+ # Examples: Planning with Files in Action
2
+
3
+ ## Example 1: Research Task
4
+
5
+ **User Request:** "Research the benefits of morning exercise and write a summary"
6
+
7
+ ### Loop 1: Create Plan
8
+ ```bash
9
+ Write task_plan.md
10
+ ```
11
+
12
+ ```markdown
13
+ # Task Plan: Morning Exercise Benefits Research
14
+
15
+ ## Goal
16
+ Create a research summary on the benefits of morning exercise.
17
+
18
+ ## Phases
19
+ - [ ] Phase 1: Create this plan ✓
20
+ - [ ] Phase 2: Search and gather sources
21
+ - [ ] Phase 3: Synthesize findings
22
+ - [ ] Phase 4: Deliver summary
23
+
24
+ ## Key Questions
25
+ 1. What are the physical health benefits?
26
+ 2. What are the mental health benefits?
27
+ 3. What scientific studies support this?
28
+
29
+ ## Status
30
+ **Currently in Phase 1** - Creating plan
31
+ ```
32
+
33
+ ### Loop 2: Research
34
+ ```bash
35
+ Read task_plan.md # Refresh goals
36
+ WebSearch "morning exercise benefits"
37
+ Write notes.md # Store findings
38
+ Edit task_plan.md # Mark Phase 2 complete
39
+ ```
40
+
41
+ ### Loop 3: Synthesize
42
+ ```bash
43
+ Read task_plan.md # Refresh goals
44
+ Read notes.md # Get findings
45
+ Write morning_exercise_summary.md
46
+ Edit task_plan.md # Mark Phase 3 complete
47
+ ```
48
+
49
+ ### Loop 4: Deliver
50
+ ```bash
51
+ Read task_plan.md # Verify complete
52
+ Deliver morning_exercise_summary.md
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Example 2: Bug Fix Task
58
+
59
+ **User Request:** "Fix the login bug in the authentication module"
60
+
61
+ ### task_plan.md
62
+ ```markdown
63
+ # Task Plan: Fix Login Bug
64
+
65
+ ## Goal
66
+ Identify and fix the bug preventing successful login.
67
+
68
+ ## Phases
69
+ - [x] Phase 1: Understand the bug report ✓
70
+ - [x] Phase 2: Locate relevant code ✓
71
+ - [ ] Phase 3: Identify root cause (CURRENT)
72
+ - [ ] Phase 4: Implement fix
73
+ - [ ] Phase 5: Test and verify
74
+
75
+ ## Key Questions
76
+ 1. What error message appears?
77
+ 2. Which file handles authentication?
78
+ 3. What changed recently?
79
+
80
+ ## Decisions Made
81
+ - Auth handler is in src/auth/login.ts
82
+ - Error occurs in validateToken() function
83
+
84
+ ## Errors Encountered
85
+ - [Initial] TypeError: Cannot read property 'token' of undefined
86
+ → Root cause: user object not awaited properly
87
+
88
+ ## Status
89
+ **Currently in Phase 3** - Found root cause, preparing fix
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Example 3: Feature Development
95
+
96
+ **User Request:** "Add a dark mode toggle to the settings page"
97
+
98
+ ### The 3-File Pattern in Action
99
+
100
+ **task_plan.md:**
101
+ ```markdown
102
+ # Task Plan: Dark Mode Toggle
103
+
104
+ ## Goal
105
+ Add functional dark mode toggle to settings.
106
+
107
+ ## Phases
108
+ - [x] Phase 1: Research existing theme system ✓
109
+ - [x] Phase 2: Design implementation approach ✓
110
+ - [ ] Phase 3: Implement toggle component (CURRENT)
111
+ - [ ] Phase 4: Add theme switching logic
112
+ - [ ] Phase 5: Test and polish
113
+
114
+ ## Decisions Made
115
+ - Using CSS custom properties for theme
116
+ - Storing preference in localStorage
117
+ - Toggle component in SettingsPage.tsx
118
+
119
+ ## Status
120
+ **Currently in Phase 3** - Building toggle component
121
+ ```
122
+
123
+ **notes.md:**
124
+ ```markdown
125
+ # Notes: Dark Mode Implementation
126
+
127
+ ## Existing Theme System
128
+ - Located in: src/styles/theme.ts
129
+ - Uses: CSS custom properties
130
+ - Current themes: light only
131
+
132
+ ## Files to Modify
133
+ 1. src/styles/theme.ts - Add dark theme colors
134
+ 2. src/components/SettingsPage.tsx - Add toggle
135
+ 3. src/hooks/useTheme.ts - Create new hook
136
+ 4. src/App.tsx - Wrap with ThemeProvider
137
+
138
+ ## Color Decisions
139
+ - Dark background: #1a1a2e
140
+ - Dark surface: #16213e
141
+ - Dark text: #eaeaea
142
+ ```
143
+
144
+ **dark_mode_implementation.md:** (deliverable)
145
+ ```markdown
146
+ # Dark Mode Implementation
147
+
148
+ ## Changes Made
149
+
150
+ ### 1. Added dark theme colors
151
+ File: src/styles/theme.ts
152
+ ...
153
+
154
+ ### 2. Created useTheme hook
155
+ File: src/hooks/useTheme.ts
156
+ ...
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Example 4: Error Recovery Pattern
162
+
163
+ When something fails, DON'T hide it:
164
+
165
+ ### Before (Wrong)
166
+ ```
167
+ Action: Read config.json
168
+ Error: File not found
169
+ Action: Read config.json # Silent retry
170
+ Action: Read config.json # Another retry
171
+ ```
172
+
173
+ ### After (Correct)
174
+ ```
175
+ Action: Read config.json
176
+ Error: File not found
177
+
178
+ # Update task_plan.md:
179
+ ## Errors Encountered
180
+ - config.json not found → Will create default config
181
+
182
+ Action: Write config.json (default config)
183
+ Action: Read config.json
184
+ Success!
185
+ ```
186
+
187
+ ---
188
+
189
+ ## The Read-Before-Decide Pattern
190
+
191
+ **Always read your plan before major decisions:**
192
+
193
+ ```
194
+ [Many tool calls have happened...]
195
+ [Context is getting long...]
196
+ [Original goal might be forgotten...]
197
+
198
+ → Read task_plan.md # This brings goals back into attention!
199
+ → Now make the decision # Goals are fresh in context
200
+ ```
201
+
202
+ This is why Manus can handle ~50 tool calls without losing track. The plan file acts as a "goal refresh" mechanism.
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "pi-planning-with-files",
3
+ "version": "1.0.0",
4
+ "description": "Manus-style file-based planning for Pi Coding Agent",
5
+ "keywords": [
6
+ "pi-package",
7
+ "planning",
8
+ "manus",
9
+ "agent",
10
+ "pi-skill"
11
+ ],
12
+ "pi": {
13
+ "skills": [
14
+ "."
15
+ ]
16
+ },
17
+ "files": [
18
+ "README.md",
19
+ "SKILL.md",
20
+ "examples.md",
21
+ "reference.md",
22
+ "scripts/",
23
+ "templates/"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/ttttmr/planning-with-files.git"
28
+ },
29
+ "author": "",
30
+ "license": "MIT",
31
+ "bugs": {
32
+ "url": "https://github.com/ttttmr/planning-with-files/issues"
33
+ },
34
+ "homepage": "https://github.com/ttttmr/planning-with-files#readme"
35
+ }