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

Quick Take: Andrej Karpathy drops wisdom on mastering AI-assisted coding, emphasizing a deliberate, iterative workflow. Hot on its heels, AI coding agent Cline highlights how its non-RAG, structure-first analysis mirrors a senior dev’s approach, aiming for superior code quality, enhanced security (no secondary IP storage!), and AI assistance that genuinely groks your code’s logic.


🚀 The Developer Crunch: What You Need to Know & Do NOW

🎯 Why This Matters for Devs: Stop wrestling with AI coding assistants that don’t *get* your code. Karpathy’s workflow offers a battle-tested rhythm for effective AI collaboration. Cline’s approach, meanwhile, champions deep structural understanding over superficial RAG, promising more reliable, secure, and context-aware AI coding partners. The goal? Higher quality code, less frustration, and AI that actually helps, not hinders.

⚡ Developer Tip: Internalize Karpathy’s AI coding workflow (details below!) – it’s gold for managing your “over-eager junior intern savant” LLM. Then, if you’re exploring AI coding agents, consider tools like Cline that prioritize deep code understanding over simple RAG, especially for complex projects where context is king.

Karpathy’s AI-Assisted Coding Rhythm: Your Actionable Workflow

  • Context Loading is Key: Feed your LLM everything relevant. For large projects, this takes time. If it’s a smaller piece, include all necessary files (Karpathy uses tools like files-to-prompt -e ts -e tsx -e css -e md --cxml --ignore node_modules -o prompt.xml). Don’t skimp here!
  • Define Small, Concrete Changes: Clearly describe the next single, incremental change you want. No vague hand-waving.
  • Explore Approaches First: Don’t just ask for code. Ask the LLM for a few high-level approaches, complete with pros and cons. There’s always more than one way to skin a cat. Optionally, ask for concrete examples of these approaches.
  • Select & Get a Draft: Pick the approach that makes sense, then ask the LLM for the first draft of the code.
  • YOU Review & Learn: Manually pull up API docs for any functions you’re not 100% on. Grill the LLM for explanations, clarifications, or changes. Be ready to backtrack and try a different approach if the first one stinks. This is where you learn.
  • Test Rigorously: Hammer on the implemented code. Does it actually work? Under all conditions?
  • Commit Your Wins: Once you’re satisfied, commit those changes with Git. Small, atomic commits are your friend.
  • Iterate & Improve: Ask the LLM for suggestions on what could be implemented next, then rinse and repeat the whole process.
🧱
Cline: Structural Analysis Power
Uses Abstract Syntax Trees (ASTs) via its list_code_definition_names tool to map your code’s structure (classes, functions, relationships) before diving into full implementations. Understands the blueprint first.
🧠
Developer-Style Exploration
Reads code file-by-file, following imports and connections to build a holistic understanding, mimicking how a human developer learns a new codebase. No superficial chunking.
🛡️
No Indexing = Better Security & Freshness
Your code isn’t chunked, embedded, or stored in a vector DB. This means no index decay as your code evolves and a significantly reduced security surface (no secondary IP representation). Always works with the latest version.
🎯
Context Quality for Large LLMs
Focuses on feeding relevant, accurate, and structurally sound context to modern LLMs (like Claude 4, Gemini 2.5 Pro) by respecting your code’s inherent logical flow.

Critical Caveats & Considerations

  • Karpathy’s Warning: LLMs are “over-eager junior intern savants.” Keep a tight leash, be defensive, careful, paranoid, and always take the learning opportunity. Don’t just delegate blindly.
  • Cline’s Approach: While promising, remember that “developer-style exploration” on large codebases can be computationally intensive. Evaluate performance for your specific project size and complexity.
  • Tooling is Early: As Karpathy notes, UI/UX for AI-assisted coding is still in its early days. Expect rapid evolution and be prepared to adapt your workflows.

🔬 The Deeper Dive

The world of AI-assisted coding is evolving at breakneck speed, and insights from seasoned pros like Andrej Karpathy are invaluable. His recently shared “rhythm in AI-assisted coding” offers a practical, iterative workflow that emphasizes developer control and continuous learning, rather than blind delegation to an LLM.

💡 “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

Karpathy’s core message is clear: treat your AI coding assistant like a brilliant but sometimes erratic intern. Guide it, question it, learn from its suggestions (and mistakes), and always, always test thoroughly. This hands-on, iterative approach ensures higher quality output and, crucially, enhances your own understanding of the codebase and the solutions being implemented.

Enter Cline: AI Coding with a Developer’s Mindset?

Responding to Karpathy’s insights, the team behind Cline, an autonomous coding agent, highlighted how their tool’s philosophy aligns with this deliberate, understanding-first approach. As Nick Baumann detailed in a recent blog post, Cline eschews common RAG (Retrieval Augmented Generation) techniques involving codebase indexing and vector embeddings. Instead, it aims to interact with code much like a senior engineer would when onboarding to a new project.

Cline X.com post referencing Karpathy
Cline’s take on X.com. Source: X
Source: Cline YouTube

🔬 Cline’s Non-RAG Rationale: Why It Matters

  1. Code Isn’t Just “Chunks”: Baumann argues that chunking code for embeddings is like “trying to understand a symphony by listening to random 10-second clips.” The inherent logic—a function call, its definition, and the critical context explaining its existence—can get fragmented and lost across numerous disconnected pieces. Cline aims to preserve this logical flow.
  2. Indexes Decay, Code Evolves Constantly: Software is a living entity. An index is merely a static snapshot. With every refactor, dependency update, or merge, a RAG index drifts further from the ground truth of your codebase. This can lead to your AI suggesting calls to non-existent functions or missing newly introduced abstractions. Cline’s approach of reading fresh aims to avoid this.
  3. Security & IP Protection: Your codebase is valuable intellectual property. Creating vector embeddings means generating a secondary representation of this IP that then needs to be stored and secured, effectively doubling your security attack surface. Cline’s argument is potent: “Why create the vulnerability in the first place?” By not storing an index, this risk is mitigated.
  4. The Cline Goal – Developer-Like Reasoning: Instead of just retrieving potentially stale chunks, Cline aims to: locate the relevant function, trace its imports to find your custom error utilities, examine similar functions for established patterns, check calling functions for existing error contracts, and then suggest error handling that genuinely fits your project’s architecture and conventions.

By focusing on structural analysis using Abstract Syntax Trees (ASTs) and exploring code file-by-file like a human, Cline endeavors to provide more accurate, relevant, and secure AI coding assistance, especially for modern LLMs with large context windows that can handle this richer, more structured information.

🎯 TLDR; Vibe Check: Karpathy’s AI coding mantra: Be the meticulous senior dev guiding your brilliant AI intern. Cline’s angle: Ditch flaky RAG; analyze code structure like a pro for AI assistance that actually *gets* your project’s logic and stays secure.

Want AI That Truly Gets Your Code?

Explore Karpathy’s battle-tested workflow and check out how tools like Cline are rethinking AI code comprehension.

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!