@theglitchking/persistent-planning 1.0.1 → 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.
- package/.claude-plugin/marketplace.json +45 -0
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +132 -0
- package/LICENSE +0 -0
- package/README.md +46 -35
- package/bin/persistent-planning.js +57 -232
- package/commands/policy.md +16 -0
- package/commands/relink.md +6 -0
- package/commands/start-atom.md +93 -0
- package/commands/start-planning.md +115 -0
- package/commands/start-task.md +83 -0
- package/commands/status.md +6 -0
- package/commands/update.md +6 -0
- package/docs/atom-granularity.md +156 -0
- package/docs/examples.md +0 -0
- package/docs/lg-mode.md +135 -0
- package/docs/reference.md +0 -0
- package/docs/workspace-json.md +85 -0
- package/hooks/hooks.json +15 -0
- package/hooks/session-start.js +13 -0
- package/package.json +17 -11
- package/scripts/link-skills.js +23 -0
- package/skills/{SKILL.md → persistent-planning/SKILL.md} +0 -0
- package/.claude/commands/start-planning.md +0 -65
- package/.claude/settings.local.json +0 -13
- package/postinstall.js +0 -34
- package/scripts/init-planning.sh +0 -233
|
@@ -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
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: start-planning
|
|
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
|
+
---
|
|
5
|
+
|
|
6
|
+
# /start-planning
|
|
7
|
+
|
|
8
|
+
Initialize the persistent planning structure. Mode (sm vs lg) determines what gets created.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```
|
|
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)
|
|
18
|
+
```
|
|
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
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```
|
|
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
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## What To Do
|
|
39
|
+
|
|
40
|
+
When the user runs `/start-planning "<name>" [--mode sm|lg]`:
|
|
41
|
+
|
|
42
|
+
1. **Resolve mode**:
|
|
43
|
+
```bash
|
|
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
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. **Dispatch by mode**:
|
|
54
|
+
|
|
55
|
+
If `MODE=sm`:
|
|
56
|
+
```bash
|
|
57
|
+
bash "${SCRIPT_DIR}/init-planning.sh" "<name>"
|
|
58
|
+
```
|
|
59
|
+
|
|
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
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## What It Creates
|
|
82
|
+
|
|
83
|
+
### sm mode
|
|
84
|
+
```
|
|
85
|
+
.planning/
|
|
86
|
+
└── <slug>/
|
|
87
|
+
├── task_plan.md # Track phases inline + progress
|
|
88
|
+
└── notes.md # Store research and findings
|
|
89
|
+
```
|
|
90
|
+
|
|
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
|
|
111
|
+
|
|
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,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Update persistent-planning to the latest version (runs npm update + re-links skills)
|
|
3
|
+
allowed-tools: Bash(npx:*)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Run `npx --no @theglitchking/persistent-planning update` and report the before/after versions to the user. If the project doesn't have a local install, fall back to `npx -y @theglitchking/persistent-planning update` and note that in your summary.
|
|
@@ -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)
|
package/docs/examples.md
CHANGED
|
File without changes
|
package/docs/lg-mode.md
ADDED
|
@@ -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
|
package/docs/reference.md
CHANGED
|
File without changes
|