# Harvesting Stuck-to-Unstuck Transitions into Injectable Knowledge
<!--
ref: @knowledge/protocols/stuck-to-unstuck-knowledge-harvest
type: protocol
tags: [knowledge management, AI learning, failure analysis, user experience]
triggers: [user repeats questions, complaints about implementation, session abandonment, failure to resolve issues]
trigger_prompt: When users express frustration by repeating their questions or abandoning sessions, indicating that the system has failed to provide a satisfactory solution.
version: 2
updated_at: 2026-07-18T22:55:54.180Z
-->
The moment a user goes from stuck to unstuck (and didn't just give up) is a high-signal sample of a solved problem — capture what should have been injected at the start, and only keep entries that measurably help.
*Synthesized from Benjamin Verbeek, How Lovable self-improves every hour (AI Engineer World's Fair 2026).*
When to use: a high-volume agent product where you want failures to teach the system durably ("a mistake happens once, then never again").
Steps:
1. **Detect "stuck"** with an LLM judge watching sessions: the user asks the same thing more than once, complains about the implementation, explicitly says it failed, or abandons a session.
2. **Wait for the stuck->unstuck flip** that was a real resolution, not the user giving up. That transition is the gold sample.
3. **Ask the counterfactual:** what should we have injected at the start to jump straight to this solution? Write a knowledge entry from the answer.
4. **Cluster similar issues before storing** so entries generalize instead of overfitting to one exact prompt (you don't want a million near-duplicate entries).
5. **Verify with an external reviewer** (an agent, or a human when uncertain) that generates the entry and runs a quick eval confirming it resolves the captured examples.
6. **Inject at runtime** via a lightweight model that detects a matching issue and injects the relevant entry into the main agent.
Gotcha — prune aggressively: the knowledge bank goes stale fast (every new model, every feature change), so rebalance and throw entries away continuously to avoid context rot. Use the blank-injection A/B (companion framework) to decide which entries earn their place.
---
*Related: `@content/youtube/tiago-forte/i-trained-ai-to-write-like-me-and-it-actually-worked` · `@protocol/getting-started` · `@knowledge/frameworks/three-ingredients-of-an-agent` · `@knowledge/frameworks/blank-injection-ab` · `@protocol/extract`*
---
*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*
*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*