session-cleanup

session-cleanup is a skill for Claude Code, Codex from tao12345666333/ankaloop. It costs 25 tokens per session (598 once invoked), scanned A, original, Apache-2.0.

A cleanup process for old AnkaLoop session files and stored history. AnkaLoop sessions are files that preserve previous agent conversations or runs.

In plain words
What is it for?
Use it to archive sessions older than 30 days, delete backups older than 90 days, compact memory history, and report the space recovered.
Why use it?
It keeps recent sessions active, backs up older ones, removes expired backups, and limits stored history to reduce clutter.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to archive sessions older than 30 days, delete backups older than 90 days, compact memory history, and report the space recovered.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tao12345666333/ankaloop/session-cleanup
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.

Any agent
npx skills add tao12345666333/ankaloop --skill session-cleanup
Clone the repo
git clone --depth 1 https://github.com/tao12345666333/ankaloop

Made for: Claude Code, Codex.

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 session-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/skills/tao12345666333/ankaloop/session-cleanup/github.svg)](https://agentmods.dev/skills/tao12345666333/ankaloop/session-cleanup)
Your own site
<a href="https://agentmods.dev/skills/tao12345666333/ankaloop/session-cleanup"><img src="https://agentmods.dev/badge/skills/tao12345666333/ankaloop/session-cleanup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for session-cleanup

Your own site · 80×15
<a href="https://agentmods.dev/skills/tao12345666333/ankaloop/session-cleanup"><img src="https://agentmods.dev/badge/skills/tao12345666333/ankaloop/session-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 598 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00025 $0.00598
Opus 5 $0.00013 $0.00299
Sonnet 5 $0.00005 $0.00120
Haiku 4.5 $0.00003 $0.00060

Measured 11d ago against content hash 28e740d6ec16, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

session-cleanup 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 11d 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.

src/ankaloop/builtin_skills/session-cleanup/SKILL.md · 62 lines

What it actually says

Session Cleanup

Backup old AnkaLoop sessions by renaming with execution date, then clean and compact sessions and memory to keep the system efficient.

What to Clean

  1. Session files backup: Rename session JSON files in ~/.config/ankaloop/sessions/ that haven't been modified in 30+ days to YYYY-MM-DD_<original_name>.json.bak
  2. Active sessions keep: Keep the most recent 10 session files (by modification time) as active
  3. Memory compaction: Compact ~/.config/ankaloop/memory/HISTORY.md to keep only the last 50 entries

Procedure

Step 1: Backup Old Sessions

  1. List all .json files in ~/.config/ankaloop/sessions/ directory
  2. Get modification time of each file
  3. Sort by modification time (oldest first)
  4. Keep the 10 most recent files as active
  5. For files older than 30 days (or beyond the 10 most recent):
    • Rename to YYYY-MM-DD_<original_name>.json.bak where YYYY-MM-DD is the current execution date
    • Move to a backups/ subdirectory within sessions folder

Step 2: Clean Backup Files

  1. Remove .bak backup files older than 90 days to free space
  2. Report: "Backed up N session files, cleaned M old backups, freed X MB"

Step 3: Compact Memory

  1. Read ~/.config/ankaloop/memory/HISTORY.md
  2. Count the number of entries (each - bullet is an entry)
  3. If more than 50 entries, keep only the last 50 entries
  4. Add a summary entry at the top: "Compacted from X entries to 50 entries on YYYY-MM-DD"

Safety

  • Never delete the currently active session (most recent)
  • Only delete .json and .bak files (not directories or other file types)
  • Always create backups before any cleanup operation
  • Log each operation for audit trail

Example Output

Session Cleanup Report (2026-02-16):
- Active sessions kept: 10
- Sessions backed up: 15
- Old backups removed: 3
- Space freed: 45 MB
- Memory entries: compacted from 120 to 50
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. 11d ago First seen · 62 lines · 25 tokens per session scan A 28e740d6ec16

Subscribe to this mod's changes

session-cleanup is a skill published in the GitHub repository tao12345666333/ankaloop (48 stars, last pushed 12d ago), licensed Apache-2.0. It adds 25 tokens to every session and 598 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-30.

Related

Other skills, from other repositories

handoff

Write a compact, decision-ready handoff so the next session (or the user) can continue without reconstructing the current one. Use when the session is ending, context is running low, the user asks for a handoff / "pass the baton" / "hand off", or a long-running operation needs a durable state checkpoint.

Hmbown/CodeWhale · 70 tokens

memory-index

Index a folder's contents into the MemPalace semantic memory for search and retrieval. Use this skill whenever the user asks to "index a folder", "index a directory", "index memory", "mine a project into memory", "make a folder searchable", "embed a folder", "ingest code into the palace", or "index this directory for…

dimetron/pi-go · 0 tokens

memory-mine

Mine project files or conversations into the MemPalace memory system. Indexes source code and conversation history as searchable palace drawers with semantic embeddings and room assignment.

dimetron/pi-go · 35 tokens

memory-status

Show MemPalace memory system status — drawer counts, wings, rooms, knowledge graph stats, and embedding model state.

dimetron/pi-go · 27 tokens

colleague-distillation

Distill a colleague into a reusable AI skill (work + persona) using tool connections — Slack, Slack AI, Jira, GHE, Bitbucket, Confluence, SharePoint, Teams, Outlook, Notion, Linear, Google Docs, and more — without manual paste. Use when the user wants a colleague skill, digital twin of a coworker, or capture of…

ZhixiangLuo/10xProductivity · 104 tokens

proactive-agent

Transform AI agents from task-followers into proactive partners that anticipate needs and continuously improve. Now with WAL Protocol, Working Buffer, Autonomous Crons, and battle-tested patterns. Part of the Hal Stack 🦞.

MerkyorLynn/Lynn · 46 tokens