memory-tidy

memory-tidy is a skill for Claude Code from tonydzi/second-brain-starter-kit. It costs 78 tokens per session (2,351 once invoked), scanned A, original, MIT.

A procedure for keeping the always-loaded MEMORY.md index on a Mac or Linux machine small and organised. It archives closed material, groups related information, and restores missing pointers without editing files owned by another machine.

In plain words
What is it for?
It is for trimming and reorganising persistent agent memory, moving old entries to archives, and repairing links to stored knowledge.
Why use it?
An oversized memory index can be cut off when every session loads it, causing useful information to disappear from context. Ownership checks also help prevent sync conflicts and lost edits.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths.

Part of the second-brain-skills plugin — 248 skills, 1 plugin shipped together

Good fit It is for trimming and reorganising persistent agent memory, moving old entries to archives, and repairing links to stored knowledge.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tonydzi/second-brain-starter-kit/memory-tidy
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 tonydzi/second-brain-starter-kit --skill memory-tidy
Clone the repo
git clone --depth 1 https://github.com/tonydzi/second-brain-starter-kit

Made for: Claude Code.

Or install second-brain-skills, the plugin that ships this one along with the rest of its 248 skills, 1 plugin.

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 memory-tidy

README.md
[![agentmods](https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/memory-tidy/github.svg)](https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/memory-tidy)
Your own site
<a href="https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/memory-tidy"><img src="https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/memory-tidy/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 memory-tidy

Your own site · 80×15
<a href="https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/memory-tidy"><img src="https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/memory-tidy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,351 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.
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.00078 $0.02351
Opus 5.5 $0.00031 $0.00940
Sonnet 5.5 $0.00016 $0.00470
Haiku 4.5 $0.00008 $0.00235

Measured 12d ago against content hash 41a5f8a621f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

memory-tidy 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 12d 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.

skills/memory-tidy/SKILL.md · 126 lines

How it starts

The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Memory Tidy — уборка всегда-загружаемого индекса

MEMORY.md грузится в КАЖДУЮ сессию. Это не файл, это аренда, которую платишь на каждом ходу. Харнес молча режет хвост за 25 КБ: распухший индекс не «чуть хуже» — он теряет память без единого сообщения об ошибке. Поэтому уборка здесь — не гигиена, а сохранность.

Паспорт детали: ~/.claude/scripts/_doc_memory_tidy.md. Тело рельсы: memory_tidy.sh.

Когда запускать

  • сторож сказал RED (memory_guard.py);
  • индекс подошёл к мягкой черте (15 КБ / 110 строк);
  • руками — когда захотелось порядка;
  • ночью само: launchd ai.paloalto.memory-tidy, 01:10 и 05:40 по локальному времени.

Шаг 0 — ВЛАДЕНИЕ (пропустить = устроить sync-conflict)

python3 ~/.claude/scripts/memory_tidy_scope.py --explain

~/.claude/projects/ держит три разных вещи, и они выглядят одинаково: свои индексы · синкнутые байт-в-байт копии, которыми владеет другой узел · одноразовые ворктри. Написать в чужой = два писателя на один файл = потерянная чья-то память. Область объявляется в memory_tidy_scope.json, никогда не угадывается. Незнакомый узел → выход 3 громко, не тишина.

Шаг 1 — посмотреть, что вообще есть

sh ~/.claude/scripts/memory_tidy.sh --dry-run --force

Печатает вердикт детекторов и рендерит промпт, ничего не меняя. Промпт стоит прочитать глазами — это то, по чему будет действовать модель.

Шаг 2 — механическое, без модели (0 токенов)

python3 ~/.claude/scripts/memory_orphan_cover.py --dry-run   # сироты → указатели в архив
python3 ~/.claude/scripts/memory_orphan_cover.py

Сирота — это не потерянные данные, это недостижимые данные, что при recall одно и то же: файл на диске есть, ссылки нет, ни одна сессия его никогда не поднимет. Указатели идут в MEMORY-archive.md, который НЕ грузится, — покрытие стоит 0 живого бюджета. Хук берётся из description: самой заметки, поэтому скрипт не выдумывает: он переписывает.

Шаг 2-бис — забрать память из сессионных папок (0 токенов, узлы с ворктри)

python3 ~/.claude/scripts/memory_harvest.py --scan              # только читает
python3 ~/.claude/scripts/memory_harvest.py --harvest --dry-run # что бы записал
python3 ~/.claude/scripts/memory_harvest.py --harvest

Заметку, написанную сессией ворктри, кладут в ЕЁ папку проекта, и домашний индекс о ней не знает. Для домашней сессии такой заметки просто не существует — это та же недостижимость, что и сирота, только этажом выше. Жатка копирует её домой (оригинал остаётся на месте) и вешает указатель в MEMORY-archive.md.

Read the full file on GitHub · 126 lines

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. 12d ago Changed · -1 lines 41a5f8a621f6
  2. 14d ago Changed · +1 lines · -43 tokens per session 27cb95d3d07d
  3. 17d ago Changed · +13 lines fe3b9e6efe15
  4. 26d ago First seen · 113 lines · 121 tokens per session scan A 7054dfaf704f

Subscribe to this mod's changes

memory-tidy is a skill published in the GitHub repository tonydzi/second-brain-starter-kit (9 stars, last pushed yesterday), licensed MIT. It adds 78 tokens to every session and 2,351 once invoked, about $0.0003 per session on Opus 5.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-24.

Related

Other skills, from other repositories

save

Save a user-selected answer, decision, insight, or session summary into an Obsidian vault as one reviewed transaction. Use only when the user explicitly asks to preserve specific conversation content, not when they supply a file or URL to ingest. Triggers: /save, save this, save that answer, file this conversation…

AgriciDaniel/claude-obsidian · 80 tokens

wiki-retrieve

Build and query a vault-local contextual BM25 retrieval index with optional multilingual Nomic cosine reranking; use for retrieve, hybrid retrieval, BM25, rerank, contextual retrieval, chunk search, vault search, semantic search, find relevant passages, or retrieval diagnostics. Derived caches stay under .vault-meta…

AgriciDaniel/claude-obsidian · 81 tokens

obsidian-bases

Explain, draft, and validate Obsidian Bases .base files with filters, formulas, properties, summaries, and table, card, or list views. Use for Obsidian Bases, database-like vault views, dynamic tables, reading lists, task trackers, filters, formulas, summaries, and .base file edits.

AgriciDaniel/claude-obsidian · 69 tokens

wiki-fold

Create a bounded, extractive, structurally idempotent rollup of recent Obsidian wiki log entries, with dry-run preview by default and one optional transaction apply. Use for manual log compression without modifying child pages. Triggers: fold the log, run a fold, run wiki-fold, log rollup, roll up log entries, commit…

AgriciDaniel/claude-obsidian · 76 tokens

wiki-mode

Read or configure the vault filing methodology and suggest destinations for planned knowledge creation under Generic, LYT, PARA, or Zettelkasten. Use for wiki mode, methodology mode, what is my vault mode, set vault mode, switch to PARA, use LYT, Zettelkasten setup, change mode, configure mode, or methodology routing.…

AgriciDaniel/claude-obsidian · 83 tokens

wiki-cli

Detect and use the official Obsidian command-line interface for read-only vault access; use for wiki-cli, Obsidian CLI, Obsidian read, Obsidian search, vault transport, which transport, transport detection, backlinks, tags, or Obsidian command line. Mutations always go through the claude-obsidian transaction core.

AgriciDaniel/claude-obsidian · 74 tokens