AGENTS.md vs. Skills: Why Rules Get ‘Forgotten’

Rules from a shared memory file (AGENTS.md, CLAUDE.md) fade over time: at the start of a session the model follows them, and by the middle of a long session it does things its own way. Skills, meanwhile, are carried out without objection at any point. From this observation, which practitioners repeat at every round table, grows an entire architecture of agent memory: what to keep in the rules file, what to move into skills, and what to duplicate with hooks. Below — the mechanics of “forgetting”, a three-bucket distribution table, and working examples of each bucket, from a SKILL.md header to a Python guard script.

Why rules “get forgotten”: the mechanics of attention

The rules file is read at the start of a session — and from then on it competes for attention with the working context: code, logs, tool output. The longer the session, the “farther” the rules drift from the current request. The model does not delete them from the context — it stops refreshing them: formally the lines are still in place, but during response generation priority goes to fresh messages and task data, not to background directives from the header.

A skill works differently: it is invoked explicitly at the moment of the process. The instruction arrives exactly when it is needed — as a fresh, single task in the context, not as one of twenty background items. The moment of delivery matters more than the wording here: the same rule, delivered at the start of a long session and at the moment of action, gets followed differently.

The second factor is volume. A five-page rules file with twenty rules is twenty competing instructions, each pulling attention toward itself. A twenty-line skill is one dense task. The model’s attention is a limited resource, and a dense single instruction reliably beats a long list. The practical takeaway: moving a critical rule from a file into a skill changes not the text of the rule but the moment of its delivery — and that is exactly what decides the outcome.

Three memory buckets: rules file, skills, hooks

Everything you want to tell the agent sorts into three buckets with different delivery mechanics:

BucketWhat goes inMechanics
CLAUDE.md / AGENTS.mdWho I am, the stack, global prohibitions, response formatRead at the start of a session
SkillsRepeatable processes, critical proceduresInvoked explicitly — followed literally
HooksDestructive, irreversible, client-facingPhysical blocking

The sorting test takes a minute. The rule “use Tailwind classes instead of inline styles” — rules file: a forgotten style guideline gets caught in review. The process “cut a release: tests, changelog, tag, publish” — skill: a missed process step costs an hour of rollback. The prohibition “no pushing to main” — hook: a request in the rules text does not stop the command, but a script does.

Run every new rule through one question: “what happens if the model forgets this in the middle of a session?” Forgotten with no consequences — rules file. Material consequences — skill. Irreversible or client-facing consequences — hook: a mechanical block instead of a request.

The instructions in practice: file, skill, hook

Rules file: short and alive

The file is plain markdown in the repository root. In Claude Code it is created with the /init command, edited via /memory, and a message that starts with the # character appends a rule to the file on the fly. A schematic example of the contents:

Project context: Python 3.12, FastAPI, PostgreSQL 16.
Response style: short paragraphs, code examples with explanations.
Prohibitions: no pushing to main without an explicit request, no installing packages silently.
Build and tests: commands collected in @docs/build-rules.md

A line with the @ sign pulls in a separate file — long instructions move out of the main file without losing availability. The user’s personal rules live apart from project rules: the global file in the home folder and the file in the repository are different documents about different things.

Skill: SKILL.md with a two-field header

A skill is a folder with a SKILL.md file inside: project-level skills live in .claude/skills, personal ones in the user’s home folder. The header is YAML with two key fields: the name and the description, which the agent uses to understand when to apply the skill:

name: release-version
description: Cut a release: tests, changelog, tag, publish. Apply when asked to release a version or assemble a release.

The rest of the file is the procedure step by step — those same dense twenty lines. The agent loads the skill when the description matches the task; a skill can also be invoked explicitly, by name. The instruction lands in the context in full at the moment of need — which is exactly why it gets followed literally. The practice of maintaining a skills folder is covered in a separate piece — how to organize a skills folder.

Hook: blocking instead of asking

Hooks are configured in settings.json and fire on harness events. The PreToolUse event runs before a tool call: the hook script receives the call’s JSON on input and can veto the action with exit code 2. The configuration (schematic; the field names are real):

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "python3 ~/.claude/hooks/guard-push.py"
          }
        ]
      }
    ]
  }
}

The guard itself is a simplified working skeleton in Python:

import json
import re
import sys

data = json.load(sys.stdin)
cmd = data.get("tool_input", {}).get("command", "")
if re.search(r"push\s+.*\bmain\b", cmd):
    print("Push to main blocked by hook", file=sys.stderr)
    sys.exit(2)
sys.exit(0)

The model receives a refusal before the command runs — the rule works even when the model has “forgotten”. A walkthrough of guard scripts for other destructive actions is in the piece on hooks and guard scripts.

The interview trick: the agent assembles the rules file

Tina Huang’s practice: a prompt-driven “interview”. You ask the model to interview you about yourself and your working process — and you answer; voice works too. The model assembles the project rules itself: it asks about the stack, about the response format, about the prohibitions, about the things you will not forgive it. The result is twofold. First, the rules end up in the model’s own wording — more readable to a model than a human paraphrase. Second, they are complete: the model asks about things you would have forgotten to mention.

The second ritual is an end-of-session update: “update CLAUDE.md based on what we figured out”. A session ends not at zero but with an enriched file — this is the rule of accumulating project knowledge: every session leaves a trace that the next session picks up.

Rules-file hygiene — five points from practice:

  • Five paragraphs, not five pages: a long file is not read attentively — the model skims it the way a human skims a coffee-machine manual.
  • Update at the end of every session: rules are the project’s living document, not a one-time setup.
  • An example instead of a description: one ideal example works better than ten lines describing “how it should be done”.
  • Critical stuff — not in the file: anything that must be followed goes into skills and hooks, not into text in the header.
  • Separation: the user’s personal rules (“who I am, how to work with me”) and project rules are different files.

The baseline memory setup — which files exist, where they live, and what goes into them — is described in the agent memory guide.

Frequently asked questions

Are AGENTS.md and CLAUDE.md compatible? Yes: the format is the same — plain text rules without specialized syntax. Project rules migrate between agents with almost no edits; the investment is not lost when you switch harnesses. If you are unsure what exactly your harness does with these files, start with the piece on what a harness is.

How many rules is the maximum? The guideline is 10–15 lines of rules; more than that — split into skills or cut down. Density beats completeness: a five-page file loses to ten precise lines.

Does the model forget skills too? Rarer and later: the instruction arrives in the context at the moment of the call, instead of hanging around from the start of the session. But critical things are still duplicated with a hook — the incident with the 30% discount handed to a client happened while the instruction already existed: the text of the rule was there, the mechanical block was not. The case is analyzed in the piece on sandboxes and agent isolation.

What about memory between projects? The user’s personal rules are global: “who I am, how to work with me”. Project rules are local, in the repository. The two-level Cowork system is described in the piece on Cowork levels.

The three memory buckets — rules file, skills, hooks — and the test “what happens if the model forgets this” sort any instruction into its proper place. Memory architecture is the detail that separates a working agent stack from a demo. Action for today: open your rules file and count the lines — move everything that describes a process into skills, and hand the prohibitions on irreversible actions to hooks. The practice is current as of fall 2026.

Like this post? Please share to your friends:
11AI - Your Free LLM
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: