ashlr-compact

ashlr-compact is a command for coding agents from ashlrai/ashlr-plugin. It costs 21 tokens per session (676 once invoked), scanned A, original, MIT.

A command that examines old tool results in the current conversation and reports which ones are stale. It reads session history, counts turns, and groups stale results by tool and size.

In plain words
What is it for?
Use it to decide whether conversation results should be recompressed, especially in long sessions with many tool calls.
Why use it?
Long conversations can accumulate old results that make the history larger and harder to manage. This report shows where that stale data is concentrated.

Command

Part of the ashlr plugin — 11 skills, 36 commands, 5 agents, 7 hooks, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ashlrai/ashlr-plugin/ashlr-compact
Clone the repo
git clone --depth 1 https://github.com/ashlrai/ashlr-plugin

Or install ashlr, the plugin that ships this one along with the rest of its 11 skills, 36 commands, 5 agents, 7 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ashlr-compact

README.md
[![agentmods](https://agentmods.dev/badge/commands/ashlrai/ashlr-plugin/ashlr-compact.svg)](https://agentmods.dev/commands/ashlrai/ashlr-plugin/ashlr-compact)
Your own site
<a href="https://agentmods.dev/commands/ashlrai/ashlr-plugin/ashlr-compact"><img src="https://agentmods.dev/badge/commands/ashlrai/ashlr-plugin/ashlr-compact.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 676 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00021 $0.00676
Opus 5 $0.00010 $0.00338
Sonnet 5 $0.00004 $0.00135
Haiku 4.5 $0.00002 $0.00068

Measured 3d ago against content hash b63dc5db681a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ashlr-compact scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/ashlr-compact.md · 55 lines

What it actually says

Read ~/.ashlr/session-history/<sessionId>.jsonl using the ashlr__read tool (or Bash if the path resolves) and then run the following analysis logic:

  1. Find the session ID: It is in ~/.ashlr/last-project.json under the sessionId key. Read that file first.

  2. Read the session history: Read ~/.ashlr/session-history/<sessionId>.jsonl. Each line is a JSON object with fields: ts, tool, sizeBytes, contentSha8, turn, sessionId.

  3. Compute current turn count: Count the total number of lines in the history file — this is currentTurn.

  4. 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)
  5. Aggregate:

    • Total stale results: count of entries where turnDelta ≥ 5
    • Total stale bytes: sum of sizeBytes for stale entries
    • Per-tool breakdown: group by tool, show count + bytes
  6. Print the report to the user in this format:

    ashlr-compact: Stale result analysis
    ─────────────────────────────────────
    Session turns:    <currentTurn>
    Stale results:    <count> (turnDelta ≥ 5)
    Stale volume:     ~<KB> KB
    
    By tool:
      <tool>          <count> results · ~<KB> KB
      ...
    
    Recompression opportunity: ~<staleKB> KB could be freed by re-running
    these reads now (the fresh results would replace stale ones in context).
    
    Suggested actions:
    

    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).

  7. 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."

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 55 lines · 21 tokens per session scan A b63dc5db681a

Subscribe to this mod's changes

ashlr-compact is a command published in the GitHub repository ashlrai/ashlr-plugin (3 stars, last pushed 3d ago), licensed MIT. It adds 21 tokens to every session and 676 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.