memory-bank-defrag

memory-bank-defrag is a skill for Claude Code from alexeyshishin/as-skill. It costs 163 tokens per session (2,721 once invoked), scanned A, original, MIT.

A maintenance process for a project's knowledge files and automatic notes. It checks what changed in the repository and updates outdated documentation while keeping original records intact.

In plain words
What is it for?
Use it to synchronize project memory with the current code, clean up outdated facts, and update documents such as README files, requirements, and decision records.
Why use it?
It prevents project notes from becoming stale or filling up with layers of corrections that are hard to follow.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

Good fit Use it to synchronize project memory with the current code, clean up outdated facts, and update documents such as README files, requirements, and decision records.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alexeyshishin/as-skill/memory-bank-defrag
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 alexeyshishin/as-skill --skill memory-bank-defrag
Clone the repo
git clone --depth 1 https://github.com/alexeyshishin/as-skill

Made for: Claude Code.

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-bank-defrag

README.md
[![agentmods](https://agentmods.dev/badge/skills/alexeyshishin/as-skill/memory-bank-defrag/github.svg)](https://agentmods.dev/skills/alexeyshishin/as-skill/memory-bank-defrag)
Your own site
<a href="https://agentmods.dev/skills/alexeyshishin/as-skill/memory-bank-defrag"><img src="https://agentmods.dev/badge/skills/alexeyshishin/as-skill/memory-bank-defrag/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-bank-defrag

Your own site · 80×15
<a href="https://agentmods.dev/skills/alexeyshishin/as-skill/memory-bank-defrag"><img src="https://agentmods.dev/badge/skills/alexeyshishin/as-skill/memory-bank-defrag.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 163 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,721 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.00163 $0.02721
Opus 5.5 $0.00065 $0.01088
Sonnet 5.5 $0.00033 $0.00544
Haiku 4.5 $0.00016 $0.00272

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

Security

Grade A, and why

memory-bank-defrag 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 13d 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.

domains/core/skills/memory-bank-defrag/SKILL.md · 231 lines

How it starts

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

Memory Bank Defrag

Bring a project's memory bank back in sync with reality and cut it down to current state. The memory bank is three things:

  1. .memory-bank/ in the repo — the project encyclopedia the memory-bank skill maintains: index.md, product-overview/, steerings/, tech-details/, tasks/. Operate on whatever files exist; don't create folders the project doesn't use.
  2. Auto-memory — the host's cross-session memory (Claude Code: a MEMORY.md index plus one file per fact). Take its path from the session context; don't guess it. Skip silently if the context names none or the directory doesn't exist (cloud/headless runs, other hosts).
  3. Repo current-state docs — files that assert what is true now: README.md, AGENTS.md/CLAUDE.md, design specs. Update them only when a change proves a statement stale. Do not touch raw source records that capture what happened — transcripts, chat dumps, extracted content — those are evidence; keep them verbatim.

Every run has two phases:

  • Actualize — what changed in the repo since the last defrag → stale facts, dangling references, uncaptured decisions.
  • Compact — the whole memory bank, regardless of what changed → same facts, less text.

Non-negotiables

  • Accuracy > speed. Memory is point-in-time and may be wrong. Before you assert a fact as current, verify it against the live repo (file exists, symbol not renamed, deadline not passed, stack matches code). If a memory claim contradicts current code, trust the code and fix the memory.
  • Compact the form, never the facts. Every substantive fact survives: what is true now, where it lives, why it was decided (when the reason isn't obvious from the code). Narrative goes: how we got there, step-by-step logs, debugging history, "first we tried X". A reversal that carries decision-relevant context (why we moved off X) stays as one supersession line — that's history, not a patch.
  • Don't rephrase for style. Text that already states a current fact tersely stays as is. Edit only to remove something (patch, narrative, duplicate) or fix something (stale, dangling). This keeps a repeat run on an unchanged bank a no-op.
  • Only substantive facts — no process noise. The memory bank records the project, not your maintenance of it. Do not add "actualized on " or "synced the docs" entries, and do not repeat the same standing rule across many files — state it once in its authoritative home and link to it. When a sync makes an old "needs updating" caveat stale, delete the caveat.
  • Don't invent. No facts, paths, dates, or decisions that aren't in the changes, the code, or the existing memory. Unknown stays unknown.
  • Review before commit. Make the edits, then show the diff and a summary. Do not auto-commit unless the user asks (interactive) or the unattended rules below apply. Auto-memory files live outside the repo and are written directly (not committed).
  • Convert relative dates to absolute (use the current date from context).

Read the full file on GitHub · 231 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 13d ago Changed · -29 lines · +20 tokens per session 970be8109e32
  2. 27d ago Changed a4554b4ef056
  3. 3mo ago First seen · 260 lines · 143 tokens per session scan A 16a399049e99

Subscribe to this mod's changes

memory-bank-defrag is a skill published in the GitHub repository alexeyshishin/as-skill (6 stars, last pushed yesterday), licensed MIT. It adds 163 tokens to every session and 2,721 once invoked, about $0.0007 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-08-31.

Related

memory-bank-defrag compared with skills from other repositories

memory-bank-defrag next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
memory-bank-defragalexeyshishin/as-skillSkill6yesterdayMITA163Claude Code
knowledge-opsMark393295827/third-brain-v7-skillsSkill1402mo agoMITA33Claude Code, Codex
context-managerMark393295827/third-brain-v7-skillsSkill1402mo agoMITA28Claude Code, Codex
session-learnMark393295827/third-brain-v7-skillsSkill1402mo agoMITA29Claude Code, Codex
session-managerEnakoneschniy/claude-dev-stackSkill52mo agoMITA108Claude Code
cds-statsEnakoneschniy/claude-dev-stackSkill52mo agoMITA29Claude Code, Codex
cds-searchEnakoneschniy/claude-dev-stackSkill52mo agoMITA27Claude Code