mm-clear-gate

mm-clear-gate is a skill for Claude Code, Codex from mworldorg/markdown-memory. It costs 167 tokens per session (2,145 once invoked), scanned A, original, MIT.

A read-only checkpoint that uses a script to check whether project notes, handoff files, repository changes, and session records have been saved before clearing context.

In plain words
What is it for?
Use it midway through a project or at the end of a session to find unsaved work, unpushed changes, stale handoffs, or other blockers before running /clear.
Why use it?
It replaces a model's informal claim that work is saved with a result based on the script's exit code.

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/mworldorg/markdown-memory/mm-clear-gate
Any agent
npx skills add mworldorg/markdown-memory --skill mm-clear-gate
Clone the repo
git clone --depth 1 https://github.com/mworldorg/markdown-memory

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 mm-clear-gate

README.md
[![agentmods](https://agentmods.dev/badge/skills/mworldorg/markdown-memory/mm-clear-gate.svg)](https://agentmods.dev/skills/mworldorg/markdown-memory/mm-clear-gate)
Your own site
<a href="https://agentmods.dev/skills/mworldorg/markdown-memory/mm-clear-gate"><img src="https://agentmods.dev/badge/skills/mworldorg/markdown-memory/mm-clear-gate.svg" alt="Measured on agentmods" height="20"></a>
Per session 167 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,145 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.00167 $0.02145
Opus 5 $0.00084 $0.01073
Sonnet 5 $0.00033 $0.00429
Haiku 4.5 $0.00017 $0.00215

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

Security

Grade A, and why

mm-clear-gate 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.

skills/mm-clear-gate/SKILL.md · 74 lines

How it starts

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

mm-clear-gate — гейт перед /clear

Решает проблему: единственным подтверждением «всё сохранено» была фраза модели о сессии, память о которой /clear и стирает. Вердикт должен приходить из скрипта с exit code, а не из реплики.

Вся логика — в скрипте. Скилл его запускает, печатает вывод целиком и переводит exit code в одну строку. Ничего не пересчитывает и не пересказывает.

Запуск

python <repo>/scripts/clear-gate.py --mode mid   # дефолт: между этапами GSD
python <repo>/scripts/clear-gate.py --mode end   # конец сессии

<repo> — корень mm-репозитория (paths.skills_repo из конфига). Проверяемый проект — текущий cwd; можно задать явно через --project <путь>.

Режим: /mm gatemid, /mm gate end (или «конец сессии», «закругляемся») → end.

Что делать с выводом

  1. Напечатай вывод скрипта целиком, дословно — секции блокеров, предупреждений и пройденного. Не сокращай список файлов, не убирай подсказки-команды.
  2. Добавь одну строку по exit code:
    • 0✅ Гейт пройден — можно /clear.
    • 1⛔ Гейт не пройден — чистить нельзя, сначала закрой блокеры выше.
  3. При exit 1 не предлагай /clear и не утверждай, что всё записано. Блокеры перечислены — назови их и остановись.
  4. Ничего не чини сам. Гейт read-only, исправления — отдельное решение оператора.

Планка по режимам

Проверка mid end
Свежесть GSD-handoff в репозитории проекта (.planning/HANDOFF.json, .continue-here.md) блокер блокер
Свежесть vault-файлов для Project Knowledge (handoff.md, dashboard.md) предупреждение³ блокер³
Vault-репо: грязный или не запушен блокер блокер
Дерево проекта незакоммичено предупреждение¹ блокер
HEAD впереди origin предупреждение блокер
Лог сессии в <vault>/sessions/ не проверяется блокер
Фаза Complete без passing-VERIFICATION.md блокер² блокер²
validate.health предупреждение предупреждение

¹ становится блокером, если GSD-handoff устарел: незаписанное состояние плюс грязное дерево — это уже потеря.

Read the full file on GitHub · 74 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 · 74 lines · 167 tokens per session scan A dd14401c820e

Subscribe to this mod's changes

mm-clear-gate is a skill published in the GitHub repository mworldorg/markdown-memory (25 stars, last pushed 18d ago), licensed MIT. It adds 167 tokens to every session and 2,145 once invoked, about $0.0008 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

catchup

Rebuild the human's lost context on a project from live state, in plain language: what needs them, what changed, what new words mean. Use when the human returns after a gap, says they can't follow the project anymore, asks what happened or what a term means, or before deciding what to do next when their mental model…

LilMGenius/paperthin · 84 tokens

re0-memo

Turn a finished, failed, or disappointing work cycle into portable lessons, anti-patterns, quality gates, and next-cycle vocabulary. Use after a build, QA pass, demo, user complaint, or abandoned attempt when the useful output is what the next pass must learn rather than the code itself.

LilMGenius/paperthin · 64 tokens

rag-and-memory

Patterns for Retrieval-Augmented Generation (RAG) and agent memory systems. Retrieves only relevant context, prevents context bloat, and maintains coherent state across sessions.

DevelopersGlobal/ai-agent-skills · 36 tokens

context-loading

Load minimum necessary context into agent context windows. Prevents token bloat, reduces cost, and improves focus. Only load what the current task needs.

DevelopersGlobal/ai-agent-skills · 33 tokens

agent-memory-systems

Memory is the cornerstone of intelligent agents. Without it, every interaction starts from zero. This skill covers the architecture of agent memory: short-term (context window), long-term (vector stores), and the cognitive architectures that organize them. Key insight: Memory isn't just storage - it's retrieval. A…

omer-metin/skills-for-antigravity · 0 tokens

api-designer

API design specialist for REST, GraphQL, gRPC, versioning strategies, and developer experienceUse when "api design, rest, graphql, grpc, openapi, swagger, versioning, pagination, rate limiting, endpoint, api, rest, graphql, grpc, openapi, swagger, versioning, pagination, rate-limiting, ml-memory" mentioned.

omer-metin/skills-for-antigravity · 78 tokens