The Three-Layer Framework for Claude Engineering

Austin Marchesego watch the original →

Andrej Karpathy’s method for AI-assisted development relies on three layers: creating detailed specs, implementing verification loops, and building a persistent environment to minimize AI drift.

The Three-Layer Framework

To move beyond basic prompting, developers should treat AI agents as statistical simulators rather than human-like collaborators. The Karpathy method organizes this interaction into three distinct layers: the Spec, the Verifier, and the Environment.

The Spec: Defining Goals and Agility

Instead of relying on high-level "plan modes," developers must co-design detailed specifications with the agent. This process prevents the model from making assumptions that lead to drift.

  • Uncover the goal: Ask Claude to interview you to identify the specific decision or outcome the task drives, rather than just the task itself.
  • Adopt agile specking: Break large tasks into small, compartmentalized buckets. Review the output at each checkpoint rather than waiting for a final product.
  • Enforce precision: Use prompts like "Make me verify key decisions explicitly to ensure nothing is missed" to force the model to account for every assumption.

The Verifier: Establishing Feedback Loops

Since AI models lack context for non-measurable tasks, they require explicit verification mechanisms to ensure quality. Boris Churnney, creator of Claude Code, notes that feedback loops can improve final output quality by 2x to 3x.

  • Define evaluation criteria: Before execution, explicitly define what a successful output looks like. For example, specify that a report must contain exactly three sections, each ending with a recommendation.
  • Use a critic model: Run the output of the primary agent through a second model (e.g., using the Codex plugin) to grade the results from a different perspective.
  • Integrate external signals: Connect the agent to live deployment systems or historical data files to verify output against reality rather than relying on the model's internal knowledge.

The Environment: Building a Persistent Workshop

Treat the development environment as a permanent workshop rather than a transient chat session. This creates a foundation that compounds over time.

  • Optimize claude.md: Use this file to inject system-wide instructions, such as mandatory verification plans, knowledge architecture, and custom skill routing, every time the agent starts.
  • Build an LLM knowledge base: Create a local folder system containing your own training data to serve as a proprietary knowledge source.
  • Implement tool-level guardrails: Instead of relying on prompt-based instructions to protect files, use pre-tool use hooks to prevent the agent from editing critical directories (e.g., /important-donotedit).
  • Develop custom skills: Treat repetitive tasks as code-based skills. The more these are used, the more they can be refined and optimized for specific workflows.
  • #ai
  • #dev-tooling
  • #claude

summary by google/gemini-3.1-flash-lite. probably wrong about something. check the source.