planning-with-files 3.16.1 → 3.18.3

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/README.md CHANGED
@@ -1,13 +1,25 @@
1
- # planning-with-files
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/OthmanAdi/planning-with-files/master/media/v3-banner-1400.jpg" alt="planning-with-files: task_plan.md, findings.md, and progress.md as three stone tablets" width="100%">
3
+ </div>
2
4
 
3
- > **Your agent's context window dies. The plan does not.**
5
+ <h1 align="center">Planning with Files</h1>
4
6
 
5
- Persistent file-based planning for AI coding agents. The skill keeps `task_plan.md`, `findings.md` and `progress.md` on disk. After `/plan-execute`, Pi lifecycle hooks inject selected project planning context so the plan survives context loss, `/clear`, crashes and compaction. Automatic recovery reads project files only. Reading same-project local session records for aggregate counts or bounded replay requires an explicit catchup mode.
7
+ <p align="center">
8
+ <strong>The planning skill your agent cannot ignore.</strong><br>
9
+ Your agent's context window dies. The plan does not.
10
+ </p>
6
11
 
7
- This is the npm distribution of [OthmanAdi/planning-with-files](https://github.com/OthmanAdi/planning-with-files), which installs across 60+ agents via the Agent Skills standard. The package ships:
12
+ Persistent file-based planning for AI coding agents. Keep the plan, research and progress in your project so work can continue after context loss, `/clear`, crashes or compaction.
8
13
 
9
- - the planning skill itself: `SKILL.md`, `scripts/` and `templates/`
10
- - a [Pi Coding Agent](https://pi.dev) extension providing Claude-style lifecycle automation
14
+ | File | Purpose |
15
+ | --- | --- |
16
+ | `task_plan.md` | Goals, phases and decisions |
17
+ | `findings.md` | Research and discoveries |
18
+ | `progress.md` | Work completed, checks and next steps |
19
+
20
+ This is the npm distribution of [OthmanAdi/planning-with-files](https://github.com/OthmanAdi/planning-with-files), available across 60+ agents via the Agent Skills standard. It includes the planning skill, scripts and templates. Supported agent integrations add lifecycle hooks that bring selected planning context back into the session.
21
+
22
+ Automatic recovery reads project files only. Reading same-project local session records for aggregate counts or bounded replay requires an explicit catchup mode.
11
23
 
12
24
  ## Installation
13
25
 
@@ -19,19 +31,40 @@ npm install planning-with-files
19
31
 
20
32
  Places the skill, scripts and templates under `node_modules/planning-with-files/`. Use this to pin an exact version into a project, or to copy `SKILL.md` and `scripts/` into your agent's skills directory yourself. It does not register hooks on its own.
21
33
 
22
- ### Pi Install
34
+ ### Agent integrations
23
35
 
24
- ```bash
25
- pi install npm:planning-with-files
36
+ Claude Code gets the full surface (skill, hooks, slash commands) through the plugin route, and 60+ other agents install in one line. See the [main README](https://github.com/OthmanAdi/planning-with-files#quick-install).
37
+
38
+ ## Usage
39
+
40
+ Once the skill is installed for your agent, start with:
41
+
42
+ ```text
43
+ Use the planning-with-files skill to help me with this task.
44
+ ```
45
+
46
+ The workflow centers on three files in your project:
47
+
48
+ ```text
49
+ your-project/
50
+ ├── task_plan.md
51
+ ├── findings.md
52
+ └── progress.md
26
53
  ```
27
54
 
28
- Wires up the skill, the extension and the status bar automatically.
55
+ ## Pi Coding Agent integration
29
56
 
30
- ### Other agents
57
+ The package also bundles a [Pi Coding Agent](https://pi.dev) extension for lifecycle automation and a planning status bar.
31
58
 
32
- Claude Code gets the full surface (skill, hooks, slash commands) through the plugin route, and 60+ other agents install in one line. See the [main README](https://github.com/OthmanAdi/planning-with-files#quick-install).
59
+ ### Install in Pi
60
+
61
+ ```bash
62
+ pi install npm:planning-with-files
63
+ ```
33
64
 
34
- ### Manual Install
65
+ Pi discovers the skill and extension from the installed package.
66
+
67
+ For a local repository checkout:
35
68
 
36
69
  ```bash
37
70
  # From the planning-with-files repo root
@@ -45,31 +78,17 @@ Or add to `.pi/settings.json`:
45
78
  }
46
79
  ```
47
80
 
48
- ---
49
-
50
- ## Usage
51
-
52
- Pi discovers the skill and extension from the installed package.
53
-
54
- Start with:
55
-
56
- ```text
57
- Use the planning-with-files skill to help me with this task.
58
- ```
59
-
60
- Or:
81
+ You can also invoke the skill directly in Pi:
61
82
 
62
83
  ```text
63
84
  /skill:planning-with-files
64
85
  ```
65
86
 
66
- ---
67
-
68
- ## Hook Parity in Pi
87
+ ### Lifecycle hooks
69
88
 
70
89
  The bundled extension maps Claude-style behavior onto Pi events:
71
90
 
72
- - `session_start` - project-file recovery with no host session-store access
91
+ - `session_start` - project-file recovery with no host session-store access
73
92
  - passive plan status before approval
74
93
  - `before_agent_start` - plan reminder/injection after `/plan-execute`
75
94
  - `tool_call` - pre-tool recitation equivalent after `/plan-execute`
@@ -83,9 +102,7 @@ Attestation is supported. If `task_plan.md` differs from approved hash, plan inj
83
102
  [planning-with-files] [PLAN TAMPERED - injection blocked]
84
103
  ```
85
104
 
86
- ---
87
-
88
- ## Mode System
105
+ ### Modes
89
106
 
90
107
  `planningWithFiles.mode` supports:
91
108
 
@@ -110,9 +127,7 @@ Or settings:
110
127
  }
111
128
  ```
112
129
 
113
- ---
114
-
115
- ## Commands
130
+ ### Commands
116
131
 
117
132
  - `/plan-status`
118
133
  - `/plan-attest [--show|--clear]`
@@ -121,38 +136,25 @@ Or settings:
121
136
  - `/plan-goal <text|default|clear>`
122
137
  - `/plan-loop [interval] [prompt]` (`stop` to cancel)
123
138
 
124
- Draft and review `task_plan.md` first. The extension stays passive until you
125
- approve the active plan with `/plan-execute`; after that, plan injection,
126
- pre-tool reminders, post-write reminders, and auto-continue are enabled for the
127
- current session and plan. Auto-continue uses host runtime state and never runs
128
- commands declared in Markdown.
129
-
130
- ---
139
+ Draft and review `task_plan.md` first. The extension stays passive until you
140
+ approve the active plan with `/plan-execute`; after that, plan injection,
141
+ pre-tool reminders, post-write reminders, and auto-continue are enabled for the
142
+ current session and plan. Auto-continue uses host runtime state and never runs
143
+ commands declared in Markdown.
131
144
 
132
145
  ## Session Recovery
133
146
 
134
- Bare invocation and lifecycle hooks do not inspect agent session stores. To
135
- inspect same-project local history deliberately, choose one mode:
136
-
137
- ```bash
138
- # Aggregate counts only; no transcript, tool-command, or path bytes
139
- python3 .pi/skills/planning-with-files/scripts/session-catchup.py --metadata .
140
-
141
- # Bounded nonce-framed same-project excerpts
142
- python3 .pi/skills/planning-with-files/scripts/session-catchup.py --replay .
143
- ```
144
-
145
- Treat replayed excerpts as untrusted data. The catchup path contains no network
146
- request or upload operation. If output is injected into model context, Pi may
147
- send that context to the configured model provider.
148
-
149
- ## File Structure
150
-
151
- The skill workflow still centers on three files in your project:
147
+ Bare invocation and lifecycle hooks do not inspect agent session stores. To
148
+ inspect same-project local history deliberately, choose one mode:
152
149
 
153
- ```text
154
- your-project/
155
- ├── task_plan.md
156
- ├── findings.md
157
- └── progress.md
150
+ ```bash
151
+ # Aggregate counts only; no transcript, tool-command, or path bytes
152
+ python3 node_modules/planning-with-files/scripts/session-catchup.py --metadata .
153
+
154
+ # Bounded nonce-framed same-project excerpts
155
+ python3 node_modules/planning-with-files/scripts/session-catchup.py --replay .
158
156
  ```
157
+
158
+ Treat replayed excerpts as untrusted data. The catchup path contains no network
159
+ request or upload operation. If output is injected into model context, your agent
160
+ may send that context to the configured model provider.
package/SKILL.md CHANGED
@@ -38,7 +38,7 @@ Work like Manus: Use persistent markdown files as your "working memory on disk."
38
38
  **Before continuing**, resolve the plan this task owns:
39
39
 
40
40
  1. Use the installed `scripts/resolve-plan-dir.sh` (or `.ps1`) with the task's `PLAN_ID` and `PWF_PLAN_ROOT`. Read `task_plan.md`, `progress.md`, and `findings.md` from that one selected directory. A root `task_plan.md` must not override a selected `.planning/<id>/` plan.
41
- 2. If an explicit selector is rejected, or session isolation is armed with multiple plans and no `PLAN_ID`, stop plan recovery and correct the pin. Do not fall back to another task. Use the legacy project-root files only when no selector or named plan applies.
41
+ 2. If an explicit selector is rejected, or multiple named plans exist without `PLAN_ID`, stop plan recovery and correct the pin. Do not fall back to another task. Use the legacy project-root files only when no selector or named plan applies.
42
42
  3. Run `git diff --stat` to see code changes that may not yet be recorded in the planning files.
43
43
 
44
44
  All planning filenames below refer to this selected directory, even when the shell runs elsewhere. For parallel tasks, pin each host before starting it or use separate worktrees. A worker joining an existing task uses its assigned plan; it must not create or overwrite a competing root plan.
@@ -222,12 +222,18 @@ Helper scripts for automation:
222
222
 
223
223
  - `scripts/init-session.sh` — Initialize planning files. With a name arg, creates an isolated plan under `.planning/YYYY-MM-DD-<slug>/` for parallel task workflows. Without args, writes `task_plan.md` at project root (legacy mode, backward-compatible).
224
224
  - `scripts/set-active-plan.sh` — Switch the active plan pointer (`.planning/.active_plan`). Run with a plan ID to switch; run without args to show which plan is current.
225
- - `scripts/resolve-plan-dir.sh` — Resolve the active plan directory. A set `$PLAN_ID` is a binding: it resolves or resolution stops, never another plan (issue #237). With no `$PLAN_ID`, checks `.planning/.active_plan`, then newest plan dir by mtime, then falls back to project root (legacy). Used internally by hooks.
225
+ - `scripts/resolve-plan-dir.sh` — Resolve the active plan directory. A set `$PLAN_ID` is a binding: it resolves or resolution stops, never another plan (issue #237). With no `$PLAN_ID`, multiple named plans refuse selection. A single named plan may use `.planning/.active_plan` or discovery by mtime; otherwise resolution falls back to the project root (legacy). Used internally by hooks.
226
226
  - `scripts/check-complete.sh` — Verify all phases in the active plan are complete.
227
227
  - `scripts/session-catchup.py`: Explicit same-project session-record aggregation or bounded replay (`--metadata` / `--replay`); bare invocation does not access host history.
228
228
  - `scripts/attest-plan.sh` (and `.ps1`) — Lock the current `task_plan.md` content with a SHA-256 attestation (v2.37.0). Hooks then refuse to inject plan content if the file diverges from the attested hash. Use `--show` to print the stored hash, `--clear` to remove the attestation. See `/plan-attest` command.
229
229
  - `scripts/plan-doctor.sh` — One-pass self-check for the mechanisms that fail silently (v3.6.0): plan resolution, hook injection, canonicalizer path shape, attestation state, install surfaces, per-fire hook latency. Run it whenever hooks seem quiet or after installing on a new machine. See `/plan-doctor` command.
230
230
 
231
+ ### List saved plans
232
+
233
+ To find a task before resuming it, run `sh "<skill-dir>/scripts/set-active-plan.sh" --list` or, in Windows PowerShell, `& "<skill-dir>/scripts/set-active-plan.ps1" -List`. Replace `<skill-dir>` with this installed skill directory and keep your current directory at the project root.
234
+
235
+ This read-only command lists named plans and phase progress under the current directory's `.planning/`. `[active]` marks the shared default pointer; it does not bind a session. Concurrent tasks still require each host's `PLAN_ID` or separate worktrees.
236
+
231
237
  ### Parallel task workflow
232
238
 
233
239
  For independent tasks in the same repository, create a named plan for each and pin each agent host to its own plan:
@@ -360,7 +366,7 @@ The mode is set by writing a `.mode` file next to the plan (`.planning/<id>/.mod
360
366
 
361
367
  ### The legacy invariant (promise)
362
368
 
363
- With no `.mode` file and no other v3 marker, the hooks produce byte-identical output to v2.43, including the raw `progress.md` tail and the `===BEGIN PLAN DATA===` / `===END PLAN DATA===` delimiters. Every v3 behavior is additive and opt-in. No existing workflow changes.
369
+ With no `.mode` file and no other v3 marker, plan injection preserves the v2.43 output, including the raw `progress.md` tail and the `===BEGIN PLAN DATA===` / `===END PLAN DATA===` delimiters. Autonomous and gated behavior remains opt-in. Since v3.18.3, completed plans are silent through the shared Stop gate and Codex Stop hook. Explicit `check-complete.sh` or `check-complete.ps1` calls without the gate flag still report completion; incomplete-plan notices and gate decisions are unchanged.
364
370
 
365
371
  ### What each mode does
366
372
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planning-with-files",
3
- "version": "3.16.1",
3
+ "version": "3.18.3",
4
4
  "description": "Persistent project planning with selected context injection. Automatic recovery uses project files only; explicit catchup modes read same-project local session records for aggregate counts or bounded replay. The host-aware gate never runs Markdown-declared commands. No network upload path. Ships the skill plus a Pi Coding Agent extension.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -404,6 +404,7 @@ function Resolve-PlanFile {
404
404
  $resolver = Join-Path $PSScriptRoot "resolve-plan-dir.ps1"
405
405
  if (-not (Test-Path -LiteralPath $resolver -PathType Leaf)) { return $null }
406
406
  $resolvedDir = @(& $resolver | Where-Object { $_ }) | Select-Object -First 1
407
+ if (-not $resolvedDir -and ((& $resolver -CheckAmbiguity) -eq "PWF_PLAN_AMBIGUOUS_V1")) { return $null }
407
408
  if ($resolvedDir) {
408
409
  $planFile = Join-Path $resolvedDir "task_plan.md"
409
410
  return (Resolve-ContainedPlanFile -Candidate $planFile -ExpectedDirectory $resolvedDir)
@@ -45,6 +45,10 @@ resolve_plan_file() {
45
45
  plan_dir=""
46
46
  if [ -f "${RESOLVER}" ]; then
47
47
  plan_dir="$(sh "${RESOLVER}" 2>/dev/null)"
48
+ if [ -z "$plan_dir" ] && [ "$(sh "${RESOLVER}" --check-ambiguity 2>/dev/null)" = "PWF_PLAN_AMBIGUOUS_V1" ]; then
49
+ printf "[plan-attest] Multiple plans are available. Set PLAN_ID=<slug>; nothing was attested.\n" >&2
50
+ return 1
51
+ fi
48
52
  fi
49
53
  if [ -n "${plan_dir}" ] && [ -f "${plan_dir}/task_plan.md" ]; then
50
54
  printf "%s\n" "${plan_dir}/task_plan.md"
@@ -10,7 +10,8 @@
10
10
  # 4. the block counter (<plan-dir>/.stop_blocks) is below cap (PWF_GATE_CAP, default 20)
11
11
  # 5. the ledger advanced since the last block (stall -> allow stop)
12
12
  # When all hold, emits a single-line block-decision JSON on stdout and exits 0.
13
- # Otherwise advisory output and exit 0. Without -Gate, byte-equivalent to v2.43.
13
+ # Otherwise reports incomplete plans and exits 0; completed plans stay silent
14
+ # with -Gate, including legacy plans without .mode. Explicit reports are unchanged.
14
15
  #
15
16
  # Stdin: read only when input is redirected ([Console]::IsInputRedirected), so an
16
17
  # interactive console never blocks. Hook-piped JSON is EOF-terminated.
@@ -35,6 +36,7 @@ if ($PlanFile -ne "") {
35
36
  try {
36
37
  $resolvedDir = (& $resolver 2>$null | Select-Object -First 1)
37
38
  if ($null -eq $resolvedDir) { $resolvedDir = "" }
39
+ if (-not $resolvedDir -and ((& $resolver -CheckAmbiguity) -eq "PWF_PLAN_AMBIGUOUS_V1")) { exit 0 }
38
40
  } catch {
39
41
  $resolvedDir = ""
40
42
  }
@@ -84,9 +86,10 @@ if ($TOTAL -eq 0) {
84
86
  exit 0
85
87
  }
86
88
 
87
- # advisory_report: the v2.43 status echo.
89
+ # Keep explicit reports, but omit routine success from automatic gate checks.
88
90
  function Write-AdvisoryReport {
89
91
  if ($COMPLETE -eq $TOTAL -and $TOTAL -gt 0) {
92
+ if ($Gate) { return }
90
93
  Write-Host ('[planning-with-files] ALL PHASES COMPLETE (' + $COMPLETE + '/' + $TOTAL + '). If the user has additional work, add new phases to task_plan.md before starting.')
91
94
  } else {
92
95
  Write-Host ('[planning-with-files] Task in progress (' + $COMPLETE + '/' + $TOTAL + ' phases complete). Update progress.md before stopping.')
@@ -21,8 +21,9 @@
21
21
  # 4. the block counter (<plan-dir>/.stop_blocks) is below cap (PWF_GATE_CAP, default 20)
22
22
  # 5. the ledger advanced since the last block (stall → allow stop)
23
23
  # When all hold, it emits a single-line block-decision JSON on stdout and
24
- # exits 0. Otherwise it falls back to advisory output and exits 0.
25
- # Without --gate, or in non-gated mode, behavior is byte-equivalent to v2.43.
24
+ # exits 0. Otherwise it reports incomplete plans and exits 0; completed
25
+ # plans stay silent in --gate mode, including legacy plans without .mode.
26
+ # Without --gate, the explicit advisory report is unchanged.
26
27
  #
27
28
  # Stdin handling: the Claude Code Stop hook pipes a JSON payload on stdin. To
28
29
  # avoid hanging when nothing is piped, stdin is read ONLY when fd 0 is not a
@@ -56,6 +57,9 @@ else
56
57
  RESOLVED_DIR=""
57
58
  if [ -f "${RESOLVER}" ]; then
58
59
  RESOLVED_DIR="$(sh "${RESOLVER}" 2>/dev/null)"
60
+ if [ -z "$RESOLVED_DIR" ] && [ "$(sh "${RESOLVER}" --check-ambiguity 2>/dev/null)" = "PWF_PLAN_AMBIGUOUS_V1" ]; then
61
+ exit 0
62
+ fi
59
63
  fi
60
64
  if [ -n "${RESOLVED_DIR}" ] && [ -f "${RESOLVED_DIR}/task_plan.md" ]; then
61
65
  PLAN_FILE="${RESOLVED_DIR}/task_plan.md"
@@ -116,9 +120,11 @@ if [ "$TOTAL" -eq 0 ]; then
116
120
  exit 0
117
121
  fi
118
122
 
119
- # advisory_report: the v2.43 status echo. Always exit 0 after calling.
123
+ # Explicit status reports retain completion text. Automatic gate checks have
124
+ # nothing to report on success; keep evaluating all gate guards before here.
120
125
  advisory_report() {
121
126
  if [ "$COMPLETE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then
127
+ [ "$GATE" -eq 1 ] && return 0
122
128
  echo "[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL). If the user has additional work, add new phases to task_plan.md before starting."
123
129
  else
124
130
  echo "[planning-with-files] Task in progress ($COMPLETE/$TOTAL phases complete). Update progress.md before stopping."