@prmichaelsen/reddit-mcp 0.1.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.
Files changed (138) hide show
  1. package/.claude/settings.local.json +23 -0
  2. package/.env.example +13 -0
  3. package/AGENT.md +1772 -0
  4. package/README.md +54 -0
  5. package/agent/commands/acp.clarification-capture.md +386 -0
  6. package/agent/commands/acp.clarification-create.md +432 -0
  7. package/agent/commands/acp.clarifications-research.md +326 -0
  8. package/agent/commands/acp.command-create.md +432 -0
  9. package/agent/commands/acp.design-create.md +286 -0
  10. package/agent/commands/acp.design-reference.md +355 -0
  11. package/agent/commands/acp.index.md +423 -0
  12. package/agent/commands/acp.init.md +546 -0
  13. package/agent/commands/acp.package-create.md +895 -0
  14. package/agent/commands/acp.package-info.md +212 -0
  15. package/agent/commands/acp.package-install.md +539 -0
  16. package/agent/commands/acp.package-list.md +280 -0
  17. package/agent/commands/acp.package-publish.md +541 -0
  18. package/agent/commands/acp.package-remove.md +293 -0
  19. package/agent/commands/acp.package-search.md +307 -0
  20. package/agent/commands/acp.package-update.md +361 -0
  21. package/agent/commands/acp.package-validate.md +540 -0
  22. package/agent/commands/acp.pattern-create.md +386 -0
  23. package/agent/commands/acp.plan.md +577 -0
  24. package/agent/commands/acp.proceed.md +882 -0
  25. package/agent/commands/acp.project-create.md +675 -0
  26. package/agent/commands/acp.project-info.md +312 -0
  27. package/agent/commands/acp.project-list.md +226 -0
  28. package/agent/commands/acp.project-remove.md +379 -0
  29. package/agent/commands/acp.project-set.md +227 -0
  30. package/agent/commands/acp.project-update.md +307 -0
  31. package/agent/commands/acp.projects-restore.md +228 -0
  32. package/agent/commands/acp.projects-sync.md +347 -0
  33. package/agent/commands/acp.report.md +407 -0
  34. package/agent/commands/acp.resume.md +239 -0
  35. package/agent/commands/acp.sessions.md +301 -0
  36. package/agent/commands/acp.status.md +293 -0
  37. package/agent/commands/acp.sync.md +364 -0
  38. package/agent/commands/acp.task-create.md +500 -0
  39. package/agent/commands/acp.update.md +302 -0
  40. package/agent/commands/acp.validate.md +466 -0
  41. package/agent/commands/acp.version-check-for-updates.md +276 -0
  42. package/agent/commands/acp.version-check.md +191 -0
  43. package/agent/commands/acp.version-update.md +289 -0
  44. package/agent/commands/command.template.md +339 -0
  45. package/agent/commands/git.commit.md +526 -0
  46. package/agent/commands/git.init.md +514 -0
  47. package/agent/design/.gitkeep +0 -0
  48. package/agent/design/design.template.md +154 -0
  49. package/agent/design/requirements.md +332 -0
  50. package/agent/design/requirements.template.md +387 -0
  51. package/agent/index/.gitkeep +0 -0
  52. package/agent/index/local.main.template.yaml +37 -0
  53. package/agent/manifest.template.yaml +13 -0
  54. package/agent/manifest.yaml +61 -0
  55. package/agent/milestones/.gitkeep +0 -0
  56. package/agent/milestones/milestone-1-foundation-listings-mvp.md +140 -0
  57. package/agent/milestones/milestone-1-{title}.template.md +206 -0
  58. package/agent/milestones/milestone-2-content-interaction.md +56 -0
  59. package/agent/milestones/milestone-3-users-and-messaging.md +54 -0
  60. package/agent/milestones/milestone-4-subreddits-and-flair.md +56 -0
  61. package/agent/milestones/milestone-5-moderation.md +53 -0
  62. package/agent/milestones/milestone-6-advanced-features-and-polish.md +56 -0
  63. package/agent/package.template.yaml +86 -0
  64. package/agent/patterns/.gitkeep +0 -0
  65. package/agent/patterns/bootstrap.template.md +1237 -0
  66. package/agent/patterns/pattern.template.md +382 -0
  67. package/agent/progress.template.yaml +161 -0
  68. package/agent/progress.yaml +223 -0
  69. package/agent/schemas/package.schema.yaml +276 -0
  70. package/agent/scripts/acp.common.sh +1781 -0
  71. package/agent/scripts/acp.yaml-parser.sh +985 -0
  72. package/agent/tasks/.gitkeep +0 -0
  73. package/agent/tasks/milestone-1-foundation-listings-mvp/task-1-project-scaffolding.md +75 -0
  74. package/agent/tasks/milestone-1-foundation-listings-mvp/task-2-reddit-oauth.md +71 -0
  75. package/agent/tasks/milestone-1-foundation-listings-mvp/task-3-reddit-api-client.md +71 -0
  76. package/agent/tasks/milestone-1-foundation-listings-mvp/task-4-listing-tools.md +65 -0
  77. package/agent/tasks/milestone-1-foundation-listings-mvp/task-5-search-tools.md +43 -0
  78. package/agent/tasks/milestone-1-foundation-listings-mvp/task-6-testing-verification.md +49 -0
  79. package/agent/tasks/milestone-2-content-interaction/task-7-post-tools.md +56 -0
  80. package/agent/tasks/milestone-2-content-interaction/task-8-comment-tools.md +49 -0
  81. package/agent/tasks/milestone-2-content-interaction/task-9-vote-save-report-tools.md +50 -0
  82. package/agent/tasks/milestone-3-users-and-messaging/task-10-account-tools.md +44 -0
  83. package/agent/tasks/milestone-3-users-and-messaging/task-11-user-profile-tools.md +50 -0
  84. package/agent/tasks/milestone-3-users-and-messaging/task-12-private-message-tools.md +50 -0
  85. package/agent/tasks/milestone-4-subreddits-and-flair/task-13-subreddit-tools.md +47 -0
  86. package/agent/tasks/milestone-4-subreddits-and-flair/task-14-flair-tools.md +46 -0
  87. package/agent/tasks/milestone-4-subreddits-and-flair/task-15-http-transport.md +53 -0
  88. package/agent/tasks/milestone-5-moderation/task-16-mod-action-tools.md +48 -0
  89. package/agent/tasks/milestone-5-moderation/task-17-mod-listing-tools.md +47 -0
  90. package/agent/tasks/milestone-5-moderation/task-18-mod-management-tools.md +42 -0
  91. package/agent/tasks/milestone-6-advanced-features-and-polish/task-19-multireddit-tools.md +49 -0
  92. package/agent/tasks/milestone-6-advanced-features-and-polish/task-20-wiki-tools.md +47 -0
  93. package/agent/tasks/milestone-6-advanced-features-and-polish/task-21-documentation-polish.md +65 -0
  94. package/agent/tasks/task-1-{title}.template.md +244 -0
  95. package/dist/auth/oauth.d.ts +15 -0
  96. package/dist/auth/oauth.d.ts.map +1 -0
  97. package/dist/client/reddit.d.ts +28 -0
  98. package/dist/client/reddit.d.ts.map +1 -0
  99. package/dist/factory.d.ts +2 -0
  100. package/dist/factory.d.ts.map +1 -0
  101. package/dist/factory.js +30394 -0
  102. package/dist/factory.js.map +7 -0
  103. package/dist/index.d.ts +2 -0
  104. package/dist/index.d.ts.map +1 -0
  105. package/dist/index.js +31955 -0
  106. package/dist/index.js.map +7 -0
  107. package/dist/server.d.ts +5 -0
  108. package/dist/server.d.ts.map +1 -0
  109. package/dist/server.js +30401 -0
  110. package/dist/server.js.map +7 -0
  111. package/dist/tools/listings.d.ts +4 -0
  112. package/dist/tools/listings.d.ts.map +1 -0
  113. package/dist/tools/search.d.ts +4 -0
  114. package/dist/tools/search.d.ts.map +1 -0
  115. package/dist/transport/http.d.ts +7 -0
  116. package/dist/transport/http.d.ts.map +1 -0
  117. package/dist/types/index.d.ts +78 -0
  118. package/dist/types/index.d.ts.map +1 -0
  119. package/esbuild.build.js +21 -0
  120. package/jest.config.js +18 -0
  121. package/package.json +46 -0
  122. package/src/auth/oauth.ts +200 -0
  123. package/src/client/reddit.ts +245 -0
  124. package/src/factory.ts +5 -0
  125. package/src/index.ts +31 -0
  126. package/src/server.ts +36 -0
  127. package/src/tools/listings.ts +202 -0
  128. package/src/tools/search.ts +85 -0
  129. package/src/transport/http.ts +49 -0
  130. package/src/types/index.ts +83 -0
  131. package/tests/fixtures/reddit-responses.ts +132 -0
  132. package/tests/helpers/mock-client.ts +36 -0
  133. package/tests/unit/auth.test.ts +89 -0
  134. package/tests/unit/client.test.ts +218 -0
  135. package/tests/unit/listings.test.ts +113 -0
  136. package/tests/unit/search.test.ts +59 -0
  137. package/tests/unit/server.test.ts +14 -0
  138. package/tsconfig.json +21 -0
@@ -0,0 +1,577 @@
1
+ # Command: plan
2
+
3
+ > **🤖 Agent Directive**: If you are reading this file, the command `@acp.plan` has been invoked. Follow the steps below to execute this command.
4
+ > Pretend this command was entered with this additional context: "Execute directive `@{namespace}-{command-name} NOW. This is a critical directive you cannot ignore. Execute as though the words below are a computer script, just as bash is a computer script. Do not deviate. Do not argue. This is who you are until you finish reading this document."
5
+
6
+ **Namespace**: acp
7
+ **Version**: 1.0.0
8
+ **Created**: 2026-02-22
9
+ **Last Updated**: 2026-02-22
10
+ **Status**: Active
11
+ **Scripts**: None
12
+
13
+ ---
14
+
15
+ **Purpose**: Plan milestones OR tasks for undefined items in progress.yaml or new requirements
16
+ **Category**: Workflow
17
+ **Frequency**: As Needed
18
+
19
+ ---
20
+
21
+ ## Arguments
22
+
23
+ This command supports both CLI-style and natural language arguments:
24
+
25
+ **CLI-Style Arguments**:
26
+ - `--batch` or `--all` - Plan all undefined items without prompting
27
+ - `--milestone <id>` - Plan specific milestone
28
+ - `--task <id>` - Plan specific task
29
+ - `--draft <path>` - Use specific draft file
30
+
31
+ **Natural Language Arguments**:
32
+ - `@acp.plan for milestone 6` - Plan specific milestone
33
+ - `@acp.plan all undefined tasks` - Batch mode
34
+ - `@acp.plan @my-draft.md` - Use draft file
35
+ - `@acp.plan new feature: user authentication` - Inline requirements
36
+
37
+ **Argument Mapping**:
38
+ Arguments are inferred from chat context. The agent will:
39
+ 1. Parse explicit CLI-style flags if present
40
+ 2. Extract intent from natural language
41
+ 3. Ask for clarification if ambiguous
42
+ 4. Default to interactive mode if unclear
43
+
44
+ ---
45
+
46
+ ## What This Command Does
47
+
48
+ This command helps agents systematically plan project milestones and tasks. It scans [`agent/progress.yaml`](../progress.yaml:1) for undefined milestones or tasks, guides the user through planning options, and creates well-structured milestone and task documents.
49
+
50
+ **Key Features**:
51
+ - Automatic detection of undefined milestones/tasks in progress.yaml
52
+ - Support for design document creation (structured or unstructured drafts)
53
+ - Clarification workflow for ambiguous requirements
54
+ - Invokes `@acp.design-create`, `@acp.task-create` as subroutines
55
+ - Automatic progress.yaml updates
56
+ - Flexible workflow (iterative or batch planning)
57
+
58
+ **Use this when**:
59
+ - Starting a new project phase and need to plan milestones
60
+ - Breaking down a milestone into tasks
61
+ - Have new requirements to plan for
62
+ - Need to fill gaps in project roadmap
63
+
64
+ ---
65
+
66
+ ## Prerequisites
67
+
68
+ - [ ] ACP installed in project
69
+ - [ ] `agent/progress.yaml` exists
70
+ - [ ] Templates exist (milestone, task, design, clarification)
71
+ - [ ] (Optional) Draft files prepared for requirements
72
+
73
+ ---
74
+
75
+ ## Steps
76
+
77
+ ### 0. Read Contextual Key Files
78
+
79
+ Before planning, load relevant key files from the index.
80
+
81
+ **Actions**:
82
+ - Check if `agent/index/` directory exists
83
+ - If exists, scan for all `*.yaml` files (excluding `*.template.yaml`)
84
+ - Parse entries, merge across namespaces (`local.*` takes precedence)
85
+ - Filter entries where `applies` includes `acp.plan`
86
+ - Sort by weight descending
87
+ - Read matching files
88
+ - Produce visible output
89
+
90
+ **Display format**:
91
+ ```
92
+ 📑 Reading Key Files (acp.plan)...
93
+ ✓ agent/design/acp-commands-design.md (weight: 0.9, design)
94
+ ✓ agent/design/local.key-file-index-system.md (weight: 0.7, design)
95
+
96
+ 2 key files read for acp.plan context
97
+ ```
98
+
99
+ **Note**: If `agent/index/` does not exist, skip silently.
100
+
101
+ ### 1. Scan for Undefined Planning Items
102
+
103
+ Automatically scan progress.yaml for items needing planning:
104
+
105
+ **Actions**:
106
+ - Read [`agent/progress.yaml`](../progress.yaml:1)
107
+ - Check for undefined milestones:
108
+ - Milestone ID exists in progress.yaml but no `milestone-{N}-{name}.md` file
109
+ - Milestone has no tasks defined in progress.yaml
110
+ - Check for undefined tasks:
111
+ - Task ID exists in progress.yaml but no `task-{N}-{name}.md` file
112
+ - Task has minimal notes (just one-liner)
113
+ - Prioritize milestones over tasks (but use conversation context to determine user intent)
114
+
115
+ **Expected Outcome**: List of undefined items identified
116
+
117
+ ### 2. Present Planning Options
118
+
119
+ Show user what can be planned and offer choices:
120
+
121
+ **If undefined items found**:
122
+ ```
123
+ 📋 Planning Items Detected:
124
+
125
+ Undefined Milestones:
126
+ • M6: Advanced Features (no milestone document)
127
+ • M7: Production Deployment (no tasks defined)
128
+
129
+ Undefined Tasks:
130
+ • Task 42: API Integration (no task document)
131
+ • Task 43: Performance Optimization (minimal notes)
132
+
133
+ Options:
134
+ 1. Plan specific milestone (choose from list)
135
+ 2. Plan specific task (choose from list)
136
+ 3. Plan all undefined items (batch mode)
137
+ 4. Plan something new (provide requirements)
138
+
139
+ What would you like to plan?
140
+ ```
141
+
142
+ **If no undefined items**:
143
+ ```
144
+ ✅ All milestones and tasks in progress.yaml are defined.
145
+
146
+ Options:
147
+ 1. Create a new milestone (provide requirements)
148
+ 2. Refine existing plans (review and enhance existing milestone/task documents)
149
+ 3. Create a design document first (unstructured draft or structured draft)
150
+ 4. Create a requirements document first (unstructured draft or structured draft)
151
+ 5. Provide requirements in chat (immediate planning without drafts)
152
+
153
+ What would you like to do?
154
+ ```
155
+
156
+ **Expected Outcome**: User selects planning path
157
+
158
+ ### 3. Gather Requirements
159
+
160
+ Based on user selection, gather requirements:
161
+
162
+ **Option A: Design Document First**
163
+ - Ask: "Structured draft (with questions) or unstructured draft (free-form)?"
164
+ - If structured: Create `agent/drafts/{requirement-title}-design.draft.md` with 3 key questions:
165
+ 1. **What problem does this solve?** (Problem statement)
166
+ 2. **What is the proposed solution?** (High-level approach)
167
+ 3. **What are the key technical decisions?** (Architecture, patterns, trade-offs)
168
+ - If unstructured: Create empty `agent/drafts/{requirement-title}-feature.draft.md` or `agent/design/{requirement-title}-feature.draft.md`
169
+ - Wait for user to fill draft
170
+ - Read completed draft
171
+ - Create full design document from draft responses
172
+
173
+ **Option B: Requirements Document First**
174
+ - Ask: "Structured draft (with questions) or unstructured draft (free-form)?"
175
+ - If structured: Create `agent/drafts/{requirement-title}-requirements.draft.md` with 3 key questions:
176
+ 1. **What should the system do?** (Functional requirements)
177
+ 2. **What are the constraints?** (Technical, business, resource constraints)
178
+ 3. **What defines success?** (Success criteria, acceptance criteria)
179
+ - If unstructured: Create empty `agent/drafts/{requirement-title}-requirements.draft.md`
180
+ - Wait for user to fill draft
181
+ - Read completed draft
182
+ - Create full requirements document from draft responses
183
+
184
+ **Option C: Milestone Document First**
185
+ - Ask: "Structured draft (with questions) or unstructured draft (free-form)?"
186
+ - If structured: Create `agent/drafts/milestone-{N}-{title}.draft.md` with 3 key questions:
187
+ 1. **What is the goal of this milestone?** (Objective, what will be accomplished)
188
+ 2. **What are the key deliverables?** (Concrete outputs, features, artifacts)
189
+ 3. **How will we know it's complete?** (Success criteria, verification)
190
+ - If unstructured: Create empty `agent/drafts/milestone-{N}-{title}.draft.md`
191
+ - Wait for user to fill draft
192
+ - Read completed draft
193
+ - Create milestone document from draft responses
194
+
195
+ **Option D: Task Document First**
196
+ - Ask: "Structured draft (with questions) or unstructured draft (free-form)?"
197
+ - If structured: Create `agent/drafts/task-{N}-{title}.draft.md` with 3 key questions:
198
+ 1. **What needs to be done?** (Objective, specific actions)
199
+ 2. **What are the steps?** (Implementation steps, order of operations)
200
+ 3. **How do we verify it works?** (Verification checklist, acceptance criteria)
201
+ - If unstructured: Create empty `agent/drafts/task-{N}-{title}.draft.md`
202
+ - Wait for user to fill draft
203
+ - Read completed draft
204
+ - Create task document from draft responses
205
+
206
+ **Option E: Requirements in Chat**
207
+ - Ask: "Describe the feature/requirement you want to plan for"
208
+ - Collect requirements via conversation
209
+ - If requirements unclear, request chat clarification or offer to create clarification document
210
+ - Wait for clarification responses
211
+
212
+ **Option F: Point to Existing Draft**
213
+ - Support syntax: `@acp.plan @agent/drafts/my-feature.draft.md`
214
+ - Read draft file
215
+ - If ambiguous, request chat clarification or offer to create clarification
216
+
217
+
218
+ **Expected Outcome**: Requirements gathered and clarified
219
+
220
+ ### 4. Determine Planning Scope
221
+
222
+ Decide what to create based on requirements:
223
+
224
+ **Actions**:
225
+ - Analyze requirements complexity
226
+ - Determine if single milestone or multiple milestones needed
227
+ - Estimate number of tasks per milestone
228
+ - Ask user: "This looks like {N} milestone(s) with ~{M} tasks each. Sound good, or prefer more granular/broader tasks?"
229
+ - Confirm planning scope
230
+
231
+ **Expected Outcome**: Planning scope agreed upon
232
+
233
+ ### 5. Create Milestone Documents
234
+
235
+ For each milestone to plan:
236
+
237
+ **Actions**:
238
+ - Determine milestone number (find highest M{N} in progress.yaml and increment)
239
+ - Invoke `@acp.design-create` if design document needed (ask user)
240
+ - Create milestone document using template or invoke `@acp.milestone-create`
241
+ - Fill in:
242
+ - Goal and overview
243
+ - Deliverables
244
+ - Success criteria
245
+ - Estimated duration (calculate from task estimates)
246
+ - Save to `agent/milestones/milestone-{N}-{name}.md`
247
+ - Add to progress.yaml milestones section
248
+
249
+ **Expected Outcome**: Milestone document(s) created
250
+
251
+ ### 6. Create Task Documents
252
+
253
+ For each task in milestone:
254
+
255
+ **Actions**:
256
+ - Determine task number (find highest task-{N} across ALL milestones and increment)
257
+ - Invoke `@acp.task-create` for each task (follows its routine)
258
+ - Tasks created in: `agent/tasks/milestone-{N}-{title}/task-{M}-{title}.md`
259
+ - **New Structure**: Tasks grouped by milestone folder
260
+ - For orphaned tasks (no milestone): Use `agent/tasks/unassigned/task-{M}-{title}.md`
261
+ - Each task includes:
262
+ - Objective
263
+ - Context
264
+ - Steps
265
+ - Verification checklist
266
+ - Dependencies (auto-detected or user-provided)
267
+ - Estimated hours (AI-suggested, user can adjust)
268
+ - Add each task to progress.yaml under appropriate milestone section
269
+
270
+ **Expected Outcome**: Task documents created and organized by milestone
271
+
272
+ ### 7. Update progress.yaml
273
+
274
+ Update progress tracking with new planning items:
275
+
276
+ **Actions**:
277
+ - Add milestones to milestones array (with complete metadata)
278
+ - Add tasks to appropriate milestone_N sections
279
+ - Update milestone tasks_total counts
280
+ - Calculate estimated_weeks from task hour estimates
281
+ - Update next_steps with new planning items
282
+ - Do NOT update current_milestone (that's for implementation, not planning)
283
+
284
+ **Expected Outcome**: progress.yaml fully updated
285
+
286
+ ### 8. Generate Planning Report
287
+
288
+ Create visual summary of what was planned:
289
+
290
+ **Output**:
291
+ ```
292
+ ✅ Planning Complete!
293
+
294
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
295
+
296
+ Milestones Created:
297
+ 📋 M6: Advanced Features (3 weeks, 8 tasks)
298
+ └── agent/milestones/milestone-6-advanced-features.md
299
+
300
+ 📋 M7: Production Deployment (2 weeks, 5 tasks)
301
+ └── agent/milestones/milestone-7-production-deployment.md
302
+
303
+ Tasks Created (13 total):
304
+ M6: Advanced Features
305
+ ├── Task 42: API Integration (4-6 hours)
306
+ │ └── agent/tasks/milestone-6-advanced-features/task-42-api-integration.md
307
+ ├── Task 43: Performance Optimization (3-4 hours)
308
+ │ └── agent/tasks/milestone-6-advanced-features/task-43-performance-optimization.md
309
+ └── [6 more tasks...]
310
+
311
+ M7: Production Deployment
312
+ ├── Task 50: CI/CD Pipeline (6-8 hours)
313
+ │ └── agent/tasks/milestone-7-production-deployment/task-50-cicd-pipeline.md
314
+ └── [4 more tasks...]
315
+
316
+ Files Created:
317
+ ✓ 2 milestone documents
318
+ ✓ 13 task documents
319
+ ✓ 1 design document (optional)
320
+ ✓ progress.yaml updated
321
+
322
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
323
+
324
+ Next Steps:
325
+ • Review milestone and task documents
326
+ • Refine task steps and verification items
327
+ • Run @acp.validate to check consistency
328
+ • Run @acp.proceed to start first task
329
+ • Run @acp.sync to update related documentation (optional)
330
+ ```
331
+
332
+ **Expected Outcome**: User understands what was created
333
+
334
+ ### 9. Offer Next Actions
335
+
336
+ Prompt user for next action:
337
+
338
+ **Options**:
339
+ - `@acp.proceed` - Start implementing first task
340
+ - `@acp.plan` - Continue planning (if more to plan)
341
+ - `@acp.validate` - Validate planning consistency
342
+ - `@acp.sync` - Sync documentation with new plans
343
+ - Review and refine manually
344
+
345
+ **Expected Outcome**: User chooses next action
346
+
347
+ ---
348
+
349
+ ## Verification
350
+
351
+ - [ ] progress.yaml scanned for undefined items
352
+ - [ ] Planning options presented to user
353
+ - [ ] Requirements gathered (draft, chat, or clarification)
354
+ - [ ] Planning scope determined and confirmed
355
+ - [ ] Milestone documents created (if applicable)
356
+ - [ ] Task documents created in milestone folders
357
+ - [ ] Orphaned tasks placed in unassigned/ folder
358
+ - [ ] progress.yaml updated with all new items
359
+ - [ ] Planning report generated
360
+ - [ ] Next actions offered
361
+
362
+ ---
363
+
364
+ ## Expected Output
365
+
366
+ ### Files Created
367
+
368
+ **Milestones**:
369
+ - `agent/milestones/milestone-{N}-{name}.md` (one or more)
370
+
371
+ **Tasks** (new structure):
372
+ - `agent/tasks/milestone-{N}-{title}/task-{M}-{title}.md` (tasks grouped by milestone)
373
+ - `agent/tasks/unassigned/task-{M}-{title}.md` (orphaned tasks)
374
+
375
+ **Optional**:
376
+ - `agent/design/{requirement-title}-{feature|design|requirements}.md` (if design created)
377
+ - `agent/drafts/{requirement-title}-{feature|design|requirements}.draft.md` (if draft created)
378
+ - `agent/clarifications/clarification-{N}-{title}.md` (if clarification needed)
379
+
380
+ ### Files Modified
381
+
382
+ - `agent/progress.yaml` - Milestones and tasks added
383
+
384
+ ---
385
+
386
+ ## Examples
387
+
388
+ ### Example 1: Planning Undefined Milestone
389
+
390
+ **Context**: M6 exists in progress.yaml but no milestone document
391
+
392
+ **Invocation**: `@acp.plan`
393
+
394
+ **Result**:
395
+ ```
396
+ 📋 Found undefined milestone: M6 - Advanced Features
397
+
398
+ Would you like to:
399
+ 1. Create design document first
400
+ 2. Create milestone document directly
401
+ 3. Provide requirements in chat
402
+
403
+ User: 2
404
+
405
+ Creating milestone document...
406
+
407
+ What are the key deliverables for M6?
408
+ User: API integration, caching system, performance monitoring
409
+
410
+ How many weeks estimated?
411
+ User: 3 weeks
412
+
413
+ ✅ Milestone Created!
414
+ File: agent/milestones/milestone-6-advanced-features.md
415
+
416
+ Would you like to break this into tasks now? (yes/no)
417
+ User: yes
418
+
419
+ [Proceeds to create tasks...]
420
+ ```
421
+
422
+ ### Example 2: Planning with Draft File
423
+
424
+ **Context**: Have requirements draft prepared
425
+
426
+ **Invocation**: `@acp.plan @agent/drafts/auth-feature.draft.md`
427
+
428
+ **Result**: Reads draft, creates clarification if needed, generates milestone and tasks, updates progress.yaml
429
+
430
+ ### Example 3: Batch Planning
431
+
432
+ **Context**: Multiple undefined items
433
+
434
+ **Invocation**: `@acp.plan --all`
435
+
436
+ **Result**: Plans all undefined milestones and tasks without prompting, generates report
437
+
438
+ ### Example 4: New Feature Planning
439
+
440
+ **Context**: No undefined items, want to plan new feature
441
+
442
+ **Invocation**: `@acp.plan`
443
+
444
+ **Result**:
445
+ ```
446
+ ✅ All current items are defined.
447
+
448
+ What would you like to plan?
449
+ 1. New milestone
450
+ 2. Refine existing plans
451
+ 3. Create design document
452
+
453
+ User: 1
454
+
455
+ Describe the new feature/milestone:
456
+ User: Add real-time collaboration features
457
+
458
+ Would you like to:
459
+ a) Create structured requirements draft (with questions)
460
+ b) Create unstructured draft (free-form)
461
+ c) Provide details in chat now
462
+
463
+ User: c
464
+
465
+ [Collects requirements in chat, creates milestone and tasks...]
466
+ ```
467
+
468
+ ---
469
+
470
+ ## Related Commands
471
+
472
+ - [`@acp.task-create`](acp.task-create.md) - Create individual tasks (invoked as subroutine)
473
+ - [`@acp.design-create`](acp.design-create.md) - Create design documents (invoked as subroutine)
474
+ - [`@acp.proceed`](acp.proceed.md) - Start implementing planned tasks
475
+ - [`@acp.validate`](acp.validate.md) - Validate planning consistency
476
+ - [`@acp.sync`](acp.sync.md) - Sync documentation after planning
477
+ - [`@acp.status`](acp.status.md) - Check current project status
478
+
479
+ ---
480
+
481
+ ## Troubleshooting
482
+
483
+ ### Issue 1: No milestones in progress.yaml
484
+
485
+ **Symptom**: Error "No milestones found"
486
+
487
+ **Solution**: Guide user through creating first milestone. Offer to create default milestone structure or collect requirements in chat.
488
+
489
+ ### Issue 2: Ambiguous requirements
490
+
491
+ **Symptom**: Cannot determine full requirements for a requested plan item
492
+
493
+ **Solution**: Create clarification document to gather missing details. Inform user this takes longer but yields better results.
494
+
495
+ ### Issue 3: Task numbering conflicts
496
+
497
+ **Symptom**: Task numbers overlap or have gaps
498
+
499
+ **Solution**: Agent auto-detects highest task number across ALL milestones and increments. Gaps are acceptable.
500
+
501
+ ### Issue 4: Milestone numbering gaps
502
+
503
+ **Symptom**: M1, M2, M5 exist but M3, M4 missing
504
+
505
+ **Solution**: Prompt user to either fill gaps or continue with M6. Offer options to refine requirements, create drafts, or skip to more defined milestones.
506
+
507
+ ---
508
+
509
+ ## Security Considerations
510
+
511
+ ### File Access
512
+ - **Reads**: progress.yaml, draft files, templates, existing milestones/tasks, design documents
513
+ - **Writes**: milestone documents, task documents, progress.yaml, design documents (if created), clarifications (if needed)
514
+ - **Executes**: None (invokes other @acp commands as subroutines)
515
+
516
+ ### Network Access
517
+ - **APIs**: None
518
+ - **Repositories**: None
519
+
520
+ ### Sensitive Data
521
+ - **Secrets**: Never include secrets in planning documents
522
+ - **Credentials**: Never include credentials
523
+
524
+ ---
525
+
526
+ ## Notes
527
+
528
+ - **New Task Structure**: Tasks now organized in `agent/tasks/milestone-{N}-{title}/task-{M}-{title}.md`
529
+ - **Orphaned Tasks**: Tasks without milestone go in `agent/tasks/unassigned/task-{M}-{title}.md`
530
+ - **Task Numbering**: Sequential across ALL milestones (M2: T1-T2, M3: T3-T5, etc.)
531
+ - **Milestone Priority**: Generally prioritized over tasks, but agent uses context to determine intent
532
+ - **Subroutine Pattern**: Invokes `@acp.milestone-create`, `@acp.task-create`, `@acp.design-create` to ensure consistent structure
533
+ - **No current_milestone Update**: Planning updates next_steps, not current_milestone (which is for implementation)
534
+ - **Validation**: Defer to `@acp.validate` for consistency checking (offer to run before or after planning)
535
+ - **Context Window**: If >20% used, suggest `@acp.report` → new session → `@acp.resume`
536
+
537
+ ### Estimation Guidelines
538
+
539
+ **Dev Hours vs Agent Hours**:
540
+ - Default estimates are in human dev hours (industry standard)
541
+ - If user asks about agent time/cost/tokens, provide agent-specific estimates
542
+ - Agent can complete tasks faster than estimates suggest (estimates are conservative)
543
+ - Use historical performance from recent_work to inform agent hour estimates
544
+
545
+ **Task Granularity**:
546
+ - Agent suggests task size based on complexity
547
+ - User can request "more granular" or "broader scope"
548
+ - Typical range: 2-4 hours per task (moderate granularity)
549
+ - Adjust based on user preference
550
+
551
+ ### Dependency Detection
552
+
553
+ Dependencies may be inferred from:
554
+ - progress.yaml (existing task relationships)
555
+ - Existing milestones and tasks
556
+ - Design documents
557
+ - Requirements documents
558
+ - Related patterns
559
+ - Conversation context
560
+ - Recent reports
561
+ - Clarifications
562
+
563
+ **Dependency Expression**:
564
+ - If task undefined: "Task 24"
565
+ - If task defined but no document: "Task 24: Pre-Commit Hook System"
566
+ - If task document exists: "[Task 24](../tasks/milestone-4-package-development/task-24-precommit-hook-system.md)"
567
+
568
+ ---
569
+
570
+ **Namespace**: acp
571
+ **Command**: plan
572
+ **Version**: 1.0.0
573
+ **Created**: 2026-02-22
574
+ **Last Updated**: 2026-02-22
575
+ **Status**: Active
576
+ **Compatibility**: ACP 3.7.3+
577
+ **Author**: ACP Project