memory-gate

memory-gate is a skill for Claude Code, Codex from rjmurillo/ai-agents. It costs 109 tokens per session (1,811 once invoked), scanned A, original, MIT.

A tool for creating evidence-based reports from several project memory sources, repository artifacts, and GitHub issues. It connects findings to their supporting evidence.

In plain words
What is it for?
Use it to investigate recurring problems, trace how decisions changed, identify undocumented coding patterns, or examine doubts about past choices.
Why use it?
Important patterns and decisions may be spread across different stores and issue discussions. Cross-checking them produces a traceable account instead of relying on one memory source.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the project-toolkit plugin — 95 skills, 26 commands, 33 agents, 4 hooks 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 skills/rjmurillo/ai-agents/memory-gate
Any agent
npx skills add rjmurillo/ai-agents --skill memory-gate
Clone the repo
git clone --depth 1 https://github.com/rjmurillo/ai-agents

Made for: Claude Code, Codex.

Or install project-toolkit, the plugin that ships this one along with the rest of its 95 skills, 26 commands, 33 agents, 4 hooks.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/rjmurillo/ai-agents/memory-gate.svg)](https://agentmods.dev/skills/rjmurillo/ai-agents/memory-gate)
Your own site
<a href="https://agentmods.dev/skills/rjmurillo/ai-agents/memory-gate"><img src="https://agentmods.dev/badge/skills/rjmurillo/ai-agents/memory-gate.svg" alt="Measured on agentmods" height="20"></a>
Per session 109 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,811 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.1 $0.00109 $0.01811
Opus 5 $0.00055 $0.00905
Sonnet 5 $0.00022 $0.00362
Haiku 4.5 $0.00011 $0.00181

Measured yesterday against content hash 4aeb6817dd2d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

memory-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 yesterday.

The scan reads SKILL.md. This mod also ships 2 executable files (tests/__init__.py, tests/test_memory_gate_structure.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

.claude/skills/memory-gate/SKILL.md · 196 lines

How it starts

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

Memory Gate

The Memory-First Gate and its investigation protocol, extracted from the memory router per ADR-063 (memory-skill decomposition). memory still routes here; an agent about to change an existing system loads this sub-skill instead of the full memory surface.

The gate is one operation with a single rule: before you change something that already exists, search memory for why it exists. The search uses the canonical Tier 1 script; this sub-skill owns the enforcement semantics (ADR-070) and the Chesterton's Fence framing, not the search implementation.

Triggers

Use this skill when the user says:

  • memory-first gate to apply the BLOCKING pre-change check
  • search memory before changing to recover historical context first
  • chesterton fence check to investigate why a system exists before removing it

Memory-First Gate (BLOCKING)

Before changing existing systems, you MUST:

  1. Search memory for the topic you are about to change.
  2. Review results for historical context.
  3. If Tier 1 is insufficient, escalate to Tier 2 (episodes).
  4. Document findings in your decision rationale.
  5. Only then proceed with the change.
# Recover the "why" before you change the "what"
SCRIPTS_DIR="${COPILOT_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-.claude}}/skills/memory/scripts"
python3 "$SCRIPTS_DIR/search_memory.py" "[topic]"

Why BLOCKING: under 50% compliance with "check memory first" guidance when it is advisory. Making it BLOCKING achieves 100% compliance, the same pattern as the session protocol gates (ADR-070 gate semantics).

Verification: the transcript, pull request, handoff, Serena memory, or an optional log must show the search before the decision.

The canonical Tier 1 script is search_memory.py. It is shared with the memory router and lives at .claude/skills/memory/scripts/search_memory.py. This sub-skill delegates to it and does not reimplement search.

Memory-First as Chesterton's Fence

Core insight: memory-first architecture implements the Chesterton's Fence principle for AI agents.

Read the full file on GitHub · 196 lines

Files

What ships with it

3 files 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. yesterday First seen · 196 lines · 109 tokens per session scan A 4aeb6817dd2d

Subscribe to this mod's changes

memory-gate is a skill published in the GitHub repository rjmurillo/ai-agents (45 stars, last pushed today), licensed MIT. It adds 109 tokens to every session and 1,811 once invoked, about $0.0005 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-09-03.