InterviewKata
AI engineering · Module 09 of 21 · Level 3: Configure your tools

Project instructions and memory

Every session starts with an empty desk (Module 02). Project instructions are the notes your tool puts on that desk automatically, so the agent knows your commands, layout and rules without being told each time. Written well, they're the highest-leverage file in your repository.

1. The idea

A new contractor arrives each morning with no memory of yesterday. On the kitchen counter you leave a short note: "Water main is under the sink. Don't touch the fuse box: the wiring is old. Clean up with the blue bucket." It takes a minute to read, and it prevents the same three mistakes every single day.

There are three kinds of persistent context, and each has its place:

  1. Project instructions, committed to the repository and shared with the team: build and test commands, folder layout, conventions, and the traps you've hit. The open standard is AGENTS.md, now stewarded by the Agentic AI Foundation under the Linux Foundation and read by all five tools in this track. Some tools also have their own file (CLAUDE.md, GEMINI.md, .github/copilot-instructions.md).
  2. Scoped rules that load only when relevant: a file in a subfolder (frontend/AGENTS.md), or a rule tied to file patterns ("apply to **/*.sql"). The nearest instructions win.
  3. Memory: notes the agent writes for itself as it works ("this repo's tests need Docker running"). Useful, but review it, because it can be wrong or go stale.

The rule of thumb: if it's true for the team, it goes in the repository; if it's true only for you, it goes in your personal file or memory. Secrets go in neither.

2. How it works

What lands on the desk at the start of a session, and what's added as the agent moves around the repository.

Step through an agent working in a monorepo. Watch which instruction files are active, and which rule wins when two disagree.

3. Try it yourself: the AGENTS.md checker

Paste your AGENTS.md (or start from an example). The checker estimates what it costs every session and flags the most common problems.

    4. Why it matters at work

    What makes instructions actually get followed:

    1. Commands exactly as typed. Agents copy them literally: BAZEL_TEST=1 pnpm test, not "run the tests".
    2. Say why, briefly. "Never use pnpm test alone: it silently runs 7 of 135 tests" is followed far better than a bare rule (Module 05).
    3. Record traps you've actually hit. The most valuable lines are past mistakes. If you had to correct the agent twice, it belongs here.
    4. Keep it short. It's loaded into every session and costs tokens every time. A few hundred lines at most; move long procedures into skills (Module 11), which load only when needed.
    5. No history and no essays. "We migrated from X in 2023 because…" dilutes the rules that matter.
    6. Make it the team's file. Review changes to it like code; update it in the same pull request that changes the build or conventions.

    A compact example:

    # AGENTS.md
    
    ## Commands
    - Build: `pnpm build`
    - Test: `BAZEL_TEST=1 pnpm test`  (plain `pnpm test` runs only 7 of 135 tests)
    - Before every commit: `pnpm format && pnpm check`
    
    ## Layout
    - `api/` Kotlin service · `web/` Angular app · `proto/` API contracts · `docs/` design notes
    
    ## Rules
    - Never edit an applied migration; add a new `V{N}__name.sql` (others have already run them).
    - Every colour comes from a `--bf-*` token; raw hex breaks dark mode.
    
    ## Never
    - Commit to main, force-push, read `secrets/`, or paste customer data into prompts.

    5. In your five tools

    All five read AGENTS.md; each adds its own options. Checked October 2026.

    ToolProject instructionsScoped rulesMemory
    Claude CodeCLAUDE.md; since v2.1.277 it reads AGENTS.md when there's no CLAUDE.md (or import it with @AGENTS.md)Nested CLAUDE.md files; .claude/rules/Auto memory: notes Claude writes and reloads each session; /memory to view and edit
    Antigravity CLIAGENTS.md or GEMINI.md (always on for their folder); global ones in ~/.gemini/.agents/rules/*.md with modes always_on, glob, model_decision or manualUse global rules for personal preferences
    GitHub Copilot.github/copilot-instructions.md, AGENTS.md (root and nested).github/instructions/*.instructions.md with an applyTo globCopilot Memory: repository-specific memories, validated against the code (public preview, on by default for Pro plans)
    CursorAGENTS.md (root and nested) or project rules.cursor/rules/*.mdc: Always, Apply Intelligently, Apply to Specific Files (globs), ManualMemories were removed in Cursor 2.1; Cursor recommends turning them into rules
    Codex CLIAGENTS.md, merged from ~/.codex/, the repo root and each folder down to where you workNested AGENTS.md; AGENTS.override.md takes precedence in its folderGlobal ~/.codex/AGENTS.md for personal defaults; combined files are capped at 32 KiB by default
    One file for every toolWrite the shared rules once in AGENTS.md. Add tool-specific extras only where a tool needs them; in Claude Code, a CLAUDE.md that starts with @AGENTS.md loads both.

    6. Remember it

    Memory hook: "Leave a note on the desk"The agent forgets everything overnight. AGENTS.md is the short note that's on the desk every morning: commands, layout, rules with reasons, and the traps you've hit.
    How this hook works: what “Leave a note on the desk” means

    What the slogan means, phrase by phrase

    “Leave a note”
    Write it down once, in a file, instead of repeating it in every chat. A rule said twice in chat is a rule that belongs in the note.
    “on the desk”
    The file is loaded into the context window at the start of every session (Module 02's desk). That's why it works, and why it must be short: it takes up space every time.
    Implied: a note, not a manual
    A contractor reads a sticky note; they skim a 40-page manual. Long procedures belong in skills that are fetched only when needed.

    Why this picture fits: it links to the desk from Module 02, and it explains both halves of the advice: write things down (it's the only memory that reliably survives), and keep it brief (it competes for desk space).

    The story → the concept

    In the storyIn your tools
    The note on the kitchen counterAGENTS.md (or CLAUDE.md, GEMINI.md…) at the repository root
    A note taped inside the garageA nested frontend/AGENTS.md, or a rule scoped to **/*.sql
    The contractor's own notebookMemory: notes the agent writes itself
    Your personal remindersUser-level files such as ~/.claude/CLAUDE.md or ~/.codex/AGENTS.md
    The thick manual on the shelfSkills and docs, read only when a task needs them

    Watch it on an example

    1. Monday: the agent runs pnpm test, sees "7 passed" and says done. 128 tests never ran.
    2. You add one line to AGENTS.md: "Test with BAZEL_TEST=1 pnpm test; plain pnpm test runs only 7 of 135 tests."
    3. Tuesday, a fresh session, a different tool: it reads the note first, runs the right command, and sees 135 tests.
    4. That one line now protects every session, for every teammate, in every tool that reads AGENTS.md.

    The trap it saves you from

    Two opposite ones: correcting the same mistake in chat every day, and writing a 2,000-line "everything about our system" file that buries the five rules that matter.

    It still works when…

    Your monorepo grows: each team leaves its own note in its folder (nested AGENTS.md), and the nearest note wins. And when knowledge outgrows a note, it becomes a skill (Module 11).

    7. Common mistakes

    Secrets in instruction or memory filesThese files are committed, shared and sent to the model every session. Tokens, passwords and customer data never go in them.
    Instructions that grow foreverLong files cost tokens every session and get followed less reliably (context rot). Prune quarterly; move procedures into skills.
    Rules without reasons"Use BAZEL_TEST=1" is easy to drop; "…because plain pnpm test skips 128 tests" isn't.
    Trusting memory blindlyAgent-written memories can be wrong or out of date. Review them, and delete what's stale.
    Instructions for a rule that must never be brokenInstructions are strong suggestions. For a hard guarantee ("never run rm -rf"), use a permission rule or a hook (Module 12).

    8. Hands-on lab (roadmap week 9)

    1. Draft it. Run your tool's starter (/init in Claude Code or Codex) or write AGENTS.md by hand: commands, layout, rules with reasons, a "never" list.
    2. Check it in the checker above. Cut it below 200 lines.
    3. Prove it loads. Start a fresh session in two tools and ask "what are the test commands for this repo?" without pointing at the file.
    4. Add a scoped rule for one folder or file type (a nested AGENTS.md, or a glob rule) and confirm it applies only there.
    5. Review memory in a tool that has it, and delete one stale or wrong note.

    9. Self-check quiz

    Where should "run tests with BAZEL_TEST=1" go so every teammate's agent knows it?

    It's true for the whole team, so it goes in the committed, shared file every tool reads.

    Both the root AGENTS.md and frontend/AGENTS.md set a lint command. The agent is editing frontend/app.ts. Which wins?

    The AGENTS.md convention: the closest file in the directory tree takes precedence.

    Why keep AGENTS.md short?

    It sits on the desk for every request; long files also get followed less reliably.

    "The agent must never delete the database." What enforces that reliably?

    Instructions guide; permissions and hooks enforce.

    10. Go deeper

    ResourceTimeWhy
    agents.md10 minThe open standard, its recommended sections and the tools that support it.
    How Claude remembers your project (Claude Code)20 minCLAUDE.md, AGENTS.md support, rules folders and auto memory in detail.
    Custom instructions with AGENTS.md (Codex)10 minHow Codex merges global, repository and folder files.
    Rules (Cursor) and Rules (Antigravity)15 minTwo takes on scoped rules: globs, model-decided and manual rules.
    Custom instructions (VS Code Copilot)10 minRepository instructions, applyTo files and AGENTS.md settings.