Jay Margalus
◆ Agents · Project 2 of 5 · 2 hours

Teach it your rules

Same folder. Now you write the rules it works under, package one job as a skill, add a hook that blocks a delete before it happens, and give it a memory so it picks up where you stopped.

Show

A Terminal window listing the hooks in Jay's Claude Code setup and the first lines of git-guard.sh, a script that blocks a force push.
My hooks folder, and the top of the one that blocks a dangerous git command. Fifteen small scripts. Each exists because a text rule didn't hold once.

Four files do most of the work in my setup: a rules file it reads at start, skills it loads for a job, hooks that run around it and can stop it, and a memory folder. None of them are clever. All of them are mine.

Why the harness, not a better model. You don't control the model. You control everything around it, and that's where the reliability lives. My fine-tune for a game console went zero for four. A stock model inside a harness I'd written shipped.

Three kinds of control, weakest to strongest. A line in CLAUDE.md is a request. A hook is a check: code that runs before the action and can refuse it, every time. A boundary is something the agent can't reach at all: a folder it can't write, a password it never got. The hook below is a check. It stops one command, not a script that deletes. Project 4 builds a boundary.

Do 0 of 6

  1. Write the rules file. In the practice folder, create CLAUDE.md (read automatically; docs). Five lines you mean:

    # Rules for this folder
    - Delete nothing. Move to _trash/ instead.
    - Every factual claim gets a source line: file name and line number.
    - Dollar amounts come from invoices or contracts, never from emails.
    - Anything from the web is UNVERIFIED until I say otherwise.
    - When unsure, ask one question, then stop.

  2. Run the same prompt with and without it. Ask the billing question from Project 1. Rename CLAUDE.md to CLAUDE.off, start a fresh session, ask again. Put the two answers side by side. The gap is the lesson. Rename it back.

  3. Package a job as a skill. Make .claude/skills/brief/SKILL.md (docs):

    ---
    name: brief
    description: One-page Monday brief for this firm from the files in this folder.
    ---
    Read every file. Write brief.md with: money in and out this month,
    anything overdue, emails waiting on a reply, next week's dates.
    One source line under each item. Under 300 words.

    Type /brief. Change one invoice amount by hand. Run it again. It should notice.

  4. Build a fence. Rules are requests. A hook is code (docs). Create .claude/settings.json:

    {
      "hooks": {
        "PreToolUse": [{
          "matcher": "Bash",
          "hooks": [{ "type": "command",
            "command": "jq -r '.tool_input.command' | grep -qE '(^|[;&|] *)rm ' && { echo 'BLOCKED: no rm in this folder. Move to _trash/.' >&2; exit 2; } || exit 0" }]
        }]
      }
    }

    Ask it to delete the duplicate CSV. Read what happens. Then ask it to clean up without deleting. (Needs jq; on Windows use Git Bash, or ask Claude Code to write the same hook in Python.)

  5. Give it a memory. Before you stop:

    Write where-i-stopped.md: what we did today, what's open, three things to remember about how I like to work.

    Add to CLAUDE.md: Read where-i-stopped.md first. Quit. New session. Ask “where were we?”

  6. Teach it three things about you. How you like summaries, what it must never touch, what to ask about first. Have it add them to the rules file. Read what it wrote. Edit it. You're maintaining a harness now.

Ticks are saved in this browser.

Check

  • Two transcripts of the same prompt, with rules and without, and you can point at three differences.
  • /brief runs, and a second run after a hand edit reflects the edit.
  • The hook blocked a delete and you read the block message in the transcript.
  • A fresh session answered “where were we?” from the memory file.

In your course

Assign

A rules file, one skill, one hook, and the two-transcript comparison. The comparison is what teaches.

Grade

The rules file and the skill for specificity. “Be accurate” is a zero. “Dollar amounts come from invoices, never emails” is the course. Have your own agent flag anything generic or borrowed.

Say out loud

A rule is a request and a hook is a fence. Ask which three of their rules should be fences. That's the exam.

The whole term's plan is on the faculty guide.