Adventures in Nodeland logo

Adventures in Nodeland

Archives
March 8, 2026

Your Coding Agent Keeps Making the Same Mistakes. I Built a Fix

"Explored how coding agents can learn from past mistakes with a new pi-self-learning extension."

Hey Everyone!

I've been thinking about something for a while: can coding agents stop making the same mistakes?

You know the drill — you fix a bug, then three weeks later you hit the exact same issue in a different file. Or your AI assistant forgets a lesson you taught it yesterday. Frustrating, right?

Well, I built something to fix that. Introducing pi-self-learning — a pi extension that gives your coding agent a git-backed memory.

What it does

After each completed agent task, it automatically: - Extracts what went wrong and how it was fixed - Appends the entry to a daily markdown file - Updates core/CORE.md with top-ranked durable learnings - Writes full history to long-term-memory.md - Commits everything to a dedicated memory git repository

The memory folder layout looks like this:

.pi/self-learning-memory/
├── .git/
├── daily/YYYY-MM-DD.md
├── monthly/YYYY-MM.md
├── long-term-memory.md
└── core/CORE.md

Why it matters

Here's the thing — coding agents are amazing at solving problems, but they have zero memory. Every session is a fresh start. That's fine for some things, but when you're iterating on a complex project, you end up re-discovering the same pitfalls over and over.

pi-self-learning solves this by creating a durable learning system. The core/CORE.md file ranks learnings by frequency and recency, so your agent always knows what to watch out for.

Loading memory into context

You can configure it to inject memory into each turn: - includeCore: inject CORE.md (enabled by default) - includeLatestMonthly: inject monthly summaries - instructionMode: strict/advisory/off — enforces checking memory logs for history-related questions

Commands

  • /learning-now → generate reflection now
  • /learning-month [YYYY-MM] → generate monthly summary
  • /learning-daily → show today's daily file path
  • /learning-toggle → enable/disable for current branch
  • /learning-status → show effective config

Installation

pi install npm:pi-self-learning

Or copy the extension locally:

cp extensions/self-learning.ts ~/.pi/agent/extensions/

The bigger picture

This is part of my journey in making AI assistants actually useful for long-term development work. Memory is the missing piece. Without it, even the smartest agent is just someone who keeps making the same mistakes.

Check it out, play with it, and let me know what you think!

Read more:

  • March 1, 2026

    My Personal Skills for AI-assisted Node.js Development

    Hey Everyone! I've been working on something I want to share with you. As you know, I've started relying on AI assistants to do most of my coding, but I...

    Read article →
Don't miss what's next. Subscribe to Adventures in Nodeland:
Share this email:
Share on Twitter Share on LinkedIn
GitHub
Twitter
YouTube
LinkedIn