@theglitchking/persistent-planning 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "persistent-planning-marketplace",
3
+ "owner": {
4
+ "name": "TheGlitchKing",
5
+ "email": "theglitchking@users.noreply.github.com"
6
+ },
7
+ "metadata": {
8
+ "description": "Official marketplace for persistent-planning - Persistent markdown-based planning for Claude Code. Context engineering pattern with task directories, progress tracking, and working memory that persists across sessions.",
9
+ "version": "3.0.0"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "persistent-planning",
14
+ "description": "Persistent markdown-based planning for Claude Code. Uses on-disk markdown files as working memory for planning, progress tracking, and knowledge storage. Plans persist across sessions and support multiple concurrent tasks.",
15
+ "version": "3.0.0",
16
+ "author": {
17
+ "name": "TheGlitchKing"
18
+ },
19
+ "homepage": "https://github.com/TheGlitchKing/persistent-planning",
20
+ "repository": "https://github.com/TheGlitchKing/persistent-planning.git",
21
+ "license": "MIT",
22
+ "keywords": [
23
+ "planning",
24
+ "persistent",
25
+ "markdown",
26
+ "context-engineering",
27
+ "task-tracking",
28
+ "working-memory",
29
+ "goal-tracking",
30
+ "claude-code"
31
+ ],
32
+ "category": "productivity",
33
+ "tags": [
34
+ "planning",
35
+ "context-engineering",
36
+ "working-memory"
37
+ ],
38
+ "source": {
39
+ "source": "npm",
40
+ "package": "@theglitchking/persistent-planning"
41
+ },
42
+ "strict": true
43
+ }
44
+ ]
45
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "persistent-planning",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Persistent markdown-based planning with task directories, progress tracking, and context engineering for multi-step Claude Code workflows",
5
5
  "author": {
6
6
  "name": "TheGlitchKing"
package/CHANGELOG.md CHANGED
@@ -2,6 +2,63 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.0.0] - 2026-05-07
6
+
7
+ ### Added — Lg-mode (large/team) layered planning
8
+
9
+ v3.0 introduces a new **layered planning mode** alongside the existing single-task flow. The mode is auto-detected (90-day git-author-count heuristic; ≥2 distinct authors → lg) and is sticky once chosen.
10
+
11
+ **Four layers** in lg mode:
12
+
13
+ - **Phase** — strategic grouping of related tasks (top)
14
+ - **Task** — bounded deliverable; declares `depends_on` + `parallelizable` for subagent team scheduling
15
+ - **Atom** — subagent hand-off unit; sequential within a task; status: `ready | in_progress | done | blocked` with reopen support
16
+ - **Notes** — cross-cutting references scoped to a phase or task
17
+
18
+ All four layers carry HEWTD-aligned frontmatter (`tier: plan`). `version` is intentionally omitted — HEWTD 2.2.0+ makes it conditionally optional for plan-tier docs.
19
+
20
+ ### Added — `/start-task` and `/start-atom` slash commands
21
+
22
+ - `/start-task "<name>" --parent <phase>` — adds a task under an existing phase (lg only)
23
+ - `/start-atom "<name>" --parent <task>` — adds an atom (subagent hand-off unit) under a task (lg only); auto-resolves the parent phase by walking `.planning/`; auto-assigns sequence number
24
+ - `/start-planning` updated to dispatch sm vs lg based on detect-mode.sh; accepts `--mode sm|lg` for explicit override
25
+
26
+ ### Added — `.planning/.meta/workspace.json`
27
+
28
+ Per-project mode tracker. Fields: `schema_version`, `mode`, `auto_detected`, `detected_contributors`, `created_at`. Bootstrapped on first lg-mode init. See `docs/workspace-json.md` for the full schema.
29
+
30
+ ### Added — Documentation
31
+
32
+ - `docs/lg-mode.md` — full lg-mode guide
33
+ - `docs/atom-granularity.md` — anti-pattern guide for inline-checkbox-vs-standalone-atom
34
+ - `docs/workspace-json.md` — workspace.json schema reference
35
+
36
+ ### Added — Scripts
37
+
38
+ - `scripts/detect-mode.sh` — sm/lg resolution
39
+ - `scripts/lib/planning.sh` — shared bash helpers
40
+ - `scripts/init-phase.sh`, `scripts/init-task.sh`, `scripts/init-atom.sh` — lg-mode init scripts
41
+
42
+ ### Added — Templates
43
+
44
+ - `templates/lg/{phase,task,atom,notes}.md` — HEWTD-frontmattered layer templates
45
+
46
+ ### Subagent contract (requires semantic-memory 1.0)
47
+
48
+ Lg-mode plans are designed to be read by subagents via semantic-memory's MCP verbs (registered conditionally on the `plans` corpus). When semantic-memory is absent, persistent-planning falls back to filesystem-based reads — slash commands still work; subagent comprehension degrades.
49
+
50
+ ### Backwards compatibility
51
+
52
+ - **Sm mode preserved exactly**: existing `.planning/<task-slug>/{task_plan.md, notes.md}` directories continue to work without changes. The original `/start-planning "Task name"` flow is identical to v2.
53
+ - **Auto-detection is non-disruptive**: existing v2 plans aren't migrated. New `/start-planning` invocations auto-detect mode and create new artifacts using the resolved mode.
54
+
55
+ ### Optional dependencies
56
+
57
+ - `@theglitchking/hit-em-with-the-docs ^2.2.0` — required for `hewtd validate` to accept lg-mode plan frontmatter (introduces `tier: "plan"` + conditional `version`)
58
+ - `@theglitchking/semantic-memory ^1.0.0` (formerly `semantic-sidekick`) — required for the planning MCP verbs that subagents use to read/mutate lg-mode plans
59
+
60
+ When neither is installed, lg mode still works as a pure file-authoring flow.
61
+
5
62
  ## [2.0.0] - 2026-04-18
6
63
 
7
64
  ### ⚠️ Breaking changes
package/README.md CHANGED
@@ -43,43 +43,48 @@ For every complex task, create three files:
43
43
 
44
44
  ## Installation
45
45
 
46
- ### Option 1: NPM (Recommended)
46
+ > **v1 → v2 breaking change**: the hand-rolled `persistent-planning install --scope ...` flow was removed. Skills and slash commands are now placed automatically — either by the Claude Code plugin marketplace, or by npm's postinstall symlinking. See [CHANGELOG.md](./CHANGELOG.md) for the full migration guide.
47
47
 
48
- ```bash
49
- # Install globally
50
- npm install -g @theglitchking/persistent-planning
51
- persistent-planning install --scope user
48
+ ### Option A: Claude Code Plugin Marketplace (Recommended)
52
49
 
53
- # Or via npx (no global install)
54
- npx @theglitchking/persistent-planning install --scope user
55
50
  ```
51
+ /plugin marketplace add TheGlitchKing/persistent-planning
52
+ /plugin install persistent-planning@persistent-planning-marketplace
53
+ ```
54
+
55
+ ### Option B: Project-level npm install
56
56
 
57
- ### Option 2: Installer Script
57
+ Pins the exact version in `package.json`, visible to teammates, CI, and LLMs reading the repo. Postinstall symlinks `skills/persistent-planning/` into `<project>/.claude/skills/`, writes a default `.claude/persistent-planning.json` (update policy `nudge`), and registers a SessionStart hook in `.claude/settings.json` if one is present. Dedup: if the plugin marketplace version is already enabled in `~/.claude/settings.json`, the npm hook registration is skipped.
58
58
 
59
59
  ```bash
60
- git clone https://github.com/TheGlitchKing/persistent-planning.git
61
- cd persistent-planning
62
- ./install.sh --scope user # Available in all projects
63
- # OR
64
- ./install.sh --scope project # Current project only
60
+ npm install --save-dev @theglitchking/persistent-planning
65
61
  ```
66
62
 
67
- ### Option 3: Claude Marketplace
63
+ ### Option C: Try it (no install)
68
64
 
69
- ```
70
- /plugin install TheGlitchKing/persistent-planning
65
+ ```bash
66
+ npx @theglitchking/persistent-planning status
71
67
  ```
72
68
 
73
- ### Option 4: Manual Installation
69
+ ## Update management
70
+
71
+ Each install ships with an update policy. By default the plugin checks npm at session start and prints a one-liner when a newer version is available — no changes made. Opt into automatic updates or silence the check entirely:
74
72
 
75
73
  ```bash
76
- mkdir -p ~/.claude/skills
77
- cp -r persistent-planning/skills/SKILL.md ~/.claude/skills/persistent-planning/SKILL.md
78
- cp -r persistent-planning/scripts ~/.claude/skills/persistent-planning/scripts
79
- cp -r persistent-planning/docs ~/.claude/skills/persistent-planning/docs
80
- cp persistent-planning/.claude/commands/start-planning.md ~/.claude/commands/start-planning.md
74
+ # Slash commands
75
+ /persistent-planning:policy auto # auto-update on session start
76
+ /persistent-planning:policy nudge # one-liner nudge only (default)
77
+ /persistent-planning:policy off # silent
78
+
79
+ # CLI equivalents
80
+ npx --no @theglitchking/persistent-planning policy auto
81
+ npx --no @theglitchking/persistent-planning status # installed, latest, policy, hook state
82
+ npx --no @theglitchking/persistent-planning update # runs npm update + relinks skills
83
+ npx --no @theglitchking/persistent-planning relink # re-symlink skills only
81
84
  ```
82
85
 
86
+ Policy resolution order: `PERSISTENT_PLANNING_UPDATE_POLICY` env var → `<project>/.claude/persistent-planning.json` → default `nudge`.
87
+
83
88
  ## Usage
84
89
 
85
90
  ### Quick Start
@@ -151,23 +156,29 @@ Each task gets its own directory. No conflicts, no overwrites.
151
156
  ```
152
157
  persistent-planning/
153
158
  ├── .claude-plugin/
154
- │ └── plugin.json # Plugin manifest
155
- ├── .claude/
156
- │ └── commands/
157
- │ └── start-planning.md # /start-planning command
158
- ├── skills/
159
- │ └── SKILL.md # Core skill definition
159
+ │ └── plugin.json # Plugin manifest (marketplace loader)
160
+ ├── bin/
161
+ │ └── persistent-planning.js # CLI (update/policy/status/relink)
162
+ ├── commands/
163
+ │ ├── start-planning.md # /start-planning slash command
164
+ │ ├── update.md # /persistent-planning:update
165
+ │ ├── policy.md # /persistent-planning:policy
166
+ │ ├── status.md # /persistent-planning:status
167
+ │ └── relink.md # /persistent-planning:relink
168
+ ├── hooks/
169
+ │ ├── hooks.json # SessionStart hook manifest
170
+ │ └── session-start.js # Runtime-delegated hook
160
171
  ├── scripts/
161
- │ └── init-planning.sh # Automated setup script
172
+ │ └── link-skills.js # Postinstall (runtime-delegated)
173
+ ├── skills/
174
+ │ └── persistent-planning/
175
+ │ └── SKILL.md # Core skill definition
162
176
  ├── docs/
163
177
  │ ├── reference.md # Manus context engineering principles
164
178
  │ └── examples.md # Worked examples
165
- ├── install.sh # Plugin installer
166
- ├── uninstall.sh # Plugin uninstaller
167
- ├── plugin.json # Root plugin metadata
168
- ├── README.md # This file
169
- ├── LICENSE # MIT license
170
- └── CHANGELOG.md # Version history
179
+ ├── README.md
180
+ ├── LICENSE
181
+ └── CHANGELOG.md
171
182
  ```
172
183
 
173
184
  ## Cleanup
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: start-atom
3
+ description: "Add an atom (subagent hand-off unit) under an existing task in lg-mode persistent-planning. Creates .planning/<phase>/<task>/atoms/<atom-slug>.md with auto-incremented sequence. Requires --parent <task-slug>. Lg mode only."
4
+ ---
5
+
6
+ # /start-atom
7
+
8
+ Add an atom — the smallest unit of planning, designed for subagent hand-off — under an existing task. **Lg mode only.**
9
+
10
+ ---
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /start-atom "Atom name" --parent <task-slug>
16
+ ```
17
+
18
+ ## Examples
19
+
20
+ ```
21
+ /start-atom "Update zod schema" --parent hewtd-schema-extension
22
+ /start-atom "Add plan-tier tests" --parent hewtd-schema-extension
23
+ /start-atom "Bump to 2.2.0" --parent hewtd-schema-extension
24
+ ```
25
+
26
+ ---
27
+
28
+ ## What To Do
29
+
30
+ When the user runs `/start-atom "<name>" --parent <task-slug>`:
31
+
32
+ 1. Run the init script:
33
+ ```bash
34
+ SCRIPT_DIR="$(dirname "$(readlink -f "$0")")/../scripts"
35
+ bash "${SCRIPT_DIR}/init-atom.sh" "<name>" --parent "<task-slug>"
36
+ ```
37
+
38
+ The script auto-resolves which phase contains the task (no need to specify the phase). It auto-assigns the next sequence number based on existing atoms in the same task's `atoms/` directory.
39
+
40
+ If the script isn't found at that path, try:
41
+ ```bash
42
+ bash scripts/init-atom.sh "<name>" --parent "<task-slug>"
43
+ bash ~/.claude/skills/persistent-planning/scripts/init-atom.sh "<name>" --parent "<task-slug>"
44
+ ```
45
+
46
+ 2. After completion, remind the user:
47
+ - Edit `.planning/<phase>/<task>/atoms/<atom-slug>.md` to define:
48
+ - `## What to do` — the atomic action
49
+ - `## Inputs` — files / state the atom depends on
50
+ - `## Expected outputs` — files / commands / state changes
51
+ - `## Acceptance criteria` — how to verify completion
52
+ - The atom starts with `status: ready`. A subagent will claim it (status → `in_progress`) and complete it (status → `done`).
53
+
54
+ ---
55
+
56
+ ## What It Creates
57
+
58
+ ```
59
+ .planning/<phase-slug>/<task-slug>/atoms/
60
+ └── <atom-slug>.md # HEWTD-frontmattered atom (parent: <task-slug>, sequence: N)
61
+ ```
62
+
63
+ The atom file includes the structured sections needed for subagent comprehension. It's the contract a subagent reads to know exactly what to do.
64
+
65
+ ## Atoms vs. inline checkboxes
66
+
67
+ Not every step needs a standalone atom file. The rule of thumb:
68
+
69
+ - **Inline checkbox in `task.md`**: simple, self-contained step that doesn't need its own context file. The user (or the active agent) handles it directly.
70
+ - **Standalone atom file via `/start-atom`**: a step that will be **handed off to a subagent**. Atoms get their own files because subagents need explicit inputs / outputs / acceptance criteria they can read structured rather than parse from prose.
71
+
72
+ See `docs/atom-granularity.md` for full anti-pattern guidance with examples.
73
+
74
+ ## Sequence semantics
75
+
76
+ Atoms within a task default to **sequential** processing. The `sequence:` frontmatter field is auto-assigned (1 + max existing). The planning MCP's `next_atom(task)` verb returns the next `status: ready` atom in sequence order.
77
+
78
+ Sequential matches the single-agent reality and eliminates filesystem race conditions on claim. If you have a genuine parallel-atom workload, that's a Phase 4.x conversation; today, atoms hand off one at a time.
79
+
80
+ ## Lg-mode-only
81
+
82
+ This command refuses to run if the project is in sm mode. To switch:
83
+
84
+ ```
85
+ /start-planning "<phase name>" --mode lg
86
+ ```
87
+
88
+ ## See also
89
+
90
+ - `/start-planning` — initialize the planning structure (phase in lg)
91
+ - `/start-task` — add a task under a phase
92
+ - `docs/lg-mode.md` — full lg-mode layer model
93
+ - `docs/atom-granularity.md` — when to spawn an atom file vs. inline checkbox
@@ -1,65 +1,115 @@
1
1
  ---
2
2
  name: start-planning
3
- description: "Initialize persistent planning structure for a task. Creates .planning/[task-slug]/ with task_plan.md and notes.md for on-disk working memory that persists across sessions."
3
+ description: "Initialize persistent planning structure. In sm mode (solo/small) creates .planning/[task-slug]/ with task_plan.md + notes.md (v2 behavior). In lg mode (team/large), creates a phase: .planning/[phase-slug]/{phase.md, notes.md} and bootstraps .planning/.meta/workspace.json. Mode auto-detects via 90-day git author count (≥2 = lg) or can be forced with --mode."
4
4
  ---
5
5
 
6
6
  # /start-planning
7
7
 
8
- Initialize the persistent planning structure for a task.
8
+ Initialize the persistent planning structure. Mode (sm vs lg) determines what gets created.
9
9
 
10
10
  ---
11
11
 
12
12
  ## Usage
13
13
 
14
14
  ```
15
- /start-planning "Your task name here"
15
+ /start-planning "Your name here" # auto-detect mode
16
+ /start-planning "Your name here" --mode sm # force small mode (single task)
17
+ /start-planning "Your name here" --mode lg # force large mode (phase)
16
18
  ```
17
19
 
20
+ ## Mode behavior
21
+
22
+ - **sm mode** (solo / small): creates `.planning/<slug>/{task_plan.md, notes.md}`. Single-task flow. Identical to v2 behavior.
23
+ - **lg mode** (team / large): creates `.planning/<phase-slug>/{phase.md, notes.md}` — the new top-layer "phase" artifact. Add tasks under it with `/start-task`, atoms with `/start-atom`. Bootstraps `.planning/.meta/workspace.json`.
24
+
25
+ Mode is auto-detected via 90-day git author count (≥2 distinct authors → lg, else sm), with a printed decision banner. Once detected (or explicitly set with `--mode`), the choice is sticky in `.planning/.meta/workspace.json` for all subsequent runs.
26
+
18
27
  ## Examples
19
28
 
20
29
  ```
21
- /start-planning "Refactor authentication system"
22
- /start-planning "Build REST API with JWT"
23
- /start-planning "Fix memory leak in worker process"
30
+ /start-planning "Refactor authentication system" # solo: makes a task plan
31
+ /start-planning "Foundation" # team: makes a phase
32
+ /start-planning "Multi-corpus refactor" --mode lg # force lg
33
+ /start-planning "Quick spike" --mode sm # force sm
24
34
  ```
25
35
 
26
36
  ---
27
37
 
28
38
  ## What To Do
29
39
 
30
- When the user runs `/start-planning "Task Name"`:
40
+ When the user runs `/start-planning "<name>" [--mode sm|lg]`:
31
41
 
32
- 1. Run the init script:
42
+ 1. **Resolve mode**:
33
43
  ```bash
34
- bash "$(dirname "$(readlink -f "$0")")/../scripts/init-planning.sh" "Task Name"
44
+ SCRIPT_DIR="$(dirname "$(readlink -f "$0")")/../scripts"
45
+ # Honor explicit --mode flag if given; otherwise detect.
46
+ if [ -n "$EXPLICIT_MODE" ]; then
47
+ MODE="$EXPLICIT_MODE"
48
+ else
49
+ MODE=$(bash "${SCRIPT_DIR}/detect-mode.sh" --explain)
50
+ fi
35
51
  ```
36
52
 
37
- If the script is not found at that path, try these fallbacks in order:
53
+ 2. **Dispatch by mode**:
54
+
55
+ If `MODE=sm`:
38
56
  ```bash
39
- bash scripts/init-planning.sh "Task Name"
40
- bash ~/.claude/skills/persistent-planning/scripts/init-planning.sh "Task Name"
57
+ bash "${SCRIPT_DIR}/init-planning.sh" "<name>"
41
58
  ```
42
59
 
43
- 2. After the script completes, remind the user:
44
- - Edit `.planning/[task-slug]/task_plan.md` to define phases
45
- - Update the Status section as they work
46
- - Save findings to `.planning/[task-slug]/notes.md`
47
- - Re-read `task_plan.md` before major decisions
60
+ If `MODE=lg`:
61
+ ```bash
62
+ bash "${SCRIPT_DIR}/init-phase.sh" "<name>"
63
+ ```
64
+
65
+ If `--mode lg` was passed but workspace.json already exists with `mode: sm` (or vice versa), update workspace.json to the new mode (the override sticks).
66
+
67
+ 3. **After the script completes**:
68
+ - sm mode: remind the user to edit `task_plan.md`, update `Status`, save to `notes.md`
69
+ - lg mode: remind the user to add tasks via `/start-task "<task name>" --parent <phase-slug>`
70
+
71
+ If a script isn't found at the resolved path, try these fallbacks in order:
72
+ ```bash
73
+ bash scripts/init-phase.sh "<name>" # for lg
74
+ bash scripts/init-planning.sh "<name>" # for sm
75
+ bash ~/.claude/skills/persistent-planning/scripts/init-phase.sh "<name>"
76
+ bash ~/.claude/skills/persistent-planning/scripts/init-planning.sh "<name>"
77
+ ```
48
78
 
49
79
  ---
50
80
 
51
81
  ## What It Creates
52
82
 
83
+ ### sm mode
53
84
  ```
54
85
  .planning/
55
- └── [task-slug]/
56
- ├── task_plan.md # Track phases and progress
86
+ └── <slug>/
87
+ ├── task_plan.md # Track phases inline + progress
57
88
  └── notes.md # Store research and findings
58
89
  ```
59
90
 
60
- ## Task Slug Conversion
91
+ ### lg mode
92
+ ```
93
+ .planning/
94
+ ├── .meta/
95
+ │ └── workspace.json # {mode: "lg", auto_detected: true, ...}
96
+ └── <phase-slug>/
97
+ ├── phase.md # HEWTD-frontmattered top-layer artifact
98
+ └── notes.md # Cross-cutting notes for the phase
99
+ ```
100
+
101
+ Add tasks under a phase with `/start-task "<name>" --parent <phase-slug>`.
102
+
103
+ ## Slug conversion
104
+
105
+ Names are converted to URL-friendly slugs:
106
+ - "Refactor Authentication" → `refactor-authentication`
107
+ - "Multi-Corpus Refactor" → `multi-corpus-refactor`
108
+ - "Fix Bug #123" → `fix-bug-123`
109
+
110
+ ## See also
61
111
 
62
- Task names are converted to URL-friendly slugs:
63
- - "Refactor Authentication" -> `refactor-authentication`
64
- - "Build REST API" -> `build-rest-api`
65
- - "Fix Bug #123" -> `fix-bug-123`
112
+ - `/start-task` — add a task under a phase (lg mode only)
113
+ - `/start-atom` — add an atom (subagent hand-off unit) under a task (lg mode only)
114
+ - `docs/workspace-json.md` — workspace.json schema reference
115
+ - `docs/lg-mode.md` — full lg-mode guide (phase / task / atom / notes layer model)
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: start-task
3
+ description: "Add a task under an existing phase in lg-mode persistent-planning. Creates .planning/<phase>/<task-slug>/{task.md, notes.md, atoms/}. Requires --parent <phase-slug>. Lg mode only."
4
+ ---
5
+
6
+ # /start-task
7
+
8
+ Add a task under an existing phase. **Lg mode only** — refuses to run in sm mode.
9
+
10
+ ---
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /start-task "Task name" --parent <phase-slug>
16
+ ```
17
+
18
+ ## Examples
19
+
20
+ ```
21
+ /start-task "HEWTD schema extension" --parent foundation
22
+ /start-task "Multi-corpus refactor" --parent semantic-memory-core
23
+ /start-task "Drift detection algorithm" --parent ecosystem-extensions
24
+ ```
25
+
26
+ ---
27
+
28
+ ## What To Do
29
+
30
+ When the user runs `/start-task "<name>" --parent <phase-slug>`:
31
+
32
+ 1. Run the init script:
33
+ ```bash
34
+ SCRIPT_DIR="$(dirname "$(readlink -f "$0")")/../scripts"
35
+ bash "${SCRIPT_DIR}/init-task.sh" "<name>" --parent "<phase-slug>"
36
+ ```
37
+
38
+ If the script isn't found at that path, try:
39
+ ```bash
40
+ bash scripts/init-task.sh "<name>" --parent "<phase-slug>"
41
+ bash ~/.claude/skills/persistent-planning/scripts/init-task.sh "<name>" --parent "<phase-slug>"
42
+ ```
43
+
44
+ 2. After completion, remind the user:
45
+ - Edit `.planning/<phase>/<task-slug>/task.md` to define the task goal
46
+ - Add atoms with `/start-atom "<name>" --parent <task-slug>` (or inline checkboxes for simple atoms)
47
+ - Update task frontmatter: `depends_on: [<other-task-slug>]` for sequential dependencies, or `parallelizable: true` for tasks with no inter-dependencies
48
+
49
+ ---
50
+
51
+ ## What It Creates
52
+
53
+ ```
54
+ .planning/<phase-slug>/
55
+ └── <task-slug>/
56
+ ├── task.md # HEWTD-frontmattered task artifact (parent: <phase-slug>)
57
+ ├── notes.md # Cross-cutting notes scoped to this task
58
+ └── atoms/ # Empty dir for future atoms (subagent hand-off units)
59
+ ```
60
+
61
+ ## Frontmatter scheduling fields
62
+
63
+ The `task.md` template includes two key scheduling fields:
64
+
65
+ - `depends_on: []` — array of other task slugs (within the same phase) this task depends on. The planning MCP's `next_task()` verb respects this graph.
66
+ - `parallelizable: false` — set to `true` for tasks that can be picked up in any order by subagent teams. Default `false` (conservative).
67
+
68
+ ## Lg-mode-only
69
+
70
+ This command refuses to run if the project is in sm mode. To switch:
71
+
72
+ ```
73
+ /start-planning "<phase name>" --mode lg
74
+ ```
75
+
76
+ That writes `.planning/.meta/workspace.json` with `mode: "lg"` and creates the first phase.
77
+
78
+ ## See also
79
+
80
+ - `/start-planning` — initialize the planning structure (phase in lg, task in sm)
81
+ - `/start-atom` — add an atom under a task
82
+ - `docs/lg-mode.md` — full lg-mode layer model
83
+ - `docs/atom-granularity.md` — when to spawn an atom file vs. add an inline checkbox
@@ -0,0 +1,156 @@
1
+ ---
2
+ title: Atom Granularity (anti-pattern guide)
3
+ tier: standard
4
+ domains:
5
+ - planning
6
+ status: active
7
+ last_updated: 2026-05-07
8
+ version: 1.0.0
9
+ audience:
10
+ - developers
11
+ purpose: When to spawn a standalone atom file vs. add an inline atom checkbox to task.md. The atom layer is load-bearing for subagent hand-off; this doc keeps it from being misused.
12
+ ---
13
+
14
+ # Atom Granularity
15
+
16
+ This is anti-pattern guidance for **lg-mode** planning. Sm-mode users can ignore this — sm has only `task_plan.md` with inline checkboxes throughout.
17
+
18
+ ## The two kinds of atoms
19
+
20
+ In lg mode, "atom" can mean two different artifacts:
21
+
22
+ 1. **Inline atom checkbox** in `task.md`:
23
+ ```markdown
24
+ ## Atoms
25
+ - [ ] Bump version to 3.0.0 in package.json
26
+ - [ ] Update CHANGELOG entry
27
+ - [ ] Run npm publish
28
+ ```
29
+
30
+ 2. **Standalone atom file** at `.planning/<phase>/<task>/atoms/<atom-slug>.md`:
31
+ ```markdown
32
+ ---
33
+ title: Bump version to 3.0.0
34
+ tier: plan
35
+ plan_kind: atom
36
+ parent: release-3-0-0
37
+ sequence: 1
38
+ status: ready
39
+ ---
40
+
41
+ # Atom: Bump version to 3.0.0
42
+
43
+ ## What to do
44
+ ...
45
+ ## Inputs
46
+ ...
47
+ ## Expected outputs
48
+ ...
49
+ ## Acceptance criteria
50
+ ...
51
+ ```
52
+
53
+ Both are valid. The question is **when to use which**.
54
+
55
+ ## The rule
56
+
57
+ **Inline checkbox**: simple, self-contained step that doesn't need its own context file.
58
+ The active agent handles it directly while working through the task.
59
+
60
+ **Standalone atom file**: a step that will be **handed off to a subagent**.
61
+ Subagents need explicit inputs / outputs / acceptance criteria they can read
62
+ structured rather than parse from prose. Standalone atoms exist to make the
63
+ hand-off contract explicit and machine-readable.
64
+
65
+ ## Examples
66
+
67
+ ### ✅ Use inline checkbox
68
+
69
+ ```markdown
70
+ ## Atoms
71
+ - [ ] Bump package.json to 3.0.0
72
+ - [ ] Add CHANGELOG entry under "## [3.0.0]"
73
+ - [ ] Run `npm test` and confirm all pass
74
+ ```
75
+
76
+ These are mechanical, self-evident, and don't need their own files. The active
77
+ agent reads task.md, executes them, and ticks them off.
78
+
79
+ ### ✅ Use standalone atom file
80
+
81
+ ```markdown
82
+ ## Atoms
83
+ (see atoms/ for files)
84
+ ```
85
+
86
+ With:
87
+
88
+ ```
89
+ atoms/
90
+ ├── 01-extract-embedder-to-shared-package.md
91
+ ├── 02-refactor-vault-indexer-to-registry-driven.md
92
+ └── 03-add-corpora-json-schema.md
93
+ ```
94
+
95
+ Each of these is a meaty, multi-step refactor with non-obvious context (which
96
+ files to touch, what shape the resulting code should take, how to verify).
97
+ Subagents picking these up need explicit briefing — that's what the standalone
98
+ atom file provides.
99
+
100
+ ## Anti-patterns
101
+
102
+ ### 🚫 Standalone atom for a one-liner
103
+
104
+ If the atom file ends up being mostly empty (`## What to do` is one sentence,
105
+ `## Acceptance criteria` is "ran the command"), it's overhead. Use an inline
106
+ checkbox.
107
+
108
+ ### 🚫 Inline checkboxes for multi-step subagent work
109
+
110
+ If the checkbox is `- [ ] Refactor the indexer to support multi-corpus`, you've
111
+ pushed too much into one inline checkbox. A subagent picking up "refactor the
112
+ indexer" has no idea what scope, what files, or what success looks like. Spawn
113
+ a standalone atom (or several — one per logical refactor step).
114
+
115
+ ### 🚫 Mixing — inline checkboxes that are subagent hand-offs
116
+
117
+ Don't have inline checkboxes that say "subagent: do X" without an atom file.
118
+ Either it's small enough for the active agent (inline) or it's big enough for
119
+ hand-off (atom file). The line between them is "is the subagent going to need
120
+ to ask questions?"
121
+
122
+ ## Heuristic
123
+
124
+ Ask: **could a fresh subagent walk into this and complete the work without
125
+ asking the user a clarifying question?**
126
+
127
+ - If yes → inline checkbox is fine
128
+ - If no → spawn an atom file with explicit Inputs / Outputs / Acceptance
129
+ criteria
130
+
131
+ ## Sequence semantics
132
+
133
+ Standalone atoms have explicit `sequence:` ordering. The planning MCP's
134
+ `next_atom(task)` verb returns the next `status: ready` atom in sequence order.
135
+
136
+ Sequential matches the single-agent reality. If you have N atoms in a task,
137
+ they hand off one at a time, in order. This eliminates filesystem race
138
+ conditions on claim and matches how agentic coding actually flows today.
139
+
140
+ If you have a genuinely parallel-atom workload (multiple subagents working
141
+ simultaneously on independent atoms within one task), that's a Phase 4.x
142
+ conversation — today, atoms hand off one at a time.
143
+
144
+ ## Reopen semantics
145
+
146
+ A `done` atom can be reopened to `in_progress` if a follow-up correction is
147
+ needed. The frontmatter gets a `reopened_at: <iso-timestamp>` audit field.
148
+ Don't use this for "the work was wrong, redo it" — for that, the cleaner move
149
+ is to add a NEW atom that explains what to fix and why. Reopening is for "this
150
+ was almost done but missed a small detail."
151
+
152
+ ## See also
153
+
154
+ - `/start-atom` — slash command to spawn a standalone atom file
155
+ - `templates/lg/atom.md` — the atom file template
156
+ - `templates/lg/task.md` — the task template (inline checkbox section)
@@ -0,0 +1,135 @@
1
+ ---
2
+ title: Lg-Mode Layered Planning Guide
3
+ tier: guide
4
+ domains:
5
+ - planning
6
+ status: active
7
+ last_updated: 2026-05-07
8
+ version: 1.0.0
9
+ audience:
10
+ - developers
11
+ purpose: Full guide to lg-mode (large/team) persistent-planning — phase / task / atom / notes layered model, scheduling defaults, subagent contract, and integration with semantic-memory MCP.
12
+ ---
13
+
14
+ # Lg-Mode (Layered Planning)
15
+
16
+ Lg mode was introduced in **persistent-planning 3.0.0**. It complements the original sm-mode flow without replacing it — solo devs and quick spikes still get the v2 single-task experience.
17
+
18
+ ## When to use lg mode
19
+
20
+ - 2+ contributors over the last 90 days (auto-detected → lg)
21
+ - Multi-week or multi-task project with strategic boundaries (phases)
22
+ - Subagent hand-off needed for parallel or sequenced work
23
+ - Wanting the plan to integrate with semantic-memory's MCP (lg plans carry HEWTD frontmatter)
24
+
25
+ If none of those apply, sm mode is faster and lighter. You can always run `/start-planning --mode lg "name"` to switch.
26
+
27
+ ## The four layers
28
+
29
+ | Layer | File | Purpose |
30
+ |---|---|---|
31
+ | **Phase** | `<phase-slug>/phase.md` | Strategic grouping; multi-task boundary |
32
+ | **Task** | `<phase-slug>/<task-slug>/task.md` | Bounded deliverable; mid-level summary |
33
+ | **Atom** | `<phase-slug>/<task-slug>/atoms/<atom-slug>.md` | Subagent hand-off unit |
34
+ | **Notes** | `<phase-slug>/notes.md` or `<task-slug>/notes.md` | Cross-cutting references |
35
+
36
+ Notes are scoped to either a phase or a task (or both). Notes are NOT part of the hierarchy — they're cross-cutting context.
37
+
38
+ ## Directory layout
39
+
40
+ ```
41
+ .planning/
42
+ ├── .meta/
43
+ │ └── workspace.json # {mode: "lg", auto_detected: true, ...}
44
+ ├── archive/
45
+ │ └── <archived-phase-slug>/ # phases moved here on status: archived
46
+ └── <phase-slug>/
47
+ ├── phase.md # the phase
48
+ ├── notes.md # phase-scoped notes
49
+ └── <task-slug>/
50
+ ├── task.md # the task
51
+ ├── notes.md # task-scoped notes
52
+ └── atoms/
53
+ ├── <atom-slug>.md # sequence: 1
54
+ └── <atom-slug>.md # sequence: 2
55
+ ```
56
+
57
+ A standalone task (without a phase) lives at `.planning/<task-slug>/` — same as sm mode but with HEWTD frontmatter and the new templates.
58
+
59
+ ## Lifecycle status
60
+
61
+ Each layer has a status enum tracked in frontmatter:
62
+
63
+ - **phase.status**: `draft | active | paused | done | archived`
64
+ - **task.status**: same enum
65
+ - **atom.status**: `ready | in_progress | done | blocked`
66
+
67
+ Status transitions are explicit. Atoms additionally support **reopen** (`done → in_progress`) with a `reopened_at: <iso-timestamp>` audit field for legitimate post-completion fixes.
68
+
69
+ When a phase is marked `archived`, the entire `<phase-slug>/` directory moves to `archive/<phase-slug>/`. Atoms and tasks within move with it.
70
+
71
+ ## Scheduling: dependencies-first, then parallelism
72
+
73
+ Tasks declare scheduling intent in frontmatter:
74
+
75
+ ```yaml
76
+ plan_kind: task
77
+ parent: foundation
78
+ depends_on: [hewtd-schema-extension] # this task waits for that one
79
+ parallelizable: false # only true if no inter-deps
80
+ ```
81
+
82
+ The planning MCP's `next_task(phase)` verb (added in semantic-memory 1.0) walks the `depends_on` graph and returns the next ready task respecting the order. Tasks with `parallelizable: true` and no inter-deps can be returned in any order — perfect for subagent teams picking up work concurrently.
83
+
84
+ **Atoms within a task default to sequential** (`sequence: 1, 2, 3...`). Atom-level parallelism is a Phase 4.x conversation.
85
+
86
+ ## Subagent contract
87
+
88
+ Lg-mode plans are designed to be **read by subagents via semantic-memory MCP verbs**, not by parsing markdown. The contract:
89
+
90
+ - `read_phase(slug)`, `read_task(slug)`, `read_atom(slug)`, `read_notes(scope?)`
91
+ - `list_phases(status?)`, `list_tasks(phase?, status?)`, `list_atoms(task?, status?)`
92
+ - `next_task(phase, exclude_in_progress?)` — respects depends_on + parallelizable
93
+ - `next_atom(task)` — returns the next ready atom in sequence
94
+ - `update_atom_status(slug, status)`, `update_task_status(slug, status)`, `update_phase_status(slug, status)`
95
+ - `get_planning_context(scope, slug)` — bundles parent chain + sibling status + relevant notes for one read; the subagent's primary "load my context" verb
96
+ - `append_notes(scope, slug, content)` — append-only writer for notes during execution
97
+
98
+ These verbs ship in semantic-memory 1.0 (registered conditionally on the `plans` corpus being active). When semantic-memory is absent, persistent-planning falls back to filesystem-based reads — slash commands still work; subagent comprehension degrades.
99
+
100
+ ## HEWTD frontmatter
101
+
102
+ Every layer carries HEWTD-aligned frontmatter (`tier: plan`). The `version` field is intentionally omitted — HEWTD 2.2.0 makes it conditionally optional for plan-tier docs (plans use lifecycle status, not semver).
103
+
104
+ This means lg-mode plans:
105
+ - Validate against HEWTD's metadata schema
106
+ - Are searchable + filterable by HEWTD's domain / load_priority / status fields
107
+ - Get indexed by semantic-memory's `plans` corpus for free
108
+ - Get drift-detected against the codebase by semantic-memory's drift verb (when both code corpus + plans corpus are active)
109
+
110
+ ## Migration from v2 (sm)
111
+
112
+ Existing `.planning/<task-slug>/{task_plan.md, notes.md}` directories continue to work without changes. They're treated as sm-mode tasks. The first time you run `/start-planning` on a project that auto-detects to lg, a `.planning/.meta/workspace.json` is written and lg-mode flow begins for new plans. Existing v2 plans aren't migrated — they coexist.
113
+
114
+ To explicitly migrate a v2 plan to lg, manually:
115
+ 1. `mkdir .planning/<phase-slug>` and create `phase.md` with the high-level goal
116
+ 2. Move the existing `<task-slug>/` under it
117
+ 3. Convert `task_plan.md` → `task.md` (rename + add HEWTD frontmatter)
118
+
119
+ ## Slash commands
120
+
121
+ | Command | Mode | Creates |
122
+ |---|---|---|
123
+ | `/start-planning "<name>"` | sm or lg (auto-detect) | sm: task; lg: phase |
124
+ | `/start-planning "<name>" --mode lg` | lg (explicit) | phase |
125
+ | `/start-planning "<name>" --mode sm` | sm (explicit) | task |
126
+ | `/start-task "<name>" --parent <phase>` | lg only | task under phase |
127
+ | `/start-atom "<name>" --parent <task>` | lg only | atom under task |
128
+
129
+ ## See also
130
+
131
+ - `docs/workspace-json.md` — workspace.json schema reference
132
+ - `docs/atom-granularity.md` — when to spawn an atom file vs. inline checkbox
133
+ - `templates/lg/{phase,task,atom,notes}.md` — frontmatter shapes
134
+ - `scripts/detect-mode.sh` — mode resolution logic
135
+ - `scripts/init-{phase,task,atom}.sh` — init script implementations
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: workspace.json schema
3
+ tier: standard
4
+ domains:
5
+ - planning
6
+ status: active
7
+ last_updated: 2026-05-07
8
+ version: 1.0.0
9
+ audience:
10
+ - developers
11
+ purpose: Document the .planning/.meta/workspace.json schema introduced in v3.0 for sm/lg mode tracking
12
+ ---
13
+
14
+ # `workspace.json` schema (v3.0)
15
+
16
+ Introduced in persistent-planning **3.0.0**. Tracks per-project planning mode and
17
+ detection state. Lives at `.planning/.meta/workspace.json`.
18
+
19
+ ## Schema
20
+
21
+ ```json
22
+ {
23
+ "schema_version": "1.0",
24
+ "mode": "sm" | "lg",
25
+ "auto_detected": true | false,
26
+ "detected_contributors": <integer>,
27
+ "created_at": "<ISO 8601 timestamp>"
28
+ }
29
+ ```
30
+
31
+ ## Field reference
32
+
33
+ | Field | Type | Required | Description |
34
+ |---|---|---|---|
35
+ | `schema_version` | string | yes | Schema version of this file. Currently `"1.0"`. |
36
+ | `mode` | `"sm"` \| `"lg"` | yes | Active planning mode for this project. |
37
+ | `auto_detected` | boolean | yes | `true` if mode was determined by the heuristic, `false` if explicitly set via `--mode`. |
38
+ | `detected_contributors` | integer | yes (when `auto_detected=true`) | Distinct git author email count over the last 90 days at detection time. |
39
+ | `created_at` | string (ISO 8601) | yes | When this workspace.json was first written. |
40
+
41
+ ## Mode determination
42
+
43
+ `detect-mode.sh` resolves the active mode using this precedence (first match wins):
44
+
45
+ 1. **Explicit override**: if `workspace.json` exists with a `"mode"` field, that value wins.
46
+ 2. **Auto-detect**: count distinct git author emails over the last 90 days. ≥ 2 → `"lg"`. Otherwise → `"sm"`.
47
+ 3. **Fallback**: if neither applies (no git repo, git fails), default to `"sm"`.
48
+
49
+ The override is sticky — once written, future runs read `workspace.json` and skip
50
+ re-detection. Override the override by editing `workspace.json` directly or by passing
51
+ `--mode sm` / `--mode lg` to `/start-planning` (which rewrites the file).
52
+
53
+ ## Mode behavior
54
+
55
+ ### `sm` (small / solo)
56
+ - Single-task model — `.planning/<task-slug>/{task_plan.md, notes.md}`
57
+ - Identical to v2 behavior; existing v2 plans continue to work without migration
58
+ - No HEWTD frontmatter on plans (frontmatter is plain text)
59
+ - Single slash command: `/start-planning "Task name"`
60
+
61
+ ### `lg` (large / team)
62
+ - Layered model: phase → task → atom + cross-cutting notes
63
+ - Directory layout: `.planning/<phase-slug>/<task-slug>/{task.md, notes.md, atoms/<atom-slug>.md}`
64
+ - HEWTD frontmatter on every layer (`tier: plan`, conditionally version-exempt per HEWTD 2.2.0)
65
+ - Three slash commands: `/start-planning` (phase), `/start-task --parent <phase>`, `/start-atom --parent <task>`
66
+ - Sequential atom hand-offs; tasks can declare `depends_on` + `parallelizable` for subagent team scheduling
67
+
68
+ ## Backwards compatibility
69
+
70
+ Existing `.planning/<task-slug>/` folders without `.meta/` continue to work as `sm`.
71
+ Mode detection only writes `workspace.json` when `/start-planning` is run after v3.0
72
+ upgrade — pure read operations don't trigger writes.
73
+
74
+ ## Manual editing
75
+
76
+ Safe to edit by hand. Common changes:
77
+
78
+ - Switch mode: change `"mode"`, set `"auto_detected": false`
79
+ - Reset auto-detection: delete the file; the next `/start-planning` will re-detect
80
+
81
+ ## See also
82
+
83
+ - `scripts/detect-mode.sh` — the resolution logic
84
+ - `templates/lg/{phase,task,atom,notes}.md` — frontmatter shape per layer
85
+ - `~/workspace/the-glitch-kingdom/persistent-planning/.planning/layered-planning-with-mcp-and-hewtd-frontmatter/task_plan.md` — the meta-plan that drove this design
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theglitchking/persistent-planning",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Persistent markdown-based planning with task directories, progress tracking, and context engineering for multi-step Claude Code workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,5 +54,8 @@
54
54
  "dependencies": {
55
55
  "@theglitchking/claude-plugin-runtime": "^0.1.0",
56
56
  "commander": "^14.0.0"
57
+ },
58
+ "devDependencies": {
59
+ "@theglitchking/semantic-pages": "^0.10.0"
57
60
  }
58
61
  }