memory-merger

memory-merger is a skill for Claude Code, Codex from monkilabs/opencastle. It costs 74 tokens per session (695 once invoked), scanned A, original, MIT.

A process for turning repeated lessons from a project’s LESSONS-LEARNED.md file into permanent rules in instruction or skill files. Mature lessons are then archived and indexed.

In plain words
What is it for?
Use it to find recurring or high-severity lessons, map them to the right instruction file, apply an attributed rule or example, archive the original lesson, and validate the updates.
Why use it?
Useful guidance can get buried in a long history file or be forgotten between sessions. This process preserves lessons that have proved important or repeatedly useful.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/monkilabs/opencastle/memory-merger
Any agent
npx skills add monkilabs/opencastle --skill memory-merger
Clone the repo
git clone --depth 1 https://github.com/monkilabs/opencastle

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-merger

README.md
[![agentmods](https://agentmods.dev/badge/skills/monkilabs/opencastle/memory-merger.svg)](https://agentmods.dev/skills/monkilabs/opencastle/memory-merger)
Your own site
<a href="https://agentmods.dev/skills/monkilabs/opencastle/memory-merger"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/memory-merger.svg" alt="Measured on agentmods" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 695 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00074 $0.00695
Opus 5 $0.00037 $0.00347
Sonnet 5 $0.00015 $0.00139
Haiku 4.5 $0.00007 $0.00069

Measured 4d ago against content hash 64c3622af3f4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory-merger 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 4d 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/orchestrator/skills/memory-merger/SKILL.md · 84 lines

How it starts

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

Memory Merger

Run Criteria

Combined signals to identify merge candidates.

Criterion Signal / Threshold
File size LESSONS-LEARNED.md > 50 entries
Citation count Cited 3+ times across sessions
Age >60 days and still relevant
Category cluster 5+ lessons in same category
Severity Marked high or blocking
Discretionary Curator / maintainer judgement (stale file)

Workflow (numbered)

  1. Scan LESSONS-LEARNED.md for candidate entries (frequency, severity, age).
  2. Map each candidate to target file, section.
  3. Draft exact edit (concise rule or example).
  4. Apply edit with attribution comment.
  5. Archive migrated lesson in LESSONS-LEARNED.md with merge note.
  6. Update index; run validation checks.

Merge Protocol

3 — Draft Edit

Lesson: LES-XXX — [title]
Target: [file path]
Section: [section name]
Edit: [exact text]

Strategies: add rule, add anti-pattern, add code example, expand existing rule, add table row.

4 — Apply & Attribute

Edit target file; add <!-- Merged from LES-XXX --> attribution inline.

5 — Archive

Move merged lessons to ## Archived (Merged) at the bottom of LESSONS-LEARNED.md:

### LES-XXX: [title] → Merged to `[target]` on YYYY-MM-DD

Never delete lessons — archive for traceability.

6 — Update Index

Update ## Index by Category in LESSONS-LEARNED.md to mark archived lessons.

Automating the scan

# Find lessons cited 3+ times across sessions
rg -c "LES-[0-9]+" .opencastle/logs/events.ndjson | awk -F: '$2 >= 3 {print $1}'

# Find lessons referenced in recent retries
rg "retry.*LES-[0-9]+" .opencastle/logs/events.ndjson | rg -o "LES-[0-9]+" | sort | uniq -c | sort -rn | head -20

Quality Gates (validation checkpoints)

  • No duplicate rules created in target files or other skills
  • Archived lesson references target file and date
  • Target file still passes lint/markdown checks (if applicable)
  • Keyword search in the target file confirms the merge applied

Read the full file on GitHub · 84 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. 4d ago First seen · 84 lines · 74 tokens per session scan A 64c3622af3f4

Subscribe to this mod's changes

memory-merger is a skill published in the GitHub repository monkilabs/opencastle (61 stars, last pushed 6d ago), licensed MIT. It adds 74 tokens to every session and 695 once invoked, about $0.0004 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

retrieval-practice-generator

Generate low-stakes retrieval-practice questions with grounded answer notes and implementation guidance. Use for quiz starters, revision activities, delayed recall, misconception checks, or adapting recall difficulty.

iflytek/skillhub · 41 tokens

aws-secrets-manager

Secret safety for AWS Secrets Manager, secret management, credentials, API keys, tokens, and passwords. Prevents AI agents from directly fetching secret values and teaches runtime dynamic references with asm-exec so plaintext never enters the LLM context window.

aws/agent-toolkit-for-aws · 53 tokens

mindos

MindOS: local knowledge assistant & shared KB. Keeps decisions, notes, SOPs, debugging lessons, research findings, preferences across sessions/agents. Core: save notes, search KB, organize files, run workflows, review, append CSV, hand off context, distill lessons. NOT for app source or paths outside KB. Triggers…

GeminiLight/MindOS · 136 tokens

mindos-max

MindOS: local knowledge assistant & global memory layer. Keeps decisions, notes, SOPs, debugging lessons, architecture choices, research findings, preferences, conversation summaries for all connected agents. PROACTIVE: (1) search MindOS first for past context, (2) offer to save after valuable work, (3) persist key…

GeminiLight/MindOS · 145 tokens

tutorial-guide

The 12-lesson tutorial curriculum for teaching a human how Lingtai works. Router for orientation, agent runtime, communication, memory/molt, capabilities, operations, addons, and graduation. Invoke this skill when the human is ready to begin or continue the tutorial.

Lingtai-AI/lingtai · 57 tokens

self-improve

Extract lessons from the current session, or sweep the project's past sessions when asked, and route them to the appropriate knowledge layer (project AGENTS.md, auto memory, existing skills, or new skills). Use when the user asks to "self-improve", "distill this session", "distill past sessions", "sweep past…

tobihagemann/turbo · 125 tokens