memory-distill

memory-distill is a skill for Claude Code, Codex from tonyghiani/ai-essentials. It costs 88 tokens per session (833 once invoked), scanned B, original, MIT.

A memory-maintenance skill that reads logged corrections and preferences, groups repeated themes, and proposes lasting memory entries for approval.

In plain words
What is it for?
Use it periodically to review correction logs, compare them with existing project memories, and decide which recurring guidance to store.
Why use it?
It helps preserve useful user preferences without automatically saving every minor detail or creating duplicate memories.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: reads .claude/ paths; mentions CLAUDE.md.

Good fit Use it periodically to review correction logs, compare them with existing project memories, and decide which recurring guidance to store.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/tonyghiani/ai-essentials/memory-distill.svg)](https://agentmods.dev/skills/tonyghiani/ai-essentials/memory-distill)
Your own site
<a href="https://agentmods.dev/skills/tonyghiani/ai-essentials/memory-distill"><img src="https://agentmods.dev/badge/skills/tonyghiani/ai-essentials/memory-distill.svg" alt="Measured on agentmods" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 833 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00088 $0.00833
Opus 5 $0.00044 $0.00417
Sonnet 5 $0.00018 $0.00167
Haiku 4.5 $0.00009 $0.00083

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

Security

Grade B, and why

memory-distill scanned grade B with 1 finding 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 7d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat ~/.claude/memory-signal.jsonl
skills/memory-distill/SKILL.md · 91 lines

How it starts

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

Memory distill

The log-correction-signal hook captures every prompt where Marco corrected behaviour or stated a preference, at zero token cost. This skill turns that raw log into memory files. Run it periodically, not every session.

Why it works this way

Auto-extracting memories at the end of every session burns tokens and produces low-grade noise ("user wanted the button blue"). Corrections are the high-signal moments: they mark where the assistant's default diverged from what Marco actually wants. Logging is free; distilling is deliberate.

Workflow

Step 1 — Read the log

wc -l ~/.claude/memory-signal.jsonl 2>/dev/null || echo "no signal log yet"
cat ~/.claude/memory-signal.jsonl

Each line is { at, cwd, session, prompt, hits }. If the file is missing or empty, say so and stop; don't invent memories.

Step 2 — Read what's already stored

Memory lives per-project at ~/.claude/projects/<slug>/memory/. Read the relevant MEMORY.md index and any file that might already cover a theme. You are updating, not appending duplicates.

Step 3 — Group into themes

Cluster the raw prompts. A theme needs at least two independent occurrences, or one very explicit standing instruction ("from now on…"). Discard:

  • One-off task corrections with no general rule ("no, the other file")
  • Anything already covered by CLAUDE.md, a skill, or the repo's own docs
  • Preferences derivable from the code itself (the marco-code-style skill covers style; don't duplicate it here)

For each surviving theme, write down the why. A memory without a reason gets misapplied later.

Step 4 — Propose, don't write

Present each candidate as:

### <slug>
**Type:** feedback | project | user | reference
**Claim:** <one line>
**Why:** <the reason it matters>
**Evidence:** <2-3 quoted fragments from the log, with dates>
**Action:** new file | update <existing-file.md> | supersedes <old-file.md>

Then ask which to keep, using a numbered list so a numbered reply maps by index.

Read the full file on GitHub · 91 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. 7d ago First seen · 91 lines · 88 tokens per session scan B bf0abbbbc569

Subscribe to this mod's changes

memory-distill is a skill published in the GitHub repository tonyghiani/ai-essentials (6 stars, last pushed 29d ago), licensed MIT. It adds 88 tokens to every session and 833 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

media-ingest

Ingest video, audio, PDF, book, screenshot, and GitHub repo content into the brain. Multi-format handling with entity extraction and backlink propagation. Covers video-ingest, youtube-ingest, and book-ingest subtypes.

garrytan/gbrain · 52 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

Cortex

Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…

danielmiessler/LifeOS · 196 tokens

memory

Use when the user asks to remember, recall, forget, update, search, or inspect durable OpenSquilla memory, including profile facts in USER.md and long-term notes in MEMORY.md or memory//.md.

opensquilla/opensquilla · 44 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

establishing-project-context

Use when the user asks to establish shared project language, or project work exposes a conflicting, renamed, or deprecated domain term that needs active semantic modeling. Routine small tasks stay on the fast path.

GanyuanRan/Aegis · 45 tokens