claude-code-memory-and-rules

claude-code-memory-and-rules is a skill for Claude Code from dwmkerr/claude-toolkit. It costs 101 tokens per session (1,615 once invoked), scanned C, original, MIT.

A guide for configuring Claude Code's persistent instructions and notes through CLAUDE.md files, project rules, and automatic memory.

In plain words
What is it for?
It is for setting up shared or personal instructions, organizing path-specific rules, and managing notes Claude Code keeps about past work.
Why use it?
It helps keep coding preferences and project instructions available across sessions, with more specific rules taking priority over broader ones.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

Part of the toolkit plugin — 15 skills, 3 commands, 1 agent 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/dwmkerr/claude-toolkit/claude-code-memory-and-rules
Any agent
npx skills add dwmkerr/claude-toolkit --skill claude-code-memory-and-rules
Clone the repo
git clone --depth 1 https://github.com/dwmkerr/claude-toolkit

Made for: Claude Code.

Or install toolkit, the plugin that ships this one along with the rest of its 15 skills, 3 commands, 1 agent.

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 claude-code-memory-and-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/dwmkerr/claude-toolkit/claude-code-memory-and-rules.svg)](https://agentmods.dev/skills/dwmkerr/claude-toolkit/claude-code-memory-and-rules)
Your own site
<a href="https://agentmods.dev/skills/dwmkerr/claude-toolkit/claude-code-memory-and-rules"><img src="https://agentmods.dev/badge/skills/dwmkerr/claude-toolkit/claude-code-memory-and-rules.svg" alt="Measured on agentmods" height="20"></a>
Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,615 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00101 $0.01615
Opus 5 $0.00051 $0.00807
Sonnet 5 $0.00020 $0.00323
Haiku 4.5 $0.00010 $0.00161

Measured 6d ago against content hash 2d8c612f78c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade C, and why

claude-code-memory-and-rules scanned grade C 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 6d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

| "Block rm -rf /" | Hook — use `claude-code-hook-development` skill |
plugins/toolkit/skills/claude-code-memory-and-rules/SKILL.md · 184 lines

How it starts

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

Claude Code Memory and Rules

Configure Claude Code's memory system — CLAUDE.md files, modular rules, and auto memory — so instructions persist across sessions.

Quick Reference

You MUST read these references for detailed guidance:

  • Memory Types - All memory locations, scopes, and precedence
  • Rules Guide - Modular .claude/rules/ with path scoping
  • Auto Memory - Claude's self-managed memory system
  • Examples - Real-world memory and rules configurations

Core Concepts

Claude Code has two kinds of persistent memory:

  1. CLAUDE.md files — Markdown you write with instructions, rules, and preferences
  2. Auto memory — Notes Claude writes for itself based on session learnings

Both load at session start. More specific instructions take precedence over broader ones.

Memory Hierarchy

Scope Location Shared With Priority
Organization /Library/Application Support/ClaudeCode/CLAUDE.md All org users Lowest
User ~/.claude/CLAUDE.md All your projects
User rules ~/.claude/rules/*.md All your projects
Project (shared) ./CLAUDE.md or ./.claude/CLAUDE.md Team via git
Project rules ./.claude/rules/*.md Team via git
Project (local) ./CLAUDE.local.md Just you Highest
Auto memory ~/.claude/projects/<project>/memory/ Just you Per-project

CLAUDE.md files in parent directories are loaded in full at launch. Files in child directories load on demand when Claude reads files there.

Choosing the Right Location

What do you need?
├── Instruction for ALL your projects?
│   ├── Shared with team? → Not possible at user level
│   └── Just you? → ~/.claude/CLAUDE.md or ~/.claude/rules/
├── Instruction for ONE project?
│   ├── Shared with team? → ./CLAUDE.md or .claude/rules/
│   └── Just you? → ./CLAUDE.local.md
├── Scoped to specific file types?
│   └── .claude/rules/<topic>.md with paths frontmatter
├── Session learnings that persist?
│   └── Auto memory (~/.claude/projects/<project>/memory/)
├── Automated enforcement (not guidance)?
│   └── Hook — use the claude-code-hook-development skill
└── Organization-wide policy?
    └── Managed CLAUDE.md (deployed by IT)

Read the full file on GitHub · 184 lines

Files

What ships with it

5 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. 6d ago First seen · 184 lines · 101 tokens per session scan C 2d8c612f78c2

Subscribe to this mod's changes

claude-code-memory-and-rules is a skill published in the GitHub repository dwmkerr/claude-toolkit (23 stars, last pushed 12d ago), licensed MIT. It adds 101 tokens to every session and 1,615 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). 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

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