Skip to content

fix: keep the live ponytail level across context compaction - #1074

Merged
DietrichGebert merged 2 commits into
DietrichGebert:mainfrom
devohmycode:fix/keep-mode-on-compact
Oct 13, 2026
Merged

DietrichGebert merged 2 commits into
DietrichGebert:mainfrom
devohmycode:fix/keep-mode-on-compact

Conversation

@devohmycode

Copy link
Copy Markdown
Contributor

Problem

SessionStart also fires on compaction (source: "compact"), and the activate hook always reset the flag to the default level. So:

  • a session switched to /ponytail ultra fell back to full after compaction,
  • a session stopped with "stop ponytail" was switched back on.

Codex fires the same compact source.

Fix

hooks/ponytail-activate.js now reads source from the JSON that Claude Code and Codex pipe on stdin:

  • compact: keep the live level, or stay off if the session was stopped,
  • startup, resume, clear: start at the default level, as before.

Like the mode tracker, it never waits on stdin for more than a second, and falls back to the default level (#443).

The hook entry in the manifests is unchanged on purpose: Codex trusts a hook by a hash of its matcher and command, and skips a changed hook until the user approves it again. A new or edited entry would have dropped the ruleset there.

Tests

  • tests/hooks.test.js: compact keeps ultra, compact after "stop ponytail" stays off, startup still resets to the default.
  • tests/hooks-windows.test.js: updated for the stdin read.
  • node scripts/check-rule-copies.js and node scripts/check-versions.js pass.

Note: on my Windows machine, two failures also show up on an untouched main: tests/correctness.test.js (pandas one-liner) and the #1032 nudge-path assertion at tests/hooks.test.js:319, which aborts the rest of that file. I ran the rest of hooks.test.js with that one assertion commented out, and it passes. CI on Linux should show the full picture.

SessionStart also fires on compact, and the activate hook always reset
the flag to the default level. A session switched to /ponytail ultra fell
back to full after compaction, and a session stopped with "stop ponytail"
was switched back on. Codex fires the same compact source.

The activate hook now reads the source from the JSON Claude Code and
Codex pipe on stdin, and keeps the live level (or stays off) on compact.
Startup, resume and clear still start at the default level. Like the
mode tracker, it never waits on stdin for more than a second and falls
back to the default level (DietrichGebert#443).

The hook entry itself is unchanged: Codex trusts a hook by a hash of its
matcher and command, and skips a changed hook until the user approves it
again, so a new or edited entry would have dropped the ruleset there.
keyclaw6 added a commit to keyclaw6/ponytail that referenced this pull request Oct 11, 2026
Fork-only: carries DietrichGebert#1074 (compaction keeps the live level) until upstream merges it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DietrichGebert
DietrichGebert merged commit 70d0065 into DietrichGebert:main Oct 13, 2026
1 check passed
@DietrichGebert

Copy link
Copy Markdown
Owner

Thanks! Tested it in Claude Code: on main a real /compact dropped ultra back to full, with this PR it stays ultra, and after "stop ponytail" it stays off. Merged, will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants