Skip to content

afk-compact 0.1.11

Choose a tag to compare

@RuslanTar RuslanTar released this 12 Nov 22:49
· 140 commits to main since this release

afk-compact 0.1.11 makes keep-warm easier to follow: it says why it stays off for an idle gap, shows a request while it is out, and its results appear in reports. It also reads usage near a limit more strictly and fixes several problems under Git Bash on Windows. The one-line install needs 2.1.292 or newer. Requires Claude Code 2.1.287 or newer; tested against 2.1.322.

Added

  • When keep-warm does not start in an idle gap, /afk-compact:status shows keep-warm off (<why>), or the last gap: keep-warm off (<why>) after a later request, and the log records the reason (such as no-jobs, ttl-5m, near-limit, no-idle-path or cutoff).
  • The status line command adds · keep-warm off (<why>) to its cache line when keep-warm stays off, except for no-jobs (no background job of the session is open), which is the normal idle case.
  • While a keep-warm request is out, the status line command adds · ping pending, for at most 150 seconds.
  • The JSON output of the status line command (cache --stdin --json) gains a label key (warm, compacted, cold or unknown), plus keep_warm.pending and keep_warm.off for the two new status line parts.
  • A keep-warm request that reads the cache but takes over about 2 minutes, or returns over 58 minutes after the last cache refresh, is logged as late, counts for nothing and ends keep-warm for the gap. A slow request that did not read the cache, or failed, keeps its own result.
  • /afk-compact:report adds keep-warm.json to its zip and watch report adds a Keep-warm section, both built from the log and holding only counts, durations, reasons and versions.
  • The keep-warm report lists idle gaps warmed and refused (by reason), requests sent and how they came back (warm, fork-miss, late or failed), why warming stopped, gaps handed back to plugin idle compaction or the idle handoff turn, and the next main request's cache result.
  • After a pause of 5 minutes or more, the log records the pause and whether the first main response read the cache (hit, miss or none), with its cache reads, cache writes and uncached input, and Claude Code's cache miss reason and missed tokens when given. It holds no text.

Changed

  • Breaking: After a compaction the status line reads cache compacted, not cache cold (compacted), as the next request writes the cache anew. If your script matched cold (compacted), read the JSON label key (compacted) instead; state still reads cold.
  • Near a usage limit, plugin idle compaction, keep-warm and the idle handoff turn treat a reading as new only when a limit's share moved or a response came. A report that only the context or cost moved no longer lets them go past 90% on a reading that says nothing of usage since.
  • A usage reading dated more than a minute ahead of the clock is now stale for going past 90%, since its time is not known.
  • A limit reset time further ahead than its window is long (over about 5 hours for the five-hour limit, about 7 days for the seven-day one) is no longer believed; the reading counts as one with no reset time, in the shared usage record too.
  • /afk-compact:report, and watch report with --out, still never replace an existing file, but now print REFUSED: output file exists (exit 73) instead of REFUSED: output folder not writable.

Fixed

  • When the shared usage record is full, a reading dated ahead of the clock with a smaller share no longer pushes out the real latest reading of its period; the record now keeps the same latest reading the plugin decides by.
  • Two watch report runs on one date could pick the same file name, so one report replaced the other or the second said the folder was not writable. Without --out it now takes the next free number, and skips a name held by a broken link instead of writing through it.
  • A wait --for path starting with a drive letter (file:C:/work/out.log, exit:C:\…, marker:C:/…:<regex>), as Claude Code gives paths on Windows, was refused as a usage error. It now parses.
  • Under Git Bash on Windows, the worktree's path has a drive letter, so the handoff check read every GSD STATE.md as outside it and a handoff never got its GSD state. It now reads it, and a nested checkout is still refused.
  • In a folder outside git whose name has non-ASCII characters, handoffs were saved under a second, wrongly encoded folder, and the session's own handoff was taken for another session's.
  • Under Git Bash the helper took process 1 for Claude Code, so the session's alive record, sessions and locks all named it. Under Git Bash and Cygwin it now uses Claude Code's own CLAUDE_PID; on macOS and Linux an orphaned helper keeps process 1, as before.
  • /afk-compact:status grouped only other sessions' usage readings by period, so the session's own reading could look like the deciding one when it was not. It now says when another session read the same period later, with that share.
  • In /afk-compact:status, on a full tie the session's own usage reading stays the latest, as in the plugin, and a reading dated more than a minute ahead of the clock shows as of unknown time.