You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(pstack): make worktree-audit's LAST_CHAT work with GNU stat and date - #805
Replaces #707 by @surlymochan. The commit is the same, rebased onto current main, and Chao Chen is still its author. GitHub refused the push to the fork branch: the rebase brings in main's newer .github/workflows/validate-plugins.yml, and the app cannot update workflow files on a fork.
Problem
worktree-audit.sh reads transcript mtimes with BSD stat -f '%m %N' and date -r <epoch>. GNU coreutils (Linux, Homebrew gnubin) reads stat -f as file-system status and date -r as a file path. The result is that LAST_CHAT is always empty, and a worktree with a recent chat is bucketed safe to delete.
Fix
Probe stat -c %Y / once. Use stat -c '%Y %n' and date -d "@<epoch>" when it succeeds. Otherwise keep the BSD flags.
bun test (68 pass) and bun run typecheck in pstack/skills/poteto-mode/scripts; node tests for pstack skill scripts (58 pass). Main has no test for worktree-audit.sh.
Direct run on Linux (GNU coreutils) with a fake transcript dated 2026-10-21 in a temp repo with one linked worktree:
main: LAST_CHAT empty, bucket safe.
this branch: LAST_CHAT 2026-10-21, bucket verify-recent-chat.
Closes#34.
Upstream: cursor/plugins@9580c23696ac, which brings 13 pstack commits.
The daily sync stopped on one conflict and opened #34, so this is the
manual merge from `pstack/port/merge-upstream.py`, plus the ports that
#34 lists.
## What changes
- **Merge (`914da34`)**: `merge-upstream.py` resolved everything except
`poteto-mode/scripts/worktree-audit.sh`.
- Upstream cursor#805 fixed GNU vs. BSD `stat`/`date` with new `stat_fmt` and
`fmt_day` helpers. The port had fixed the same problem its own way (an
`mtime` array and a `date -r || date -d` fallback).
- The resolution keeps the port's transcript list, which also scans
Claude Code and Codex session logs, and takes upstream's helpers in
place of the port's own. The port's diff to this file is now only the
transcript list.
- **`feat(pstack): port ketchup-video` (`732c804`)**: upstream cursor#797's
new skill follows `ketchup` and ends with "the embedded video", which a
terminal can't show.
- It gets the `pstack-harness` pointer, its Codex policy file (it's
user-only), a `SKILLS` entry, and a README row.
- `pstack-harness` gets a Tools row: give an embedded image or video by
its absolute path.
- `check.py` requires that mapping for any skill that embeds a video.
- **`fix(pstack): keep reflect's edits out of the pstack clone and
plugin cache` (`76b5790`)**: upstream cursor#800 made `reflect` refuse to edit
a skill under `plugins/cache/`, because an update moves to a new folder
and drops the edit. The port has the same trap in two places:
- Claude Code installs upstream's plugin under
`~/.claude/plugins/cache/`, one folder per version.
- pstack's own skills link into the clone behind `~/.agents/pstack/`,
which `pstack update` moves to each new release.
`pstack-harness` now names both. It says to copy the skill to the
project or personal skill folder and edit the copy, unless the clone is
the repo being worked in. `check.py` requires that mapping.
- **Not ported**: #34 also flags two `swarm` lines. They're the lines
upstream cursor#807 renumbered (the fix from cursor#751), and every Cursor term in
them is already mapped.
## Risk
- The `worktree-audit.sh` change is the only hand-written code. On macOS
it now goes through upstream's BSD branch (`stat -f '%m %N'`, `date -r`)
in place of the port's. The `pstack macOS` workflow covers that after
merge.
- `statechart` changed a lot upstream (+7k/−2k lines). The port doesn't
modify it, and this repository's CI doesn't run its tests. On first run
it can now install TLC and Java with `mise`, about 305 MB. `TLA2TOOLS`
still takes precedence.
## Proof
- `check.py`: 0 problems, 0 warnings across 56 pstack skills, on each
commit.
- Removing either new harness mapping, or `ketchup-video`'s pointer,
makes `check.py` name the problem.
- Port unit tests: 257 pass. `install_test.sh` passes with 59 skills.
`test_worktree_audit.py` passes with both GNU and system tools.
- `poteto-mode` bun tests (`orch`, `watch-pr`, `check-plan`): 82 pass.
- `statechart` on Node 18.19.1: its test file can't load, because it
imports `zlib.crc32`, which only Node 20.15+ has. The skill's scripts
don't use it. A real `from-chart` run on upstream's `test/sync.mmd`
wrote the spec, ran TLC, and drew one bug path.
- `statechart`'s full suite: not run. Upstream cursor#977, which the next sync
brings in (cursor/plugins@519d36a), rewrites these scripts in TypeScript
and replaces this suite. The next sync's pull request runs the new
suite.
- Smoke test: after release. `smoke.py` runs the installed clone behind
`~/.agents/pstack`, not this branch, so it can't test this branch before
merge. After `pstack update`, run `smoke.py --only reflect,swarm`, the
scenarios for the changed skills.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #707 by @surlymochan. The commit is the same, rebased onto current main, and Chao Chen is still its author. GitHub refused the push to the fork branch: the rebase brings in main's newer
.github/workflows/validate-plugins.yml, and the app cannot update workflow files on a fork.Problem
worktree-audit.shreads transcript mtimes with BSDstat -f '%m %N'anddate -r <epoch>. GNU coreutils (Linux, Homebrew gnubin) readsstat -fas file-system status anddate -ras a file path. The result is that LAST_CHAT is always empty, and a worktree with a recent chat is bucketedsafeto delete.Fix
Probe
stat -c %Y /once. Usestat -c '%Y %n'anddate -d "@<epoch>"when it succeeds. Otherwise keep the BSD flags.Verification
node scripts/validate-plugins.mjs,node scripts/generate-pstack-harness-trees.mjs --check,node scripts/check-pstack-docs.mjs: pass.bun test(68 pass) andbun run typecheckinpstack/skills/poteto-mode/scripts; node tests for pstack skill scripts (58 pass). Main has no test forworktree-audit.sh.safe.2026-10-21, bucketverify-recent-chat.