How I Made a Coding Agent Learnt With Hindsight. A developer built a Python CLI coding assistant that pairs an LLM with Hindsight, an open-source agent memory system accessed via Hindsight Cloud, to retain corrections, recall relevant memories, and reflect over accumulated memories to generalize rules. The three-operation loop (retain, recall, reflect) lets the assistant apply a single correction — such as using date-fns instead of moment.js — to adjacent tasks like countdown timers, which plain recall alone could not do. The first time I asked my coding assistant for a date picker, it reached for moment.js. I told it once — "we use date-fns here, not moment.js" — and from that point on, it never suggested moment.js again. Not because I repeated myself. Because it actually learned the rule. That distinction — between an agent that remembers what you said and one that learns what you meant — turned out to be the whole project. The problem with assistants that forget Every coding assistant I'd used had the same failure mode: it treated each session as a blank slate. Tell it your team avoids a library, and the next day, on an unrelated task, it suggests that exact library again. The correction evaporates the moment the conversation ends. That's not a minor annoyance. It means the assistant never actually gets better at working on your codebase. Multiply that across a team, and every developer ends up re-teaching the same assistant the same lessons, forever. I wanted to build something that broke that cycle: an assistant that treats a correction not as a one-off fix, but as a fact worth keeping. How it's built The assistant itself is a small Python CLI that wraps an LLM call with a memory layer. The memory layer is Hindsight, an open-source agent memory system, accessed through Hindsight Cloud so the memory store lives outside the client entirely — no local database, no embedding models bundled into my dependency tree. The assistant talks to Hindsight over a small HTTP client, and to an LLM for code generation. The loop is three operations, and the names matter: Retain — store an interaction as a memory Recall — pull back memories relevant to the current request Reflect — ask the memory system to reason over everything it knows and produce a generalized conclusion Here's the recall step, called before any code gets generated: def recall context client: Hindsight, query: str - str: """Pull memories relevant to the current request and format them as plain text to inject into the LLM prompt.""" result = client.recall bank id=BANK ID, query=query memories = getattr result, "results", None or if not memories: return "" lines = f"- {m.text}" for m in memories return "\n".join lines And the retain step, called after the user gives feedback: def retain interaction client: Hindsight, user request: str, code: str, feedback: str - None: """Store the exchange and any correction as a memory.""" content = f"User asked: {user request}\n" f"Assistant generated:\n{code}\n" f"User feedback: {feedback}" client.retain bank id=BANK ID, content=content Nothing exotic. The interesting part isn't the plumbing — it's what happens when you add the third operation. Why recall alone isn't learning Early on, I assumed retain + recall would be enough. Store every correction, search for relevant ones before generating new code, done. And it mostly worked — if I asked for another date picker, it correctly recalled the earlier correction and used date-fns. But that's not learning. That's search. The moment I asked for something adjacent but not identical — a countdown timer, which touches date arithmetic but isn't a "date picker" in any literal sense — plain recall had no obligation to connect the dots. A correction about picker components doesn't obviously match a query about timers, unless something has generalized the underlying rule: this project uses date-fns for date and time logic, period. That generalization is what reflect does. Instead of matching a query against stored text, it reasons over the accumulated memories and produces a standing conclusion. When I ran reflect after a handful of corrections, here's a representative fragment of what came back: date-fns for Date/Time Logic: This project explicitly favors the