agent-planner-mcp 0.2.0 → 0.3.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.
@@ -0,0 +1,335 @@
1
+ # Autonomous Plan Execution Guide
2
+
3
+ This directory is configured for autonomous plan execution using Claude Code with the MCP planning system.
4
+
5
+ ## System Architecture
6
+
7
+ ```
8
+ ┌─────────────────────────────────────────────────────────────┐
9
+ │ Claude Code │
10
+ │ ┌────────────────┐ ┌────────────────┐ ┌───────────────┐ │
11
+ │ │ Slash Commands │→│ Task Tool │→│ MCP Planning │ │
12
+ │ │ (Orchestrator) │ │ (Executors) │ │ System (Data) │ │
13
+ │ └────────────────┘ └────────────────┘ └───────────────┘ │
14
+ └─────────────────────────────────────────────────────────────┘
15
+ ↓ ↓ ↓
16
+ /execute-plan general-purpose Persistent Storage
17
+ /create-plan agents (plans, tasks, logs)
18
+ /plan-status
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ### 1. Create a Plan
24
+
25
+ ```bash
26
+ # In Claude Code CLI, run:
27
+ /create-plan
28
+ ```
29
+
30
+ This interactive command will guide you through:
31
+ - Defining your plan title and description
32
+ - Breaking it into phases
33
+ - Creating specific tasks with acceptance criteria
34
+ - Adding agent instructions for autonomous execution
35
+
36
+ ### 2. Execute the Plan
37
+
38
+ ```bash
39
+ # Start autonomous execution:
40
+ /execute-plan <plan-id>
41
+ ```
42
+
43
+ Claude will:
44
+ - Load the plan from MCP
45
+ - Work through tasks one by one
46
+ - Launch specialized Task agents for each task
47
+ - Update status in real-time
48
+ - Log all progress
49
+ - Report completion or blockers
50
+
51
+ ### 3. Monitor Progress
52
+
53
+ ```bash
54
+ # Check status anytime:
55
+ /plan-status <plan-id>
56
+ ```
57
+
58
+ Shows:
59
+ - Overall progress (% complete)
60
+ - Current task being worked on
61
+ - Any blockers
62
+ - Recent activity
63
+ - Next suggested actions
64
+
65
+ ## Available Commands
66
+
67
+ ### `/create-plan`
68
+ Interactive plan builder that helps you structure work into phases and tasks.
69
+
70
+ **When to use**: Starting a new feature, bug fix, refactoring, or any multi-step work.
71
+
72
+ **Output**: A complete plan with hierarchical structure stored in MCP.
73
+
74
+ ### `/execute-plan <plan-id>`
75
+ Autonomous execution orchestrator that works through tasks systematically.
76
+
77
+ **When to use**: After creating a plan, or to resume interrupted execution.
78
+
79
+ **What it does**:
80
+ - Fetches tasks from the plan
81
+ - Executes them one by one using Task agents
82
+ - Updates MCP with progress
83
+ - Handles errors and blockers
84
+ - Reports final summary
85
+
86
+ ### `/plan-status <plan-id>`
87
+ Real-time status reporter showing plan progress and activity.
88
+
89
+ **When to use**: Check progress during execution, review completed work, identify blockers.
90
+
91
+ **Output**: Formatted report with statistics, task breakdown, and recent activity.
92
+
93
+ ## How Autonomous Execution Works
94
+
95
+ ### The Execution Loop
96
+
97
+ 1. **Fetch Plan**: Load plan structure from MCP
98
+ 2. **Find Next Task**: Get first task with status "not_started"
99
+ 3. **Get Context**: Load task details, acceptance criteria, agent instructions
100
+ 4. **Update Status**: Mark task as "in_progress" in MCP
101
+ 5. **Execute**: Launch Task agent with full context
102
+ 6. **Wait**: Agent works autonomously (reads code, makes changes, runs tests)
103
+ 7. **Process Result**:
104
+ - If successful → Mark "completed", log progress, move to next task
105
+ - If blocked → Mark "blocked", log issue, ask user for guidance
106
+ 8. **Repeat**: Continue until all tasks done or blocked
107
+
108
+ ### Task Agent Execution
109
+
110
+ Each task gets a dedicated `general-purpose` agent that:
111
+ - Has access to all Claude Code tools (Read, Write, Edit, Bash, etc.)
112
+ - Receives full task context from the plan
113
+ - Works autonomously to complete the task
114
+ - Reports back with summary of changes
115
+ - Verifies acceptance criteria are met
116
+
117
+ ### State Management
118
+
119
+ All state is stored in the MCP planning system:
120
+ - **Plans**: Title, description, status (draft/active/completed)
121
+ - **Nodes**: Hierarchical tasks/phases/milestones
122
+ - **Logs**: Activity timeline (progress, challenges, decisions)
123
+ - **Artifacts**: File references and resources
124
+
125
+ **Key benefit**: Execution can be interrupted and resumed. State persists across sessions.
126
+
127
+ ## Writing Good Plans
128
+
129
+ ### Task Structure
130
+
131
+ Each task should have:
132
+
133
+ 1. **Clear Title**: "Create user authentication API endpoint"
134
+ 2. **Description**: What needs to be done and why
135
+ 3. **Acceptance Criteria**:
136
+ - Specific, measurable outcomes
137
+ - "API returns 200 on valid credentials"
138
+ - "Returns 401 on invalid credentials"
139
+ - "Integration tests pass with 80%+ coverage"
140
+ 4. **Agent Instructions**:
141
+ - Specific file paths or patterns to follow
142
+ - Technologies/frameworks to use
143
+ - Testing requirements
144
+ - Related files to reference
145
+
146
+ ### Example: Good vs. Bad Tasks
147
+
148
+ ❌ **Bad Task**:
149
+ ```
150
+ Title: Add login
151
+ Description: Add login functionality
152
+ Acceptance Criteria: Login works
153
+ Agent Instructions: Add login
154
+ ```
155
+
156
+ ✅ **Good Task**:
157
+ ```
158
+ Title: Create login API endpoint
159
+ Description: Add POST /api/v1/auth/login endpoint that validates credentials and returns JWT token
160
+ Acceptance Criteria:
161
+ - Endpoint accepts email and password
162
+ - Returns JWT token on valid credentials
163
+ - Returns 401 on invalid credentials
164
+ - Returns 400 on missing fields
165
+ - Integration tests pass with 80%+ coverage
166
+ - Swagger docs updated
167
+ Agent Instructions:
168
+ Create route in agent-planner/src/routes/auth.routes.js following pattern in users.routes.js.
169
+ Create controller in src/controllers/auth.controller.js.
170
+ Use bcrypt for password hashing.
171
+ Generate JWT using jsonwebtoken library.
172
+ Add validation middleware using express-validator.
173
+ Write integration tests in tests/integration/auth.test.js.
174
+ Run 'npm test' to verify.
175
+ Update API docs with 'npm run docs:all'.
176
+ ```
177
+
178
+ ### Task Ordering
179
+
180
+ Consider dependencies:
181
+ 1. Database migrations before API endpoints
182
+ 2. API endpoints before frontend components
183
+ 3. Core functionality before tests
184
+ 4. Tests before documentation
185
+
186
+ ## Project Context
187
+
188
+ The orchestrator and agents have access to CLAUDE.md which provides:
189
+ - Multi-repo structure (backend, frontend, MCP, homepage)
190
+ - Development commands for each repo
191
+ - Testing patterns
192
+ - Authentication flow
193
+ - Database migration system
194
+ - Deployment procedures
195
+
196
+ Agents automatically reference this context when executing tasks.
197
+
198
+ ## Backend-Specific Tasks
199
+
200
+ For backend tasks (migrations, API endpoints, database):
201
+ - Agents know to use `npm run db:init` after creating migrations
202
+ - Follow patterns in src/routes/*.routes.js and src/controllers/*.controller.js
203
+ - Add RLS policies for security
204
+ - Update API docs with `npm run docs:all`
205
+ - Run appropriate test suites
206
+
207
+ ## Frontend-Specific Tasks
208
+
209
+ For frontend tasks (components, pages, hooks):
210
+ - Agents use React + TypeScript patterns
211
+ - Follow Tailwind CSS conventions
212
+ - Create components in src/components/
213
+ - Use React Query for server state
214
+ - Write tests with React Testing Library
215
+
216
+ ## Tips for Success
217
+
218
+ 1. **Be Specific**: Vague tasks lead to vague implementations
219
+ 2. **One Thing Per Task**: Don't combine multiple concerns
220
+ 3. **Clear Success Criteria**: Agent needs to know when done
221
+ 4. **Reference Existing Code**: Help agents find patterns
222
+ 5. **Include Testing**: Every code task should mention tests
223
+ 6. **Review Agent Instructions**: These guide the autonomous agent
224
+
225
+ ## Troubleshooting
226
+
227
+ ### "Plan not found"
228
+ - Check plan ID is correct
229
+ - List plans with `/plan-status` (no ID) to see available plans
230
+
231
+ ### "Task is blocked"
232
+ - Check logs with `/plan-status <plan-id>`
233
+ - Review what blocked the task
234
+ - Update agent instructions if needed
235
+ - Manually unblock or fix issue, then change status back to "not_started"
236
+
237
+ ### "Agent didn't follow instructions"
238
+ - Review agent_instructions in the task
239
+ - Make them more specific with file paths and patterns
240
+ - Reference similar existing code to follow
241
+ - Update task and retry
242
+
243
+ ### Execution interrupted
244
+ - No problem! Just run `/execute-plan <plan-id>` again
245
+ - It will resume from where it left off
246
+ - All progress is saved in MCP
247
+
248
+ ## MCP Configuration
249
+
250
+ Your `.claude/settings.local.json` should include:
251
+
252
+ ```json
253
+ {
254
+ "permissions": {
255
+ "allow": [
256
+ "mcp__planning-system__create_node",
257
+ "mcp__planning-system__create_plan",
258
+ "mcp__planning-system__add_log",
259
+ "mcp__planning-system__get_plan_summary",
260
+ "mcp__planning-system__batch_update_nodes",
261
+ "mcp__planning-system__update_node"
262
+ ]
263
+ }
264
+ }
265
+ ```
266
+
267
+ These permissions let Claude autonomously update plans without asking for approval each time.
268
+
269
+ ## Example Workflow
270
+
271
+ ```bash
272
+ # 1. Create a plan
273
+ /create-plan
274
+ # → Follow prompts to create "Feature: User Notifications" plan
275
+ # → Plan ID: abc-123
276
+
277
+ # 2. Execute autonomously
278
+ /execute-plan abc-123
279
+ # → Claude works through all tasks
280
+ # → Creates migration
281
+ # → Adds API endpoints
282
+ # → Creates frontend components
283
+ # → Writes tests
284
+ # → Reports completion
285
+
286
+ # 3. Check status anytime (in another session if needed)
287
+ /plan-status abc-123
288
+ # → Shows progress: 8/10 tasks complete
289
+ # → 2 tasks in progress
290
+
291
+ # 4. When done
292
+ /plan-status abc-123
293
+ # → Shows: All tasks completed!
294
+ ```
295
+
296
+ ## Advanced: Manual MCP Tool Usage
297
+
298
+ You can also use MCP tools directly:
299
+
300
+ ```javascript
301
+ // List all plans
302
+ mcp__planning-system__list_plans()
303
+
304
+ // Create a plan
305
+ mcp__planning-system__create_plan({
306
+ title: "Feature: Dark Mode",
307
+ description: "Add dark mode support across the app"
308
+ })
309
+
310
+ // Add a task
311
+ mcp__planning-system__create_node({
312
+ plan_id: "abc-123",
313
+ node_type: "task",
314
+ title: "Create dark mode toggle component",
315
+ acceptance_criteria: "Toggle switches theme, persists preference"
316
+ })
317
+
318
+ // Update status
319
+ mcp__planning-system__update_node({
320
+ plan_id: "abc-123",
321
+ node_id: "task-456",
322
+ status: "completed"
323
+ })
324
+ ```
325
+
326
+ But using the slash commands is much easier!
327
+
328
+ ## Next Steps
329
+
330
+ 1. Try creating a simple 2-3 task plan with `/create-plan`
331
+ 2. Run `/execute-plan` and watch it work
332
+ 3. Monitor with `/plan-status`
333
+ 4. Iterate and refine your task definitions
334
+
335
+ Happy autonomous coding! 🚀
@@ -0,0 +1,112 @@
1
+ # Claude Code Slash Commands
2
+
3
+ Custom slash commands for autonomous plan execution in the Talking Agents project.
4
+
5
+ ## Available Commands
6
+
7
+ ### `/create-plan`
8
+ Interactive plan builder that guides you through creating a structured development plan.
9
+
10
+ **Usage**: `/create-plan`
11
+
12
+ **What it does**:
13
+ - Asks for plan title and description
14
+ - Helps break work into phases
15
+ - Creates specific tasks with acceptance criteria
16
+ - Adds agent instructions for autonomous execution
17
+ - Stores everything in MCP planning system
18
+
19
+ ### `/execute-plan`
20
+ Autonomous execution orchestrator that works through plan tasks systematically.
21
+
22
+ **Usage**: `/execute-plan <plan-id>` or `/execute-plan` (will prompt for ID)
23
+
24
+ **What it does**:
25
+ - Loads plan from MCP
26
+ - Executes tasks sequentially using Task agents
27
+ - Updates status in real-time
28
+ - Logs all progress
29
+ - Handles blockers and errors
30
+ - Reports final summary
31
+
32
+ ### `/plan-status`
33
+ Status reporter showing plan progress and recent activity.
34
+
35
+ **Usage**: `/plan-status <plan-id>` or `/plan-status` (will list all plans)
36
+
37
+ **What it does**:
38
+ - Shows overall progress statistics
39
+ - Lists all tasks with current status
40
+ - Highlights blockers
41
+ - Shows recent activity logs
42
+ - Suggests next actions
43
+
44
+ ## How They Work Together
45
+
46
+ ```
47
+ 1. /create-plan
48
+
49
+ Creates structured plan in MCP
50
+
51
+ 2. /execute-plan <plan-id>
52
+
53
+ Executes tasks autonomously
54
+
55
+ 3. /plan-status <plan-id>
56
+
57
+ Monitor progress anytime
58
+ ```
59
+
60
+ ## Requirements
61
+
62
+ - MCP planning system must be configured and running
63
+ - `.claude/settings.local.json` must have MCP permissions enabled
64
+ - See AUTONOMOUS_EXECUTION_GUIDE.md for full setup details
65
+
66
+ ## Examples
67
+
68
+ ### Creating and executing a plan
69
+ ```
70
+ > /create-plan
71
+ Claude: What is this plan for?
72
+ You: Add user profile editing feature
73
+
74
+ Claude: Let me help you break this down...
75
+ [Interactive prompts follow]
76
+
77
+ Claude: Plan created! Plan ID: plan_abc123
78
+
79
+ > /execute-plan plan_abc123
80
+ Claude: Starting execution...
81
+ Task 1/5: Create migration... ✅ Complete
82
+ Task 2/5: Add API endpoint... ✅ Complete
83
+ Task 3/5: Create UI component... 🔄 In progress...
84
+ ```
85
+
86
+ ### Checking status
87
+ ```
88
+ > /plan-status plan_abc123
89
+ # Plan Status Report
90
+
91
+ ## 📋 Plan: Add user profile editing feature
92
+ **Status**: active
93
+ **Progress**: 3/5 tasks complete (60%)
94
+
95
+ ## Task Status:
96
+ - ✅ Completed: 3
97
+ - 🔄 In Progress: 1
98
+ - 📋 Not Started: 1
99
+ ```
100
+
101
+ ## Customization
102
+
103
+ These commands can be modified by editing the .md files in this directory. Each file contains:
104
+ - Instructions for Claude Code on how to execute the command
105
+ - Templates for interacting with MCP
106
+ - Guidance on error handling and edge cases
107
+
108
+ ## See Also
109
+
110
+ - [AUTONOMOUS_EXECUTION_GUIDE.md](../AUTONOMOUS_EXECUTION_GUIDE.md) - Comprehensive guide
111
+ - [CLAUDE.md](/CLAUDE.md) - Project architecture and patterns
112
+ - [.claude/settings.local.json](../settings.local.json) - MCP configuration
@@ -0,0 +1,174 @@
1
+ # Create Plan - Interactive Plan Builder
2
+
3
+ You are a plan creation assistant. Help the user create a structured plan in the MCP planning system.
4
+
5
+ ## Step 1: Gather Plan Information
6
+
7
+ Ask the user for:
8
+ 1. **Plan title**: What is this plan for?
9
+ 2. **Plan description**: What's the overall goal?
10
+ 3. **Plan scope**: Is this for:
11
+ - A new feature?
12
+ - A bug fix?
13
+ - A refactoring effort?
14
+ - Testing work?
15
+ - Documentation?
16
+ - Other?
17
+
18
+ ## Step 2: Create the Plan
19
+
20
+ Use `mcp__planning-system__create_plan` with:
21
+ - `title`: The plan title
22
+ - `description`: The plan description
23
+ - `status`: "draft" (user can activate it later)
24
+
25
+ Save the returned `plan_id` - you'll need it for creating nodes.
26
+
27
+ ## Step 3: Break Down Into Phases
28
+
29
+ Ask the user what major phases this work involves. Common patterns:
30
+
31
+ **For new features**:
32
+ - Phase 1: Backend API
33
+ - Phase 2: Frontend UI
34
+ - Phase 3: Testing
35
+ - Phase 4: Documentation
36
+
37
+ **For bug fixes**:
38
+ - Phase 1: Investigation & Root Cause
39
+ - Phase 2: Fix Implementation
40
+ - Phase 3: Testing & Verification
41
+
42
+ **For refactoring**:
43
+ - Phase 1: Analysis & Planning
44
+ - Phase 2: Incremental Changes
45
+ - Phase 3: Testing & Validation
46
+
47
+ For each phase, create a node using `mcp__planning-system__create_node` with:
48
+ - `plan_id`
49
+ - `node_type: "phase"`
50
+ - `title`: Phase name
51
+ - `description`: What happens in this phase
52
+ - `status: "not_started"`
53
+
54
+ ## Step 4: Break Phases Into Tasks
55
+
56
+ For each phase, ask the user what specific tasks are needed.
57
+
58
+ **Guide the user with suggestions based on phase type**:
59
+
60
+ **Backend API phase**:
61
+ - Create database migration
62
+ - Create/update routes
63
+ - Create/update controllers
64
+ - Add authentication/validation
65
+ - Write API tests
66
+ - Update API documentation
67
+
68
+ **Frontend UI phase**:
69
+ - Create React components
70
+ - Set up React Query hooks
71
+ - Add routing
72
+ - Style with Tailwind CSS
73
+ - Write component tests
74
+
75
+ **Testing phase**:
76
+ - Write unit tests
77
+ - Write integration tests
78
+ - Write E2E tests
79
+ - Verify test coverage
80
+
81
+ For each task, create a node using `mcp__planning-system__create_node` with:
82
+ - `plan_id`
83
+ - `node_type: "task"`
84
+ - `parent_id`: The phase node_id
85
+ - `title`: Task name
86
+ - `description`: What needs to be done
87
+ - `acceptance_criteria`: How to know it's complete (be specific!)
88
+ - `agent_instructions`: Specific guidance for the AI agent executing this
89
+ - `status: "not_started"`
90
+
91
+ ## Step 5: Add Agent Instructions (Critical!)
92
+
93
+ For each task, help user write clear `agent_instructions`. These guide the autonomous agent.
94
+
95
+ **Good agent instructions examples**:
96
+
97
+ ```markdown
98
+ **Backend API Task**:
99
+ Create a new Express route at /api/v1/users/:id/profile with GET and PUT methods.
100
+ Follow patterns in src/routes/users.routes.js. Add Swagger annotations.
101
+ Include validation middleware. Add RLS policies for the database.
102
+
103
+ **Frontend Component Task**:
104
+ Create a ProfileCard component in src/components/ProfileCard.tsx.
105
+ Use Tailwind CSS for styling. Accept user prop with type User.
106
+ Include loading and error states. Write tests in ProfileCard.test.tsx.
107
+
108
+ **Testing Task**:
109
+ Write integration tests for the user profile endpoints.
110
+ Use patterns from tests/integration/users.test.js.
111
+ Test success case, validation errors, and authentication.
112
+ Ensure test coverage is above 80%.
113
+ ```
114
+
115
+ **Key elements**:
116
+ - Specific file paths or patterns to follow
117
+ - Technologies/tools to use
118
+ - Error cases to handle
119
+ - Related files to reference
120
+ - Testing requirements
121
+
122
+ ## Step 6: Review and Activate
123
+
124
+ Show the user the full plan structure:
125
+ - Plan title and description
126
+ - All phases
127
+ - All tasks under each phase
128
+ - Acceptance criteria for each task
129
+
130
+ Ask: "Does this look good? Any changes needed?"
131
+
132
+ If approved, update plan status to "active":
133
+ ```
134
+ mcp__planning-system__update_plan with:
135
+ - plan_id
136
+ - status: "active"
137
+ ```
138
+
139
+ ## Step 7: Next Steps
140
+
141
+ Tell the user:
142
+ ```
143
+ Plan created successfully!
144
+
145
+ Plan ID: {plan_id}
146
+
147
+ To execute this plan autonomously, run:
148
+ /execute-plan {plan_id}
149
+
150
+ To check status anytime:
151
+ /plan-status {plan_id}
152
+ ```
153
+
154
+ ## Tips for Good Plans
155
+
156
+ 1. **Be specific**: Vague tasks lead to vague implementations
157
+ 2. **One concern per task**: Don't combine "add API + add UI + add tests" in one task
158
+ 3. **Clear acceptance criteria**: "Add tests" ❌ | "Add integration tests with 80%+ coverage for all CRUD operations" ✅
159
+ 4. **Reference existing code**: Help agents find patterns to follow
160
+ 5. **Include test requirements**: Every code task should mention testing
161
+ 6. **Think about order**: Some tasks depend on others being done first
162
+
163
+ ## Example Complete Task
164
+
165
+ ```json
166
+ {
167
+ "title": "Create user profile API endpoint",
168
+ "description": "Add GET and PUT endpoints for user profile management at /api/v1/users/:id/profile",
169
+ "acceptance_criteria": "- GET /api/v1/users/:id/profile returns user profile\n- PUT /api/v1/users/:id/profile updates profile\n- Returns 401 if not authenticated\n- Returns 403 if accessing other user's profile\n- Swagger documentation is complete\n- Integration tests pass with 80%+ coverage",
170
+ "agent_instructions": "Create new route file: agent-planner/src/routes/profile.routes.js\n\nFollow the pattern in src/routes/users.routes.js:\n- Use authenticate middleware from src/middleware/auth.middleware.js\n- Create controller in src/controllers/profile.controller.js\n- Add Swagger JSDoc annotations for API docs\n- Validate request body using express-validator\n- Add RLS policy to ensure users can only access their own profile\n\nWrite integration tests in tests/integration/profile.test.js:\n- Test successful GET\n- Test successful PUT with valid data\n- Test 401 unauthorized\n- Test 403 forbidden (different user)\n- Test 400 validation errors\n\nRun npm test to verify all tests pass.\nRun npm run docs:all to update API documentation."
171
+ }
172
+ ```
173
+
174
+ Now begin helping the user create their plan!
@@ -0,0 +1,202 @@
1
+ # Execute Plan - Autonomous Task Orchestrator
2
+
3
+ You are an autonomous plan execution orchestrator. Your mission is to execute tasks from a plan stored in the MCP planning system, working through them methodically until completion.
4
+
5
+ ## Step 1: Identify the Plan
6
+
7
+ **If user provided a plan ID**: Use it directly
8
+ **If no plan ID provided**:
9
+ - Use `mcp__planning-system__list_plans` with filter `status: "active"` to show available plans
10
+ - Ask user which plan to execute
11
+
12
+ ## Step 2: Load Plan Structure
13
+
14
+ Use `mcp__planning-system__get_plan_structure` with the plan_id to get the full hierarchy.
15
+
16
+ Analyze the structure:
17
+ - Identify all nodes with `node_type: "task"`
18
+ - Note their current status: `not_started`, `in_progress`, `completed`, `blocked`
19
+ - Check parent relationships (phases → tasks)
20
+ - Review `acceptance_criteria` and `agent_instructions` for each task
21
+
22
+ ## Step 3: Execute Tasks Sequentially
23
+
24
+ For each task with status `not_started` or `in_progress`:
25
+
26
+ ### 3.1 Prepare Task Context
27
+ ```
28
+ Use mcp__planning-system__get_node_context with:
29
+ - plan_id
30
+ - node_id (of the task)
31
+
32
+ This gives you:
33
+ - Full task details
34
+ - Parent nodes (phase context)
35
+ - Existing logs
36
+ - Artifacts
37
+ - Child nodes if any
38
+ ```
39
+
40
+ ### 3.2 Update Status to In Progress
41
+ ```
42
+ Use mcp__planning-system__update_node:
43
+ - plan_id
44
+ - node_id
45
+ - status: "in_progress"
46
+ ```
47
+
48
+ ### 3.3 Execute Task Using Task Tool Agent
49
+ Launch a Task tool with:
50
+ - `subagent_type: "general-purpose"`
51
+ - `description: "<5 word summary of task>"`
52
+ - `prompt: "...detailed prompt below..."`
53
+
54
+ **Prompt Template**:
55
+ ```
56
+ You are executing a task from a development plan. Complete it fully and autonomously.
57
+
58
+ ## Task Details
59
+
60
+ **Title**: {task.title}
61
+
62
+ **Description**: {task.description}
63
+
64
+ **Status**: {task.status}
65
+
66
+ **Acceptance Criteria**:
67
+ {task.acceptance_criteria}
68
+
69
+ **Agent Instructions**:
70
+ {task.agent_instructions}
71
+
72
+ ## Context from Plan
73
+
74
+ **Plan**: {plan.title}
75
+ **Phase**: {parent_node.title if exists}
76
+
77
+ **Previous Logs**:
78
+ {logs from get_node_context}
79
+
80
+ **Related Artifacts**:
81
+ {artifacts from get_node_context}
82
+
83
+ ## Project Context
84
+
85
+ This is the Talking Agents planning system. See CLAUDE.md for architecture:
86
+ - Multi-repo structure (agent-planner backend, agent-planner-ui frontend, agent-planner-mcp)
87
+ - Backend: Node.js + Express + Supabase + PostgreSQL
88
+ - Frontend: React + TypeScript + Tailwind CSS
89
+ - Testing: Jest + Supertest for backend, React Testing Library for frontend
90
+
91
+ ## Your Mission
92
+
93
+ 1. **Read relevant code** to understand current implementation
94
+ 2. **Implement the task** following project conventions
95
+ 3. **Test your implementation** (run tests if applicable)
96
+ 4. **Verify acceptance criteria** are met
97
+ 5. **Report back** with:
98
+ - Summary of what you did
99
+ - Files created/modified
100
+ - Test results
101
+ - Any issues or blockers encountered
102
+ - Confirmation that acceptance criteria are met (or what's missing)
103
+
104
+ ## Important Notes
105
+
106
+ - Follow existing patterns in the codebase
107
+ - Run tests after making changes
108
+ - Don't skip error handling or validation
109
+ - Update documentation if needed
110
+ - If blocked, explain why clearly
111
+
112
+ Execute this task completely and thoroughly. Report back when done.
113
+ ```
114
+
115
+ ### 3.4 Process Agent Response
116
+
117
+ After the Task agent completes:
118
+
119
+ **If successful**:
120
+ 1. Update node status to "completed":
121
+ ```
122
+ mcp__planning-system__update_node with status: "completed"
123
+ ```
124
+
125
+ 2. Add success log:
126
+ ```
127
+ mcp__planning-system__add_log with:
128
+ - plan_id
129
+ - node_id
130
+ - log_type: "progress"
131
+ - content: "<summary of what was done>"
132
+ ```
133
+
134
+ 3. Show user a brief summary
135
+
136
+ **If blocked/failed**:
137
+ 1. Update node status to "blocked":
138
+ ```
139
+ mcp__planning-system__update_node with status: "blocked"
140
+ ```
141
+
142
+ 2. Add challenge log:
143
+ ```
144
+ mcp__planning-system__add_log with:
145
+ - plan_id
146
+ - node_id
147
+ - log_type: "challenge"
148
+ - content: "<description of blocker>"
149
+ ```
150
+
151
+ 3. Ask user for guidance:
152
+ - What went wrong
153
+ - How to proceed
154
+ - Should we skip this task or try again?
155
+
156
+ ## Step 4: Continue or Finish
157
+
158
+ After each task:
159
+ - Check if there are more tasks with status `not_started`
160
+ - If yes: Repeat Step 3 for next task
161
+ - If no: Proceed to Step 5
162
+
163
+ ## Step 5: Final Summary
164
+
165
+ Use `mcp__planning-system__get_plan_summary` to get statistics and show user:
166
+ - Total tasks completed
167
+ - Any tasks still blocked or pending
168
+ - Overall plan status
169
+ - Suggest next actions (e.g., "Plan complete! Ready to deploy?" or "3 tasks remaining, continue?")
170
+
171
+ ## Error Handling
172
+
173
+ - **If a task agent fails**: Mark task as blocked, log the issue, ask user for help
174
+ - **If MCP tools fail**: Report error to user immediately
175
+ - **If you're unsure about a task**: Ask user for clarification before executing
176
+
177
+ ## Execution Guidelines
178
+
179
+ 1. **Work methodically**: One task at a time, no skipping
180
+ 2. **Respect dependencies**: If a task depends on another being completed first, follow the order
181
+ 3. **Be thorough**: Don't mark tasks complete unless acceptance criteria are truly met
182
+ 4. **Communicate clearly**: Keep user informed after each task
183
+ 5. **Stay autonomous**: Try to solve problems yourself before asking for help
184
+ 6. **Use project knowledge**: Refer to CLAUDE.md for patterns and commands
185
+
186
+ ## Special Cases
187
+
188
+ **Backend tasks**:
189
+ - Run `npm run db:init` after creating migrations
190
+ - Run `npm test` or specific test suites
191
+ - Update API docs with `npm run docs:all`
192
+
193
+ **Frontend tasks**:
194
+ - Check TypeScript compilation
195
+ - Run frontend tests
196
+ - Verify component renders correctly
197
+
198
+ **Testing tasks**:
199
+ - Run specific test suite to verify
200
+ - Check coverage if needed
201
+
202
+ Now begin execution!
@@ -0,0 +1,145 @@
1
+ # Plan Status - Monitor Plan Progress
2
+
3
+ You are a plan status reporter. Show the user the current state of a plan from the MCP planning system.
4
+
5
+ ## Step 1: Identify the Plan
6
+
7
+ **If user provided a plan ID**: Use it directly
8
+ **If no plan ID provided**:
9
+ - Use `mcp__planning-system__list_plans` to show all plans
10
+ - Ask user which plan they want to check
11
+
12
+ ## Step 2: Get Plan Summary
13
+
14
+ Use `mcp__planning-system__get_plan_summary` with the plan_id.
15
+
16
+ This returns comprehensive statistics and metadata about the plan.
17
+
18
+ ## Step 3: Get Detailed Structure
19
+
20
+ Use `mcp__planning-system__get_plan_structure` with:
21
+ - `plan_id`
22
+ - `include_details: true`
23
+
24
+ This gives you the full hierarchy with all node details.
25
+
26
+ ## Step 4: Present Status Report
27
+
28
+ Format the information in a clear, scannable way:
29
+
30
+ ```markdown
31
+ # Plan Status Report
32
+
33
+ ## 📋 Plan: {plan.title}
34
+
35
+ **Status**: {plan.status} (draft/active/completed/archived)
36
+ **Created**: {plan.created_at}
37
+ **Last Updated**: {plan.updated_at}
38
+
39
+ **Description**: {plan.description}
40
+
41
+ ---
42
+
43
+ ## 📊 Progress Summary
44
+
45
+ **Total Nodes**: {summary.total_nodes}
46
+ - Phases: {count phases}
47
+ - Tasks: {count tasks}
48
+ - Milestones: {count milestones}
49
+
50
+ **Task Status**:
51
+ - ✅ Completed: {count completed} ({percentage}%)
52
+ - 🔄 In Progress: {count in_progress}
53
+ - 📋 Not Started: {count not_started}
54
+ - 🚫 Blocked: {count blocked}
55
+
56
+ ---
57
+
58
+ ## 📝 Detailed Breakdown
59
+
60
+ ### Phase: {phase.title}
61
+
62
+ **Status**: {phase.status}
63
+
64
+ Tasks:
65
+ 1. ✅ {task.title} - Completed
66
+ 2. 🔄 {task.title} - In Progress
67
+ 3. 📋 {task.title} - Not Started
68
+ 4. 🚫 {task.title} - Blocked
69
+
70
+ {Repeat for each phase}
71
+
72
+ ---
73
+
74
+ ## 🚨 Blockers
75
+
76
+ {List any tasks with status "blocked" and their recent logs}
77
+
78
+ ---
79
+
80
+ ## 🎯 Next Actions
81
+
82
+ {Suggest what should happen next based on status:}
83
+
84
+ - If all tasks completed: "Plan is complete! Ready to review and close."
85
+ - If tasks in progress: "Tasks currently being worked on. Continue monitoring."
86
+ - If tasks not started: "Run /execute-plan {plan_id} to begin execution."
87
+ - If tasks blocked: "Address blockers before continuing."
88
+ ```
89
+
90
+ ## Step 5: Show Recent Activity
91
+
92
+ Use `mcp__planning-system__search` to find recent logs:
93
+ - Query: Plan-specific search
94
+ - Type filter: "log"
95
+ - Limit: 10
96
+
97
+ Show the most recent activity:
98
+ ```markdown
99
+ ## 📝 Recent Activity
100
+
101
+ 1. [{timestamp}] {log.log_type}: {log.content} (Node: {node.title})
102
+ 2. [{timestamp}] {log.log_type}: {log.content} (Node: {node.title})
103
+ ...
104
+ ```
105
+
106
+ ## Step 6: Offer Actions
107
+
108
+ Based on the status, suggest relevant actions:
109
+
110
+ ```markdown
111
+ ## 🎬 Available Actions
112
+
113
+ - `/execute-plan {plan_id}` - Continue autonomous execution
114
+ - `/plan-status {plan_id}` - Refresh this status report
115
+ - View specific task details (provide node_id)
116
+ - Update plan status or task statuses manually
117
+ ```
118
+
119
+ ## Special Reporting Modes
120
+
121
+ ### Quick Status (one-liner)
122
+ If user asks for quick status, just show:
123
+ ```
124
+ Plan "{title}": {completed}/{total} tasks done ({percentage}%), {in_progress} in progress, {blocked} blocked
125
+ ```
126
+
127
+ ### Focus on Blockers
128
+ If user asks about blockers specifically:
129
+ 1. Filter to only blocked tasks
130
+ 2. Get logs for each blocked task
131
+ 3. Show detailed breakdown of what's blocking each one
132
+
133
+ ### Timeline View
134
+ If user asks for timeline:
135
+ 1. Get all logs ordered by timestamp
136
+ 2. Show chronological activity
137
+ 3. Highlight status changes
138
+
139
+ ## Error Handling
140
+
141
+ - If plan_id not found: List available plans
142
+ - If MCP tools fail: Report error clearly
143
+ - If plan has no tasks yet: Suggest using `/create-plan`
144
+
145
+ Now generate the status report!
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "mcp__planning-system__create_node",
5
+ "mcp__planning-system__create_plan",
6
+ "mcp__planning-system__add_log",
7
+ "mcp__planning-system__get_plan_summary",
8
+ "mcp__planning-system__batch_update_nodes",
9
+ "mcp__planning-system__update_node"
10
+ ]
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-planner-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server interface for the Planning System API",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -12,6 +12,7 @@
12
12
  "test": "jest",
13
13
  "test:tools": "node test-tools.js",
14
14
  "setup": "node src/setup.js",
15
+ "setup-claude-code": "node src/setup-claude-code.js",
15
16
  "prepublishOnly": "echo 'Ready to publish agent-planner-mcp'"
16
17
  },
17
18
  "keywords": [
@@ -47,6 +48,7 @@
47
48
  },
48
49
  "files": [
49
50
  "src/",
51
+ "claude-code/",
50
52
  "README.md",
51
53
  "LICENSE"
52
54
  ]
package/src/index.js CHANGED
File without changes
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import readline from 'readline';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+
11
+ const rl = readline.createInterface({
12
+ input: process.stdin,
13
+ output: process.stdout
14
+ });
15
+
16
+ function question(query) {
17
+ return new Promise(resolve => rl.question(query, resolve));
18
+ }
19
+
20
+ function copyRecursive(src, dest) {
21
+ const exists = fs.existsSync(src);
22
+ const stats = exists && fs.statSync(src);
23
+ const isDirectory = exists && stats.isDirectory();
24
+
25
+ if (isDirectory) {
26
+ if (!fs.existsSync(dest)) {
27
+ fs.mkdirSync(dest, { recursive: true });
28
+ }
29
+ fs.readdirSync(src).forEach(childItemName => {
30
+ copyRecursive(
31
+ path.join(src, childItemName),
32
+ path.join(dest, childItemName)
33
+ );
34
+ });
35
+ } else {
36
+ fs.copyFileSync(src, dest);
37
+ }
38
+ }
39
+
40
+ function mergeSettings(existingPath, templatePath) {
41
+ let existing = {};
42
+ if (fs.existsSync(existingPath)) {
43
+ existing = JSON.parse(fs.readFileSync(existingPath, 'utf8'));
44
+ }
45
+
46
+ const template = JSON.parse(fs.readFileSync(templatePath, 'utf8'));
47
+
48
+ // Merge permissions
49
+ if (!existing.permissions) {
50
+ existing.permissions = { allow: [] };
51
+ }
52
+ if (!existing.permissions.allow) {
53
+ existing.permissions.allow = [];
54
+ }
55
+
56
+ // Add planning-system permissions if not already present
57
+ template.permissions.allow.forEach(permission => {
58
+ if (!existing.permissions.allow.includes(permission)) {
59
+ existing.permissions.allow.push(permission);
60
+ }
61
+ });
62
+
63
+ return existing;
64
+ }
65
+
66
+ async function main() {
67
+ console.log('🚀 Agent Planner Claude Code Setup\n');
68
+ console.log('This will install the autonomous execution orchestration system.\n');
69
+
70
+ // Ask for target directory
71
+ const defaultTarget = process.cwd();
72
+ const target = await question(`Installation directory [${defaultTarget}]: `) || defaultTarget;
73
+
74
+ const claudeDir = path.join(target, '.claude');
75
+ const commandsDir = path.join(claudeDir, 'commands');
76
+ const settingsPath = path.join(claudeDir, 'settings.local.json');
77
+
78
+ // Show what will be installed
79
+ console.log('\n📦 Will install:');
80
+ console.log(' - Slash commands: /create-plan, /execute-plan, /plan-status');
81
+ console.log(' - Documentation: AUTONOMOUS_EXECUTION_GUIDE.md');
82
+ console.log(' - Settings: permissions for MCP planning-system tools\n');
83
+
84
+ const confirm = await question('Proceed with installation? (y/n): ');
85
+ if (confirm.toLowerCase() !== 'y') {
86
+ console.log('Installation cancelled.');
87
+ rl.close();
88
+ return;
89
+ }
90
+
91
+ try {
92
+ // Create .claude directory structure
93
+ console.log('\n📁 Creating directory structure...');
94
+ if (!fs.existsSync(claudeDir)) {
95
+ fs.mkdirSync(claudeDir, { recursive: true });
96
+ }
97
+ if (!fs.existsSync(commandsDir)) {
98
+ fs.mkdirSync(commandsDir, { recursive: true });
99
+ }
100
+
101
+ // Copy commands
102
+ console.log('📝 Installing slash commands...');
103
+ const sourceCommandsDir = path.join(__dirname, '..', 'claude-code', 'commands');
104
+ copyRecursive(sourceCommandsDir, commandsDir);
105
+
106
+ // Copy guide
107
+ console.log('📚 Installing documentation...');
108
+ const sourceGuide = path.join(__dirname, '..', 'claude-code', 'AUTONOMOUS_EXECUTION_GUIDE.md');
109
+ const destGuide = path.join(claudeDir, 'AUTONOMOUS_EXECUTION_GUIDE.md');
110
+ fs.copyFileSync(sourceGuide, destGuide);
111
+
112
+ // Merge settings
113
+ console.log('⚙️ Configuring permissions...');
114
+ const templatePath = path.join(__dirname, '..', 'claude-code', 'settings.template.json');
115
+ const mergedSettings = mergeSettings(settingsPath, templatePath);
116
+ fs.writeFileSync(settingsPath, JSON.stringify(mergedSettings, null, 2));
117
+
118
+ console.log('\n✅ Installation complete!\n');
119
+ console.log('📖 Next steps:');
120
+ console.log(' 1. Ensure agent-planner-mcp is configured in your Claude Code MCP settings');
121
+ console.log(' 2. Read the guide: .claude/AUTONOMOUS_EXECUTION_GUIDE.md');
122
+ console.log(' 3. Create your first plan: /create-plan');
123
+ console.log(' 4. Execute autonomously: /execute-plan <plan-id>\n');
124
+ console.log('🎯 Available commands:');
125
+ console.log(' /create-plan - Interactive plan builder');
126
+ console.log(' /execute-plan - Autonomous execution orchestrator');
127
+ console.log(' /plan-status - Progress monitoring\n');
128
+
129
+ } catch (error) {
130
+ console.error('\n❌ Installation failed:', error.message);
131
+ process.exit(1);
132
+ }
133
+
134
+ rl.close();
135
+ }
136
+
137
+ main();