---
title: "Discussion on \"When your coding agent repeats a mistake, move the lesson out of chat.\" | Hashnode"
description: "Discussion on \"When your coding agent repeats a mistake, move the lesson out of chat.\". Turn repeated corrections into rules, hooks, skills, and an independent review loop that improves the next session."
url: "https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [When your coding agent repeats a mistake, move the lesson out of chat.](https://blog.mindrealm.ai/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat?utm_source=hashnode&utm_medium=feed)

Turn repeated corrections into rules, hooks, skills, and an independent review loop that improves the next session.

Aug 3 · 10 min read · blog.mindrealm.ai  
Read the article

-   [#ai](https://hashnode.com/tag/ai)
-   [#code-review](https://hashnode.com/tag/code-review)
-   [#ai-tools](https://hashnode.com/tag/ai-tools)
-   [#llm](https://hashnode.com/tag/llm)

## Written by

[Bryce Darling](https://hashnode.com/@mindrealm)

@mindrealm · Asheville, NC

  
[View profile](https://hashnode.com/@mindrealm)

Making AI-generated code safer to ship. Consulting: advising, building, coaching on AI

I build Mindrealm: it catches the slop your AI agent ships confidently, then makes it fix it. 75+ deterministic checks across Go, Rust, TypeScript, and Python.

## Responses 16

Markdown supported · ⌘↵ to post

[Julian Neagu](https://hashnode.com/@julianneagulab)

[Aug 6](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a747c10c9c92d9b15129347)

I’ve seen this happen a lot with coding agents. The fix is usually not a better prompt, it’s moving that lesson into the right place so the next session starts smarter.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Aug 5](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a7372279911169defc1278d)

The placement decision is the real engineering work. I would add an expiration or review owner to every learned rule, because repository constraints can outlive the architecture that justified them and then become invisible drag. A useful mistake record should link the failing example, the positive counterexample, the rule or hook that changed, and the regression test that enforces it. That gives the team a way to remove a safeguard safely when the underlying boundary changes.

[Bryce Darling](https://hashnode.com/@mindrealm)

[Aug 5](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a7372279911169defc1278d#reply-6a737ec9aeb3e7ef845df449)

Assigning a review owner and date to every learned rule is a good idea. Automatic expiration is too blunt for some safeguards, but an owner and review date make someone responsible for asking whether the architecture still justifies the rule.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Aug 6](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a7372279911169defc1278d#reply-6a7428d86e5833c7ce73cf94)

Agreed—expiry should be a review trigger, not automatic deletion. I would make the owner confirm one of three outcomes: keep it with renewed rationale, narrow or replace it with a better safeguard, or remove it with a regression test proving the boundary has changed. That small lifecycle prevents both stale constraints and silent safeguard decay.

[Kartik N V J K](https://hashnode.com/@kartik-nvj)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a723eff95c5452a78aa6d1e)

Judging the setup by what happens when a mistake recurs, not by one good session, is a sharp way to think about agent reliability. The six-place breakdown is useful precisely because it forces the question of where a correction belongs, since piling every rule into agent config is what makes the important instructions get lost. For the mistake-log-plus-regression-test path, how do you keep that suite from growing into something the agent spends more time satisfying than the task itself?

[Bryce Darling](https://hashnode.com/@mindrealm)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a723eff95c5452a78aa6d1e#reply-6a727692c0efcb54d46b680f)

I don't optimize for keeping the suite small. I'm biased because I've been doing TDD for two decades, but I think automated testing matters more when agents can produce more code than a person can realistically inspect line by line. I treat test code as production code. Mindrealm reviews the tests too: weak assertions, mock abuse, flaky tests, state leaks, and public functions or methods with no corresponding test. If an agent spends time satisfying a valid test, that's part of the task. If a test no longer protects behavior we care about, I decide whether it gets fixed or deleted.

For a prototype or proof of concept, who cares. Ship it without tests. If a team has to maintain it, the test suite is part of the product.

[Synfinity Dynamics Pvt Ltd](https://hashnode.com/@synfinity-dynamics)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a71d2e1209c304a1318b01f)

This is a great perspective on moving from “fixing the same mistake repeatedly” to building systems that actually learn from those corrections.

[Bryce Darling](https://hashnode.com/@mindrealm)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a71d2e1209c304a1318b01f#reply-6a720dc09a3eabce2433352d)

Hey, good to see you again. Glad this one hit.

[Mateo Ruiz](https://hashnode.com/@mateoruiz)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a71b6eb398282c2e2421fd5)

I like the distinction between fixing the current task and improving the system that produces future tasks. That's a pattern that applies well beyond coding agents. Too many teams keep adding instructions to prompts when the real fix belongs in the harness, a reusable skill, a deterministic check, or a regression test. Treating repeated failures as signals to improve the surrounding system not just the model's immediate output is what makes agent workflows scale instead of accumulating more prompt debt over time.

[Bryce Darling](https://hashnode.com/@mindrealm)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a71b6eb398282c2e2421fd5#reply-6a720f850f8f3a18f2ffa94a)

Prompt debt is a good name for it. What have you found works for you in your setup?

[Sanoary Istiaque](https://hashnode.com/@istyy)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a71b595ca7c1628f2212fd6)

This is a practical way to think about working with coding agents. Fixing a mistake in chat may solve the immediate task, but documenting the lesson in AGENTS.md, adding a targeted regression test, or improving the review process prevents the same issue from returning in future sessions. I especially like the reminder not to turn one failure into an overly broad rule the best safeguards should block the specific mistake without restricting valid solutions.

[Bryce Darling](https://hashnode.com/@mindrealm)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a71b595ca7c1628f2212fd6#reply-6a720f6e1d8f7180b142a5cf)

Exactly, a broad rule can do more damage than the original mistake because it keeps blocking valid cases after that. Oof

[Duko tools](https://hashnode.com/@talha24ramzan)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a719582e4ec2895c6d4db9c)

The "does every session need this" filter for AGENTS.md is the most transferable rule, a hard line-count ceiling forces real discipline instead of "just one more exception" creeping in forever.

"Don't turn one failure into a universal law" is the sharper insight. Requiring both a regression case (rejects the bad example) and a positive case (still passes valid ones) is what stops an overbroad fix like "never use mocks" from replacing a narrower real problem.

Self-review not being independent, even when the agent inspects its own diff, is worth remembering, it already committed to the assumptions behind the output, so grading its own homework isn't structurally the same as a reviewer with no stake in it.

[Bryce Darling](https://hashnode.com/@mindrealm)

[Aug 4](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a719582e4ec2895c6d4db9c#reply-6a720f59177e33a49c72a864)

Do you use a line/character count ceiling in your own config? What did you land on?

[Duko tools](https://hashnode.com/@talha24ramzan)

[Aug 11](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a719582e4ec2895c6d4db9c#reply-6a7af48214b5d94781c374d8)

Honestly, no formal ceiling of my own yet, I don't run a config file with that structure on my current project. The rule stood out to me more as a principle worth borrowing than something I've implemented, since most of what I've built so far leans on ad-hoc instructions rather than a maintained agent-config file.

If I did set one, I'd probably start with something close to your under-60-lines/4,000-character number rather than inventing my own, it's a concrete enough constraint to actually enforce, versus a vaguer "keep it short" that erodes the same way any unmeasured limit does.

What made you land on that specific number, out of curiosity, was it empirical (you hit a point where longer files started causing problems) or more of a reasonable starting constraint you picked and haven't needed to revisit?

[Puneet Khandelwal](https://hashnode.com/@lifestyle4u)

[Aug 3](https://hashnode.com/posts/when-your-coding-agent-repeats-a-mistake-move-the-lesson-out-of-chat/6a70d2a0f40be8a79446c4e7/comment/6a710f416d863637d39d19e7)

GGreat insight into the importance of community in our lives.
