/ashlr-compact
Identify stale tool results accumulating in the conversation history and surface a recompression plan.
Read ~/.ashlr/session-history/<sessionId>.jsonl using the ashlr__read tool (or Bash if the path resolves) and then run the following analysis logic:
-
Find the session ID: It is in
~/.ashlr/last-project.jsonunder thesessionIdkey. Read that file first. -
Read the session history: Read
~/.ashlr/session-history/<sessionId>.jsonl. Each line is a JSON object with fields:ts,tool,sizeBytes,contentSha8,turn,sessionId. -
Compute current turn count: Count the total number of lines in the history file — this is
currentTurn. -
Classify entries by staleness:
turnDelta = currentTurn - entry.turn- Fresh:
turnDelta < 5(freshness 1.0) - Stale:
5 ≤ turnDelta < 15(freshness 0.5) - Very stale:
turnDelta ≥ 15(freshness 0.2)
-
Aggregate:
- Total stale results: count of entries where
turnDelta ≥ 5 - Total stale bytes: sum of
sizeBytesfor stale entries - Per-tool breakdown: group by
tool, show count + bytes
- Total stale results: count of entries where
-
Print the report to the user in this format:
Then list the top 5 stale entries (by sizeBytes descending) and suggest re-running the specific tool that produced them (e.g.,
re-run ashlr__read on <implied subject>if tool is ashlr__read or Read). -
Inject recompression hint as your next assistant message context:
"ashlr: The above stale results are from 5+ turns ago. If any are still needed, consider re-running the relevant reads now with fresh context. Stale results from earlier turns remain in the conversation history and count against the context window even when no longer load-bearing."
If the history file does not exist or is empty, tell the user: "No ashlr session history found — the tracker starts recording after the first ashlr__read or ashlr__grep call."
If total stale bytes < 5 KB, tell the user: "Session looks clean — less than 5 KB of stale tool output. No recompression needed yet."