01 ▸ Workflow Position
[Plan]
│
▼
┌─────────────────────────────┐
│ Karpathy (ACTIVE) │
│ Preventive Guardrails │
└──────────────┬──────────────┘
│
▼
[Execute]
│
▼
[Verify]
02 ▸ When to use?
Always active before implementation and during coding. Prevents LLMs from ignoring existing code or attempting excessive changes.
Key Triggers
- Before starting feature implementation
- When attempting to generate code without reading existing context
- During code modification (including exception handling)
03 ▸ How it works?
Core Principle: "Verify, don't guess." Every decision made during implementation must be based on evidence from the actual codebase.
Guardrail Process
- Context Sync: Before starting modifications, read the file and its related dependencies to understand conventions.
- List & Verify Assumptions: Immediately verify assumptions like "This function will return X" using
grep or read_file.
- Lock Change Scope: Limit the scope to prevent unrelated refactoring or "future-proofing" code.
04 ▸ 5 Hard Rules
Mandatory Rules
- Surgical Changes (Minimum Edit Needed): Only make the minimum changes required to meet the goal. Separate refactoring into a different task.
- No Modification Before Reading: Understand the style and conventions of the file to be modified first. Never code based on guesses.
- Verify All Assumptions: Always directly check APIs, function signatures, and data structures. Guesses are the root of all bugs.
- Define Specific Success Criteria: Clearly define "what state constitutes completion" before starting to code.
- No Solving Imaginary Future Problems: Strictly exclude abstractions, generalizations, or extra configurations added "because they might be needed later."