cd /news/ai-agents/how-to-build-a-claude-agent-that-thi… · home › topics › ai-agents › article
[ARTICLE · art-146889] src=mindstudio.ai ↗ pub= topic=ai-agents verified=true sentiment=· neutral

How to Build a Claude Agent That Thinks Like a Real Expert

A four-step method for building a Claude Code sub-agent that replicates an expert's reasoning rather than reciting their words was demonstrated using Andrej Karpathy, a founding OpenAI member, former Tesla AI lead, and current member of Anthropic's pretraining team, as the source expert. The build compiles public material — YouTube transcripts, blog posts, GitHub repos, and X posts — into an Obsidian-based wiki of linked sources, topics, principles, and methods, then extracts rules that each link to an exact quote and source, with the agent required to flag when it is inferring rather than quoting. The finished agent ships as a Claude sub-agent plus a custom skill and a run gate hook that blocks the agent from claiming code works until it has actually executed it, and is designed to keep ingesting new material and updating its own wiki pages, index, and rules without manual editing.

by read9 min views5 publishedOct 6, 2026
How to Build a Claude Agent That Thinks Like a Real Expert
Image: Mindstudio (auto-discovered)

A four-step method for turning a real expert's public writing into a Claude Code wiki and sub-agent that mimics their reasoning, not just their words.

What does it mean to build an AI agent that “thinks like” an expert? #

It means compiling someone’s actual public reasoning, their blog posts, lecture transcripts, code, and social posts, into a structured memory system, then extracting the rules behind how they solve problems rather than just what they’ve said. The result is a Claude Code sub-agent that follows those rules on new, unseen problems instead of reciting old answers. The method was demonstrated using Andrej Karpathy, a founding OpenAI member, former Tesla AI lead, and current member of Anthropic’s pretraining team, as the source expert. The same four-step process works for any public figure with enough written or recorded material to draw from.

TL;DR #

  • The core idea is separating knowing what someone said fromreplicating how they reason , which requires turning raw text into linked rules with sourced quotes, not just feeding an LLM a pile of transcripts.
  • The build pulls from public sources like YouTube transcripts, blog posts, GitHub repos, and X posts , using free tools like the YouTube Transcript API and yt-dlp, plus a paid API for X history.
  • Raw material gets converted into an Obsidian-based wiki with linked pages for sources, topics, principles, and methods, so the agent can trace every claim back to where it came from.
  • Rules get extracted with a strict requirement that each one links to an exact quote and source , and the agent must explicitly flag when it’s inferring rather than quoting.
  • The final agent ships as a Claude sub-agent plus a custom skill , paired with arun gate hook that blocks the agent from claiming code works until it has actually executed it.
  • The system is designed to keep learning , ingesting new source material over time and updating its own wiki pages, index, and rules without manual editing.
  • The underlying motivation is that most people using AI tools aren’t domain experts themselves, so pulling a real expert’s reasoning into a reusable system lets anyone build on top of that expertise.

Other agents ship a demo. Remy ships an app. #

Real backend. Real database. Real auth. Real plumbing. Remy has it all.

Why build this instead of just asking Claude to explain things? #

Default LLM behavior has a known failure mode: it tends to sound confident rather than be correct, and it often prioritizes producing an answer or finished code over walking through the reasoning that got there. Karpathy himself ran into this directly. He’s noted publicly that when he tried to get Claude Code to teach him alongside the code it was writing, it didn’t work, because the model is strongly biased toward writing code rather than explaining its decisions along the way.

That bias creates two practical problems. First, if you’re trying to learn something, you can walk away from a conversation feeling like you understood less than when you started, because the model overexplained, skipped steps, or quietly papered over gaps. Second, if you’re shipping code for a client or a real project, you can end up with something you can’t fix or explain when it eventually breaks, because you never actually understood why it worked in the first place.

Building a persona agent is a way to bake in better habits by force. Instead of hoping the model explains itself well, you give it an explicit set of rules, drawn from someone who has already solved this exact communication problem in their own teaching, and you make those rules load every time you invoke the agent.

How do you compile someone’s public work into usable knowledge? #

The process starts with a comprehensive crawl of everything publicly available from the subject: blog posts, lecture transcripts, GitHub repositories, and social media posts. For YouTube content, this can be done with the YouTube Transcript API and yt-dlp, both free Python packages that pull captions directly. For X (formerly Twitter), a paid API like twitterapi.io can retrieve years of historical posts for a relatively small cost.

The key technique is running one crawl agent per source in parallel, so Claude Code isn’t sequentially working through years of content one platform at a time. Each agent should log exactly what it retrieved, so the output can be checked for completeness. Done thoroughly, this kind of crawl can produce hundreds of thousands of words across one raw folder with a subfolder per source.

The important caveat here: raw text dumps are not directly useful. A folder with 700,000 unstructured words is too messy for an LLM to reliably search through or reason over. Finding the right detail becomes a needle-in-a-haystack problem. The raw files need to be compiled into something with actual structure and relationships.

What is an LLM wiki and why does it matter here? #

An LLM wiki is a system where an LLM reads through raw source material and organizes it into interlinked pages, an index, and a log, without altering the original files. Karpathy has publicly described using this exact approach for his own notes: having an LLM compile raw material into a wiki rather than relying on flat storage.

Applied to this project, the wiki becomes the connective layer between disconnected pieces of content. Instead of a single scraped blog post sitting in isolation, it becomes a page linked to the methods it demonstrates, the principles it supports, and other sources that reinforce the same idea. Visualized in a tool like Obsidian, this shows up as a web of pages, sources, topics, principles, rules, and methods, connected by links that represent real relationships between ideas rather than arbitrary tags.

This structure matters because it’s what allows the next step, rule extraction, to work reliably. A rule that’s connected to three different sources across five years carries more weight than one invented from a single offhand comment, and the wiki format makes that traceable.

How do you turn a wiki into working rules an agent can follow? #

This is the step that converts “knows what the person said” into “reasons the way the person reasons.” Each rule extracted from the wiki must be backed by an exact quote and a traceable source. If no clear source exists, the agent has to say explicitly that it’s inferring based on general patterns rather than quoting something specific. This constraint keeps the system honest and prevents the model from fabricating a persona.

In the Karpathy build, this process surfaced seven rules: build it yourself or you don’t really understand it, tackle the first-order term before anything else, predict an outcome before running code and then compare, show the broken version before the fixed one, prove claims instead of just asserting them, state your assumptions explicitly rather than burying them, and prefer the simpler solution. Each rule links back to specific quotes, lectures, or posts, and clicking through shows the original source and timestamp.

These rules then get compiled into two artifacts: a Claude sub-agent (a separate instance with its own instructions, memory, and context window) and a custom skill that can be invoked directly, such as a slash command that routes a question through the rule set and grades the response against a checklist before returning it.

How do you stop the agent from just claiming its code works? #

One of the specific rules extracted from Karpathy’s own writing is a direct complaint about AI coding tools: models frequently make unstated assumptions and then proceed as if those assumptions were verified, without checking them against reality. The fix for this is a “run gate,” a hook that fires when the agent tries to end its turn. If the agent wrote code but never executed it, the hook blocks the response and sends it back with an instruction to run the code first.

This only works because Claude Code can actually execute code natively, not just generate it. The hook doesn’t require manually writing a verification script; it can be requested directly as a prompt, and Claude Code builds the enforcement logic itself. The practical effect is a loop where the agent runs, tests, and fixes before ever presenting a final answer, instead of presenting an answer first and hoping it’s correct.

Is this worth building compared to just prompting Claude directly? #

#

Plans first. Then code.

Remy writes the spec, manages the build, and ships the app.

It depends on how much you need traceability and verification versus speed. A persona agent built this way is slower to set up (the initial crawl alone can take close to an hour to run across multiple sources) and requires some comfort working inside Claude Code. But the payoff is a system that explains its reasoning step by step, states what it expects before running anything, shows failure cases on purpose, and cites which rule it followed for each decision. For learning a technical subject or reviewing work before it goes to a client, that transparency is the actual value. For quick one-off tasks, it’s likely overkill.

The system is also designed to keep improving. New source material, like a rough voice memo cleaned up into text, can be ingested directly, and the agent updates the relevant wiki pages, strengthens or adds rules, and refreshes its own index without manual editing.

Frequently Asked Questions #

What is a Claude sub-agent?

A sub-agent is a separate instance of Claude with its own instructions, memory, and context window. It can be handed a specific task without dragging the full history of your main conversation into it, which keeps its reasoning focused on the rules and knowledge it was built with.

Do I need Obsidian to build one of these?

No. Obsidian is used only as a visual layer to see the links between wiki pages. The wiki itself is just structured markdown files that Claude Code can read and query directly.

Can this be done with someone other than Andrej Karpathy?

Yes. The four-step process (crawl public material, compile it into a linked wiki, extract sourced rules, and enforce verification) works for any person with enough public writing, talks, or posts to draw from, such as a teacher, author, or coach.

How much source material do you actually need?

There’s no fixed minimum, but the approach depends on volume and diversity of sources so that extracted rules can be backed by multiple independent quotes rather than a single comment taken out of context.

Does this replace actually learning the subject yourself?

No. The point, in line with Karpathy’s own stated view, is that you can outsource your thinking but not your understanding. The agent accelerates access to expert reasoning, but you still have to engage with its explanations to actually understand the material.

── more in #ai-agents 4 stories · sorted by recency
── more on @anthropic 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-build-a-claud…] indexed:0 read:9min 2026-10-06 · —