Contact Us
knowledge-curator-cover

Knowledge Curator: How AI Agents Turn Session Lessons Into Rules and Fixes

AI coding agents can take a ticket from spec to verified code with very little human input. Every run also teaches the agent something, such as a command that no longer works, an API that behaves differently than its docs suggest, or a reason to prefer one pattern over another. When the session ends, that knowledge ends with it.

This article walks through two mechanisms in the multi-agent frontend pipeline we run on Claude Code. The Knowledge Curator decides what is worth keeping. Knowledge Backlog Review turns kept knowledge into fixes and then retires it.

Here is the whole lifecycle in one sentence. The curator adds entries, backlog review turns them into tickets, and an entry disappears only once its fix is in the code. Until then, agents read it before every task.

Image

Caption: The lifecycle of a knowledge entry, from signal to removal

Part 1. Knowledge Curator: how agents accumulate knowledge across tickets

The curator's main job is filtering. It keeps only what clears an explicit usefulness bar. The only files it writes to on its own are two low-cost ones that are easy to revert.

The problem

Every ticket an agent runs end to end produces knowledge that gets stored nowhere. Examples include a documented command that no longer works, an API that turned out to be asynchronous, or the reason one pattern was chosen over another. All of it lives in a single session's context and disappears when the session ends. The next ticket rediscovers the same thing at the same cost in tokens, time, and false "regressions."

The obvious fix is to let the agent write down lessons after every task, and it does more harm than good. A curator that saves ten "lessons" per ticket turns the knowledge base into noise within a few months. Once people stop trusting the entries, nobody reads them at all, including the important ones.

How the curator fits into the pipeline

The frontend pipeline runs in seven phases: architect → developer → visual check → AI review → verifier → QA → curator. The curator is the last one.

A signal triggers the curator, and the task's risk level plays no part in that. Each phase's output artifact has an optional Knowledge signals section where the agent notes anything non-obvious it ran into.

  • If no phase reports a signal, the orchestrator prints "nothing to keep" itself, and the curator does not run.

  • If there is a signal, the curator runs, even for a trivial task that took the light "developer + verifier" path.

As input, the curator receives three things:

  • the phase artifacts (TICKET_SPEC, SOLUTION, IMPLEMENTATION, REVIEW, VERIFICATION, QA_REPORT)

  • the list of changed files

  • the signal lines that triggered it

When someone invokes it by hand ("what should we remember from this session?"), it builds the context itself from git diff and git log.

The scoring gate: a usefulness formula

Before anything is saved, each candidate gets a score.

Image

Each axis is scored from 1 to 5:

  • Reuse: how likely a future ticket is to hit the same situation.

  • Impact: how much time or risk the knowledge saves in advance.

  • Confidence: whether it rests on a single observation or is corroborated by several signals.

  • Maintenance cost: how much the entry adds to the reader's load and how fast it goes stale. A specific command name goes stale faster than an architectural fact.

The threshold is 20. Candidates below it get no action. They still appear in the curator's report with their scores, so a human can see what was filtered out. Nothing is dropped silently.

Confidence cap. Two kinds of claims have produced false positives, so their confidence is capped at Medium:

  • "The backend contract is ahead of the generated client." A stale local client produces exactly the same symptom.

  • "Value X is sent through the API as Y." Reading a constant's name is a different thing from seeing the real payload.

The cap comes from a specific failure. Two proposals rated High confidence, each backed by two or three "independent" confirmations, both turned out to be false positives. All the confirmations came from the same static reading of the code, so they shared the same reasoning error.

Decision matrix: eight destinations with different blast radius

Depending on what it found, the curator routes the knowledge to one of eight destinations. The more tasks a destination affects, the more human control it requires.

An instruction that affects almost every task

CLAUDE.md

Proposal only

A code convention or invariant

.claude/rules/*.md

Proposal only

A repeatable multi-step process

A new Skill

Proposal only

A long-term architectural decision

ADR (Architecture Decision Record)

Proposal only

Minor friction (broken command, flaky test)

PAPERCUTS.md

Automatic

A non-obvious practical lesson (API quirk, async behavior)

LESSONS.md

Automatic

A problem that needs dedicated work

A ticket in Azure DevOps (ADO)

Proposal only

An outdated instruction

Deprecation

Proposal only

  • Only PAPERCUTS and LESSONS are written automatically, and a mistake there is cheap. They are not loaded into every context; agents read them on demand. Entries are only appended, and changes are easy to revert.

  • All proposals go to PROPOSED_CHANGES.md, a durable inbox. Adding an entry there does not apply the change. Only a human edits the target file.

  • A mandatory duplicate check runs before every write. It greps all knowledge files, rules, ADRs, and skill descriptions, and it searches open tickets in ADO.

How knowledge gets back into the work

An entry is only worth something if someone reads it. So before starting, every agent in the pipeline greps these files for its own area:

  • The architect rules out solutions that would repeat a known trap.

  • The developer searches by hook or component name so it doesn't rediscover things.

  • The verifier searches by the name of the failed command. If it finds a match, it marks the failure as pre-existing and doesn't spend a retry on someone else's breakage.

  • QA accounts for timing issues such as debounce and race conditions so it doesn't write a flaky test.

Part 2. Knowledge Backlog Review: how knowledge turns into fixes

Backlog review is a separate mode of the same agent, and its only job is closing entries. An entry stays in the knowledge base until its fix is in the code. It disappears as soon as its ticket is closed.

The problem

The curator only adds entries and never closes them. The PROPOSED_CHANGES inbox keeps growing. Entries in PAPERCUTS and LESSONS go stale as the code around them changes.

A stale entry is worse than no entry, because an agent greps the file, sees the entry, and acts on it. Here is a real example. A lesson about three "sibling" guards in a hook outlived the refactoring that removed two of them. An agent that read this lesson would start keeping code in sync that no longer exists.

The procedure

Step 0. Reconcile the entry-to-ticket map across all three files.

An entry with a ticket carries a link to it:

  • in PAPERCUTS/LESSONS, a Ticket: line

  • in PROPOSED_CHANGES, a line reading Status: filed — Task #…

The agent fetches the state of every linked ticket with a single batch request to ADO:

  • Ticket Done: the entry is deleted, because the fix is already in the code.

  • Ticket closed without a fix: in PAPERCUTS/LESSONS the entry stays, minus the link, because the problem is still there.

  • Ticket still open: nothing changes.

Step 1. Open proposals in PROPOSED_CHANGES become tickets.

There is no third option. Before creating a ticket, the agent runs a duplicate check. It then files a Bug for a defect or a Task for planned work.

Every ticket has a parent Story. Tickets that share a theme are grouped under one Story, and if a matching Story already exists, it is reused.

The ai-bot tag. The organization runs an external bot that picks up tickets carrying this tag, implements them on its own, and opens a PR. The tag is set only when the work needs no human decision at all. Otherwise, the ticket gets a comment mentioning a specific person with the open question. The tag is added in the same update that resolves it.

Step 2. Every entry in PAPERCUTS/LESSONS gets one of three outcomes.

  • Keep: the entry is true, but nothing in the repo can fix it. Examples include a jsdom quirk, the behavior of the Okta widget, and DOM ids being global per page. This is exactly the knowledge these files exist for.

  • File and link: it can be fixed. The agent files a ticket and puts a link to it under the entry.

    The entry stays until the ticket is closed, so agents keep the knowledge while the fix hasn't landed yet. Without it, the verifier, for example, would stop recognizing a known failure.

  • Remove: the entry is stale or invalid and is deleted right away. The reason is recorded in the report and the commit message. A note inside the file would be misleading, because an agent that greps an entry sees its top lines and treats it as current.

Why the agent never fixes things itself

Even a one-line doc edit is filed as a ticket. We learned this the hard way. Claude once opened a PR for an edit, and the bot independently opened a second PR for the same change. Filing the ticket is the hand-off, either to the bot if the tag is set or to a human.

A twist: the sweep filed a ticket for something that broke during the sweep

During one run, the circuit breaker against "runaway" agents fired. It exists to stop an agent that keeps working unattended after a PR is created. It blocked every tool, and the user's replies did not reset it.

The cause was in the reset script. It read the .user_prompt field, while Claude Code sends .prompt. The author had tested the script by hand on synthetic JSON, which they had written themselves with the same mistake in it.

The issue went in as a papercut with two tickets, and the lesson suggests itself: test agent hooks on a real payload.

Key takeaways

  • Filter first. Saving agent knowledge is easy. Keeping it from turning into noise is the hard part, which is why the curator filters first.

  • Write automatically only where a mistake is cheap. That means PAPERCUTS/LESSONS. Anything loaded into every task, such as CLAUDE.md, goes through a human.

  • Build reading into every agent's procedure. Knowledge only matters if it gets read.

  • Close the loop. Without a closing step, the knowledge base gets worse over time.

  • Remove an entry once the fix is in the code. Filing a ticket for it is too early.

  • Hand work to automation through a ticket. When the agent edits files itself, you get races and duplicate PRs.

Building AI agents into your engineering workflow? Erbis helps teams design agentic pipelines that fit real delivery processes, from guardrails and human checkpoints to integration with ticketing and CI. Talk to our team.

Speed

Our clients can see the progress regularly. Should you decide to give us an assignment today, we’ll have something to show you in as little as 2 weeks!