ml-retain

ml-retain is a command for coding agents from jpavley/meta-loop-ios. It costs 14 tokens per session (1,553 once invoked), scanned A, original, MIT.

A command for recording useful lessons from a completed coding session in project documentation. It reviews changes, decisions, workarounds, and gaps in existing guidance.

In plain words
What is it for?
Use it after a successful implementation pass to capture patterns, decisions, newly found rules, and documentation improvements.
Why use it?
It helps prevent the same discoveries and mistakes from being lost after the work is finished. The provided information does not specify the exact documentation files it updates.

Command

Part of the meta-loop-ios plugin — 4 skills, 5 commands shipped together

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 commands/jpavley/meta-loop-ios/ml-retain
Clone the repo
git clone --depth 1 https://github.com/jpavley/meta-loop-ios

Or install meta-loop-ios, the plugin that ships this one along with the rest of its 4 skills, 5 commands.

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 ml-retain

README.md
[![agentmods](https://agentmods.dev/badge/commands/jpavley/meta-loop-ios/ml-retain.svg)](https://agentmods.dev/commands/jpavley/meta-loop-ios/ml-retain)
Your own site
<a href="https://agentmods.dev/commands/jpavley/meta-loop-ios/ml-retain"><img src="https://agentmods.dev/badge/commands/jpavley/meta-loop-ios/ml-retain.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,553 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.00014 $0.01553
Opus 5 $0.00007 $0.00776
Sonnet 5 $0.00003 $0.00311
Haiku 4.5 $0.00001 $0.00155

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

Security

Grade A, and why

ml-retain 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 3d 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.

commands/ml-retain.md · 270 lines

How it starts

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

Meta-Loop: Learning Retention

Capture session learnings in documentation before clearing context.

Modes: Plan Mode → Agent Mode

Prerequisites

This skill implements Step 4 of the Meta-Loop process defined in skills/meta-loop-methodology/SKILL.md.

Use this after a successful implementation pass (/ml-impl review passed).


Phase 1: Plan (Plan Mode)

Enter plan mode and create a plan for documentation updates.

1.1 Review Session Changes

Analyze what happened in this session:

  1. Check git status and diff:

    • What files were created?
    • What files were modified?
    • What's the scope of changes?
  2. Read the feature's notes.md (if this session followed the Meta-Loop):

    • Located in the spec directory (e.g., specs/views/{name}/notes.md)
    • Contains decisions from wireframe, spec, and implementation phases
    • Review for learnings that should be promoted to CLAUDE.md or doc/
  3. Identify learnings:

    • What patterns emerged?
    • What decisions were made?
    • What documentation gaps were discovered?
    • What issues required workarounds?
  4. Check current documentation state:

    • Read TODO.md for task tracking
    • Read CLAUDE.md for current context
    • Note any outdated information

1.2 Create Documentation Plan

Plan updates to these files:

TODO.md Updates:

  • Tasks completed this session
  • New tasks discovered
  • Phase/milestone status changes

CLAUDE.md Updates (keep concise!):

  • New patterns that should be quick-reference
  • Updated file references if structure changed
  • Removed outdated content
  • ⚠️ Keep under 40k characters total

New doc/ Files (if detailed knowledge needed):

  • Complex patterns that need explanation
  • Architectural decisions with rationale
  • Anti-patterns with examples
  • Guides that would bloat CLAUDE.md

1.3 Present Plan to Developer

## Learning Retention Plan

### Session Summary
[1-2 sentence summary of what was accomplished]

### TODO.md Updates
**Move to Completed:**
- [ ] [Task that was completed]

**Add to Next Up:**
- [ ] [New task discovered]

**Milestone Update:**
- [Any phase/milestone status change]

### CLAUDE.md Updates
**Add:**
- [New section or entry]

**Update:**
- [Section to modify]

**Remove:**
- [Outdated content to delete]

### New Documentation Files
| File | Purpose |
|------|---------|
| `doc/[name].md` | [What it documents] |

### Git Commit
**Suggested message:**
> [Descriptive commit message]

Ready to proceed?

Read the full file on GitHub · 270 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. 3d ago First seen · 270 lines · 14 tokens per session scan A 1bba8b7fa8b5

Subscribe to this mod's changes

ml-retain is a command published in the GitHub repository jpavley/meta-loop-ios (3 stars, last pushed 6mo ago), licensed MIT. It adds 14 tokens to every session and 1,553 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-31.