Compare commits

...
7 Commits
Author SHA1 Message Date
OthmanAdi 9e94390e59 release: v3.11.2 2026-08-22 13:03:16 +02:00
OthmanAdi 71258dae71 fix: create the skill destination before manual copies 2026-08-22 12:53:05 +02:00
Dylan Pulver 3c5ea2b14f docs: name the skill directory in the skills-only install commands
docs/installation.md:101 and docs/windows.md:38 copy skills/* into the user's
skills directory. Since the v3.11.0 move of the language variants to
skills/i18n/, that glob also copies i18n/, which is not a skill: the user ends
up with ~/.claude/skills/i18n/ holding no SKILL.md, and the five translations
at ~/.claude/skills/i18n/planning-with-files-<lang>/ rather than the
~/.claude/skills/planning-with-files-<lang>/ that commands/plan-<lang>.md
probes first.

Both now name skills/planning-with-files, matching section 4 of
installation.md, README.md:250 and every other copy command in docs/. A second
line copying skills/i18n/* would restore what the glob used to install, but
docs/languages.md:26 states that installing English installs no translation,
and six skills in ~/.claude/skills/ returns the five extra descriptions to
every session that PR #226 removed from the plugin route.

The guard lives in tests/test_plugin_skill_surface.py, which owns the skills/
depth invariant. It matches only lines starting with cp or Copy-Item, so the
prose describing the skills/*/SKILL.md plugin scan does not trip it.
2026-08-22 12:53:05 +02:00
OthmanAdi 39d75d8acf release: v3.11.1
Version bump across the 19 parity targets, CHANGELOG, CONTRIBUTORS, and the
README releases row for the POSIX shell fix in PR #228.

Also repairs the v3.11.0 changelog entry, which warned that shell hooks must
not emit JSON with echo and then carried two raw newlines of its own inside
the code spans for the escape sequence it was describing.
2026-08-21 13:30:46 +02:00
Dylan Pulver 95c903c10a fix: feed the Copilot error hook over a pipe so dash can parse it
error-occurred.sh reads its two python helpers' stdin with `<<<`, a bash
here-string. dash has no such operator, so the script is a parse error, not a
runtime error: `sh error-occurred.sh` dies at line 32 with "Syntax error:
redirection unexpected" before any line runs.

tests/test_planning_disabled_optout.py runs every Copilot hook through
`["sh", str(script)]`, which ignores the `#!/bin/bash` shebang. On Ubuntu
/bin/sh is dash, so the hook exits 2 and the enabled-run assertion at line 200
fails. That is the whole of the current master CI failure; macOS and Windows
stay green because their /bin/sh parses `<<<`.

The four sibling hooks already pipe stdin instead, so this is the last `<<<`
under .github/. They pipe with `echo`, which is not safe to copy here: dash's
builtin echo expands backslash escapes, and $INPUT is raw JSON from Copilot,
so an escaped \n inside an error message becomes a real control character and
json.load rejects the payload. The hook then reports {} and the error is
dropped. `printf '%s\n'` never touches the escapes, which is the same reason
3c78c3c moved the output side of these hooks off echo.

Scoped to .github/hooks/scripts/. The four .gemini/hooks copies use `<<<`
too, but nothing invokes them through sh and settings.json runs them by path,
so their shebang applies and they are not part of this failure.
2026-08-21 13:20:23 +02:00
OthmanAdi 6551c4d067 docs: regroup the README so the human half comes first
The first thing a visitor saw was the problem statement, then thirty lines
of mechanism before any evidence the thing works. Six sections now sit above
the fold in decision order: the /clear proof, the problem, the three files,
why it works, the numbers, install. Everything technical moves below a new
Reference index.

Two jump indexes: a five-link one under the badges for the human half, and a
table under Reference covering the technical half.

New headline leads on the differentiator rather than the symptom. A hook
that fires every turn is not the same as a prompt the model may choose to
follow, and that is the whole argument for this skill. The previous tagline
is kept underneath.

Nothing removed. Verified section by section: 22 blocks each used exactly
once, every one byte-identical, 0 of 462 substantive lines lost, 0 headings
lost. Also repairs #faq, which stopped resolving when the FAQ became a
collapsed details block, and gives Releases and Community real anchors.
2026-08-21 07:32:26 +02:00
OthmanAdi 84eb74c4b0 docs: correct the timespan in the v3.11.0 thanks section
The thread runs from #47 on 2026-01-21 to #226 merging on 2026-08-20,
which is seven months, not sixteen.
2026-08-20 22:27:36 +02:00
25 changed files with 270 additions and 117 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ hooks:
- type: command
command: "SH=\"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\"; [ -f \"$SH\" ] || SH=$(ls \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\" 2>/dev/null | head -1); [ -n \"$SH\" ] && [ -f \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
# Planning with Files
+1 -1
View File
@@ -10,7 +10,7 @@
"name": "planning-with-files",
"source": "./",
"description": "Persistent file-based planning for AI coding agents. Crash-proof markdown plans that survive context loss, /clear, and crashes, with an opt-in completion gate and multi-agent shared state on disk. Manus-style, installs across 60+ agents via the SKILL.md standard.",
"version": "3.11.0"
"version": "3.11.2"
}
]
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "planning-with-files",
"version": "3.11.0",
"version": "3.11.2",
"description": "Persistent file-based planning for AI coding agents. Crash-proof markdown plans (task_plan.md, findings.md, progress.md) that survive context loss and /clear, with an opt-in completion gate and multi-agent shared state. Manus-style. Works with Claude Code, Codex CLI, Cursor, Kiro, OpenCode and 60+ agents via the SKILL.md standard. Includes Arabic, German, Spanish, and Chinese (Simplified and Traditional).",
"author": {
"name": "OthmanAdi",
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"${CODEBUDDY_PLUGIN_ROOT}/scripts/inject-plan.sh\" \"$HOME/.codebuddy/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
+1 -1
View File
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.codex/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
+1 -1
View File
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.cursor/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
+1 -1
View File
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.factory/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
# Planning with Files
+3 -3
View File
@@ -21,7 +21,7 @@ for _p in /usr/bin/python3 /usr/local/bin/python3 /opt/homebrew/bin/python3; do
[ -x "$_p" ] && { PYTHON="$_p"; break; }
done
[ -z "$PYTHON" ] && PYTHON=$(command -v python3 2>/dev/null || command -v python 2>/dev/null)
ERROR_MSG=$($PYTHON -c "
ERROR_MSG=$(printf '%s\n' "$INPUT" | $PYTHON -c "
import sys, json
try:
data = json.load(sys.stdin)
@@ -29,11 +29,11 @@ try:
print(msg[:200])
except:
print('')
" <<< "$INPUT" 2>/dev/null || echo "")
" 2>/dev/null || echo "")
if [ -n "$ERROR_MSG" ]; then
CONTEXT="[planning-with-files] Error detected: ${ERROR_MSG}. Log this error in task_plan.md under Errors Encountered with the attempt number and resolution."
ESCAPED=$($PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" <<< "$CONTEXT" 2>/dev/null || echo "\"\"")
ESCAPED=$(printf '%s\n' "$CONTEXT" | $PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" 2>/dev/null || echo "\"\"")
printf '%s\n' "{\"hookSpecificOutput\":{\"hookEventName\":\"ErrorOccurred\",\"additionalContext\":$ESCAPED}}"
else
echo '{}'
+1 -1
View File
@@ -2,7 +2,7 @@
name: planning-with-files
description: "Manus-style persistent file-based planning for AI coding agents: keeps task_plan.md, findings.md, and progress.md on disk so work survives context loss and /clear. Use when asked to plan out, break down, or organize a multi-step project, research task, or any work requiring 5+ tool calls. Hermes adaptation with minimal notes."
metadata:
version: "3.11.0"
version: "3.11.2"
---
> Hermes note: lifecycle automation for this skill is provided by the Hermes adapter plugin in `.hermes/plugins/planning-with-files/`.
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.mastracode/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.config/opencode/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.opencode/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "planning-with-files",
"version": "3.11.0",
"version": "3.11.2",
"description": "Persistent file-based planning for AI coding agents: keeps task_plan.md, findings.md and progress.md on disk so the plan survives /clear, context loss and compaction. Manus-style. Ships the skill plus a Pi Coding Agent extension.",
"keywords": [
"pi-package",
+38 -4
View File
@@ -2,6 +2,42 @@
All notable changes to this project will be documented in this file.
## [3.11.2] - 2026-08-22
### Fixed
- **The two manual skills-only install commands copied the whole `skills/` directory after the language variants moved under `skills/i18n/` (PR #229 by @dylanpulver).** The Unix and PowerShell instructions now copy only `skills/planning-with-files`, so an English install no longer creates an unusable `~/.claude/skills/i18n/` entry or places the five translations one directory below the paths their commands probe.
- **A fresh manual install could flatten the canonical skill into `~/.claude/skills/`.** With one source directory and no existing destination, `cp` and `Copy-Item` can create the destination from the source contents, leaving `SKILL.md` directly under `skills/`. Both instructions now create `~/.claude/skills` before copying the canonical skill directory into it.
### Changed
- `tests/test_plugin_skill_surface.py` now scans tracked Markdown for `cp` or `Copy-Item` commands that copy `skills/*` wholesale. It also locks the destination-creation step before both manual copies and falls back to a filesystem scan when Git is unavailable.
### Verification
- Required baseline before integration: 434 passed, 10 skipped, and 497 subtests passed.
- Exact contributor head before the maintainer hardening: 435 passed, 10 skipped, and 497 subtests passed.
- Amended release candidate: 436 passed, 10 skipped, and 499 subtests passed. GitHub Actions passed on Ubuntu, macOS, and Windows, and the Pi extension Vitest job passed.
- `sync-ide-folders.py --verify` reports every maintained mirror in sync. `bump-version.py 3.11.2 --dry-run` resolves all 19 present parity targets with zero errors.
### Thanks
- Dylan traced the regression to the v3.11.0 language-directory move, found the only two whole-directory copy commands in tracked documentation, and added the guard that keeps that install shape out of future docs (PR #229).
## [3.11.1] - 2026-08-21
### Fixed
- **The Copilot error hook could not be parsed by a POSIX shell (PR #228 by @dylanpulver).** `error-occurred.sh` fed both of its Python helpers with `<<<`, a bash here-string that dash does not implement. `tests/test_planning_disabled_optout.py` invokes the shell hooks as `["sh", script]`, so the `#!/bin/bash` shebang never applied, and on ubuntu runners, where `/bin/sh` is dash, the file died at line 32 with `Syntax error: redirection unexpected`. Master CI had failed on the ubuntu leg for five consecutive runs. Both call sites now pipe with `printf '%s\n'`. The four sibling hooks pipe with `echo`, and that form was deliberately not copied: dash's builtin `echo` expands backslash escapes, so an escaped newline inside an error message would come back as a real control character and `json.load` would reject it, trading a loud parse failure for a silent one. No user was affected, because `.github/hooks/planning-with-files.json` invokes the hook under a `bash` key, which bypasses both the shebang and the exec bit. This is a CI and portability fix.
- The v3.11.0 changelog entry warning that shell hooks must not emit JSON with `echo` contained two raw newlines of its own, inside the code spans for `\n` and `printf '%s\n'`. The escapes were expanded when the entry was written, which broke both spans across lines.
### Verification
- The failure was reproduced locally against real dash rather than taken from the report: the pre-fix hook exits 2 with `Syntax error: redirection unexpected` at line 32, matching the ubuntu log verbatim, and the post-fix hook exits 0 and emits valid JSON with the newline escaped as two characters.
- All five scripts in `.github/hooks/scripts/` were parsed under a POSIX shell. Before the change `error-occurred.sh` was the only one that failed, and after it none do.
- The reasoning for avoiding `echo` was checked directly. Under dash, `echo` on the raw payload produces a literal newline and `json.load` rejects it with `Invalid control character`, while `printf '%s\n'` round trips.
- Full Python suite on Windows: 434 passed, 10 skipped, 497 subtests passed.
### Known limitations
- The four `.gemini/hooks/*.sh` still carry `<<<`. Nothing runs them through `sh`, and `.gemini/settings.json` invokes them by path so their shebang applies, so they are out of scope here. `.gemini` is on the intentionally lagging list and moving it needs its own scope decision.
### Thanks
- Dylan found this in CI rather than in a bug report, reproduced the ubuntu condition locally instead of guessing at it, and confirmed the suite actually exercises the path by reverting his own change. He also declined the obvious fix: copying the `echo` form used by the four sibling hooks would have made the syntax error disappear while introducing a silent JSON corruption, and he said so in the pull request instead of leaving it to review. The scope note on `.gemini` is accurate on every point (PR #228).
## [3.11.0] - 2026-08-20
### Changed
@@ -11,9 +47,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- The second candidate path in the five language commands pointed at the marketplace clone rather than the running plugin. That clone tracks the default branch while an installed plugin is version-pinned, and it does not exist at all under `CLAUDE_CONFIG_DIR` or the zip-cache route. `${CLAUDE_PLUGIN_ROOT}` is substituted by the loader and is what the repository already uses in command prose.
- `README.md` still advertised the five variant skill ids as model-invocable, which stops being true once the plugin no longer registers them.
- **Seven shell hooks could emit JSON with a raw control character on macOS (reported by @dylanpulver).** They build their payload by interpolating a `json.dumps` result and emitting it with `echo`. Under their own `#!/bin/bash` shebang that is correct, but run with `sh` on macOS, where `/bin/sh` is bash in POSIX mode with `xpg_echo` set, `echo` turns the escaped `
` inside the string back into a real newline and every parser rejects the result. All seven now use `printf '%s
'`, which never interprets backslashes. Found while rebasing #226, with the one-line repro supplied.
- **Seven shell hooks could emit JSON with a raw control character on macOS (reported by @dylanpulver).** They build their payload by interpolating a `json.dumps` result and emitting it with `echo`. Under their own `#!/bin/bash` shebang that is correct, but run with `sh` on macOS, where `/bin/sh` is bash in POSIX mode with `xpg_echo` set, `echo` turns the escaped `\n` inside the string back into a real newline and every parser rejects the result. All seven now use `printf '%s\n'`, which never interprets backslashes. Found while rebasing #226, with the one-line repro supplied.
### Added
- **`docs/languages.md`.** The five translations had no documentation page of their own: `docs/` carried a setup guide for every supported IDE and nothing for languages, and `docs/installation.md` did not mention them at all. Six lines in the README were the entire discovery path, which mattered less while the plugin auto-registered the variants and is now the only way in. The new page covers the table of names and commands, the install command per language, the repository layout, how the language commands behave on the plugin route, and why the status tokens stay literal English. Linked from the README and from `docs/installation.md`.
@@ -30,7 +64,7 @@ All notable changes to this project will be documented in this file.
### Thanks
This one took four attempts and sixteen months of the issue tracker to answer, so credit goes to everyone who pushed on it.
This one took four attempts across seven months of the issue tracker to answer, so credit goes to everyone who pushed on it.
- Sean opened #130 in April with the analysis that framed the whole problem: the scripts and templates were identical, only the prose differed, and the six skills were costing every session five descriptions it did not need. Every later attempt is a variation on that report.
- Dylan wrote the answer that shipped (#226). He found the one-level plugin scan, checked the install route rather than assuming it, and carried the literal English status-token warning into all five commands where a previous attempt had not. He also named the one cost he could not remove, which is what made the change reviewable.
+2 -2
View File
@@ -7,8 +7,8 @@ authors:
- family-names: Adi
given-names: Ahmad Othman Ammar
alias: OthmanAdi
version: "3.11.0"
date-released: "2026-08-14"
version: "3.11.2"
date-released: "2026-08-22"
license: MIT
url: "https://github.com/OthmanAdi/planning-with-files"
repository-code: "https://github.com/OthmanAdi/planning-with-files"
+2 -2
View File
@@ -374,7 +374,7 @@ Thank you to everyone who reported issues, provided feedback, and helped test fi
- [@Whxuan0701](https://github.com/Whxuan0701) (WeiHaoxuan) - [PR #223](https://github.com/OthmanAdi/planning-with-files/pull/223), [PR #222](https://github.com/OthmanAdi/planning-with-files/pull/222), [PR #224](https://github.com/OthmanAdi/planning-with-files/pull/224) (found that the `PLANNING_DISABLED=1` opt-out from #195 had never reached any of the ten GitHub Copilot hook entry points, that the #191 zero-phase guard was missing from the Copilot PowerShell stop hook, and that the Hermes determinism probe hardcoded `python` so it could not run where only `python3` exists; three single-commit PRs, each with a test that executes the real script. Auditing them surfaced three further defects fixed in the same release: the Cursor route had the same opt-out gap across all eight of its hooks, the disabled `PreToolUse` branch was widening Copilot's permissions rather than staying neutral, and `error-occurred.ps1` had never logged an error on Windows because it read stdin into PowerShell's automatic `$input` variable)
- [@dylanpulver](https://github.com/dylanpulver) (Dylan Pulver) - [PR #226](https://github.com/OthmanAdi/planning-with-files/pull/226) (answered issue #130 after two earlier attempts could not be taken: moved the five language variants one directory deeper so the Claude Code plugin scan, which reads `skills/*/SKILL.md` without recursing, stops registering them, while every `npx skills add --skill` command keeps resolving because that resolver matches by skill name across a recursive scan. Cut the plugin's always-on cost by roughly half without deleting, renaming or breaking a single install. Verified the install route rather than assuming it, carried the literal English status-token warning into all five language commands where an earlier attempt had not, and named the one cost he could not remove)
- [@dylanpulver](https://github.com/dylanpulver) (Dylan Pulver) - [PR #226](https://github.com/OthmanAdi/planning-with-files/pull/226) (answered issue #130 after two earlier attempts could not be taken: moved the five language variants one directory deeper so the Claude Code plugin scan, which reads `skills/*/SKILL.md` without recursing, stops registering them, while every `npx skills add --skill` command keeps resolving because that resolver matches by skill name across a recursive scan. Cut the plugin's always-on cost by roughly half without deleting, renaming or breaking a single install. Verified the install route rather than assuming it, carried the literal English status-token warning into all five language commands where an earlier attempt had not, and named the one cost he could not remove), [PR #228](https://github.com/OthmanAdi/planning-with-files/pull/228) (fixed the Copilot error hook, which fed its Python helpers with bash here-strings that dash cannot parse, so master CI had failed on the ubuntu leg for five consecutive runs. Reproduced the ubuntu condition locally instead of working from the log, and confirmed the suite genuinely exercises the path by reverting his own change. Declined the fix that would have looked right: copying the four sibling hooks' `echo` form clears the syntax error but silently corrupts JSON under dash, and he wrote that into the pull request rather than leaving it for review), [PR #229](https://github.com/OthmanAdi/planning-with-files/pull/229) (found the two manual install commands still copying `skills/*` after the translations moved under `skills/i18n/`, corrected both to name the canonical skill, and added a tracked-Markdown guard against the old install shape)
- [@sean3808](https://github.com/sean3808) (Sean) - [Issue #130](https://github.com/OthmanAdi/planning-with-files/issues/130) (opened the consolidation report in April 2026 with the analysis that framed the problem for every later attempt: identical scripts and templates, prose the only real difference, and five skill descriptions injected into every session that most users would never invoke; resolved in v3.11.0)
And many others who have starred, forked, and shared this project!
@@ -405,4 +405,4 @@ If you've contributed and don't see your name here, please open an issue! We wan
**Total Contributors:** 54+ and growing!
*Last updated: August 20, 2026*
*Last updated: August 22, 2026*
+123 -87
View File
@@ -5,7 +5,12 @@
<h1 align="center">Planning with Files</h1>
<p align="center">
<strong>Your agent's context window dies. The plan does not.</strong>
<strong>The planning skill your agent cannot ignore.</strong><br>
Not a prompt it might follow. A hook that fires every turn, a plan on disk that survives <code>/clear</code>, and 3 out of 3 blind A/B wins to show it works.
</p>
<p align="center">
<em>Your agent's context window dies. The plan does not.</em>
</p>
<p align="center">
@@ -26,13 +31,15 @@ Persistent file-based planning for AI coding agents and long-running agent tasks
</p>
<p align="center">
<a href="#before-and-after-clear">Before/After</a> ·
<a href="#the-solution-3-file-pattern">The 3 Files</a> ·
<a href="#quick-install">Install</a> ·
<a href="#benchmark-results">Benchmarks</a> ·
<a href="#works-across-18-platforms">Platforms</a> ·
<a href="#faq">FAQ</a> ·
<a href="docs/installation.md">Full install guide</a>
<a href="#before-and-after-clear"><strong>See it survive /clear</strong></a> ·
<a href="#the-solution-3-file-pattern">The 3 files</a> ·
<a href="#why-this-skill">Why it works</a> ·
<a href="#benchmark-results">The numbers</a> ·
<a href="#quick-install"><strong>Install</strong></a>
</p>
<p align="center">
<sub>Everything technical is <a href="#reference">further down</a> · <a href="docs/installation.md">Full install guide</a></sub>
</p>
---
@@ -102,45 +109,55 @@ your-project/
Parallel tasks get isolated directories instead: `.planning/YYYY-MM-DD-slug/` with the same three files, selected via `.active_plan` (v2.36.0+). Plain markdown, gitignored by default, no runtime state anywhere else.
## How It Works
## Why This Skill?
The agent stops at the first rung that applies:
On December 29, 2025, [Meta acquired Manus for $2 billion](https://techcrunch.com/2025/12/29/meta-just-bought-manus-an-ai-startup-everyone-has-been-talking-about/). In just 8 months, Manus went from launch to $100M+ revenue. Their secret? **Context engineering.**
```
1. Task needs 3+ steps or 5+ tool calls? → create the three files first
2. Learned something? → append it to findings.md
3. Did something? → log it in progress.md
4. Phase done? → check it off in task_plan.md
5. Context died (/clear, crash)? → session catchup re-reads all three
6. Every phase complete? → only then does the Stop gate release (gated mode)
```
> "Markdown is my 'working memory' on disk. Since I process information iteratively and my active context has limits, Markdown files serve as scratch pads for notes, checkpoints for progress, building blocks for final deliverables."
> — Manus AI
Hooks make steps 2 to 6 mechanical rather than optional: 5 lifecycle hooks on Claude Code, 7 on Codex, 8 on Pi re-inject the plan each turn, remind after writes, and check completion before stopping.
This skill packages that exact pattern for your coding agent.
```mermaid
flowchart LR
A["agent works"] -->|"writes decisions, findings, errors"| F["task_plan.md<br/>findings.md<br/>progress.md"]
F -->|"hooks re-inject the plan<br/>at the start of each turn"| A
K["/clear · crash · compaction"] -.->|"wipes the context window"| A
F ==>|"session catchup re-reads the files"| R["fresh session resumes<br/>at the current phase"]
```
### The Manus Principles
### Session Recovery
| Principle | Implementation |
|-----------|----------------|
| Filesystem as memory | Store in files, not context |
| Attention manipulation | Re-read plan before decisions (hooks) |
| Error persistence | Log failures in plan file |
| Goal tracking | Checkboxes show progress |
| Completion verification | Stop hook checks all phases |
When your context fills up and you run `/clear`, the skill recovers the previous session automatically:
## Benchmark Results
1. Checks the active IDE's session store for previous session data (`~/.claude/projects/` for Claude Code, `~/.codex/sessions/` for Codex)
2. Finds when the planning files were last updated
3. Extracts the conversation that happened after (potentially lost context)
4. Shows a catchup report so you can sync
> **Methodology note:** the 96.7% figure comes from the v2.21.0 evaluation run on `claude-sonnet-4-6` (2026-03-06). It measures file-pattern fidelity (does the agent create and maintain the 3-file structure), not goal-drift over long autonomous runs. Newer models and the autonomous-mode work are not yet covered by this number. Full methodology, dataset, and assertion list: [docs/evals.md](docs/evals.md).
**Pro tip:** disable auto-compact to maximize context before clearing:
Evaluated with Anthropic's [skill-creator](https://github.com/anthropics/skills/tree/main/skills/skill-creator) framework: skill v2.21.0, model `claude-sonnet-4-6`, 2026-03-06. 10 parallel subagents, 5 task types, 30 objectively verifiable assertions, 3 blind A/B comparisons.
```json
{ "autoCompact": false }
```
<p align="center">
<img src="media/benchmark-skill-vs-baseline.svg" width="860" alt="Eval results, with skill vs without: assertions passed 29 of 30 vs 2 of 30, 3-file pattern followed 5 of 5 vs 0 of 5, blind A/B wins 3 of 3 vs 0 of 3, average rubric score 10.0 vs 6.8">
</p>
Maintainer depth (hook architecture, dispatcher layout, parity tooling) lives in [AGENTS.md](AGENTS.md) and [docs/](docs/).
| Test | with_skill | without_skill |
|------|-----------|---------------|
| Pass rate (30 assertions) | **96.7%** (29/30) | 6.7% (2/30) |
| 3-file pattern followed | 5/5 evals | 0/5 evals |
| Blind A/B wins | **3/3 (100%)** | 0/3 |
| Avg rubric score | **10.0/10** | 6.8/10 |
### Recovery after a context wipe
> **Internal benchmark, v1 (2026-07-06).** Author-run against v3.4.0, harness-authored tasks, deterministic grading, no LLM grades anything. Treat it as the project's own measurement, not an independent comparison. Full method, arms, disclosed limits, and grader validation: [docs/evals.md](docs/evals.md#test-5-competitive-benchmark-v1-seven-planning-methods-head-to-head-2026-07-06-internal).
Protocol: the session is hard-stopped at roughly half done, and a fresh session is told only "Continue the work in this directory." Every graded run across every arm ended pytest-green (77/77), so the difference is re-orientation cost, not correctness.
<p align="center">
<img src="media/recovery-turns.svg" width="860" alt="Turns to resume after a context wipe, internal benchmark v1: 5.0 with planning-with-files, 13.3 for a raw agent with no planning method">
</p>
**With the planning files on disk, a resume took 5.0 turns on average; a raw agent took 13.3.** Session catchup plus hook injection put phase state in front of the model before its first tool call, and the same run found no correctness penalty anywhere. An animated summary lives at [docs/benchmark/index.html](docs/benchmark/index.html) ([rendered view](https://htmlpreview.github.io/?https://github.com/OthmanAdi/planning-with-files/blob/master/docs/benchmark/index.html)).
[Full methodology and results](docs/evals.md) · [Technical write-up](docs/article.md)
## Quick Install
@@ -242,6 +259,67 @@ Copy-Item -Recurse -Path "$env:USERPROFILE\.claude\plugins\cache\planning-with-f
All install methods: [docs/installation.md](docs/installation.md).
---
<a id="reference"></a>
## Reference
Everything below is the technical half: how the hooks fire, every command, every supported platform, and the release history.
| | |
|---|---|
| [How It Works](#how-it-works) | The hook loop, injection, and session recovery |
| [Commands](#commands) | All 13 slash commands |
| [Works across 18+ platforms](#works-across-18-platforms) | Per-IDE setup and discovery paths |
| [v3 Long-Running Agent Features](#v3-long-running-agent-features) | Modes, the completion gate, attestation, env vars |
| [Key Rules](#key-rules) · [When to Use](#when-to-use) | The four rules, and when the pattern pays off |
| [File Structure](#file-structure) | What lands in your project, and the repository layout |
| [FAQ](#faq) | Context rot, plan mode, agent memory tools |
| [Releases](#releases) · [Community](#community) | Version history and community forks |
| [Documentation](#documentation) | Every guide in `docs/` |
## How It Works
The agent stops at the first rung that applies:
```
1. Task needs 3+ steps or 5+ tool calls? → create the three files first
2. Learned something? → append it to findings.md
3. Did something? → log it in progress.md
4. Phase done? → check it off in task_plan.md
5. Context died (/clear, crash)? → session catchup re-reads all three
6. Every phase complete? → only then does the Stop gate release (gated mode)
```
Hooks make steps 2 to 6 mechanical rather than optional: 5 lifecycle hooks on Claude Code, 7 on Codex, 8 on Pi re-inject the plan each turn, remind after writes, and check completion before stopping.
```mermaid
flowchart LR
A["agent works"] -->|"writes decisions, findings, errors"| F["task_plan.md<br/>findings.md<br/>progress.md"]
F -->|"hooks re-inject the plan<br/>at the start of each turn"| A
K["/clear · crash · compaction"] -.->|"wipes the context window"| A
F ==>|"session catchup re-reads the files"| R["fresh session resumes<br/>at the current phase"]
```
### Session Recovery
When your context fills up and you run `/clear`, the skill recovers the previous session automatically:
1. Checks the active IDE's session store for previous session data (`~/.claude/projects/` for Claude Code, `~/.codex/sessions/` for Codex)
2. Finds when the planning files were last updated
3. Extracts the conversation that happened after (potentially lost context)
4. Shows a catchup report so you can sync
**Pro tip:** disable auto-compact to maximize context before clearing:
```json
{ "autoCompact": false }
```
Maintainer depth (hook architecture, dispatcher layout, parity tooling) lives in [AGENTS.md](AGENTS.md) and [docs/](docs/).
## Commands
Slash commands ship with the Claude Code plugin route (see the install matrix above).
@@ -341,56 +419,6 @@ One skill, three integration tiers. Know what your agent gets before you install
</details>
## Why This Skill?
On December 29, 2025, [Meta acquired Manus for $2 billion](https://techcrunch.com/2025/12/29/meta-just-bought-manus-an-ai-startup-everyone-has-been-talking-about/). In just 8 months, Manus went from launch to $100M+ revenue. Their secret? **Context engineering.**
> "Markdown is my 'working memory' on disk. Since I process information iteratively and my active context has limits, Markdown files serve as scratch pads for notes, checkpoints for progress, building blocks for final deliverables."
> — Manus AI
This skill packages that exact pattern for your coding agent.
### The Manus Principles
| Principle | Implementation |
|-----------|----------------|
| Filesystem as memory | Store in files, not context |
| Attention manipulation | Re-read plan before decisions (hooks) |
| Error persistence | Log failures in plan file |
| Goal tracking | Checkboxes show progress |
| Completion verification | Stop hook checks all phases |
## Benchmark Results
> **Methodology note:** the 96.7% figure comes from the v2.21.0 evaluation run on `claude-sonnet-4-6` (2026-03-06). It measures file-pattern fidelity (does the agent create and maintain the 3-file structure), not goal-drift over long autonomous runs. Newer models and the autonomous-mode work are not yet covered by this number. Full methodology, dataset, and assertion list: [docs/evals.md](docs/evals.md).
Evaluated with Anthropic's [skill-creator](https://github.com/anthropics/skills/tree/main/skills/skill-creator) framework: skill v2.21.0, model `claude-sonnet-4-6`, 2026-03-06. 10 parallel subagents, 5 task types, 30 objectively verifiable assertions, 3 blind A/B comparisons.
<p align="center">
<img src="media/benchmark-skill-vs-baseline.svg" width="860" alt="Eval results, with skill vs without: assertions passed 29 of 30 vs 2 of 30, 3-file pattern followed 5 of 5 vs 0 of 5, blind A/B wins 3 of 3 vs 0 of 3, average rubric score 10.0 vs 6.8">
</p>
| Test | with_skill | without_skill |
|------|-----------|---------------|
| Pass rate (30 assertions) | **96.7%** (29/30) | 6.7% (2/30) |
| 3-file pattern followed | 5/5 evals | 0/5 evals |
| Blind A/B wins | **3/3 (100%)** | 0/3 |
| Avg rubric score | **10.0/10** | 6.8/10 |
### Recovery after a context wipe
> **Internal benchmark, v1 (2026-07-06).** Author-run against v3.4.0, harness-authored tasks, deterministic grading, no LLM grades anything. Treat it as the project's own measurement, not an independent comparison. Full method, arms, disclosed limits, and grader validation: [docs/evals.md](docs/evals.md#test-5-competitive-benchmark-v1-seven-planning-methods-head-to-head-2026-07-06-internal).
Protocol: the session is hard-stopped at roughly half done, and a fresh session is told only "Continue the work in this directory." Every graded run across every arm ended pytest-green (77/77), so the difference is re-orientation cost, not correctness.
<p align="center">
<img src="media/recovery-turns.svg" width="860" alt="Turns to resume after a context wipe, internal benchmark v1: 5.0 with planning-with-files, 13.3 for a raw agent with no planning method">
</p>
**With the planning files on disk, a resume took 5.0 turns on average; a raw agent took 13.3.** Session catchup plus hook injection put phase state in front of the model before its first tool call, and the same run found no correctness penalty anywhere. An animated summary lives at [docs/benchmark/index.html](docs/benchmark/index.html) ([rendered view](https://htmlpreview.github.io/?https://github.com/OthmanAdi/planning-with-files/blob/master/docs/benchmark/index.html)).
[Full methodology and results](docs/evals.md) · [Technical write-up](docs/article.md)
## v3 Long-Running Agent Features
The v3 line adds features aimed at long-running agentic runs. Each one is listed with the command or flag that turns it on. With no mode marker set, the hooks produce the same output as v2.43, so nothing changes for existing setups.
@@ -481,6 +509,8 @@ Every release maintains 18 tracked parity targets plus the gitignored ClawHub up
</details>
<a id="faq"></a>
<details>
<summary><strong>❓ FAQ</strong></summary>
@@ -515,11 +545,15 @@ One hook fire measures 289ms wall-clock since the v3.6.0 optimization, down from
</details>
<a id="releases"></a>
<details>
<summary><strong>📦 Releases</strong></summary>
| Version | Highlights |
|---------|------------|
| **v3.11.2** | **Skills-only manual installs now copy one skill at the documented depth** (PR #229 by @dylanpulver). The Unix and PowerShell commands name `skills/planning-with-files` instead of copying `skills/*`, so the `skills/i18n/` subtree no longer lands below the loader path. Both instructions create `~/.claude/skills` first, which keeps a fresh install from placing `SKILL.md` directly under `skills/`. A tracked-Markdown test rejects the old whole-directory copy shape and locks the destination-creation step. |
| **v3.11.1** | **The Copilot error hook could not be parsed by a POSIX shell** (PR #228 by @dylanpulver). `error-occurred.sh` fed its two Python helpers with `<<<`, a bash here-string that dash does not implement, and the suite invokes the shell hooks as `sh script`, so the `#!/bin/bash` shebang never applied. On ubuntu runners the file died at line 32 with `Syntax error: redirection unexpected`, and master CI had failed on that leg for five consecutive runs. Both call sites now pipe with `printf '%s\n'`. The sibling `echo` form was deliberately not copied: dash expands backslash escapes, which would have traded a loud syntax error for silent JSON corruption. No user was affected, because Copilot invokes the hook under a `bash` key that bypasses the shebang. |
| **v3.11.0** | **The plugin registers one skill instead of six** (closes #130, reported by @sean3808; implemented by @dylanpulver in PR #226). The five language variants moved from `skills/planning-with-files-<lang>/` to `skills/i18n/planning-with-files-<lang>/`. Nothing deleted, nothing renamed, every `npx skills add --skill` command unchanged: Claude Code scans `skills/*/SKILL.md` one level without recursing, while the skills CLI resolves `--skill` by name across a recursive scan. Measured against the real loader, not inferred: 6 registered skills to 1, 19 components to 14, always-on cost roughly 2,254 to 1,042 tokens per session, with all thirteen slash commands intact. `/plan-de` and its four siblings read their translated skill from disk and state that the status tokens stay literal English, because `check-complete.sh` matches them with `grep -F`. Also fixes seven shell hooks that could emit JSON with a raw control character when run under a POSIX-mode shell on macOS. |
| **v3.10.2** | **`PLANNING_DISABLED=1` had never reached the GitHub Copilot or Cursor hooks** (PRs #223, #222 and #224, by @Whxuan0701). Both routes read `task_plan.md` directly instead of dispatching to the script that carries the #195 guard, so eighteen hook entry points ignored the opt-out entirely: a one-shot task sharing a working directory with an unrelated plan had no way to detach from it. Auditing the merge found three more: the disabled `PreToolUse` branch answered `permissionDecision: allow`, so turning the skill off widened Copilot's permissions instead of staying neutral; `.cursor/hooks/stop.ps1` was the last copy the #191 zero-phase guard never reached, still auto-continuing on `0/0 phases done`; and `error-occurred.ps1` had never logged an error on Windows because it read stdin into `$input`, PowerShell's automatic pipeline variable, which does not hold the assignment under `-File`. The opt-out tests now run every hook with the variable unset as well as set, because the disabled-only versions stayed green against a fleet gutted to emit `{}`. Suite 424 to 430. |
| **v3.10.1** | **Codex context hooks now emit valid event JSON on Linux and macOS** (fixes #220, reported by @mfehlhaber). `SessionStart`, `UserPromptSubmit`, and `PreCompact` use the same adapter as Windows, so planning output beginning with `[` is no longer misread as malformed JSON. This release also aligns the tracked npm payload with the published 20-script package, corrects the release reference, and makes the version bumper safe to run without the gitignored ClawHub stage in a fresh clone. |
@@ -589,6 +623,8 @@ One hook fire measures 289ms wall-clock since the v3.6.0 optimization, down from
</details>
<a id="community"></a>
<details>
<summary><strong>🌍 What the community shipped</strong></summary>
+2 -1
View File
@@ -98,7 +98,8 @@ If you only want the skill without the full plugin structure:
```bash
git clone https://github.com/OthmanAdi/planning-with-files.git
cp -r planning-with-files/skills/* ~/.claude/skills/
mkdir -p ~/.claude/skills
cp -r planning-with-files/skills/planning-with-files ~/.claude/skills/
```
---
+2 -1
View File
@@ -35,7 +35,8 @@ git clone https://github.com/OthmanAdi/planning-with-files.git $env:USERPROFILE\
```powershell
git clone https://github.com/OthmanAdi/planning-with-files.git
Copy-Item -Recurse planning-with-files\skills\* $env:USERPROFILE\.claude\skills\
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude\skills" | Out-Null
Copy-Item -Recurse planning-with-files\skills\planning-with-files $env:USERPROFILE\.claude\skills\
```
---
+1 -1
View File
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files-ar/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
# نظام تخطيط الملفات
+1 -1
View File
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files-de/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
# Dateiplanungssystem
+1 -1
View File
@@ -36,7 +36,7 @@ hooks:
- type: command
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files-es/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
# Sistema de Planificación con Archivos
+1 -1
View File
@@ -37,7 +37,7 @@ hooks:
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files-zh/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
+1 -1
View File
@@ -37,7 +37,7 @@ hooks:
command: "SH=\"\"; for c in \"${PWF_SCRIPT_DIR}/inject-plan.sh\" \"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files-zht/scripts/inject-plan.sh\" \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\"; do [ -f \"$c\" ] && { SH=\"$c\"; break; }; done; [ -n \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
+1 -1
View File
@@ -28,7 +28,7 @@ hooks:
- type: command
command: "SH=\"${CLAUDE_SKILL_DIR}/scripts/inject-plan.sh\"; [ -f \"$SH\" ] || SH=$(ls \"$HOME/.claude/skills/planning-with-files/scripts/inject-plan.sh\" \"$HOME/.claude/plugins/marketplaces/planning-with-files/scripts/inject-plan.sh\" 2>/dev/null | head -1); [ -n \"$SH\" ] && [ -f \"$SH\" ] && sh \"$SH\" --context=precompact; exit 0"
metadata:
version: "3.11.0"
version: "3.11.2"
---
# Planning with Files
+81
View File
@@ -14,9 +14,16 @@ a recursive scan of the repository, and still installs to
This test fails if a variant is moved (or a new one is added) directly under
`skills/`, which would silently put those descriptions back into every session.
The extra depth also invalidated any install that copies `skills/*` wholesale
into a skills directory: `i18n/` is not a skill, and the five variants land a
level below where the loader and the `/plan-<lang>` commands look for them.
The last check below keeps that shape out of the shipped install docs.
"""
from __future__ import annotations
import re
import subprocess
import unittest
from pathlib import Path
@@ -34,11 +41,50 @@ EXPECTED_VARIANTS = {
}
# A copy command whose source is the whole skills/ directory. Prose that
# mentions `skills/*/SKILL.md` (the plugin scan) must not match, so the line
# has to start with the copy verb and the glob has to end the path segment.
WHOLESALE_COPY_RE = re.compile(r"^\s*(?:cp\s|Copy-Item\b).*skills[\\/]\*(?:\s|$)")
MANUAL_SKILL_COPY_COMMANDS = {
"docs/installation.md": (
"mkdir -p ~/.claude/skills",
"cp -r planning-with-files/skills/planning-with-files ~/.claude/skills/",
),
"docs/windows.md": (
r'New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude\skills" | Out-Null',
r"Copy-Item -Recurse planning-with-files\skills\planning-with-files",
),
}
def _plugin_registered_skills():
"""Directory names the Claude Code plugin scan registers (skills/*/SKILL.md)."""
return {d.name for d in SKILLS_DIR.iterdir() if (d / "SKILL.md").is_file()}
def _tracked_markdown():
"""Every tracked .md file, via git; glob fallback for non-git checkouts."""
try:
proc = subprocess.run(
["git", "-c", "core.quotepath=off", "ls-files", "--", "*.md"],
cwd=str(REPO_ROOT),
text=True,
encoding="utf-8",
capture_output=True,
check=False,
)
if proc.returncode == 0 and proc.stdout.strip():
return [REPO_ROOT / line for line in proc.stdout.splitlines() if line]
except OSError:
pass
return [
p
for p in REPO_ROOT.rglob("*.md")
if ".git" not in p.parts and "node_modules" not in p.parts
]
class PluginSkillSurfaceTests(unittest.TestCase):
def test_plugin_registers_canonical_skill_only(self):
self.assertEqual(
@@ -61,6 +107,41 @@ class PluginSkillSurfaceTests(unittest.TestCase):
text = (I18N_DIR / name / "SKILL.md").read_text(encoding="utf-8")
self.assertIn(f"\nname: {name}\n", text)
def test_no_doc_installs_by_copying_the_skills_directory(self):
docs = _tracked_markdown()
self.assertTrue(docs, "no tracked .md files discovered")
offenders = []
for doc in docs:
if not doc.is_file():
continue
for lineno, line in enumerate(
doc.read_text(encoding="utf-8").splitlines(), start=1
):
if WHOLESALE_COPY_RE.match(line):
rel = doc.relative_to(REPO_ROOT).as_posix()
offenders.append(f"{rel}:{lineno}: {line.strip()}")
self.assertFalse(
offenders,
"install command copies the whole skills/ directory, which since "
"v3.11.0 also copies i18n/ (not a skill) and puts the five "
"variants a level below where the loader and the /plan-<lang> "
"commands look; name skills/planning-with-files instead: "
+ "; ".join(offenders),
)
def test_manual_skill_copies_create_destination_first(self):
for rel, (create_destination, copy_skill) in MANUAL_SKILL_COPY_COMMANDS.items():
with self.subTest(doc=rel):
text = (REPO_ROOT / rel).read_text(encoding="utf-8")
self.assertIn(create_destination, text)
self.assertIn(copy_skill, text)
self.assertLess(
text.index(create_destination),
text.index(copy_skill),
"the skills directory must exist before the canonical skill "
"directory is copied into it",
)
if __name__ == "__main__":
unittest.main()