@theglitchking/persistent-planning 3.0.0 → 3.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 (69) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.documentation/INDEX.md +216 -0
  4. package/.documentation/README.md +90 -0
  5. package/.documentation/REGISTRY.md +80 -0
  6. package/.documentation/agents/INDEX.md +43 -0
  7. package/.documentation/agents/REGISTRY.md +38 -0
  8. package/.documentation/api/INDEX.md +43 -0
  9. package/.documentation/api/REGISTRY.md +38 -0
  10. package/.documentation/architecture/INDEX.md +48 -0
  11. package/.documentation/architecture/REGISTRY.md +53 -0
  12. package/{docs/reference.md → .documentation/architecture/context-engineering-principles.md} +20 -1
  13. package/{docs → .documentation/architecture}/lg-mode.md +17 -8
  14. package/.documentation/archive/README.md +46 -0
  15. package/.documentation/backups/INDEX.md +43 -0
  16. package/.documentation/backups/REGISTRY.md +38 -0
  17. package/.documentation/database/INDEX.md +43 -0
  18. package/.documentation/database/REGISTRY.md +38 -0
  19. package/.documentation/devops/INDEX.md +43 -0
  20. package/.documentation/devops/REGISTRY.md +38 -0
  21. package/.documentation/drafts/.gitkeep +1 -0
  22. package/.documentation/features/INDEX.md +43 -0
  23. package/.documentation/features/REGISTRY.md +38 -0
  24. package/.documentation/plans/INDEX.md +43 -0
  25. package/.documentation/plans/REGISTRY.md +38 -0
  26. package/.documentation/procedures/INDEX.md +42 -0
  27. package/.documentation/procedures/REGISTRY.md +51 -0
  28. package/.documentation/procedures/plan-completion-and-archive.md +151 -0
  29. package/.documentation/quickstart/INDEX.md +42 -0
  30. package/.documentation/quickstart/REGISTRY.md +51 -0
  31. package/{docs → .documentation/quickstart}/examples.md +20 -0
  32. package/.documentation/reference/INDEX.md +42 -0
  33. package/.documentation/reference/REGISTRY.md +51 -0
  34. package/{docs → .documentation/reference}/workspace-json.md +11 -5
  35. package/.documentation/security/INDEX.md +43 -0
  36. package/.documentation/security/REGISTRY.md +38 -0
  37. package/.documentation/standards/INDEX.md +43 -0
  38. package/.documentation/standards/REGISTRY.md +53 -0
  39. package/{docs → .documentation/standards}/atom-granularity.md +12 -5
  40. package/.documentation/standards/mandatory-closing-phases.md +125 -0
  41. package/.documentation/testing/INDEX.md +42 -0
  42. package/.documentation/testing/REGISTRY.md +51 -0
  43. package/.documentation/testing/test-suite.md +88 -0
  44. package/.documentation/troubleshooting/INDEX.md +43 -0
  45. package/.documentation/troubleshooting/REGISTRY.md +38 -0
  46. package/.documentation/workflows/INDEX.md +43 -0
  47. package/.documentation/workflows/REGISTRY.md +38 -0
  48. package/CHANGELOG.md +59 -0
  49. package/README.md +67 -7
  50. package/commands/archive-plan.md +66 -0
  51. package/commands/plan-status.md +62 -0
  52. package/commands/start-atom.md +3 -3
  53. package/commands/start-planning.md +2 -2
  54. package/commands/start-task.md +2 -2
  55. package/hooks/session-start.js +79 -8
  56. package/package.json +8 -4
  57. package/scripts/archive-plan.sh +146 -0
  58. package/scripts/detect-mode.sh +67 -0
  59. package/scripts/init-atom.sh +139 -0
  60. package/scripts/init-phase.sh +141 -0
  61. package/scripts/init-planning.sh +256 -0
  62. package/scripts/init-task.sh +118 -0
  63. package/scripts/lib/planning.sh +161 -0
  64. package/scripts/plan-status.sh +121 -0
  65. package/skills/persistent-planning/SKILL.md +34 -9
  66. package/templates/lg/atom.md +45 -0
  67. package/templates/lg/notes.md +40 -0
  68. package/templates/lg/phase.md +58 -0
  69. package/templates/lg/task.md +54 -0
@@ -0,0 +1,121 @@
1
+ #!/bin/bash
2
+ ###############################################################################
3
+ # plan-status.sh - Report completion status for every plan under .planning/
4
+ #
5
+ # Usage:
6
+ # bash scripts/plan-status.sh # table of every active plan
7
+ # bash scripts/plan-status.sh --nudge # one line if plans are archivable, else silence
8
+ # bash scripts/plan-status.sh --complete # print the slug of each complete plan, one per line
9
+ #
10
+ # A plan is COMPLETE when every checkbox in it is checked, or when its
11
+ # top-level artifact declares `status: done` in frontmatter. Completion is
12
+ # derived from the artifacts themselves so no separate state file can drift
13
+ # away from what the plan actually says.
14
+ #
15
+ # This is the single implementation of the scan: the SessionStart hook and the
16
+ # /plan-status slash command both shell out to it.
17
+ ###############################################################################
18
+ set -uo pipefail
19
+
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ source "${SCRIPT_DIR}/lib/planning.sh"
22
+
23
+ MODE="table"
24
+ case "${1:-}" in
25
+ --nudge) MODE="nudge" ;;
26
+ --complete) MODE="complete" ;;
27
+ -h|--help)
28
+ sed -n '2,18p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
29
+ exit 0
30
+ ;;
31
+ "") ;;
32
+ *)
33
+ planning_err "Unknown option: $1 (try --help)"
34
+ exit 1
35
+ ;;
36
+ esac
37
+
38
+ PLANNING="$(planning_dir)"
39
+ [[ -d "$PLANNING" ]] || { [[ "$MODE" == "table" ]] && planning_warn "No .planning/ directory here."; exit 0; }
40
+
41
+ # plan_root_artifact <plan-dir> -> path of the plan's top-level file, or empty
42
+ plan_root_artifact() {
43
+ for f in "$1/phase.md" "$1/task_plan.md" "$1/task.md"; do
44
+ [[ -f "$f" ]] && { echo "$f"; return; }
45
+ done
46
+ }
47
+
48
+ # frontmatter_status <file> -> value of `status:` inside the leading --- block
49
+ frontmatter_status() {
50
+ [[ -f "$1" ]] || return
51
+ awk 'NR==1 && $0 != "---" { exit }
52
+ NR>1 && $0 == "---" { exit }
53
+ /^status:[[:space:]]*/ { sub(/^status:[[:space:]]*/, ""); gsub(/["\047]/, ""); print; exit }' "$1"
54
+ }
55
+
56
+ # Emits "<total> <checked>" for every markdown file under a plan directory.
57
+ count_boxes() {
58
+ local total checked
59
+ total=$(grep -rhoE '^[[:space:]]*- \[[ xX]\] ' --include='*.md' "$1" 2>/dev/null | wc -l | tr -d ' ')
60
+ checked=$(grep -rhoE '^[[:space:]]*- \[[xX]\] ' --include='*.md' "$1" 2>/dev/null | wc -l | tr -d ' ')
61
+ echo "$total $checked"
62
+ }
63
+
64
+ COMPLETE=()
65
+ ROWS=()
66
+
67
+ for plan_path in "$PLANNING"/*/; do
68
+ [[ -d "$plan_path" ]] || continue
69
+ slug=$(basename "$plan_path")
70
+ case "$slug" in .meta|.archive|archive) continue ;; esac
71
+
72
+ root=$(plan_root_artifact "${plan_path%/}")
73
+ [[ -n "$root" ]] || continue
74
+
75
+ read -r total checked <<<"$(count_boxes "${plan_path%/}")"
76
+ status=$(frontmatter_status "$root")
77
+ blocked=$(grep -rl '^status: blocked' --include='*.md' "${plan_path%/}" 2>/dev/null | wc -l | tr -d ' ')
78
+
79
+ if [[ "$status" == "archived" ]]; then
80
+ verdict="archived"
81
+ elif [[ "$status" == "done" ]] || { [[ "$total" -gt 0 ]] && [[ "$checked" -eq "$total" ]]; }; then
82
+ verdict="COMPLETE"
83
+ COMPLETE+=("$slug")
84
+ elif [[ "$blocked" -gt 0 ]]; then
85
+ verdict="blocked"
86
+ elif [[ "$total" -eq 0 ]]; then
87
+ verdict="empty"
88
+ else
89
+ verdict="in progress"
90
+ fi
91
+
92
+ ROWS+=("$(printf '%-38s %-12s %s/%s boxes' "$slug" "$verdict" "$checked" "$total")")
93
+ done
94
+
95
+ case "$MODE" in
96
+ complete)
97
+ printf '%s\n' "${COMPLETE[@]+"${COMPLETE[@]}"}"
98
+ ;;
99
+ nudge)
100
+ if [[ ${#COMPLETE[@]} -gt 0 ]]; then
101
+ printf 'persistent-planning: %d plan(s) complete but not archived — %s. Archive with: /archive-plan <slug>\n' \
102
+ "${#COMPLETE[@]}" "$(IFS=', '; echo "${COMPLETE[*]}")"
103
+ fi
104
+ ;;
105
+ table)
106
+ if [[ ${#ROWS[@]} -eq 0 ]]; then
107
+ planning_warn "No plans found under .planning/."
108
+ exit 0
109
+ fi
110
+ planning_log "Plans under .planning/"
111
+ echo ""
112
+ printf ' %-38s %-12s %s\n' "PLAN" "STATUS" "PROGRESS"
113
+ printf ' %s\n' "$(printf '%.0s-' {1..70})"
114
+ printf ' %s\n' "${ROWS[@]}"
115
+ echo ""
116
+ if [[ ${#COMPLETE[@]} -gt 0 ]]; then
117
+ planning_ok "${#COMPLETE[@]} plan(s) ready to archive:"
118
+ for s in "${COMPLETE[@]}"; do echo " bash scripts/archive-plan.sh $s"; done
119
+ fi
120
+ ;;
121
+ esac
@@ -160,6 +160,16 @@ Create this file FIRST for any complex task:
160
160
  - [ ] Phase 2: Research/gather information
161
161
  - [ ] Phase 3: Execute/build
162
162
  - [ ] Phase 4: Review and deliver
163
+ - [ ] Phase 5: Validate success through comprehensive testing (MANDATORY)
164
+ - [ ] Phase 6: Documentation pass -- create/update/deprecate docs (MANDATORY)
165
+
166
+ > Phases 5 and 6 are mandatory and MUST stay the last two phases of this plan.
167
+ > Insert new work above them; never after. Renumber them if you add phases.
168
+ >
169
+ > - **Validate success**: prove the work with tests that fail if the change breaks.
170
+ > - **Documentation pass**: create/update/deprecate every doc this change touches --
171
+ > what it is, where it lives, how to fix it, how to operate it, why it matters.
172
+ > If hit-em-with-the-docs is installed, use it for this pass.
163
173
 
164
174
  ## Key Questions
165
175
  1. [Question to answer]
@@ -217,17 +227,29 @@ Large outputs go to files, not context. Keep only paths in working memory.
217
227
  ### 5. Log All Errors
218
228
  Every error goes in the "Errors Encountered" section. This builds knowledge for future tasks.
219
229
 
220
- ### 6. Easy Cleanup
221
- When a task is complete, delete the task directory:
222
- ```bash
223
- rm -rf .planning/[task-name]/
224
- ```
230
+ ### 6. Archive on Completion, Don't Delete
231
+ A plan is **complete** when every checkbox in it is checked (or its top-level
232
+ artifact declares `status: done`). Completion is derived from the artifacts, so
233
+ checking the last box IS the completion signal -- there is no separate state to
234
+ update and no way for it to drift.
225
235
 
226
- Or clean up everything:
236
+ When a plan is complete, archive it rather than deleting it:
227
237
  ```bash
228
- rm -rf .planning/
238
+ /plan-status # which plans are COMPLETE?
239
+ /archive-plan [task-name] # -> .planning/.archive/[task-name]/
229
240
  ```
230
241
 
242
+ Archiving moves the plan to the gitignored `.planning/.archive/` and stamps it
243
+ `status: archived` + `archived_on`. The active `.planning/` tree then shows only
244
+ live work. Nothing is destroyed -- restore with
245
+ `mv .planning/.archive/[task-name] .planning/[task-name]`.
246
+
247
+ The SessionStart hook checks for complete-but-unarchived plans and says so at the
248
+ top of the session, so a finished plan gets retired instead of rediscovered.
249
+
250
+ Deleting is still available (`rm -rf .planning/[task-name]/`) but throws away the
251
+ record of what was done and why. Prefer the archive.
252
+
231
253
  ## When to Use This Pattern
232
254
 
233
255
  **Use 3-file pattern for:**
@@ -254,14 +276,17 @@ rm -rf .planning/
254
276
  | Overwrite previous plans | Use `/start-planning` (auto-creates unique task dir) |
255
277
  | Start executing immediately | Run `/start-planning "task name"` FIRST |
256
278
  | Switch tasks without saving | Update task_plan.md before switching |
279
+ | `rm -rf` a finished plan | `/archive-plan <slug>` -- keeps the record, clears the tree |
280
+ | Leave finished plans in `.planning/` | Archive them; the active tree should show only live work |
281
+ | Track completion in your head or in chat | Check the boxes -- the artifact is the status |
257
282
 
258
283
  ## Advanced Patterns
259
284
 
260
- See [reference.md](../docs/reference.md) for:
285
+ See [Manus Context Engineering Principles](../../.documentation/architecture/context-engineering-principles.md) for:
261
286
  - Attention manipulation techniques
262
287
  - Error recovery patterns
263
288
  - Context optimization principles
264
289
 
265
- See [examples.md](../docs/examples.md) for:
290
+ See [Worked Examples](../../.documentation/quickstart/examples.md) for:
266
291
  - Real task examples
267
292
  - Complex workflow patterns
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: ATOM_TITLE_PLACEHOLDER
3
+ tier: plan
4
+ domains:
5
+ - planning
6
+ status: ready
7
+ last_updated: "ATOM_DATE_PLACEHOLDER"
8
+ plan_kind: atom
9
+ parent: TASK_SLUG_PLACEHOLDER
10
+ sequence: ATOM_SEQUENCE_PLACEHOLDER
11
+ ---
12
+
13
+ # Atom: ATOM_TITLE_PLACEHOLDER
14
+
15
+ **Task**: `TASK_SLUG_PLACEHOLDER`
16
+ **Sequence**: `ATOM_SEQUENCE_PLACEHOLDER` (atoms within a task are processed sequentially)
17
+
18
+ ## What to do
19
+ [Describe the atomic action a subagent should take. Single focused step. If the work
20
+ spans more than one logical operation, split into multiple atoms with sequential ordering.
21
+
22
+ This file IS the contract a subagent reads to know exactly what to do. Be specific.]
23
+
24
+ ## Inputs
25
+ [Files, data, or prior atom outputs this atom depends on.]
26
+
27
+ ## Expected outputs
28
+ [Files modified, files created, commands run, or state changed.]
29
+
30
+ ## Acceptance criteria
31
+ [How a subagent (or human reviewer) confirms this atom is done. Should be concrete
32
+ and verifiable.]
33
+
34
+ ## Status
35
+ **Currently ready** — waiting for a subagent to claim it.
36
+
37
+ Status enum: `ready | in_progress | done | blocked`
38
+
39
+ Status transitions:
40
+ - `ready → in_progress`: a subagent claims this atom
41
+ - `in_progress → done`: the subagent completes the work and verifies acceptance criteria
42
+ - `in_progress → blocked`: the subagent hits an obstacle (add a note explaining why
43
+ in a `## Blocker` section)
44
+ - `done → in_progress` (reopen): allowed when a follow-up correction is needed; adds
45
+ `reopened_at: <iso-timestamp>` field to frontmatter for audit
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: NOTES_TITLE_PLACEHOLDER
3
+ tier: plan
4
+ domains:
5
+ - planning
6
+ status: active
7
+ last_updated: "NOTES_DATE_PLACEHOLDER"
8
+ plan_kind: notes
9
+ scope: NOTES_SCOPE_PLACEHOLDER
10
+ ---
11
+
12
+ # Notes: NOTES_TITLE_PLACEHOLDER
13
+
14
+ **Scope**: `NOTES_SCOPE_PLACEHOLDER` (which phase / task this notes file is attached to)
15
+
16
+ ## Key Findings
17
+ [Findings that emerged during plan implementation. Things that didn't fit cleanly into
18
+ a task or atom but matter for context.]
19
+
20
+ ## Research Sources
21
+ [External references, internal docs, conversations that informed decisions.]
22
+
23
+ ## Synthesized Findings
24
+ [Patterns, themes, distilled understanding from the research.]
25
+
26
+ ## Decisions Made
27
+ [Notes-level decisions that affect the parent task or phase. Promote to the parent's
28
+ Decisions Made section if they have wider impact.]
29
+
30
+ ## Errors & Solutions
31
+ [Errors encountered + how they were resolved. Useful for future similar work.]
32
+
33
+ ---
34
+
35
+ ## Append-Only Log
36
+ [Chronological record of progress. Each entry is dated. Useful for handoff and
37
+ reconstructing context after time away.]
38
+
39
+ ### NOTES_DATE_PLACEHOLDER — Initialized
40
+ - Notes file created
@@ -0,0 +1,58 @@
1
+ ---
2
+ title: PHASE_TITLE_PLACEHOLDER
3
+ tier: plan
4
+ domains:
5
+ - planning
6
+ status: draft
7
+ last_updated: "PHASE_DATE_PLACEHOLDER"
8
+ plan_kind: phase
9
+ parent: null
10
+ ---
11
+
12
+ # Phase: PHASE_TITLE_PLACEHOLDER
13
+
14
+ ## Goal
15
+ [One sentence describing what this phase achieves and the strategic boundary it represents.]
16
+
17
+ ## Tasks
18
+ [Tasks created with `/start-task --parent PHASE_SLUG_PLACEHOLDER` will be tracked here.
19
+ Each task is a bounded deliverable. Tasks default to dependencies-first scheduling.
20
+ Tasks with no inter-dependencies can be marked `parallelizable: true` in their frontmatter
21
+ so subagent teams can pick them up concurrently.]
22
+
23
+ - [ ] (no tasks yet — run `/start-task "Task name" --parent PHASE_SLUG_PLACEHOLDER`)
24
+ - [ ] **Validate success through comprehensive testing** (MANDATORY — second-to-last)
25
+ - [ ] **Documentation pass — create/update/deprecate docs** (MANDATORY — last)
26
+
27
+ > The two mandatory closing tasks above MUST remain the last two tasks of this phase.
28
+ > Add new tasks above them; never after. A phase cannot be marked `done` until both are
29
+ > `done`, and neither may be `parallelizable` — they gate on everything before them.
30
+ >
31
+ > - **Validate success**: prove the phase's work with tests that fail if it breaks.
32
+ > - **Documentation pass**: create/update/deprecate every doc this phase touches —
33
+ > what it is, where it lives, how to fix it, how to operate it, why it matters.
34
+ > If hit-em-with-the-docs is installed, use it for this pass.
35
+
36
+ ## Decisions Made
37
+ [Phase-level decisions that affect multiple tasks. Format: `**Decision**: rationale`.]
38
+
39
+ ## Status
40
+ **Currently draft** — phase has been initialized but no tasks defined.
41
+
42
+ Status enum: `draft | active | paused | done | archived`
43
+
44
+ When all tasks are `done`, mark this phase `done`. Checking every box in this phase
45
+ IS the completion signal — `/plan-status` reads it straight off the artifacts.
46
+
47
+ When complete, retire it with `/archive-plan PHASE_SLUG_PLACEHOLDER`: the whole
48
+ directory (tasks and atoms with it) moves to the gitignored
49
+ `.planning/.archive/PHASE_SLUG_PLACEHOLDER/` and the frontmatter above is stamped
50
+ `status: archived` + `archived_on`. Nothing is destroyed.
51
+
52
+ ---
53
+
54
+ ## Layer reference (lg mode)
55
+ - **Phase** (this file): strategic grouping of related tasks
56
+ - **Task** (`.planning/PHASE_SLUG_PLACEHOLDER/<task-slug>/task.md`): bounded deliverable
57
+ - **Atom** (`.planning/PHASE_SLUG_PLACEHOLDER/<task-slug>/atoms/<atom-slug>.md`): subagent hand-off unit
58
+ - **Notes** (`.planning/PHASE_SLUG_PLACEHOLDER/notes.md` or per-task `notes.md`): cross-cutting references
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: TASK_TITLE_PLACEHOLDER
3
+ tier: plan
4
+ domains:
5
+ - planning
6
+ status: draft
7
+ last_updated: "TASK_DATE_PLACEHOLDER"
8
+ plan_kind: task
9
+ parent: PHASE_SLUG_PLACEHOLDER
10
+ depends_on: []
11
+ parallelizable: false
12
+ ---
13
+
14
+ # Task: TASK_TITLE_PLACEHOLDER
15
+
16
+ **Phase**: `PHASE_SLUG_PLACEHOLDER`
17
+
18
+ ## Goal
19
+ [One sentence describing the deliverable end-state for this task.]
20
+
21
+ ## Atoms
22
+ [Atomic checkbox items that will be picked up by subagents. Each atom should be
23
+ something a single subagent can complete in one focused pass.
24
+
25
+ For complex atoms that need explicit subagent context, spawn a standalone atom file
26
+ via `/start-atom "Atom name" --parent TASK_SLUG_PLACEHOLDER` — these become files
27
+ under `atoms/` that subagents read via the planning MCP.
28
+
29
+ Inline checkbox vs. standalone atom file — see anti-pattern doc:
30
+ .documentation/standards/atom-granularity.md.]
31
+
32
+ - [ ] (no atoms yet — add inline checkboxes here for simple atoms,
33
+ or run `/start-atom "Atom name" --parent TASK_SLUG_PLACEHOLDER` for complex ones)
34
+
35
+ ## Decisions Made
36
+ [Task-level decisions. Format: `**Decision**: rationale`.]
37
+
38
+ ## Status
39
+ **Currently draft** — task has been initialized but no atoms defined.
40
+
41
+ Status enum: `draft | active | paused | done | archived`
42
+
43
+ ## Dependencies
44
+ This task does not currently depend on other tasks. Edit `depends_on:` in frontmatter
45
+ to declare dependencies on other tasks within the same phase. Tasks with no
46
+ inter-dependencies should set `parallelizable: true`.
47
+
48
+ ---
49
+
50
+ ## Layer reference
51
+ - **Phase** (`../phase.md`): the strategic grouping this task belongs to
52
+ - **This task**: the bounded deliverable
53
+ - **Atoms** (`atoms/<atom-slug>.md`): subagent hand-off units (sequential within this task)
54
+ - **Notes** (`notes.md`): cross-cutting references for this task's implementation