@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.
@@ -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
@@ -0,0 +1,15 @@
1
+ {
2
+ "description": "persistent-planning SessionStart hook — nudges/auto-updates per policy.",
3
+ "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-start.js\""
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ // persistent-planning SessionStart hook.
3
+ // Delegates entirely to @theglitchking/claude-plugin-runtime — this plugin
4
+ // has no mcp.json wiring or project-side reconcile, so only the update
5
+ // check runs.
6
+
7
+ import { runSessionStart } from "@theglitchking/claude-plugin-runtime";
8
+
9
+ await runSessionStart({
10
+ packageName: "@theglitchking/persistent-planning",
11
+ pluginName: "persistent-planning",
12
+ configFile: "persistent-planning.json",
13
+ });
package/package.json CHANGED
@@ -1,43 +1,42 @@
1
1
  {
2
2
  "name": "@theglitchking/persistent-planning",
3
- "version": "1.0.1",
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
- "type": "commonjs",
5
+ "type": "module",
6
6
  "bin": {
7
7
  "persistent-planning": "bin/persistent-planning.js"
8
8
  },
9
9
  "scripts": {
10
- "postinstall": "node postinstall.js"
10
+ "postinstall": "node scripts/link-skills.js"
11
11
  },
12
12
  "files": [
13
13
  "bin/",
14
+ "commands/",
15
+ "hooks/",
16
+ "scripts/link-skills.js",
14
17
  "skills/",
15
- "scripts/",
16
18
  "docs/",
17
- ".claude/",
18
19
  ".claude-plugin/",
19
- "postinstall.js",
20
20
  "README.md",
21
21
  "LICENSE",
22
22
  "CHANGELOG.md"
23
23
  ],
24
24
  "engines": {
25
- "node": ">=16.0.0"
25
+ "node": ">=20.0.0"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
30
  "keywords": [
31
31
  "claude-code",
32
+ "plugin",
32
33
  "planning",
33
34
  "persistent",
34
35
  "markdown",
35
36
  "context-engineering",
36
37
  "task-tracking",
37
38
  "working-memory",
38
- "goal-tracking",
39
- "manus",
40
- "plugin"
39
+ "goal-tracking"
41
40
  ],
42
41
  "author": {
43
42
  "name": "TheGlitchKing",
@@ -51,5 +50,12 @@
51
50
  "bugs": {
52
51
  "url": "https://github.com/TheGlitchKing/persistent-planning/issues"
53
52
  },
54
- "homepage": "https://github.com/TheGlitchKing/persistent-planning#readme"
53
+ "homepage": "https://github.com/TheGlitchKing/persistent-planning#readme",
54
+ "dependencies": {
55
+ "@theglitchking/claude-plugin-runtime": "^0.1.0",
56
+ "commander": "^14.0.0"
57
+ },
58
+ "devDependencies": {
59
+ "@theglitchking/semantic-pages": "^0.10.0"
60
+ }
55
61
  }
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ // Postinstall — delegates to @theglitchking/claude-plugin-runtime.
3
+ // See https://github.com/TheGlitchKing/claude-plugin-runtime/blob/main/docs/PLUGIN_AUTHORING_SCAFFOLD.md
4
+
5
+ import { runPostinstall } from "@theglitchking/claude-plugin-runtime";
6
+ import { dirname, resolve } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+
9
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
10
+
11
+ try {
12
+ runPostinstall({
13
+ packageName: "@theglitchking/persistent-planning",
14
+ pluginName: "persistent-planning",
15
+ configFile: "persistent-planning.json",
16
+ skillsDir: "skills",
17
+ packageRoot,
18
+ hookCommand:
19
+ "node ./node_modules/@theglitchking/persistent-planning/hooks/session-start.js",
20
+ });
21
+ } catch (err) {
22
+ console.warn(`[persistent-planning] postinstall failed: ${err?.message || err}`);
23
+ }
@@ -1,65 +0,0 @@
1
- ---
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."
4
- ---
5
-
6
- # /start-planning
7
-
8
- Initialize the persistent planning structure for a task.
9
-
10
- ---
11
-
12
- ## Usage
13
-
14
- ```
15
- /start-planning "Your task name here"
16
- ```
17
-
18
- ## Examples
19
-
20
- ```
21
- /start-planning "Refactor authentication system"
22
- /start-planning "Build REST API with JWT"
23
- /start-planning "Fix memory leak in worker process"
24
- ```
25
-
26
- ---
27
-
28
- ## What To Do
29
-
30
- When the user runs `/start-planning "Task Name"`:
31
-
32
- 1. Run the init script:
33
- ```bash
34
- bash "$(dirname "$(readlink -f "$0")")/../scripts/init-planning.sh" "Task Name"
35
- ```
36
-
37
- If the script is not found at that path, try these fallbacks in order:
38
- ```bash
39
- bash scripts/init-planning.sh "Task Name"
40
- bash ~/.claude/skills/persistent-planning/scripts/init-planning.sh "Task Name"
41
- ```
42
-
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
48
-
49
- ---
50
-
51
- ## What It Creates
52
-
53
- ```
54
- .planning/
55
- └── [task-slug]/
56
- ├── task_plan.md # Track phases and progress
57
- └── notes.md # Store research and findings
58
- ```
59
-
60
- ## Task Slug Conversion
61
-
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`
@@ -1,13 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(bash:*)",
5
- "Bash(echo:*)",
6
- "Bash(./install.sh:*)",
7
- "Bash(/mnt/e/docker-containers/persistent-planning/uninstall.sh:*)",
8
- "Bash(chmod:*)",
9
- "Bash(node:*)",
10
- "Bash(python3:*)"
11
- ]
12
- }
13
- }
package/postinstall.js DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const colors = {
4
- reset: '\x1b[0m',
5
- green: '\x1b[32m',
6
- blue: '\x1b[34m',
7
- yellow: '\x1b[33m',
8
- cyan: '\x1b[36m'
9
- };
10
-
11
- console.log(`
12
- ${colors.cyan}persistent-planning installed successfully!${colors.reset}
13
-
14
- ${colors.green}+${colors.reset} Package installed: ${colors.blue}@theglitchking/persistent-planning${colors.reset}
15
-
16
- ${colors.yellow}Next Steps:${colors.reset}
17
-
18
- 1. Run the installer to set up the plugin:
19
- ${colors.cyan}persistent-planning install --scope user${colors.reset}
20
-
21
- ${colors.blue}Scopes:${colors.reset}
22
- user - Install globally (~/.claude/) for all projects
23
- project - Install locally (./.claude/) for this project only
24
-
25
- 2. Check installation status:
26
- ${colors.cyan}persistent-planning status${colors.reset}
27
-
28
- 3. After installation, use this Claude Code command:
29
- ${colors.cyan}/start-planning "Your task name"${colors.reset}
30
-
31
- ${colors.yellow}Documentation:${colors.reset}
32
- ${colors.blue}https://github.com/TheGlitchKing/persistent-planning${colors.reset}
33
-
34
- `);
@@ -1,233 +0,0 @@
1
- #!/bin/bash
2
-
3
- ###############################################################################
4
- # init-planning.sh - Persistent Planning Directory Setup
5
- #
6
- # Part of the persistent-planning plugin by TheGlitchKing
7
- # https://github.com/TheGlitchKing/persistent-planning
8
- #
9
- # Usage:
10
- # bash scripts/init-planning.sh [task-name]
11
- # bash scripts/init-planning.sh "Refactor database layer"
12
- #
13
- # What it does:
14
- # 1. Creates .planning/[task-slug]/ directory (separate per task)
15
- # 2. Creates task_plan.md with templates
16
- # 3. Creates notes.md with templates
17
- # 4. Adds .planning/ to .gitignore (optional)
18
- # 5. Confirms creation and provides next steps
19
- #
20
- # Multiple tasks example:
21
- # /start-planning "Refactor auth" -> .planning/refactor-auth/
22
- # /start-planning "Debug memory leak" -> .planning/debug-memory-leak/
23
- # Both plans coexist without conflicts!
24
- ###############################################################################
25
-
26
- set -e
27
-
28
- # Validate that task name was provided
29
- if [ -z "$1" ]; then
30
- echo "Error: Task name required"
31
- echo ""
32
- echo "Usage: bash scripts/init-planning.sh \"Your Task Name\""
33
- echo ""
34
- echo "Examples:"
35
- echo " bash scripts/init-planning.sh \"Refactor authentication\""
36
- echo " bash scripts/init-planning.sh \"Debug API performance\""
37
- exit 1
38
- fi
39
-
40
- TASK_NAME="$1"
41
-
42
- # Convert task name to slug
43
- # "Refactor Authentication" -> "refactor-authentication"
44
- task_name_to_slug() {
45
- local name="$1"
46
- name=$(echo "$name" | tr '[:upper:]' '[:lower:]')
47
- name=$(echo "$name" | sed 's/[[:space:]_]\+/-/g')
48
- name=$(echo "$name" | sed 's/[^a-z0-9-]//g')
49
- name=$(echo "$name" | sed 's/^-\+\|-\+$//g')
50
- name=$(echo "$name" | sed 's/-\+/-/g')
51
- echo "$name"
52
- }
53
-
54
- TASK_SLUG=$(task_name_to_slug "$TASK_NAME")
55
-
56
- # Validate slug
57
- if [ -z "$TASK_SLUG" ]; then
58
- echo "Error: Task name must contain at least one alphanumeric character"
59
- echo "Provided: $TASK_NAME"
60
- exit 1
61
- fi
62
-
63
- # Determine project root
64
- PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$(pwd)}"
65
- PLANNING_DIR="${PROJECT_ROOT}/.planning"
66
- TASK_DIR="${PLANNING_DIR}/${TASK_SLUG}"
67
-
68
- # Color codes
69
- GREEN='\033[0;32m'
70
- BLUE='\033[0;34m'
71
- YELLOW='\033[1;33m'
72
- CYAN='\033[0;36m'
73
- NC='\033[0m'
74
-
75
- echo -e "${BLUE}Initializing Planning Structure${NC}"
76
- echo ""
77
-
78
- # Step 1: Create .planning directory
79
- if [ ! -d "$PLANNING_DIR" ]; then
80
- mkdir -p "$PLANNING_DIR"
81
- echo -e "${GREEN}+${NC} Created .planning/ directory"
82
- else
83
- echo -e "${YELLOW}*${NC} .planning/ directory exists"
84
- fi
85
-
86
- # Step 2: Create task directory
87
- if [ ! -d "$TASK_DIR" ]; then
88
- mkdir -p "$TASK_DIR"
89
- echo -e "${GREEN}+${NC} Created task directory: ${CYAN}.planning/${TASK_SLUG}/${NC}"
90
- else
91
- echo -e "${YELLOW}*${NC} Task directory already exists: ${CYAN}.planning/${TASK_SLUG}/${NC}"
92
- fi
93
-
94
- # Step 3: Create task_plan.md
95
- TASK_PLAN_FILE="${TASK_DIR}/task_plan.md"
96
- if [ ! -f "$TASK_PLAN_FILE" ]; then
97
- cat > "$TASK_PLAN_FILE" << 'EOF'
98
- # Task Plan: TASK_NAME_PLACEHOLDER
99
-
100
- ## Goal
101
- [One sentence describing the end state]
102
-
103
- ## Phases
104
- - [ ] Phase 1: Plan and setup
105
- - [ ] Phase 2: Research/gather information
106
- - [ ] Phase 3: Execute/build
107
- - [ ] Phase 4: Review and deliver
108
-
109
- ## Key Questions
110
- 1. [Question to answer]
111
- 2. [Question to answer]
112
-
113
- ## Decisions Made
114
- - [Decision]: [Rationale]
115
-
116
- ## Errors Encountered
117
- - [Error]: [Resolution]
118
-
119
- ## Status
120
- **Currently in Phase 1** - Setting up planning structure
121
-
122
- ---
123
-
124
- ## Notes
125
- - This file persists across sessions
126
- - Update status after each phase
127
- - Mark completed phases with [x]
128
- - Save research to notes.md instead of stuffing context
129
- EOF
130
-
131
- sed -i "s/TASK_NAME_PLACEHOLDER/${TASK_NAME}/g" "$TASK_PLAN_FILE"
132
- echo -e "${GREEN}+${NC} Created task_plan.md"
133
- else
134
- echo -e "${YELLOW}*${NC} task_plan.md already exists (not overwritten)"
135
- fi
136
-
137
- # Step 4: Create notes.md
138
- NOTES_FILE="${TASK_DIR}/notes.md"
139
- if [ ! -f "$NOTES_FILE" ]; then
140
- cat > "$NOTES_FILE" << 'EOF'
141
- # Notes: TASK_NAME_PLACEHOLDER
142
-
143
- ## Key Findings
144
- - [Finding 1]
145
- - [Finding 2]
146
-
147
- ## Research Sources
148
- - [Source 1]: [URL or reference]
149
- - [Source 2]: [URL or reference]
150
-
151
- ## Synthesized Findings
152
-
153
- ### [Category/Topic 1]
154
- - [Finding]
155
- - [Finding]
156
-
157
- ### [Category/Topic 2]
158
- - [Finding]
159
- - [Finding]
160
-
161
- ## Decisions Made
162
- - [Decision]: [Rationale]
163
- - [Decision]: [Rationale]
164
-
165
- ## Errors & Solutions
166
- - [Error]: [Resolution]
167
- - [Error]: [Resolution]
168
-
169
- ---
170
-
171
- ## Append-Only Log
172
- Store findings here as you discover them. This builds a searchable history.
173
-
174
- ### [Date/Time]
175
- - [What I found/did]
176
- EOF
177
-
178
- sed -i "s/TASK_NAME_PLACEHOLDER/${TASK_NAME}/g" "$NOTES_FILE"
179
- echo -e "${GREEN}+${NC} Created notes.md"
180
- else
181
- echo -e "${YELLOW}*${NC} notes.md already exists (not overwritten)"
182
- fi
183
-
184
- # Step 5: Update .gitignore
185
- if [ -f "${PROJECT_ROOT}/.gitignore" ]; then
186
- if ! grep -q "^\.planning/" "${PROJECT_ROOT}/.gitignore"; then
187
- echo ".planning/" >> "${PROJECT_ROOT}/.gitignore"
188
- echo -e "${GREEN}+${NC} Added .planning/ to .gitignore"
189
- else
190
- echo -e "${YELLOW}*${NC} .planning/ already in .gitignore"
191
- fi
192
- else
193
- echo -e "${YELLOW}*${NC} No .gitignore found (not added)"
194
- fi
195
-
196
- # Step 6: List other active tasks
197
- OTHER_TASKS=$(find "$PLANNING_DIR" -maxdepth 1 -type d -not -name ".planning" -not -path "$TASK_DIR" 2>/dev/null | wc -l)
198
- if [ "$OTHER_TASKS" -gt 0 ]; then
199
- echo ""
200
- echo -e "${CYAN}Other active tasks:${NC}"
201
- find "$PLANNING_DIR" -maxdepth 1 -type d -not -name ".planning" -not -path "$TASK_DIR" | sort | while read dir; do
202
- task_slug=$(basename "$dir")
203
- echo " .planning/${task_slug}/"
204
- done
205
- fi
206
-
207
- # Step 7: Confirmation
208
- echo ""
209
- echo -e "${GREEN}=====================================${NC}"
210
- echo -e "${GREEN}Task Plan Ready${NC}"
211
- echo -e "${GREEN}=====================================${NC}"
212
- echo ""
213
-
214
- echo -e "${BLUE}Task:${NC} ${TASK_NAME}"
215
- echo -e "${BLUE}Location:${NC} .planning/${TASK_SLUG}/"
216
- echo ""
217
-
218
- echo -e "${BLUE}Files:${NC}"
219
- echo " task_plan.md (your task plan)"
220
- echo " notes.md (research & findings)"
221
- echo ""
222
-
223
- echo -e "${BLUE}Next steps:${NC}"
224
- echo " 1. Edit .planning/${TASK_SLUG}/task_plan.md to define your phases"
225
- echo " 2. As you work, update the Status section"
226
- echo " 3. Save findings to .planning/${TASK_SLUG}/notes.md"
227
- echo " 4. Re-read task_plan.md before major decisions"
228
- echo ""
229
-
230
- echo -e "${BLUE}Cleanup:${NC}"
231
- echo " rm -rf .planning/${TASK_SLUG}/ # Remove this task"
232
- echo " rm -rf .planning/ # Remove all tasks"
233
- echo ""