Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/closedloop-ai/claude-pluginsnpx agentmods add commands/closedloop-ai/claude-plugins/prune-learningsWrote 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.
[](https://agentmods.dev/commands/closedloop-ai/claude-plugins/prune-learnings)<a href="https://agentmods.dev/commands/closedloop-ai/claude-plugins/prune-learnings"><img src="https://agentmods.dev/badge/commands/closedloop-ai/claude-plugins/prune-learnings.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00013 | $0.00565 |
| Opus 5 | $0.00006 | $0.00282 |
| Sonnet 5 | $0.00003 | $0.00113 |
| Haiku 4.5 | $0.00001 | $0.00056 |
Grade A, and why
prune-learnings 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Prune Learnings Command
Manually invokes the pruning script to clean up old learnings and rotate log files.
Purpose
Over time, the learnings system accumulates:
- Old session directories
- Large log files
- Archived pending files
This command runs the pruning script to clean up old data according to retention policy.
Retention Configuration
Edit .learnings/retention.yaml to customize:
# Maximum number of runs to keep in runs.log
max_runs: 100
# Maximum number of session directories to keep
max_sessions: 50
# Maximum lines per log file before rotation
max_log_lines: 10000
# Maximum age (days) for archived pending files
max_archive_age_days: 30
# Lock staleness threshold (hours) before force-pruning
lock_stale_hours: 4
# Protected run window (minutes) - recent runs won't be pruned
protected_window_minutes: 30
What Gets Pruned
- Session directories: Oldest sessions beyond
max_sessionslimit - Log files: Rotated when exceeding
max_log_linesruns.log→runs.log.1→ deletedoutcomes.log→outcomes.log.1→ deletedacknowledgments.log→acknowledgments.log.1→ deleted
- Archived pending files: Older than
max_archive_age_days - Stale lock files: Lock files older than
lock_stale_hours
Safety Mechanisms
- Protected runs: Current run and runs active within
protected_window_minutesare never pruned - Lock checking: Won't prune if
.learnings/.lockexists (unless stale) - Atomic operations: Uses atomic file replacement to prevent corruption
Usage
# Run pruning script directly
./plugins/self-learning/scripts/prune-learnings.sh
# Or via ClosedLoop orchestrator command
# This is automatically run after each completed run
Automatic Pruning
Pruning runs automatically:
- After each run completes (in background)
- Current run is always protected
- Failures are logged but don't block the run
Manual Pruning
Use manual pruning when:
- Disk space is low
- You want to clean up before sharing repository
- You've changed retention settings and want immediate effect
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.
- yesterday First seen · 89 lines · 13 tokens per session scan A 5efae5e7d187
prune-learnings is a command published in the GitHub repository closedloop-ai/claude-plugins (103 stars, last pushed 2d ago), licensed Apache-2.0. It adds 13 tokens to every session and 565 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-09-07.
Other commands, from other repositories
aside
Answer a quick side question without interrupting or losing context from the current task. Resume work automatically after answering.
t00-compact
A command that switches replies into an extremely short mode, removing filler and keeping only conclusions, code, numbers, errors, and pending decisions.
cpp-test
Enforce TDD workflow for C++. Write GoogleTest tests first, then implement. Verify coverage with gcov/lcov.
epic-claim
Claim an epic issue, stamp coordination state, and sync local ownership.
epic-review
Mark epic review requested, approved, or changes requested.
caveman-compress
Compress a markdown/text file into caveman format to save tokens.