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.
In this repository7 other files it gives its agents.
- context-healthSkill
- find-bloatSkill
- inspect-contextSkill
- mcp-auditSkill
- slim-instructionsSkill
- suggest-splitSkill
- token-forecastSkill
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
- Distinctive: line 61
If there is an active dependency blocking a full clear, add:
- Distinctive: line 87
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 …
- Distinctive: line 88
Prefer a trim point at a natural topic boundary (end of a resolved subtask) over an arbitrary line.
- Distinctive: line 89
If in doubt about a turn, mark it as active dependency — err on the side of preserving context.
≈ “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.
Files
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
- Read the full conversation history — every turn, from first to last.
- Identify the current task anchor — the turn where the work the user is currently doing began. This is turn T.
- 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.
- 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
/clearpoint. - 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} tokensOr if no trim is safe:
⚠️ No safe trim point found — all prior turns have active dependenciesThen a turn-by-turn summary table (keep it tight — one row per distinct topic block, not per individual turn):
| Turns | Summary | Status | Safe to Clear? |
| 1–5 | Initial project setup discussion | Resolved | ✅ Yes |
| 6–10 | Debugged login timeout — fixed in auth.ts | Resolved | ✅ Yes |
| 11–13 | Decided to use JWT over sessions | Active dependency | 🔴 No — still shapes current work |
| 14–now | Current task: refactor auth middleware | Current | — |
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: /clearIf 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
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
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.

