AI assisted coding, Andrej Karpathy and Cline: “Think Like a Dev” Approach to Code Understanding!

Quick Take: Andrej Karpathy gives his best advice on AI assisted coding and Cline follows up with their approach to the same. The connection? Cline analyzes code structure file-by-file, mimicking how a senior developer learns a new project. The goal? Better code quality, stronger security (no secondary IP storage), and more reliable AI assistance that truly comprehends your code’s logic.


🚀 The Crunch

âš¡ Developer Tip: Want to have the best use of your AI coding assistant? First, you might wish to follow upon Karpathy’s advice (see below). And second, you might want to try out Cline, while doing so (see the Dive)!

Allright, some time ago Andrej Karpathy posted his “rythm in AI-assisted coding” a thing worthy to note in detail. So here is what the godfather of Vibe Coding says about his AI assisted coding practice (rephrased):

Iterative LLM-Assisted Development Workflow:

  • Context Loading: Stuff everything relevant into the context. For large projects, this might take time. If small enough, include all necessary files (e.g., files-to-prompt -e ts -e tsx -e css -e md --cxml --ignore node_modules -o prompt.xml).
  • Define Incremental Change: Describe the next single, concrete, incremental change you want to implement.
  • Explore Approaches: Don’t ask for code immediately. Instead, ask the LLM for a few high-level approaches, including their pros and cons, as there are usually multiple ways to solve a problem. Optionally, ask for concrete examples of these approaches.
  • Select & Draft: Pick one approach and then ask the LLM for the first draft of the code.
  • Review & Learn (Manual): Manually pull up API documentation for any functions you’re unfamiliar with. Ask the LLM for explanations, clarifications, or changes. Be prepared to wind back and try a different approach if needed.
  • Test: Thoroughly test the implemented code.
  • Commit: Once satisfied, commit your changes using Git.
  • Iterate: Ask the LLM for suggestions on what could be implemented next, then repeat the process.

💡 “The emphasis is on keeping a very tight leash on this new over-eager junior intern savant with encyclopedic knowledge of software…

And emphasis on being slow, defensive, careful, paranoid, and on always taking the inline learning opportunity, not delegating. …

We’re still very early and so much can still be done on the UI/UX of AI assisted coding.”

– Andrej Karpathy

🎯 TLDR: Karpathy’s pro AI coding rhythm: Feed context, get high-level approaches (not just code!), then meticulously review, learn, and test the LLM’s draft. Keep a tight leash on your brilliant-but-fantasizing AI “intern” for quality results, don’t just delegate like an overlord.

🔬 And Cline?

Well, the makers of Cline – the autonomous coding agent – quickly jumped on that to reaffirm this is precisely how Cline works.

Source: X

As Nick Baumann writes (on the May 27, 2025) in the cline blog, this is precisely why Cline has a superior operation than the other RAG based AI code agents. In essence, instead of indexing, Cline interacts with code like a senior engineer. Check it out:

Key Aspects of Cline’s Non-RAG Approach:

  • Structural Analysis First: Cline uses Abstract Syntax Trees (ASTs) via its list_code_definition_names tool to get a high-level map of your code (classes, functions, methods, relationships) before reading full implementations.
  • Developer-Style Exploration: Instead of retrieving chunks, Cline reads your code file by file, following imports and connections to build a connected understanding, just like a human developer would.
  • No Indexing, No Embeddings: Your code isn’t chunked, embedded, or stored in a vector DB. This means no index decay as your code evolves and a reduced security surface (no secondary IP representation).
  • Context Quality for Large Windows: Cline focuses on providing relevant, accurate, and well-organized context to modern LLMs (like Claude 4, Gemini 2.5 Pro) by following the code’s logical structure.

🔬 Cline – Think & Act Like a Developer:

  1. Code Doesn’t “Think” in Chunks: Chunking code for embeddings is like “trying to understand a symphony by listening to random 10-second clips.” A function call, its definition, and the critical context explaining its existence can get scattered across numerous fragments, breaking the inherent logic.
  2. Indexes Decay, Code Evolves: Software is a moving target. An index is a snapshot. With every refactor, dependency update, or merge, your RAG index drifts further from reality. This means your AI might suggest calling non-existent functions or miss new abstractions.
  3. Security Becomes a Liability: Your codebase is IP. Vector embeddings create a secondary representation of this IP that needs storing, effectively doubling your security surface. Cline’s argument: “Why create the vulnerability in the first place?”
  4. Cline aims to: Locate the function, trace imports to find your error utilities, examine similar functions for patterns, check calling functions for error contracts, and suggest handling that fits your architecture.

Want an AI That Truly Gets Your Code?

Cline’s non-RAG approach aims for deeper understanding and more reliable AI coding assistance.

Tom Furlanis
Researcher. Narrative designer. Wannabe Developer.
Twenty years ago, Tom was coding his 1st web applications in PHP. But then he left it all to pursue studies in humanities. Now, two decades later, empowered by his coding assistants, a degree in AI ethics and a plethora of unrealized dreams, Tom is determined to develop his apps. Developer heaven or bust? Stay tuned to discover!