Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions documents/patterns/learning-loop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
authors: [ivett_ordog]
---

# Learning Loop

## Problem
The model cannot learn, so anything a session taught you evaporates when it ends. Extract Knowledge captures insights when you notice them — but noticing in the moment is unreliable, and nothing connects the dots across sessions to reveal recurring problems.

## Pattern
Make capture a ritual instead of an accident:

1. **End every session with a learning pass**: the agent reflects on the session — corrections you made, surprises, gotchas, things you had to repeat
2. **Categorize and route** each learning to the right durable store:
- behavioral rules → ground rules
- project facts → knowledge and reference docs
- recurring quality corrections → habit hooks
- repeated processes → a skill or automation
3. **You approve the routing** — the agent proposes, you decide
4. **Advanced**: also append a dated entry to a session log. Periodically have the agent read the accumulated log and surface recurring issues that deserve promotion into stronger mechanisms

This closes the self-improvement loop: sessions generate learnings, learnings harden into mechanisms, mechanisms improve every future session. It ties the other knowledge patterns together into a genuinely self-improving system.

## Example
A `/learn` command runs at session end and proposes: "you corrected mock-heavy tests twice → habit hook candidate; the deploy needs the VPN → project ground rules; the release process we walked through → new skill."

A `/remember` variant first appends the session to a log, then reflects across the whole log. After a few sessions it notices the same flaky-test complaint keeps recurring — and suggests fixing the root cause instead of re-learning the workaround every session.
4 changes: 4 additions & 0 deletions documents/relationships.mmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ graph LR
patterns/context-management -->|solves| obstacles/limited-context-window
patterns/context-markers -->|solves| obstacles/black-box-ai
patterns/extract-knowledge -->|solves| obstacles/cannot-learn
patterns/learning-loop -->|solves| obstacles/cannot-learn
patterns/learning-loop -->|uses| patterns/extract-knowledge
patterns/learning-loop -->|uses| patterns/habit-hooks
patterns/learning-loop <-->|similar| patterns/show-the-agent-let-it-repeat-automate
patterns/focused-agent -->|solves| anti-patterns/distracted-agent
patterns/focused-agent -->|solves| obstacles/limited-focus
patterns/focused-agent -->|solves| obstacles/context-rot
Expand Down