Developer Guides

AI Context Files: The Single Most Important Vibe Coding Practice

Eric Hoyer

Eric Hoyer founded Growth Automations so owner-operators don't have to wrestle with software or go up against big companies alone. He's run WordPress sites for 15 years.

Updated 4 min read

The short version

Write one short file that tells your AI what the project is, how to run it, and the few rules it must never break. Keep it under 200 lines, commit it, and tighten it every time the AI drifts.

Of all the habits that make AI-assisted coding work, one shows up in every serious workflow: the context file.

Every AI coding tool reads one. Claude Code reads CLAUDE.md. Cursor reads project rules in .cursor/rules/. A growing list of tools, Cursor and Claude Code included, also read AGENTS.md, an open format meant to work across agents. The name matters less than the habit.

This guide covers the file itself. Keeping a session on track once it’s running is in The Vibe Coding Session Loop.

What a context file does

It’s the document your AI reads at the start of every session. Without it, you re-explain your stack, conventions, folder structure and preferences every time. With it, the AI walks into your project already oriented.

Think of onboarding a contractor: you could explain everything from scratch every morning, or hand them a one-page brief.

What goes in it

# Project context

## What this is

[One paragraph: what the project does and who it's for.]

## Tech stack

- Framework: [your framework + version]
- Language: TypeScript (strict mode)
- Database: [your database]
- Deployment: [your platform]

## Key commands

- `npm run dev`: start the dev server
- `npm run build`: production build
- `npm run lint`: lint check

## Conventions

- Components: PascalCase. Files: kebab-case.
- No `any` types.
- Files stay under 500 lines.

## Rules

- NEVER hardcode secrets or API keys.
- NEVER read or print `.env` files.
- ALWAYS run lint and typecheck before committing.

Keep it short: under 200 lines

Surely more context is better? It isn’t. Claude Code’s own documentation says to “target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence.” Cursor gives the same advice for rules files, with a higher ceiling of 500 lines.

If the AI keeps ignoring a rule, the file is probably too long

Long files get skimmed. Cut anything that isn’t true for every task, and the rules that remain get followed.

Rules that only apply to one part of the project belong closer to that part:

  • Claude Code loads a CLAUDE.md inside a subfolder once it starts working in that folder, and supports rules in .claude/rules/ that apply only to matching file paths.
  • Cursor project rules can be scoped to file patterns, and it reads AGENTS.md files in subfolders too.

The context file is not the AI’s memory

Older advice said “AI has no memory between sessions”. That’s no longer quite true. Claude Code, for example, now keeps an automatic memory of things it learned while working with you, and loads part of it at the start of each session.

The two do different jobs:

Context file The tool’s own memory
You write it, on purpose The tool writes it as it goes
Committed to git, shared with your team Usually kept on your machine only
The rules that must hold every time Notes, habits and things it picked up
Reviewed like code Worth checking now and then for stale notes

Treat the context file as the source of truth. Memory helps, but it isn’t something you control or your teammates can see.

Maintaining it

The file gets better the way any document does: by fixing it when it lets you down. In our experience the first version is followed loosely, and a few weeks of tightening make new sessions feel like picking up where you left off.

Whenever the AI does something you didn’t want:


Next: The Vibe Coding Session Loop, or back to the full guide.

Sources, last checked Nov 21, 2026

Stay in the loop

Get practical guides, workflows, and automation tips delivered to your inbox.

No spam, ever. Unsubscribe anytime.