A markdown file showing four behavioral guidelines: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution
blog

The 4 Lines Every AGENTS.md Needs

Karpathy's behavioral principles that became a 179k-star GitHub repo

AGENTS.md
Harness Engineering
A markdown file showing four behavioral guidelines: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution

Andrej Karpathy's four principles for AGENTS.md — Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution — became a 179k-star GitHub repo. Here's what they are and why they work.

Mini 3 min read

In April 2026 one GitHub repo hit 179,000 stars — not a framework or a model, but a single AGENTS.md file with four behavioral rules derived from Andrej Karpathy’s observations about LLM coding pitfalls. The repo: multica-ai/andrej-karpathy-skills.

Karpathy is a founding member of OpenAI and former head of AI at Tesla, widely recognized for his work on deep learning, computer vision, and LLMs. He’s also one of the most followed voices in AI on practical agentic coding workflows.

His diagnosis zeroes in on three failure modes — and the fix is four principles that bias the agent toward caution over speed:

#Failure ModeDescriptionFix
1Silent Assumptions”They make wrong assumptions on your behalf and just run along with them without checking”→ Line 1: Think Before Coding
2Overcomplication”They implement a bloated construction over 1,000 lines when 100 would do”→ Line 2: Simplicity First
3Side-Effect Edits”They change/remove comments and code they don’t sufficiently understand as side effects”→ Line 3: Surgical Changes

Line 4 goes beyond fixing — it unlocks a new capability for agents to work independently.

Here’s the full mapping:

PrincipleProblem It SolvesThe One-Liner
Think Before CodingWrong assumptions, hidden confusion, missing tradeoffsDon’t assume. Don’t hide confusion. Surface tradeoffs.
Simplicity FirstOvercomplication, bloated abstractionsMinimum code that solves the problem. Nothing speculative.
Surgical ChangesOrthogonal edits, touching code you shouldn’tTouch only what you must. Clean up only your own mess.
Goal-Driven ExecutionVague plans with no verificationDefine success criteria. Loop until verified.

⚠️ Tradeoff: These guidelines bias toward caution over speed. For trivial tasks (typo fixes, obvious one-liners), skip the rigor. The goal is reducing costly mistakes on non-trivial work, not slowing down simple changes.


Paste this into your AGENTS.md:

- Think before coding. State assumptions, surface tradeoffs, push back when warranted.
- Simplicity first. Minimum code that solves the problem. Nothing speculative.
- Surgical changes. Touch only what you must. Clean up only your own mess.
- Goal-driven execution. Define success criteria. Loop until verified.

Source article: The 4 Lines Every AGENTS.md Needs by Yanli Liu, published in Level Up Coding (Apr 2026).

Link copied to clipboard