agentleFS
msiSharifulmsiShariful/claude-token-inspector/skills/history-trim/SKILL.md

history-trim

Skill4 starsChanged 20 days agoMITView on GitHub

Analyze conversation history turn-by-turn and identify the exact point to run /clear from to prune stale history while keeping everything relevant to the current task. Use when history has grown long but you want to continue in the same session.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If there is an active dependency blocking a full clear, add:

    line 61
  2. Distinctive:

    Never recommend clearing a turn that contains: a decision still being acted on, code that was written and is still in use, a constraint or …

    line 87
  3. Distinctive:

    Prefer a trim point at a natural topic boundary (end of a resolved subtask) over an arbitrary line.

    line 88
  4. Distinctive:

    If in doubt about a turn, mark it as active dependency — err on the side of preserving context.

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

History Trim Advisor

Analyze the conversation history and find the safest /clear point — the turn where pruning everything before it costs nothing in terms of current task context.

Analysis process

  1. Read the full conversation history — every turn, from first to last.
  2. Identify the current task anchor — the turn where the work the user is currently doing began. This is turn T.
  3. Classify every turn before T:
    • Active dependency: a prior turn contains a decision, piece of code, constraint, or output that is still referenced or needed. Cannot be cleared without loss.
    • Resolved context: a prior turn was relevant at the time but the work it relates to is complete and no longer needed. Safe to clear.
    • Dead weight: unrelated to anything still in progress. Clear immediately.
  4. Find the trim point — the latest turn where everything before it is either "resolved" or "dead weight" with no active dependencies. That's the recommended /clear point.
  5. Estimate the savings — tokens recovered by clearing up to that point.

Output format

Open with a verdict line:

✂️ Safe to clear {N} turns — recover ~{tokens} tokens

Or if no trim is safe:

⚠️ No safe trim point found — all prior turns have active dependencies

Then a turn-by-turn summary table (keep it tight — one row per distinct topic block, not per individual turn):

TurnsSummaryStatusSafe to Clear?
1–5Initial project setup discussionResolved✅ Yes
6–10Debugged login timeout — fixed in auth.tsResolved✅ Yes
11–13Decided to use JWT over sessionsActive dependency🔴 No — still shapes current work
14–nowCurrent task: refactor auth middlewareCurrent—

Then the recommended action:

💡 Recommended: /clear {N}

Where N is the turn number to clear up to (everything before turn N is pruned).

If there is an active dependency blocking a full clear, add:

⚠️ Before clearing: note this from turn {X}: "{one-sentence summary of the active dependency}"

List each active dependency that would be lost, so the user can manually preserve it before running /clear.


If everything is safe to clear (no active dependencies at all):

✅ Full clear is safe — /clear will lose nothing relevant to your current task.
💡 Run: /clear

If no turns can be cleared:

🔴 No safe trim point — every prior turn contains context still relevant to your current task.
💡 Consider /token-inspector:suggest-split to start a fresh session instead.

Trim point rules

  • Never recommend clearing a turn that contains: a decision still being acted on, code that was written and is still in use, a constraint or requirement that shapes current work.
  • Prefer a trim point at a natural topic boundary (end of a resolved subtask) over an arbitrary line.
  • If in doubt about a turn, mark it as active dependency — err on the side of preserving context.

$ARGUMENTS

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.