Session 3
Teach the Repo
Why chat corrections repeat, and how agent rules, layout, and skills teach the next session.
- Choose README vs agent rules for a given problem
- Feel the cost of rules that live only in chat
- Draft one agent rule your team could approve
- Use skills as saved instructions for common jobs
A situation you may recognize
Monday. You tell the AI: “Run payment package tests, not root smoke tests.” It does. You merge.
Wednesday. New chat. Same repo. The AI runs pnpm test at the root. Green. Wrong package. You type the same correction again.
Friday. A teammate hits the same issue. They ask you for the “magic prompt.”
A fresh session has no memory of Monday’s chat. It reads files, layout, and behavior rules: if those rules do not exist, you become the manual. README helps humans onboarding; it rarely stops an AI from running the wrong command.
That pattern is easy to miss because Monday felt successful. The failure shows up as repetition, not as a red error screen. Session 3 is about moving knowledge from your head and chat history into places the next session loads automatically, so Wednesday does not start from zero.
Two readers, two manuals
Most repositories were written for human readers first. That is not wrong; it is incomplete for agent-shaped workflows.
When you open a README, you expect narrative: what the project is, how to install, where to get help. When a fresh AI session opens your repo, it often behaves like a new contractor on day one: eager, literate, and missing every unwritten rule your team accumulated in Slack threads.
The table below is not about adding more documentation for its own sake. It is about matching audience to file:
| File | Written for | Answers… |
|---|---|---|
| README.md | Humans joining the team | What is this? How do I install and run it? |
Agent rules (often AGENTS.md) | Fresh AI sessions | How must you behave while changing this code? |
README is the welcome desk. Agent rules are house rules on the wall: run these tests, do not touch those paths, stop if unsure.
When an AI runs git clean or skips tests, the failure is often not “a bad model.” Nobody wrote the rule where the tool looks. The discovery to make in this session: every time you type the same correction twice, ask where would a new session find this without me?
Tool equivalents
| Tool ecosystem | Where behavior rules often live |
|---|---|
| Cursor | AGENTS.md, .cursor/rules/ |
| Claude Code | CLAUDE.md, project settings |
| GitHub Copilot | .github/copilot-instructions.md |
Pick one place your team reviews in pull requests.
Pick one place your team reviews in pull requests. Two competing rule files teach conflicting behavior.
What changes when you write the rules down
The vignette below is short on purpose. Read it as a before/after you may recognize, not as a product demo.
Before and after
One missing rule, three sessions of corrections
Without AGENTS.md
- Session 1: agent runs
pnpm testat repo root — green, wrong package. - Session 2: you correct in chat; agent fixes the right package.
- Session 3: new session; root tests again. You type the same correction.
Orchestration tax — rules live in your head, not the repo.
With AGENTS.md (12 lines)
# Agent house rules
## Tests
- Run tests in the package you touched: `pnpm --filter <pkg> test`
- Do not rely on root `pnpm test` alone
## Git
- Never run `git clean`, `git reset --hard`, or force-push
- Never commit `.env` or credential files
## Scope
- Payment code lives under `packages/payments/` — stay there unless the ticket says otherwise Fresh session loads the rule. Session 4 verify starts on the right package.
What you knew on Monday was correct. What was missing was location: the rule lived in your head and chat history, not where the next session loads instructions.
One small pull request, often a dozen lines, can replace weeks of repeated corrections. On a team, that file is shared infrastructure, not a private notebook. The first time you merge agent rules, watch standup the following week: the “magic prompt” requests often quiet down, not because people got smarter, but because the repo got clearer.
A starter template you can adapt
# Agent house rules
## Before saying the work is done
- Run tests in the package you touched: `pnpm --filter <pkg> test`
- Do not rely on root test scripts alone for package changes
## Git
- Never run `git clean`, `git reset --hard`, or force-push
- Never commit `.env`, credentials, or secrets
## Scope
- Payment code lives under `packages/payments/`, stay there unless the ticket says otherwise
## When stuck
- Ask instead of guessing file paths or API shapes
- Do not add new dependencies without explaining why
If a line feels vague, “write clean code”, remove it. If a line saves you from typing the same correction twice, keep it. The test for each line: would I approve this in a pull request if a teammate wrote it? Vague rules get ignored; specific rules get followed.
Layout teaches too
Agent rules tell the tool what it must do. Layout tells it what the codebase is: often without a paragraph of explanation.
AI tools also infer meaning from structure: folders, tests, names. When an AI gets lost, the fix is often clearer structure, not a longer README. You may discover this by accident: you add a rule saying “payment code lives here,” then realize the folder was already named well and the rule only made explicit what layout implied.
Three layers, from specific to general:
Skills → one job (“review this pull request”)
Agent rules → whole repository (“run tests; never commit secrets”)
Code layout → silent hints (boundaries, types, test folders)
For the payment helper:
Skill → review-changes on the diff
Agent rules → run `pnpm --filter payments test` before reporting done
Layout → src/payments/helpers/ and tests/payments/ show the boundary
Guess A: a generic “be a helpful coding assistant” preamble.
Guess B: a short, reviewed recipe for one job: review a diff, commit safely, refactor with guardrails.
B. Skills are instructions you trust, saved once, like a checklist your team already agreed on.
Examples on this site:
| Skill | Helpful when… |
|---|---|
| review-changes | Checking a local diff before push |
| review-pr | Reviewing a pull request with good questions |
| commit-changes | Committing after you have verified |
README → human onboarding confusion. Agent rules → behavior. Layout → comprehension.
Most repos only have README. The gap shows up as the same chat corrections, again and again. The Monday/Wednesday/Friday story.
A gentle try-it (optional)
- Install review-changes or one skill from /skills/.
- Run it on a small local change.
- Write one agent rule you wish every future session already knew, specific enough that a teammate would approve it in a pull request.
Before Session 4
Session 4 opens with a diff and a green CI check. You will decide ship or hold before the rest of the session explains why.