1. Home
  2. Free course
  3. Module 7

Fix it once.
Make it stay fixed.

A correction typed in chat lasts until the session ends. This module teaches you to put each one where it belongs, as a rule, a skill or a hook, keep memory clean as it grows, carry state through compaction, and check that the setup is actually getting better.

Module 7 of 8About 40 minMastery

What you will be able to do

  • Decide in one step whether a correction becomes an instruction, a skill, a hook, a permission or a memory note.
  • Write rules that a model follows consistently, with the reason attached, in the file where they belong.
  • Turn a prompt you keep retyping into a command with arguments.
  • Keep memory and instruction files small, current and free of contradictions, and keep work state alive through compaction.
  • Measure, with numbers from your own sessions, whether your setup is improving.

The operator who has run agents for a year is not faster because they type faster. Their setup has absorbed a year of corrections. Every mistake they caught once has become something the harness now knows or enforces, so they spend their attention on new problems. That is compounding. Its opposite is the operator who types "comments explain why, not what" for the fortieth time.

7.1 Every correction has a home

When you correct an agent, ask one question before you move on: will this come up again? If yes, the correction must leave the chat. Where it goes depends on what kind of correction it is.

The correction is aboutHomeExample
How to work, in every projectYour personal instruction file (in Claude Code, ~/.claude/CLAUDE.md)"Comments explain why. Never narrate what the code says."
A convention of one project, shared with the teamThe project instruction file, committed"Money is integer cents. Never floats."
One part of the codebase onlyA path-scoped rule"Migrations are append-only" for migrations/**
A procedure you run oftenA skill or command"How we cut a release"
Something that must never happenA hook or a deny rule"Never edit the generated presets file"
State that will changeMemory, not instructions"The staging box moved to a new host"
A choice already settledA decision log"We chose Postgres over MySQL; don't reopen it"

Two tests resolve most doubtful cases. The cost test: if the agent ignoring it once would cost you real damage, it needs enforcement (module 6), not an instruction. The relevance test: if it only matters for some tasks, it should load only for those tasks, as a skill or a path-scoped rule, not sit in every session's context.

Do it at the moment of correction

The moment you correct is the moment you know exactly what went wrong and why. An hour later you will remember the gist. A week later, nothing. Make filing it part of the correction. The free HOPE skills include /lesson for this: type /lesson after a correction and it writes the rule in your words, with its reason, into one home. It first searches the existing instruction files and memory for the topic, so it strengthens a rule that exists instead of adding a duplicate, and if the new rule conflicts with an old one, you choose which wins. An illustrative exchange:

> No. Don't add a new dependency for date formatting, we use Intl.
/lesson

  Rule: Format dates with the platform's Intl API; don't add a date
        library.
  Why:  user correction 2026-11-28; the project is dependency-free.
  Home: project CLAUDE.md (a convention of this repo, not everywhere).
  Existing: none on this topic.
  This file is shared with the team. Write it? (yes / edit / no)

The common mistake: filing too broadly. You corrected something about one repository, and it lands in the global file as a rule for everything. Now it misfires in another project, and you get a new problem from your fix. Keep the scope you actually meant: "in this repo" stays in this repo.

Sort last week's corrections

Write down five corrections you gave an agent in the past week, from memory or from transcripts. For each one, use the table to name its home. Then file the two you are most sure will come up again.

7.2 Rules that hold

Instruction files are loaded at the start of every session. They are context, not configuration: the model reads them and usually follows them. How consistently it follows them depends mostly on how you write them. Claude Code's docs say that the more specific and concise your instructions, the more consistently they are followed, and that if two instructions contradict each other, the model may pick one arbitrarily (how Claude remembers your project).

The shape of a good rule

- **Deliver what was asked, in the form asked.** Doing more means
  doing the asked thing better, never swapping it for something else.
  Why: I asked for images and got videos.
  How: same medium, format and count the request names. Offer extras
  in one line; don't make them instead.

Four parts. The rule itself, as one behaviour, in bold so it scans. The Why, which is what lets the model apply the rule sensibly to a case you did not foresee. The How, which says what following it looks like. And it is short. Compare the version most people write first:

- Always follow instructions carefully and don't do extra stuff.

Every word of that is true and none of it changes behaviour. "Carefully" and "extra stuff" do not describe an action the model can check itself against.

Keep the files small

  • Size. Claude Code's docs advise targeting under 200 lines per CLAUDE.md file, because longer files consume more context and reduce adherence. @path imports help organise a long file but do not reduce its cost: imported files are loaded too.
  • Scope. Move what matters for only part of the codebase into path-scoped rules. In Claude Code, a Markdown file in .claude/rules/ with a paths field in its frontmatter loads only when the agent works with matching files. Multi-step procedures go into skills (7.3).
  • Contradictions. Every few weeks, read all the files that load at start together, as one text, and remove the rules that disagree. The skills' /context-audit does this as a measured report: it lists what loaded and how big each part was, then names contradictions with both sides quoted, duplicates and stale claims, and changes nothing without your approval.
---
paths:
  - "migrations/**"
---
# Migrations
- Migrations are append-only. Never edit one that has been merged;
  write a new one. Why: deployed databases have already run the old file.

Never strengthen what was said

When you, or an agent, turn a correction into a rule, keep its strength. "I'd prefer shorter commit messages" is a preference, not "Commit messages must be under 50 characters". A rule that is stronger than you meant makes the agent rigid in exactly the cases where you would have wanted judgement. The same goes for scope: "in this file" must not become "in every file".

The common mistake: writing the rule as the incident. "Don't break the checkout like on Tuesday" means nothing to a session that never saw Tuesday. Write the behaviour that would have prevented it, and put the incident in the Why.

Rewrite three rules

Open your main instruction file. Find three rules without a reason. Add a one-line Why to each. If you cannot remember why a rule is there, try deleting it for a week and see if the problem it prevented comes back.

7.3 Skills for repeated work

If you have typed the same paragraph of instructions three times, it should be a command. If you have explained the same procedure three times, it should be a skill. Both save typing, but the real gain is consistency: the procedure is the same every time, and when you improve it, every future run gets the improvement.

In Claude Code, a skill is a folder with a SKILL.md file, in ~/.claude/skills/<name>/ for all your projects or .claude/skills/<name>/ for one repository. The older form, a Markdown file in .claude/commands/, still works. A skill's description is always in context so the model knows it exists, but its body loads only when the skill is used, which is why long procedures belong in skills rather than in the instruction file (skills). $ARGUMENTS in the body is replaced with whatever you type after the command.

---
name: release
description: Cut a release: changelog, version bump, tag. Use when the user asks to release.
disable-model-invocation: true
argument-hint: [patch|minor|major]
---
Cut a $ARGUMENTS release of this project.

1. Run the full test suite. If anything fails, stop and report; do not release.
2. Read commits since the last tag (git log $(git describe --tags --abbrev=0)..HEAD).
3. Add a CHANGELOG.md entry: one line per user-visible change, in plain words.
4. Bump the version in package.json. Commit as "release: vX.Y.Z".
5. Create the tag. Do not push. Print the push command for the user.

Notice what this skill does beyond saving keystrokes. Step 1 is a check, so a release cannot happen on red tests. Step 5 is a guardrail from module 6, the "prepare, don't perform" pattern, written into the procedure. disable-model-invocation: true means the model will not start a release on its own; only you can, by typing /release.

When a skill is the wrong tool

  • If the procedure must happen every time a certain event occurs, such as after every edit or before every compaction, a hook is better. A skill runs when invoked; a hook runs whether anyone remembers or not.
  • If it is one sentence, it is a rule, not a skill.
  • If it changes every time, it is not repeated work yet. Wait until you have done it three times the same way.

Read other people's skills to learn the craft. The harnessoperator-skills repository is public and MIT-licensed; its commands/ folder shows ten real commands, each with the checks and stopping points written in.

The common mistake: writing a skill as a description of the goal ("do a good release") instead of a procedure with checks and a stopping point. A skill is only as good as its worst step. Make each step something you could verify.

Make one command

Find the prompt you type most often, by searching your session history or just from memory. Turn it into a command with one argument. Use it three times this week, and improve it after each use.

7.4 Memory and compaction

Instructions say how to work. Memory records what is true: which host serves staging, which branch has the half-finished refactor, what was tried and failed. It grows on its own, and like any notebook it fills up with things that were true once.

Memory hygiene

Claude Code's auto memory is a set of notes the agent writes itself, with an index file, MEMORY.md. Only the first 200 lines or 25 KB of that index load at the start of a session (memory docs). Everything past that limit is invisible at start, however important it is. So:

  • Index lines, not essays. One line per topic in the index, with a link to a topic file that holds the detail.
  • Dates on state. "Deployed" without a date is a claim nobody can check. "v2.3 live on 2026-11-20, checked with curl" can be checked and can be seen to be old.
  • Verify before you trust. A memory saying a file exists, a flag is set or a service is live is a claim about the past. Check it before acting on it.
  • Prune. When something stops being true, delete or update the note. A stale memory is worse than none, because the agent acts on it with confidence.

Checkpoints that survive compaction

When the context window fills, the harness compacts: it replaces the conversation with a summary and carries on. A summary is a narrative, and narratives lose exactly the details you need to resume: the unpushed branch, the failed approach, the next command. Three things protect you.

  1. Tell the summary what to keep. Claude Code reads a "Compact instructions" section in your CLAUDE.md, and /compact accepts a focus, such as /compact Focus on code samples and API usage (costs docs).
  2. Save state to disk at the moment of compaction. Claude Code has PreCompact and PostCompact hook events. The compact hook in the HOPE skills uses them to save every compaction as a checkpoint file and keep the raw transcript, and it warns if the summary skipped a required section.
  3. Checkpoint on purpose before it matters. /checkpoint writes a verified record: done, in progress, not started, decisions, gotchas and where to resume, after checking git state. Run it before a manual compact, at the end of a day, and before anything risky.

Here are the compact instructions the skills install, which show what a resumable summary must contain:

## Compact instructions

Every compaction (manual or auto) must produce a resumable checkpoint, not a
narrative. ... Use exact paths, branches, SHAs, PR URLs, versions and
commands. Mark anything not verified as UNVERIFIED, and never state a file path
as existing unless you saw it.

- Pending Tasks → split into In progress (each item: exact stopping
  point, very next command or edit, blocker) and Not started (priority
  order). ...
- Add Decisions (choice, why, who decided, rejected options) and
  Gotchas (failed approaches and traps, so they aren't retried).

Settled choices deserve their own record, because a checkpoint is replaced each time and an old decision tends to come back as a fresh question. /decision appends each one, with who decided and what was rejected, to a log that every new session is told about.

The common mistake: trusting the compacted summary as fact. After a compact, the agent is working from its own notes about its own work. Before it continues anything that matters, have it check the state again: git status, the tests, the deploy.

Audit your memory

Open your memory index. Count the lines. Find three entries that state something as live, deployed or current, and check each one against reality today. Fix or delete what is wrong, and add a date to what is right.

7.5 Measure that it improves

A setup can grow without getting better. Rules pile up, contradict each other and cost context in every session. To know whether you are compounding or just accumulating, measure.

MeasureWhat it tells youHow to get it
Repeated correctionsWhether lessons stick. The same correction twice means it was not filed, or the rule is not working./lesson mine lists typed messages from past sessions that read like corrections, grouped, minus those an existing rule covers
Startup context sizeWhat every session pays before you type/context in Claude Code; /context-audit for a tracked report compared with the last one
Gate and guard blocksHow often the agent claimed without proof or tried a forbidden editCount the evidence gate's and brief guard's interventions in transcripts
Corrections per taskHow much steering a typical task needsCount your typed corrections in a task's transcript; compare month to month
Friction patternsWhere sessions go wrongClaude Code's /insights writes a report on recent sessions, including friction points such as misunderstood requests (costs docs)
Tooling healthWhether hooks still fire after an upgrade/doctor checks every hook, setting and command; /cure applies the fixes

You do not need all of these. Pick two, write down today's number, and check again in a month. The most honest single measure is the first one: the same correction should never need typing a third time.

Treat your setup like code

  • Keep instruction files, skills and hooks under version control, so you can see what changed and undo a rule that made things worse.
  • When a hook misfires, add the case that fooled it as a test. The evidence gate in the HOPE skills was calibrated this way: replayed over 408 real turns, it blocks 4, and each false alarm found along the way became a regression test.
  • Review the whole setup on a schedule, the way you would review dependencies: monthly is enough for most people.

The common mistake: only ever adding. Every rule has a cost in context and in the chance of contradiction. A good review deletes at least as much as it adds.

Take a baseline

Today, record two numbers: the size of what loads at session start, and the number of corrections you typed in your last three tasks. Put a reminder in your calendar for one month from now to measure again.

Practice task

Spend one working week making your setup compound, then measure the result.

  1. On day one, record the baseline from 7.5: startup context size and corrections in your last three tasks.
  2. For the rest of the week, file every repeatable correction at the moment you make it, in the home the table in 7.1 gives.
  3. Turn your most-typed prompt into a command with an argument.
  4. Turn one "must never happen" rule into a hook or deny rule (module 6), and remove the instruction it replaces if it is now redundant.
  5. Audit your memory and instruction files for stale state and contradictions.
  6. On the last day, measure again.

Success criteria

  • At least five new or strengthened rules, each with a Why, each in the home that fits its scope.
  • One command you used at least three times, with at least one improvement after use.
  • One rule replaced by enforcement, shown working with a test input.
  • No contradictions left in the files that load at start, and every state claim in memory either dated and checked or removed.
  • No correction typed a third time during the week.
  • Startup context the same size or smaller than the baseline, despite the new rules.

Check yourself

"Never edit files in dist/" keeps being ignored. Rule, skill or hook?

A hook or a deny rule. It must never happen and the instruction has already failed, so it needs enforcement, not a better-worded request.

Why does a rule need a Why?

The reason lets the model apply the rule sensibly to cases you did not foresee, and lets a later reader, human or agent, judge whether the rule still applies.

Your release procedure is 40 lines. Why not put it in the instruction file?

The instruction file loads in every session and costs context every time. A skill's body loads only when it is used, so the procedure costs nothing on days you do not release.

After a compaction, the agent says the migration was applied. What do you do?

Check it. The compacted summary is the agent's own narrative. Have it verify the real state (the database, git, the tests) before continuing, and mark anything it cannot check as unverified.

Your setup grew by 30 rules this month. How do you know it improved?

Measure it: are repeated corrections falling, are corrections per task falling, and is startup context under control? More rules alone prove nothing; contradictions and context cost can make things worse.

Key takeaways

  • A correction that stays in chat is lost. File it at the moment you make it.
  • Each correction has one home: instruction, path rule, skill, hook, permission, memory or decision log. Damage means enforcement; narrow relevance means on-demand loading.
  • Good rules are one behaviour, with a Why and a How, at the strength and scope you meant.
  • Memory records state; date it, verify it and prune it. Checkpoints carry work through compaction.
  • Measure. The same correction should never need typing a third time.

Go further

  • Module 2, Context: what the agent knows, and how to cut what misleads it.
  • Module 6, Guardrails: how to build the hooks that a correction sometimes needs.
  • Module 8, Economics: what a large setup costs in every session.
  • Free skills: /lesson, /decision, /checkpoint, /context-audit and /doctor are built for this module.
  • Training: the guided version of this module, practised on a live harness with your transcript reviewed against an expert run.
  • Certification: the Senior Operator level expects your own skills and hooks.