Goal-Driven Execution principle¶
The Goal-Driven Execution principle is a guideline for AI coding agents (and engineers) that prioritizes achieving verifiable results over simply producing code output^[001-TODO__Andrej_Karpathy_Skills_-AI_Coding_Agent_行为框架.md]. It counteracts the tendency of agents to engage in "hope-based" programming, where a task is declared finished once the code is written, without confirming that the code actually solves the problem^[001-TODO__Andrej_Karpathy_Skills-_AI_Coding_Agent_行为框架.md].
Core Concept¶
The core philosophy of Goal-Driven Execution is that an action is only complete when the specific objective is met and verified^[001-TODO__Andrej_Karpathy_Skills_-AI_Coding_Agent_行为框架.md]. This principle dictates that the workflow must transition from open-ended generation to a closed-loop cycle involving reproduction, repair, and verification^[001-TODO__Andrej_Karpathy_Skills-_AI_Coding_Agent_行为框架.md].
Instead of responding with "I implemented it" immediately after generating a solution, the agent (or developer) must operate based on explicit success criteria^[001-TODO__Andrej_Karpathy_Skills_-_AI_Coding_Agent_行为框架.md].
Execution Workflow¶
Goal-Driven Execution typically follows a strict four-step loop^[001-TODO__Andrej_Karpathy_Skills_-_AI_Coding_Agent_行为框架.md]:
- Reproduce: First, identify and understand the issue or requirement in the current context.
- Fix: Apply the specific changes necessary to address the issue.
- Verify: actively test the changes to confirm the issue is resolved.
- Stop: Conclude the task only after verification is successful.
Comparison with Unstructured Execution¶
Without the Goal-Driven principle, agents or developers often fall into a "generate and pray" pattern. The following contrasts the two approaches^[001-TODO__Andrej_Karpathy_Skills_-_AI_Coding_Agent_行为框架.md]:
| Unstructured ("Hope it works") | Goal-Driven Execution |
|---|---|
| Mindset: Task is finished when code is written. | Mindset: Task is finished when the result is verified. |
| Result: "I implemented it." | Result: Verified confirmation of the fix. |
| Reliability: High risk of introducing bugs or missing the actual requirement. | Reliability: Higher confidence that the specific problem is solved. |
Related Concepts¶
- [[Andrej Karpathy Skills - AI Coding Agent 行为框架]]
- [[Surgical Changes]]
- [[Think Before Coding]]
Sources¶
001-TODO__Andrej_Karpathy_Skills_-_AI_Coding_Agent_行为框架.md