What the cognitive science actually says about learning to code with AI agents
Your brain doesn’t read code the way it reads English
The intuitive guess is that reading code should light up the same brain regions as reading a sentence — it looks language-like on the page. An fMRI study out of MIT tested this directly, having programmers read and evaluate short Python and ScratchJr snippets while scanned (Ivanova et al., 2020). The result cut against the intuition: comprehending code activated the brain’s “multiple demand” network — the general-purpose system also used for math and logic puzzles — not the language regions. It didn’t fully overlap with math/logic processing either. The researchers’ takeaway: understanding code is its own cognitive category, not a dialect of language processing or a subtype of math.
A separate study pushed this further, comparing reading code, reading prose, and mental rotation (a classic spatial-reasoning task) in novice programmers using fNIRS (Endres et al., 2021). Coding turned out to be more different from prose-reading than it was from mental rotation, with heavier engagement of spatial and difficulty-related regions. Translation: for beginners, working with code leans on different, more effortful machinery than just reading text — including reading someone else’s code. That’s thread one: if a chunk of the learning happens in that effortful processing, skipping it by only reading an agent’s output might mean skipping the part that actually teaches you something.
*Why producing beats consuming — and where this gets shaky
*
Two classic memory findings point the same direction, and I want to be upfront that neither one is about code.
The generation effect: people remember things they produce themselves far better than things they just read, even given equal time with the material (Slamecka & Graf, 1978). The original demonstration used word pairs — generating “fast” from “rapid / f__” beat reading “rapid — fast.”
The testing effect: actively recalling something beats re-reading it, even though re-reading feels more productive in the moment (Roediger & Karpicke, 2006). Students who tested themselves on a passage repeatedly outperformed students who re-read it four times — barely at first, by a lot a week later.
Here’s the honest caveat, and it’s the one a reader called out when I first posted this: neither study says anything about coding, and neither is causal evidence that AI-assisted coding produces worse programmers. They establish a mechanism — effortful retrieval beats passive exposure — from a completely different domain (word lists, text passages). Applying that mechanism to “watching an agent write your code” is a reasonable hypothesis, not a demonstrated fact. Stitching together a 1978 word-pair study, a 2006 memory study, and 2020s neuroimaging papers gets you a plausible story, not a proven causal chain. That gap is exactly what the next section tries to close with something more direct.
What happens when an agent actually does the producing
On productivity, the evidence is strong — but not uniform. A large controlled study of GitHub Copilot found developers completed a coding task 55.5% faster, with the biggest gains for less experienced programmers (Peng et al., 2023). A 2025 classroom study found CS students finished tasks 34.9% faster and made 50% more progress on unfamiliar codebases using Copilot (Shihab et al., 2025).
But it’s not universal. Later field studies found much smaller or non-significant productivity effects for more experienced developers on longer, real-world tasks (Cui et al., 2024; Becker et al., 2025) — one even found a slowdown, from time spent waiting on and reviewing AI-generated code. Productivity gains from AI are real but uneven, concentrated among novices on short, well-scoped tasks — which matters, because that’s exactly the population and task type most likely to be learning.
The Shihab et al. study was also the first hint at a learning cost: in exit interviews, students admitted they often didn’t understand why the AI’s suggestions worked. That’s self-report after the fact, though — not a measured skill deficit. Which is where the next study comes in.
The study that actually closes the causal gap
Shen & Tamkin (2026) ran a randomized controlled trial built specifically to answer this question. Developers with real Python experience were split into two groups and asked to complete tasks using Trio, an async library neither group had used before. One group had chat-based AI assistance; the other didn’t. Afterward, everyone took a quiz testing conceptual understanding, code reading, and debugging.
The AI group scored 17% lower on the quiz — a real, statistically significant drop — and didn’t finish significantly faster, despite the assistant being able to generate complete, correct solutions on request. Watching the screen recordings, the researchers found why: people who delegated everything to the AI moved fast but learned little, while people who used AI conversationally — asking conceptual questions, requesting explanations alongside code, treating errors as something to understand rather than route around — learned nearly as much as the no-AI group, and lost little to no speed advantage doing it. The control group, meanwhile, hit more real errors and had to work through them alone, which the study ties directly to their stronger debugging and conceptual scores.
This is the piece the earlier version of this argument was missing: a study that’s actually about coding, actually causal (randomized, not observational), and actually measures skill formation rather than self-reported confusion. It also sharpens the advice — it’s not “use AI less,” it’s “use it as a conversation partner, not a vending machine.”
So — what should you actually do?
None of this is an argument against AI coding agents. The productivity data is too good, and the whole point of the Trio study is that some interaction styles get you the learning without giving up much speed.
Generate before you delegate. Attempt a solution, or at least sketch a plan, before asking the agent — this is what triggers the generation effect instead of skipping it.
Ask conceptual questions, not just “write this.” The highest-scoring group in the Trio study asked about how the library worked, not just for finished code — same information, sought a different way, very different outcomes.
Explain the output back in your own words. Turns passive reading into something closer to retrieval practice.
Let yourself hit errors sometimes. The control group’s debugging edge came directly from struggling with real errors instead of having them resolved for them.
Revisit old problems from memory, agent closed. Just the testing effect, applied on purpose.
Bottom line
Code comprehension runs on general-purpose problem-solving circuitry, not language circuitry. Producing information yourself builds stronger memory than reading it, though that evidence originally comes from outside coding. And now there’s direct, causal evidence — not just an inference from unrelated studies — that fully delegating coding tasks to AI measurably reduces skill formation, while conversational, question-asking use mostly doesn’t. Using AI agents and actually building skill aren’t at odds. But the second one won’t happen by accident — you have to protect it on purpose.
More curious? Read more on the full paper here:Reading-Writing-and-Delegating-Code
Sources
Ivanova, A. A., et al. (2020). Comprehension of computer code relies primarily on domain-general executive brain regions. eLife. doi.org/10.7554/eLife.58906
Endres, M., et al. (2021). Relating reading, visualization, and coding for new programmers: A neuroimaging study. ICSE 2021. arxiv.org/abs/2102.12376
Slamecka, N. J., & Graf, P. (1978). The generation effect: Delineation of a phenomenon. Journal of Experimental Psychology.
Roediger, H. L., & Karpicke, J. D. (2006). Test-enhanced learning. Psychological Science. doi.org/10.1111/j.1467–9280.2006.01693.x
Peng, S., et al. (2023). The impact of AI on developer productivity: Evidence from GitHub Copilot. arxiv.org/abs/2302.06590
Shihab, M. I. H., et al. (2025). The effects of GitHub Copilot on computing students’ programming effectiveness, efficiency, and processes in brownfield coding tasks. ICER 2025. doi.org/10.1145/3702652.3744219
Cui, Z. K., et al. (2024). The effects of generative AI on high skilled work. SSRN 4945566
Becker, J., et al. (2025). Measuring the impact of early-2025 AI on experienced open-source developer productivity. arxiv.org/abs/2507.09089
Shen, J. H., & Tamkin, A. (2026). How AI impacts skill formation. arxiv.org/abs/2601.20245
Sweller, J. (1988). Cognitive load during problem solving: Effects on learning. Cognitive Science.



Top comments (0)