mapify-cli 2.2.0__tar.gz → 2.3.0__tar.gz

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 (66) hide show
  1. {mapify_cli-2.2.0/src/mapify_cli/templates → mapify_cli-2.3.0/.claude}/skills/README.md +17 -2
  2. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/.gitignore +1 -0
  3. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/PKG-INFO +3 -2
  4. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/README.md +2 -1
  5. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/pyproject.toml +1 -1
  6. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/__init__.py +1 -1
  7. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/monitor.md +28 -0
  8. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/research-agent.md +41 -0
  9. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/commands/map-efficient.md +142 -3
  10. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/SKILL.md +169 -0
  11. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/scripts/check-complete.sh +68 -0
  12. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/scripts/get-plan-path.sh +35 -0
  13. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/scripts/init-session.sh +72 -0
  14. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/scripts/show-focus.sh +62 -0
  15. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/templates/findings.md +62 -0
  16. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/templates/progress.md +75 -0
  17. mapify_cli-2.3.0/src/mapify_cli/templates/skills/map-planning/templates/task_plan.md +70 -0
  18. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/docs/cipher-setup-guide/README.md +0 -0
  19. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/contradiction_detector.py +0 -0
  20. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/entity_extractor.py +0 -0
  21. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/graph_query.py +0 -0
  22. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/playbook_manager.py +0 -0
  23. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/playbook_query.py +0 -0
  24. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/relationship_detector.py +0 -0
  25. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/schemas.py +0 -0
  26. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/semantic_search.py +0 -0
  27. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/actor.md +0 -0
  28. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/curator.md +0 -0
  29. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/debate-arbiter.md +0 -0
  30. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/documentation-reviewer.md +0 -0
  31. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/evaluator.md +0 -0
  32. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/predictor.md +0 -0
  33. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/reflector.md +0 -0
  34. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/synthesizer.md +0 -0
  35. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/agents/task-decomposer.md +0 -0
  36. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/commands/map-debate.md +0 -0
  37. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/commands/map-debug.md +0 -0
  38. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/commands/map-fast.md +0 -0
  39. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/commands/map-learn.md +0 -0
  40. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/commands/map-release.md +0 -0
  41. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/commands/map-review.md +0 -0
  42. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/hooks/improve-prompt.py +0 -0
  43. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/map/static-analysis/analyze.sh +0 -0
  44. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/map/static-analysis/handlers/common.sh +0 -0
  45. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/map/static-analysis/handlers/go.sh +0 -0
  46. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/map/static-analysis/handlers/python.sh +0 -0
  47. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/map/static-analysis/handlers/typescript.sh +0 -0
  48. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/references/decomposition-examples.md +0 -0
  49. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/references/mcp-usage-examples.md +0 -0
  50. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/settings.hooks.json +0 -0
  51. {mapify_cli-2.2.0/.claude → mapify_cli-2.3.0/src/mapify_cli/templates}/skills/README.md +0 -0
  52. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-cli-reference/SKILL.md +0 -0
  53. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/SKILL.md +0 -0
  54. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/agent-architecture.md +0 -0
  55. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/cipher-integration.md +0 -0
  56. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-debug-deep-dive.md +0 -0
  57. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-efficient-deep-dive.md +0 -0
  58. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-fast-deep-dive.md +0 -0
  59. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-feature-deep-dive.md +0 -0
  60. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-refactor-deep-dive.md +0 -0
  61. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/map-workflows-guide/resources/playbook-system.md +0 -0
  62. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/skills/skill-rules.json +0 -0
  63. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/templates/workflow-rules.json +0 -0
  64. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/tools/__init__.py +0 -0
  65. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/tools/validate_dependencies.py +0 -0
  66. {mapify_cli-2.2.0 → mapify_cli-2.3.0}/src/mapify_cli/workflow_logger.py +0 -0
@@ -2,9 +2,9 @@
2
2
 
3
3
  ## What are Skills?
4
4
 
5
- **Skills** = Passive documentation modules (NOT agents!)
5
+ **Skills** = Opt-in modules (NOT agents!)
6
6
 
7
- Skills provide specialized guidance without executing code. They help users understand MAP Framework concepts and make informed decisions.
7
+ Most skills provide specialized guidance (passive documentation). Some skills may also include optional workflow automation (e.g., hooks + scripts) when explicitly loaded.
8
8
 
9
9
  ## Skills vs Agents
10
10
 
@@ -59,6 +59,21 @@ MAP: [Shows decision tree and comparison matrix]
59
59
 
60
60
  ---
61
61
 
62
+ ### map-planning
63
+
64
+ **Purpose:** Persistent session state for long MAP workflows using file-based planning in `.map/`.
65
+
66
+ **What it provides:**
67
+ - Branch-scoped files: `task_plan_<branch>.md`, `findings_<branch>.md`, `progress_<branch>.md`
68
+ - Optional hooks (PreToolUse + Stop) to reduce goal drift and prevent premature stop
69
+
70
+ **How to use:**
71
+ ```bash
72
+ .claude/skills/map-planning/scripts/init-session.sh
73
+ ```
74
+
75
+ ---
76
+
62
77
  ## Creating New Skills
63
78
 
64
79
  See [docs/P1_SKILLS_SYSTEM_IMPLEMENTATION.md](../docs/P1_SKILLS_SYSTEM_IMPLEMENTATION.md) for:
@@ -93,3 +93,4 @@ docs/claude-code-prompt-improver
93
93
  .mcp.json
94
94
  .chunkhound.json
95
95
  .chunkhound/
96
+ docs/planning-with-files.txt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapify-cli
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: MAP Framework installer - Modular Agentic Planner for Claude Code
5
5
  Project-URL: Homepage, https://github.com/azalio/map-framework
6
6
  Project-URL: Repository, https://github.com/azalio/map-framework.git
@@ -231,6 +231,7 @@ Edit `.claude/workflow-rules.json` to add project-specific trigger words and pat
231
231
  MAP includes interactive skills that provide specialized guidance:
232
232
 
233
233
  **map-workflows-guide** - Helps you choose the right workflow
234
+ **map-planning** - Persistent file-based plans for long `/map-efficient` sessions (`.map/task_plan_<branch>.md`)
234
235
 
235
236
  **Auto-suggested when you ask:**
236
237
  - "Which workflow should I use?"
@@ -243,7 +244,7 @@ MAP includes interactive skills that provide specialized guidance:
243
244
  - 8 detailed resource guides (progressive disclosure)
244
245
 
245
246
  **Skills vs Agents:**
246
- - **Skills** = Passive documentation (guidance)
247
+ - **Skills** = Optional modules (guidance and/or workflow automation via hooks)
247
248
  - **Agents** = Active execution (code generation)
248
249
 
249
250
  **See [docs/USAGE.md](docs/USAGE.md#skills-system) for full details.**
@@ -201,6 +201,7 @@ Edit `.claude/workflow-rules.json` to add project-specific trigger words and pat
201
201
  MAP includes interactive skills that provide specialized guidance:
202
202
 
203
203
  **map-workflows-guide** - Helps you choose the right workflow
204
+ **map-planning** - Persistent file-based plans for long `/map-efficient` sessions (`.map/task_plan_<branch>.md`)
204
205
 
205
206
  **Auto-suggested when you ask:**
206
207
  - "Which workflow should I use?"
@@ -213,7 +214,7 @@ MAP includes interactive skills that provide specialized guidance:
213
214
  - 8 detailed resource guides (progressive disclosure)
214
215
 
215
216
  **Skills vs Agents:**
216
- - **Skills** = Passive documentation (guidance)
217
+ - **Skills** = Optional modules (guidance and/or workflow automation via hooks)
217
218
  - **Agents** = Active execution (code generation)
218
219
 
219
220
  **See [docs/USAGE.md](docs/USAGE.md#skills-system) for full details.**
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mapify-cli"
3
- version = "2.2.0"
3
+ version = "2.3.0"
4
4
  description = "MAP Framework installer - Modular Agentic Planner for Claude Code"
5
5
  authors = [{ name = "MAP Framework Contributors" }]
6
6
  readme = "README.md"
@@ -23,7 +23,7 @@ Or install globally:
23
23
  mapify check
24
24
  """
25
25
 
26
- __version__ = "2.2.0"
26
+ __version__ = "2.3.0"
27
27
 
28
28
  import copy
29
29
  import os
@@ -1709,6 +1709,30 @@ Do NOT invent issues to justify review effort. Empty `issues` array is valid.
1709
1709
  "contract_compliant": {
1710
1710
  "type": "boolean",
1711
1711
  "description": "True if all validation_criteria contracts pass (NOT SpecificationContract compliance)"
1712
+ },
1713
+ "status_update": {
1714
+ "type": "object",
1715
+ "description": "Plan file update when subtask validation succeeds (map-planning integration)",
1716
+ "properties": {
1717
+ "subtask_id": {
1718
+ "type": "string",
1719
+ "description": "Subtask identifier (e.g., 'ST-001')"
1720
+ },
1721
+ "new_status": {
1722
+ "type": "string",
1723
+ "enum": ["complete", "blocked", "won't_do", "superseded"],
1724
+ "description": "New status for the subtask"
1725
+ },
1726
+ "completed_criteria": {
1727
+ "type": "array",
1728
+ "items": { "type": "string" },
1729
+ "description": "List of validation criteria that were satisfied"
1730
+ },
1731
+ "next_subtask_id": {
1732
+ "type": "string",
1733
+ "description": "ID of next subtask to mark as in_progress (optional)"
1734
+ }
1735
+ }
1712
1736
  }
1713
1737
  }
1714
1738
  }
@@ -1740,6 +1764,10 @@ IF ≥1 MCP tool failed:
1740
1764
 
1741
1765
  IF recovery_mode == "manual_only":
1742
1766
  → recovery_notes MUST explain limitations
1767
+
1768
+ IF map-planning workflow active AND valid === true:
1769
+ → status_update SHOULD be present with subtask_id and new_status
1770
+ → Orchestrator uses this to update task_plan file (Single-Writer Governance)
1743
1771
  ```
1744
1772
 
1745
1773
  **Required Structure**:
@@ -180,6 +180,47 @@ IF ChunkHound tools fail or timeout:
180
180
  | 0.3-0.5 | Weak match | Actor proceeds with caution |
181
181
  | <0.3 | No good match | Escalate to user |
182
182
 
183
+ # MAP-PLANNING INTEGRATION (Optional)
184
+
185
+ When orchestrator provides `findings_file` path in prompt, append research results:
186
+
187
+ **Input Signal** (from orchestrator):
188
+ ```
189
+ Findings file: .map/findings_feature-auth.md
190
+ ```
191
+
192
+ **Action**:
193
+ 1. After completing search, format findings as Markdown
194
+ 2. Append to findings file using Write tool (append mode via reading + concatenating)
195
+
196
+ **Findings Format** (append to file):
197
+ ```markdown
198
+ ---
199
+
200
+ ## Research: [query summary]
201
+ **Timestamp:** [ISO-8601]
202
+ **Confidence:** [0.0-1.0]
203
+ **Search Method:** [chunkhound_semantic|glob_grep_fallback|...]
204
+
205
+ ### Summary
206
+ [executive_summary from JSON output]
207
+
208
+ ### Key Locations
209
+ | Path | Lines | Signature | Relevance |
210
+ |------|-------|-----------|-----------|
211
+ | src/auth/service.py | 45-67 | `def validate_token(...)` | Core JWT validation |
212
+
213
+ ### Patterns Discovered
214
+ - Pattern 1
215
+ - Pattern 2
216
+ ```
217
+
218
+ **Rules**:
219
+ - Only append if `findings_file` provided in prompt
220
+ - Always prepend `---` separator for append safety
221
+ - Include timestamp for chronological tracking
222
+ - Keep append content under 500 tokens
223
+
183
224
  # ON-DEMAND CODE READING
184
225
 
185
226
  Research Agent returns **pointers**, not full code:
@@ -17,6 +17,7 @@ description: Token-efficient MAP workflow with conditional optimizations
17
17
 
18
18
  ```
19
19
  1. DECOMPOSE → task-decomposer
20
+ 1.5. INIT PLANNING → generate .map/task_plan_<branch>.md from blueprint
20
21
  2. FOR each subtask:
21
22
  a. CONTEXT → playbook query (Actor will run `cipher_memory_search` per protocol; orchestrator MAY run extra cipher search to augment context)
22
23
  b. RESEARCH → if existing code understanding needed
@@ -50,8 +51,71 @@ Hard requirements:
50
51
  )
51
52
  ```
52
53
 
54
+ ## Step 1.5: Initialize Planning Session
55
+
56
+ **REQUIRED**: Generate persistent plan file from task-decomposer blueprint.
57
+
58
+ ```bash
59
+ # 1. Create .map/ directory and planning files
60
+ .claude/skills/map-planning/scripts/init-session.sh
61
+ ```
62
+
63
+ ```
64
+ # 2. Generate task_plan from blueprint JSON
65
+ # Get branch-scoped plan path
66
+ PLAN_PATH=$(.claude/skills/map-planning/scripts/get-plan-path.sh)
67
+
68
+ # Write plan content from blueprint:
69
+ # - Header: blueprint.summary as Goal
70
+ # - For each subtask: ## ST-XXX section with **Status:** pending
71
+ # - First subtask: **Status:** in_progress
72
+ # - Terminal State: **Status:** pending
73
+ ```
74
+
75
+ **Plan file format** (`.map/task_plan_<branch>.md`):
76
+
77
+ ```markdown
78
+ # Task Plan: [blueprint.summary]
79
+
80
+ ## Goal
81
+ [blueprint.summary]
82
+
83
+ ## Current Phase
84
+ ST-001
85
+
86
+ ## Phases
87
+
88
+ ### ST-001: [subtask.title]
89
+ **Status:** in_progress
90
+ Risk: [risk_level]
91
+ Complexity: [complexity_score]
92
+ Files: [affected_files]
93
+
94
+ Validation:
95
+ - [ ] [validation_criteria[0]]
96
+ - [ ] [validation_criteria[1]]
97
+
98
+ ### ST-002: [subtask.title]
99
+ **Status:** pending
100
+ ...
101
+
102
+ ## Terminal State
103
+ **Status:** pending
104
+ ```
105
+
106
+ **Why required:**
107
+ - Enables resumption after context reset
108
+ - Prevents goal drift in long workflows
109
+ - Provides explicit state tracking for orchestrator
110
+
53
111
  ## Step 2: Subtask Loop
54
112
 
113
+ **Before each subtask**: Read current plan to prevent goal drift:
114
+ ```bash
115
+ PLAN_PATH=$(.claude/skills/map-planning/scripts/get-plan-path.sh)
116
+ # Read Goal and current in_progress phase from $PLAN_PATH
117
+ ```
118
+
55
119
  ### 2.0 Build AI-Friendly Subtask Packet (XML Anchors)
56
120
 
57
121
  Before calling any agents for the subtask, build a single **AI Packet** with unique XML-like tags (NO attributes).
@@ -114,6 +178,11 @@ Pass `context_patterns` with relevance scores to Actor for informed decision-mak
114
178
  **Call if:** refactoring, bug fixes, extending existing code, touching 3+ files
115
179
  **Skip for:** new standalone features, docs, config
116
180
 
181
+ ```bash
182
+ # Get findings file path for map-planning integration
183
+ FINDINGS_PATH=$(.claude/skills/map-planning/scripts/get-plan-path.sh | sed 's/task_plan/findings/')
184
+ ```
185
+
117
186
  ```
118
187
  Task(
119
188
  subagent_type="research-agent",
@@ -122,7 +191,8 @@ Task(
122
191
  File patterns: [relevant globs]
123
192
  Symbols: [optional keywords]
124
193
  Intent: locate
125
- Max tokens: 1500"
194
+ Max tokens: 1500
195
+ Findings file: [FINDINGS_PATH]"
126
196
  )
127
197
  ```
128
198
 
@@ -286,10 +356,59 @@ If validation_criteria present, include contract_compliance + contract_compliant
286
356
  )
287
357
  ```
288
358
 
289
- ### 2.5 Retry Loop
359
+ ### 2.5 Retry Loop (3-Strike Protocol)
290
360
 
291
361
  If `valid === false`: provide feedback, retry Actor (max 5 iterations).
292
362
 
363
+ **3-Strike Protocol** (for persistent failures):
364
+
365
+ ```bash
366
+ # Get progress file path
367
+ PROGRESS_PATH=$(.claude/skills/map-planning/scripts/get-plan-path.sh | sed 's/task_plan/progress/')
368
+ ```
369
+
370
+ ```
371
+ FOR attempt = 1 to 5:
372
+ IF attempt >= 3:
373
+ # Log to progress file
374
+ Append to PROGRESS_PATH:
375
+ | Timestamp | Subtask | Attempt | Error | Resolution |
376
+ |-----------|---------|---------|-------|------------|
377
+ | [ISO-8601] | [ST-XXX] | [attempt] | [Monitor feedback summary] | [pending] |
378
+
379
+ Call Actor with Monitor feedback
380
+ Call Monitor to validate
381
+
382
+ IF valid === true:
383
+ Update progress log: Resolution = "Fixed on attempt [N]"
384
+ BREAK
385
+
386
+ IF attempt === 3:
387
+ # Escalate after 3 failed attempts
388
+ AskUserQuestion(
389
+ questions: [{
390
+ header: "3-Strike Limit",
391
+ question: "Subtask [ST-XXX] failed 3 attempts.\n\nLast error: [Monitor feedback]\n\nHow to proceed?",
392
+ multiSelect: false,
393
+ options: [
394
+ { label: "CONTINUE", description: "Try 2 more attempts (max 5 total)" },
395
+ { label: "SKIP", description: "Mark subtask as blocked, move to next" },
396
+ { label: "ABORT", description: "Stop workflow, await manual fix" }
397
+ ]
398
+ }]
399
+ )
400
+
401
+ IF user selects "SKIP":
402
+ Update task_plan: **Status:** blocked
403
+ Update progress log: Resolution = "Marked blocked after 3 attempts"
404
+ CONTINUE to next subtask
405
+
406
+ IF user selects "ABORT":
407
+ Update task_plan: **Status:** blocked
408
+ Update Terminal State: **Status:** blocked
409
+ EXIT workflow
410
+ ```
411
+
293
412
  ### 2.5b Escalation Gate (AskUserQuestion)
294
413
 
295
414
  If Monitor returns `escalation_required === true`, you MUST ask user for confirmation before proceeding (Predictor and/or Apply).
@@ -338,7 +457,21 @@ Return ONLY valid JSON following Predictor schema."
338
457
 
339
458
  ### 2.7 Apply Changes
340
459
 
341
- Apply via Write/Edit tools. Proceed to next subtask.
460
+ Apply via Write/Edit tools.
461
+
462
+ ### 2.7.1 Update Plan Status
463
+
464
+ After Monitor returns `valid === true`:
465
+
466
+ ```
467
+ 1. Read current task_plan from PLAN_PATH
468
+ 2. Update current subtask: **Status:** in_progress → **Status:** complete
469
+ 3. Check validation criteria checkboxes [x]
470
+ 4. Set next pending subtask to **Status:** in_progress
471
+ 5. Update "Current Phase" to next subtask ID
472
+ ```
473
+
474
+ Proceed to next subtask.
342
475
 
343
476
  ### 2.8 Gate 2: Tests Available / Run
344
477
 
@@ -369,6 +502,12 @@ If none found: mark gate as skipped and proceed.
369
502
  ## Step 3: Summary
370
503
 
371
504
  - Run tests if applicable
505
+ - **Update Terminal State** in task_plan:
506
+ ```markdown
507
+ ## Terminal State
508
+ **Status:** complete
509
+ Reason: All [N] subtasks implemented and validated.
510
+ ```
372
511
  - Create commit (if requested)
373
512
  - Report: features implemented, files changed
374
513
 
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: map-planning
3
+ version: "1.0.0"
4
+ description: Implements file-based planning for MAP Framework workflows with branch-scoped task tracking in .map/ directory. Prevents goal drift via automatic plan synchronization before tool use and validates completion state on exit.
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
+ hooks:
7
+ PreToolUse:
8
+ - matcher: "Write|Edit|Bash"
9
+ hooks:
10
+ - type: command
11
+ command: "${CLAUDE_PLUGIN_ROOT}/scripts/show-focus.sh"
12
+ Stop:
13
+ - hooks:
14
+ - type: command
15
+ command: "${CLAUDE_PLUGIN_ROOT}/scripts/check-complete.sh"
16
+ ---
17
+
18
+ # MAP Planning Skill
19
+
20
+ Implements Manus-style file-based planning adapted for MAP Framework workflows. Uses branch-scoped persistent files to track goals, tasks, progress, and learnings across agent sessions.
21
+
22
+ ## Core Concept
23
+
24
+ Instead of relying solely on conversation context (limited window), this skill externalizes planning artifacts to the filesystem. The agent reads/writes structured files that survive context resets, enable progress resumption, and provide explicit traceability.
25
+
26
+ **Key Principle**: Filesystem as Extended Memory
27
+ - Plan defines "what to do" (phases, dependencies, criteria)
28
+ - Notes capture "what learned" (findings, errors, decisions)
29
+ - Progress tracked via checkboxes (visual state)
30
+ - Branch-specific scope (isolation between features/bugs)
31
+
32
+ ## File Structure
33
+
34
+ All files reside in `.map/` directory with branch-based naming:
35
+
36
+ ```
37
+ .map/
38
+ ├── task_plan_<branch>.md # Primary plan with phases and status
39
+ ├── findings_<branch>.md # Research findings, decisions, key files
40
+ └── progress_<branch>.md # Action log, errors, test results
41
+ ```
42
+
43
+ **Example**: On branch `feature-auth`:
44
+ - `.map/task_plan_feature-auth.md`
45
+ - `.map/findings_feature-auth.md`
46
+ - `.map/progress_feature-auth.md`
47
+
48
+ ## Hook Behavior
49
+
50
+ ### PreToolUse Hook (Before Write/Edit/Bash)
51
+
52
+ Runs `show-focus.sh` → extracts only the in_progress section (~200 tokens) and displays Goal + current phase. **Purpose**: Re-anchors agent to original goal before taking action, prevents goal drift.
53
+
54
+ ### Stop Hook (Before Agent Exit)
55
+
56
+ Runs `check-complete.sh` → validates all phases have terminal state before allowing exit.
57
+
58
+ **Terminal States**: `complete`, `blocked`, `won't_do`, `superseded`
59
+
60
+ ## Plan File Structure
61
+
62
+ ```markdown
63
+ # Task Plan: <Brief Title>
64
+
65
+ ## Goal
66
+ <One sentence describing end state>
67
+
68
+ ## Current Phase
69
+ ST-001
70
+
71
+ ## Phases
72
+
73
+ ### ST-001: <Title>
74
+ **Status:** in_progress
75
+ Risk: low|medium|high
76
+ Complexity: 1-10
77
+ Files: <paths>
78
+
79
+ Validation:
80
+ - [ ] <criterion 1>
81
+ - [ ] <criterion 2>
82
+
83
+ ### ST-002: <Title>
84
+ **Status:** pending
85
+ ...
86
+
87
+ ## Terminal State
88
+ **Status:** pending
89
+ Reason: [Not yet complete]
90
+ ```
91
+
92
+ ## Workflow Integration
93
+
94
+ ### Initialization
95
+ ```bash
96
+ ${CLAUDE_PLUGIN_ROOT}/scripts/init-session.sh
97
+ ```
98
+ Creates `.map/` directory and skeleton files for current branch.
99
+
100
+ ### Progress Tracking
101
+ - PreToolUse hook auto-displays focus before Write/Edit/Bash
102
+ - Update **Status:** in_progress → **Status:** complete as phases finish
103
+ - Check validation criteria checkboxes [x] when done
104
+
105
+ ### 3-Strike Error Protocol
106
+ Log errors to `progress_<branch>.md` after attempt 3+. After 3 failed attempts:
107
+ 1. Escalate to user (CONTINUE/SKIP/ABORT options)
108
+ 2. If SKIP: mark phase `blocked`, move to next subtask
109
+ 3. If ABORT: mark workflow `blocked`, exit
110
+
111
+ ### Terminal State
112
+ Update `## Terminal State` with final status before exiting. Stop hook validates this.
113
+
114
+ ## MAP Workflow Integration
115
+
116
+ When `/map-efficient` runs:
117
+ 1. `init-session.sh` creates `.map/` skeleton
118
+ 2. task-decomposer populates phases from blueprint
119
+ 3. Actor implements → PreToolUse hook shows focus
120
+ 4. Monitor validates → outputs `status_update` field
121
+ 5. Orchestrator updates task_plan using Monitor's status_update
122
+ 6. Stop hook validates terminal state before exit
123
+
124
+ `/map-fast` skips planning — hooks are no-op if plan missing.
125
+
126
+ ## Single-Writer Governance
127
+
128
+ Only Monitor agent updates task_plan status (via `status_update` output field).
129
+
130
+ | Agent | Read task_plan | Write task_plan |
131
+ |-------|----------------|-----------------|
132
+ | task-decomposer | No | Yes (creates) |
133
+ | Actor | Yes | No |
134
+ | Monitor | Yes | Yes (status only) |
135
+ | Predictor | Yes | No |
136
+ | Orchestrator | Yes | No (applies Monitor output) |
137
+
138
+ **Why**: Prevents race conditions, ensures consistent state, clear ownership.
139
+
140
+ ## Best Practices
141
+
142
+ - **Goal clarity**: Specific, measurable outcomes
143
+ - **Granular phases**: Each phase = 1 agent action
144
+ - **Checkpoint frequently**: Update status immediately after completion
145
+ - **Terminal state early**: Mark `blocked` as soon as blocker identified
146
+
147
+ ## Error Handling
148
+
149
+ | Issue | Fix |
150
+ |-------|-----|
151
+ | Plan not found | Run `init-session.sh` |
152
+ | Stop hook warns "No terminal state" | Update `## Terminal State` section |
153
+ | Branch name with `/` | Scripts sanitize: `feature/auth` → `feature-auth` |
154
+
155
+ ## Terminal States
156
+
157
+ | State | When |
158
+ |-------|------|
159
+ | `complete` | All phases finished, criteria met |
160
+ | `blocked` | Needs external input (human, resource) |
161
+ | `won't_do` | Task intentionally cancelled |
162
+ | `superseded` | Replaced by different approach |
163
+
164
+ ---
165
+
166
+ **Version**: 1.0.0 (2025-01-10)
167
+
168
+ **References**:
169
+ - [planning-with-files](https://github.com/OthmanAdi/planning-with-files) - Original pattern
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # check-complete.sh - Verify all phases have terminal state (Stop hook)
4
+ #
5
+ # Description:
6
+ # Called by Stop hook before agent session ends.
7
+ # Counts phases by status and verifies all have reached terminal state.
8
+ # Terminal states: complete, blocked, won't_do, superseded
9
+ #
10
+ # Usage:
11
+ # ${CLAUDE_PLUGIN_ROOT}/scripts/check-complete.sh
12
+ #
13
+ # Exit codes:
14
+ # 0 - All phases in terminal state (OK to stop)
15
+ # 1 - Phases still pending/in_progress (do not stop)
16
+ # 0 - No plan file (OK to stop - planning not used)
17
+
18
+ # Get script directory for calling sibling scripts
19
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20
+
21
+ # Get the branch-specific plan file path
22
+ PLAN_FILE=$("$SCRIPT_DIR/get-plan-path.sh")
23
+
24
+ # If no plan file exists, allow stop (planning not being used)
25
+ if [ ! -f "$PLAN_FILE" ]; then
26
+ exit 0
27
+ fi
28
+
29
+ echo "=== Task Completion Check ==="
30
+ echo "Plan: $PLAN_FILE"
31
+ echo ""
32
+
33
+ # Count phases by status
34
+ # NOTE: grep -c outputs "0" but exits 1 on no matches, causing || to trigger
35
+ # Use: VAR=$(grep ...) || VAR=0 pattern to avoid double output
36
+ COMPLETE=$(grep -cF "**Status:** complete" "$PLAN_FILE" 2>/dev/null) || COMPLETE=0
37
+ BLOCKED=$(grep -cF "**Status:** blocked" "$PLAN_FILE" 2>/dev/null) || BLOCKED=0
38
+ WONT_DO=$(grep -cF "**Status:** won't_do" "$PLAN_FILE" 2>/dev/null) || WONT_DO=0
39
+ SUPERSEDED=$(grep -cF "**Status:** superseded" "$PLAN_FILE" 2>/dev/null) || SUPERSEDED=0
40
+ IN_PROGRESS=$(grep -cF "**Status:** in_progress" "$PLAN_FILE" 2>/dev/null) || IN_PROGRESS=0
41
+ PENDING=$(grep -cF "**Status:** pending" "$PLAN_FILE" 2>/dev/null) || PENDING=0
42
+
43
+ # TOTAL = sum of all status lines (not all ## headers, which includes Goal, Decisions, etc.)
44
+ TOTAL=$((COMPLETE + BLOCKED + WONT_DO + SUPERSEDED + IN_PROGRESS + PENDING))
45
+
46
+ # Calculate terminal states (complete + blocked + won't_do + superseded)
47
+ TERMINAL=$((COMPLETE + BLOCKED + WONT_DO + SUPERSEDED))
48
+
49
+ echo "Total phases: $TOTAL"
50
+ echo "Terminal: $TERMINAL (complete: $COMPLETE, blocked: $BLOCKED, won't_do: $WONT_DO, superseded: $SUPERSEDED)"
51
+ echo "In progress: $IN_PROGRESS"
52
+ echo "Pending: $PENDING"
53
+ echo ""
54
+
55
+ # Check completion: all phases must be in terminal state
56
+ if [ "$TERMINAL" -ge "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then
57
+ echo "✅ ALL PHASES COMPLETE OR TERMINAL"
58
+ exit 0
59
+ else
60
+ echo "⚠️ TASK NOT COMPLETE"
61
+ echo ""
62
+ echo "Do not stop until all phases reach terminal state:"
63
+ echo " - complete: Phase finished successfully"
64
+ echo " - blocked: Waiting on external dependency"
65
+ echo " - won't_do: Decided not to implement"
66
+ echo " - superseded: Replaced by different approach"
67
+ exit 1
68
+ fi
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # get-plan-path.sh - Generate branch-scoped task plan file path
4
+ #
5
+ # Description:
6
+ # Detects current git branch and outputs path to branch-specific task plan file.
7
+ # Sanitizes branch names by replacing '/' with '-' for filesystem compatibility.
8
+ # Defaults to 'main' branch when not in a git repository.
9
+ #
10
+ # Usage:
11
+ # PLAN_PATH=$(bash .claude/skills/map-planning/scripts/get-plan-path.sh)
12
+ #
13
+ # Output:
14
+ # .map/task_plan_<sanitized_branch_name>.md
15
+ #
16
+ # Examples:
17
+ # Branch: feature/map-planning -> .map/task_plan_feature-map-planning.md
18
+ # Branch: main -> .map/task_plan_main.md
19
+ # Not in repo -> .map/task_plan_main.md
20
+
21
+ set -euo pipefail
22
+
23
+ # Detect current git branch, default to 'main' if not in git repo
24
+ BRANCH=$(git branch --show-current 2>/dev/null || echo 'main')
25
+
26
+ # Handle empty branch (detached HEAD or git issue)
27
+ if [ -z "$BRANCH" ]; then
28
+ BRANCH="main"
29
+ fi
30
+
31
+ # Sanitize branch name: replace '/' with '-' for filesystem safety
32
+ SANITIZED_BRANCH=$(echo "$BRANCH" | tr '/' '-')
33
+
34
+ # Output the plan file path
35
+ echo ".map/task_plan_${SANITIZED_BRANCH}.md"
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # init-session.sh - Initialize planning files for new MAP session
4
+ #
5
+ # Description:
6
+ # Creates .map/ directory and copies templates for branch-scoped planning files.
7
+ # Idempotent: skips files that already exist.
8
+ #
9
+ # Usage:
10
+ # ${CLAUDE_PLUGIN_ROOT}/scripts/init-session.sh
11
+ #
12
+ # Created files:
13
+ # .map/task_plan_<branch>.md
14
+ # .map/findings_<branch>.md
15
+ # .map/progress_<branch>.md
16
+
17
+ set -euo pipefail
18
+
19
+ # Get script directory for accessing templates
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
22
+ TEMPLATE_DIR="$SKILL_ROOT/templates"
23
+
24
+ # Get branch name for file naming
25
+ BRANCH=$(git branch --show-current 2>/dev/null || echo 'main')
26
+ if [ -z "$BRANCH" ]; then
27
+ BRANCH="main"
28
+ fi
29
+ SANITIZED_BRANCH=$(echo "$BRANCH" | tr '/' '-')
30
+
31
+ # Create .map directory
32
+ MAP_DIR=".map"
33
+ mkdir -p "$MAP_DIR"
34
+
35
+ # Define file paths
36
+ TASK_PLAN="$MAP_DIR/task_plan_${SANITIZED_BRANCH}.md"
37
+ FINDINGS="$MAP_DIR/findings_${SANITIZED_BRANCH}.md"
38
+ PROGRESS="$MAP_DIR/progress_${SANITIZED_BRANCH}.md"
39
+
40
+ echo "=== MAP Planning Session Initialization ==="
41
+ echo "Branch: $BRANCH (sanitized: $SANITIZED_BRANCH)"
42
+ echo ""
43
+
44
+ # Copy templates if files don't exist (idempotent)
45
+ copy_if_missing() {
46
+ local src="$1"
47
+ local dst="$2"
48
+ local name="$3"
49
+
50
+ if [ -f "$dst" ]; then
51
+ echo "✓ $name already exists: $dst"
52
+ elif [ -f "$src" ]; then
53
+ cp "$src" "$dst"
54
+ echo "✓ Created $name: $dst"
55
+ else
56
+ echo "⚠ Template not found: $src (skipping $name)"
57
+ fi
58
+ }
59
+
60
+ copy_if_missing "$TEMPLATE_DIR/task_plan.md" "$TASK_PLAN" "task_plan"
61
+ copy_if_missing "$TEMPLATE_DIR/findings.md" "$FINDINGS" "findings"
62
+ copy_if_missing "$TEMPLATE_DIR/progress.md" "$PROGRESS" "progress"
63
+
64
+ echo ""
65
+ echo "=== Session Ready ==="
66
+ echo "Edit $TASK_PLAN to define your phases."
67
+ echo ""
68
+ echo "Next steps:"
69
+ echo "1. Define goal in task_plan"
70
+ echo "2. Add phases with **Status:** pending"
71
+ echo "3. Start working - PreToolUse hook will show focus"
72
+ echo "4. Update status as phases complete"
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # show-focus.sh - Display current task plan focus (PreToolUse hook)
4
+ #
5
+ # Description:
6
+ # Called by PreToolUse hook before Write/Edit/Bash operations.
7
+ # Extracts ONLY the in_progress section (~200 tokens) to prevent goal drift.
8
+ # Shows: Goal + Current in_progress phase details.
9
+ #
10
+ # Usage:
11
+ # ${CLAUDE_PLUGIN_ROOT}/scripts/show-focus.sh
12
+ #
13
+ # Exit codes:
14
+ # 0 - Always (even if plan file doesn't exist)
15
+
16
+ # Get script directory for calling sibling scripts
17
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
+
19
+ # Get the branch-specific plan file path
20
+ PLAN_FILE=$("$SCRIPT_DIR/get-plan-path.sh")
21
+
22
+ # If no plan file, exit silently
23
+ [ ! -f "$PLAN_FILE" ] && exit 0
24
+
25
+ # Extract goal (line after "## Goal")
26
+ GOAL=$(awk '/^## Goal/{getline; if(!/^#/ && !/^$/) print; exit}' "$PLAN_FILE")
27
+
28
+ # Extract ONLY the current in_progress phase section.
29
+ # Stop at the next phase (###) OR next top-level section (##) to avoid token bloat.
30
+ # Cap output by lines as a simple proxy for token budget.
31
+ FOCUS_MAX_LINES="${FOCUS_MAX_LINES:-40}"
32
+ IN_PROGRESS_SECTION=$(
33
+ awk '
34
+ /^### / {
35
+ if (in_section) exit
36
+ header = $0
37
+ next
38
+ }
39
+ /^## / {
40
+ if (in_section) exit
41
+ }
42
+ /\*\*Status:\*\* in_progress/ {
43
+ in_section = 1
44
+ if (header != "") print header
45
+ print
46
+ next
47
+ }
48
+ in_section { print }
49
+ ' "$PLAN_FILE" | head -n "$FOCUS_MAX_LINES"
50
+ )
51
+
52
+ # Only output if we found an in_progress section
53
+ if [ -n "$IN_PROGRESS_SECTION" ]; then
54
+ BRANCH=$(basename "$PLAN_FILE" .md | sed 's/task_plan_//')
55
+ echo "───── MAP FOCUS ($BRANCH) ─────"
56
+ [ -n "$GOAL" ] && echo "Goal: $GOAL"
57
+ echo ""
58
+ echo "$IN_PROGRESS_SECTION"
59
+ echo "─────────────────────────────────"
60
+ fi
61
+
62
+ exit 0
@@ -0,0 +1,62 @@
1
+ # Findings & Decisions
2
+ <!--
3
+ WHAT: Your knowledge base for the task. Stores everything you discover.
4
+ WHY: Context windows are limited. This file is your "external memory."
5
+ WHEN: Update after ANY discovery, especially from research-agent output.
6
+ -->
7
+
8
+ ## Requirements
9
+ <!--
10
+ WHAT: What needs to be built, broken into specific requirements.
11
+ WHY: Keeps requirements visible so you don't forget what you're building.
12
+ WHEN: Fill this in during research phase.
13
+ -->
14
+ -
15
+
16
+ ## Research Findings
17
+ <!--
18
+ WHAT: Key discoveries from codebase exploration, web searches, documentation.
19
+ WHY: Preserves knowledge that might be lost when context resets.
20
+ WHEN: Update after research-agent returns, or after exploring code.
21
+ -->
22
+ -
23
+
24
+ ## Technical Decisions
25
+ <!--
26
+ WHAT: Architecture and implementation choices with reasoning.
27
+ WHY: You'll forget why you chose an approach. This table preserves that.
28
+ EXAMPLE:
29
+ | Use existing auth library | Reduces complexity, tested code |
30
+ -->
31
+ | Decision | Rationale |
32
+ |----------|-----------|
33
+ | | |
34
+
35
+ ## Key Files
36
+ <!--
37
+ WHAT: Important files discovered during research.
38
+ WHY: Quick reference for relevant code locations.
39
+ EXAMPLE:
40
+ - src/auth/jwt.ts: Token generation logic
41
+ - src/middleware/auth.ts: Request validation
42
+ -->
43
+ -
44
+
45
+ ## Issues Encountered
46
+ <!--
47
+ WHAT: Problems encountered and how they were solved.
48
+ WHY: Helps avoid repeating same mistakes.
49
+ -->
50
+ | Issue | Resolution |
51
+ |-------|------------|
52
+ | | |
53
+
54
+ ## Resources
55
+ <!--
56
+ WHAT: URLs, file paths, API references found useful.
57
+ WHY: Easy reference for later.
58
+ -->
59
+ -
60
+
61
+ ---
62
+ *Update after research-agent output or codebase exploration*
@@ -0,0 +1,75 @@
1
+ # Progress Log
2
+ <!--
3
+ WHAT: Chronological record of what you did, when, and what happened.
4
+ WHY: Answers "What have I done?" Helps resume after breaks.
5
+ WHEN: Update after completing each phase or encountering errors.
6
+ -->
7
+
8
+ ## Session: [DATE]
9
+ <!--
10
+ WHAT: The date of this work session.
11
+ EXAMPLE: 2025-01-10
12
+ -->
13
+
14
+ ### Phase 1: [Title]
15
+ <!--
16
+ WHAT: Detailed log of actions during this phase.
17
+ WHY: Provides context for what was done, making it easier to resume.
18
+ -->
19
+ - **Status:** in_progress
20
+ - **Started:** [timestamp]
21
+ - Actions taken:
22
+ -
23
+ - Files created/modified:
24
+ -
25
+
26
+ ### Phase 2: [Title]
27
+ - **Status:** pending
28
+ - Actions taken:
29
+ -
30
+ - Files created/modified:
31
+ -
32
+
33
+ ## Test Results
34
+ <!--
35
+ WHAT: Tests run, expected vs actual results.
36
+ WHY: Documents verification of functionality.
37
+ -->
38
+ | Test | Input | Expected | Actual | Status |
39
+ |------|-------|----------|--------|--------|
40
+ | | | | | |
41
+
42
+ ## Error Log
43
+ <!--
44
+ WHAT: Every error with timestamp and resolution attempts.
45
+ WHY: Detailed error history helps avoid repetition.
46
+
47
+ 3-STRIKE PROTOCOL:
48
+ - Attempt 1: Diagnose & fix
49
+ - Attempt 2: Try different approach
50
+ - Attempt 3: Broader rethink
51
+ - After 3 failures: Escalate to user
52
+ -->
53
+ | Timestamp | Error | Attempt | Resolution |
54
+ |-----------|-------|---------|------------|
55
+ | | | 1 | |
56
+
57
+ ## 5-Question Reboot Check
58
+ <!--
59
+ If you can answer these, your context is solid:
60
+ 1. Where am I? → Current phase
61
+ 2. Where am I going? → Remaining phases
62
+ 3. What's the goal? → Goal in task_plan
63
+ 4. What have I learned? → See findings.md
64
+ 5. What have I done? → See above
65
+ -->
66
+ | Question | Answer |
67
+ |----------|--------|
68
+ | Where am I? | Phase X |
69
+ | Where am I going? | Remaining phases |
70
+ | What's the goal? | [goal statement] |
71
+ | What have I learned? | See findings.md |
72
+ | What have I done? | See above |
73
+
74
+ ---
75
+ *Update after completing each phase or encountering errors*
@@ -0,0 +1,70 @@
1
+ # Task Plan: [Brief Description]
2
+ <!--
3
+ WHAT: Your roadmap for MAP workflow - "working memory on disk."
4
+ WHY: After 50+ tool calls, original goals get forgotten. This file keeps them fresh.
5
+ WHEN: Create FIRST via init-session.sh. Update after each phase completes.
6
+ -->
7
+
8
+ ## Goal
9
+ <!--
10
+ WHAT: One clear sentence describing end state.
11
+ EXAMPLE: "Implement JWT authentication for the API with refresh token support."
12
+ -->
13
+ [One sentence describing the end state]
14
+
15
+ ## Current Phase
16
+ ST-001
17
+
18
+ ## Phases
19
+ <!--
20
+ TERMINAL STATES (Stop hook accepts):
21
+ - complete: Phase finished successfully
22
+ - blocked: Waiting on external dependency
23
+ - won't_do: Decided not to implement
24
+ - superseded: Replaced by different approach
25
+ -->
26
+
27
+ ### ST-001: [subtask.title]
28
+ **Status:** in_progress
29
+ Risk: [risk_level]
30
+ Complexity: [complexity_score]
31
+ Files: [affected_files]
32
+
33
+ Validation:
34
+ - [ ] [validation_criteria[0]]
35
+ - [ ] [validation_criteria[1]]
36
+
37
+ ### ST-002: [subtask.title]
38
+ **Status:** pending
39
+ Risk: [risk_level]
40
+ Complexity: [complexity_score]
41
+ Files: [affected_files]
42
+
43
+ Validation:
44
+ - [ ] [validation_criteria[0]]
45
+ - [ ] [validation_criteria[1]]
46
+
47
+ ## Decisions Made
48
+ | Decision | Rationale |
49
+ |----------|-----------|
50
+ | | |
51
+
52
+ ## Errors Encountered
53
+ | Error | Attempt | Resolution |
54
+ |-------|---------|------------|
55
+ | | 1 | |
56
+
57
+ ## Terminal State
58
+ <!--
59
+ VALUES:
60
+ - pending: Task not finished (blocks exit)
61
+ - complete: All phases finished successfully
62
+ - blocked: Cannot proceed (needs external input)
63
+ - won't_do: Task intentionally cancelled
64
+ - superseded: Replaced by different approach
65
+ -->
66
+ **Status:** pending
67
+ Reason: [Not yet complete]
68
+
69
+ ---
70
+ *PreToolUse hook shows this before actions. Stop hook validates terminal state.*