Anatomy of AI Knowledge Loop
The self-improving loop that ties it all back together.

The self-improving system that turns every postmortem, eval, review, incident, and policy update β back into better prompts, agents, docs, and
CLAUDE.md.
This is the meta-anatomy that ties all 20 prior anatomies in the Living Library together. Without it, each piece works in isolation; with it, the whole library compounds.
TL;DRβ
- AI systems learn best from real-world feedback. Without a loop, we repeat mistakes.
- Six steps: Capture β Connect β Codify β Apply β Measure β Share β then repeat.
- Sources: postmortems, evals, code reviews, incidents, user feedback, telemetry, policy & compliance, research.
- Sinks: prompts, agents, slash commands, docs,
CLAUDE.md, runbooks, policies. - Govern with change-management rules: every change has a signal, an owner, a PR, and an evaluation.
- The mantra: Observe β Analyze β Improve β Validate β Share β Repeat.
Why this mattersβ
You can buy better models. You can hire smarter people. But the only durable advantage is a team that gets better every week at using AI β because every postmortem updates a runbook, every eval failure updates a prompt, every incident updates a hook, and every policy change updates CLAUDE.md.
Bottom line: Every loop makes us smarter. Better quality Β· faster shipping Β· lower cost Β· higher trust.
The Big Picture β The Self-Improving Loopβ
Bottom line: Six steps. One loop. Run it daily, weekly, monthly, quarterly β at different cadences for different signals.
The Six Steps at a Glanceβ
| # | Step | Question it answers |
|---|---|---|
| 1οΈβ£ | Capture | What did we just learn? |
| 2οΈβ£ | Connect | What does it mean? |
| 3οΈβ£ | Codify | How do we save it? |
| 4οΈβ£ | Apply | Where does it change behavior? |
| 5οΈβ£ | Measure | Did it actually help? |
| 6οΈβ£ | Share | How do we make it stick? |
1. Capture β Sources of Learningβ
Pull signal from every AI-adjacent activity. If it's not captured, it can't compound.
| Source | What you learn |
|---|---|
| π Postmortems | Root causes, actions, learnings |
| π§ͺ Evaluations | Quality scores, failure cases, edge cases |
| π Code Reviews | Findings, patterns, anti-patterns |
| π¨ Incidents | Alerts, timelines, mitigations |
| π¬ User feedback | Ratings, comments, support tickets |
| π Usage & telemetry | Metrics, prompts, costs, adoption |
| π Policy & compliance | Updates, audits, exceptions |
| π Research & external | New models, papers, best practices |
Capture principlesβ
- β Collect automatically where possible β humans are unreliable scribes.
- β Be structured β consistent formats unlock query and analysis.
- β Include context β who, what, when, why.
- β Keep raw + immutable β don't lose the truth.
- β Tag by domain & impact β so we can find it later.
π‘ Tip: If a learning isn't in a system, it doesn't exist. Capture early, capture often.
2. Connect β Correlate & Extractβ
Raw signals are noise. Insights emerge when you connect them across systems and time.
What "connect" looks likeβ
- π Trace-ID joins β link logs, evals, PRs, incidents, postmortems by one ID.
- π§ Theme clustering β group similar failure modes ("missing null check", "auth edge cases").
- π Trend analysis β what's increasing, what's decreasing, what's drifting?
- π Cross-source correlation β postmortem says "X" + eval drift on "Y" β likely same root pattern.
- π§ Root-cause synthesis β which 20% of patterns drive 80% of pain?
The AI Copilot for this stageβ
A Knowledge Synthesizer subagent reads postmortems, evals, reviews, and incidents nightly and emits:
- Top recurring themes.
- Recommended changes to prompts, agents, runbooks,
CLAUDE.md. - New or revised eval cases.
- Risks and mitigations.
(See the Knowledge Update Template below for the exact output shape.)
π‘ Tip: Connection is where insight lives. Without it, you have data; with it, you have knowledge.
3. Codify β What We Produceβ
Insights die unless they become artifacts the system can use.
| Artifact | Purpose | Owner | Example |
|---|---|---|---|
| π§© Prompt patterns | Reusable prompts that work | AI Platform | prompt-patterns/code-reviewer.md |
| π€ Agent playbooks | How agents should behave | AI Platform | agents/code-reviewer.yml |
| β‘ Skills / commands | Repeatable workflows | Engineering | .claude/commands/review.md |
π§ CLAUDE.md updates | Team memory, conventions, decisions | Tech Lead | CLAUDE.md |
| π Runbooks | Operational how-to | SRE | runbooks/db-connection.md |
| π Postmortem library | Incident learnings | SRE | docs/postmortems/ |
| β Eval cases | Quality guardrails | AI Platform | evals/cases/ |
| π Policy updates | Governance & compliance | Governance | policies/ |
Propertiesβ
- π Version-controlled.
- π Searchable.
- π Reusable.
- π Cross-linked (every artifact references its source signals).
π‘ Tip: Everything version-controlled. Everything searchable. Everything reusable.
4. Apply β Where Knowledge Flowsβ
Codified knowledge has to change behavior somewhere in the stack.
What good "apply" looks likeβ
- π― Intentional. Every change cites the signal it came from.
- π§ͺ Tested. Every change has at least one eval case attached.
- π Reviewed. Every change goes through normal PR review.
- π Measured. A baseline + post-change metric is captured.
- β»οΈ Reversible. Easy to roll back if it makes things worse.
π‘ Tip: Apply with intention. Each change must have a reason and a test.
5. Measure β System Quality, Velocity, Costβ
Measure the impact so the loop doesn't drift into ritual.
System quality (going up)β
- β Eval score trend β
- π‘οΈ Hallucination rate β
- π Regression rate β
- π User satisfaction β
Engineering velocityβ
- β±οΈ Cycle time β
- β PR acceptance rate β
- π Rework rate β
- π Lead time to fix β
Cost & efficiencyβ
- π° Cost per request β
- π’ Token usage β
- πΎ Cache hit rate β
- π§ Context resets β
Example dashboard (one glance)β
Eval Score (β) Hallucination Rate (β)
Cost / Request (β) PR Cycle Time (β)
π‘ Tip: Measure what matters. Iterate relentlessly. A loop that doesn't measure becomes a loop that doesn't improve.
6. Share β Make It Stickβ
Knowledge only compounds when it's distributed and adopted.
How to shareβ
- π’ Weekly knowledge digest β top 5 learnings + what changed.
- π Demo Friday β show the new prompt/agent in action.
- π Changelogs for prompts, agents, commands, and
CLAUDE.md. - π Internal wiki / handbook updated by the synthesizer agent.
- π€ Onboarding kit auto-updated (see the Onboarding Kit anatomy).
- π External: blog posts, talks, OSS contributions where appropriate.
π‘ Tip: A knowledge artifact is only as valuable as the next person who finds and uses it.
Loop Cadenceβ
Different signals deserve different rhythms.
| Cadence | Activities |
|---|---|
| β° Continuous | Capture from logs, traces, evals, alerts, chat |
| π Daily triage (15β30 min) | Synthesizer agent draft; quick scan |
| π Weekly review (60 min) | Approve changes, ship updates, publish digest |
| π Monthly deep-dive (90 min) | Cross-source patterns, OKR alignment |
| ποΈ Quarterly strategy (Β½ day) | Policy updates, library cleanup, roadmap |
π‘ Tip: Pick one cadence and run it religiously before adding the next.
AI Copilots in the Loopβ
Just like the rest of the library, AI is your force multiplier β but never the decision-maker.
| Copilot | Role |
|---|---|
| π Collector | Pulls data from all sources (postmortems, evals, reviews, incidents) |
| π§© Synthesizer | Summarizes and connects patterns |
| π‘ Insight Finder | Finds anomalies, trends, root causes |
| βοΈ Draftsman | Writes timelines, mitigations, drafts |
| β Critic | Challenges assumptions and gaps |
| π Teacher | Suggests training and learning content |
AI Copilot prompt β the Knowledge Synthesizerβ
You are the Knowledge Synthesizer.
Given the following inputs:
- Postmortems (last N days)
- Eval failures (last N days)
- Code reviews / findings (last N days)
- Incident updates (last N days)
- Policies (recently changed)
Extract:
1. Key themes and recurring issues.
2. Recommended changes to prompts, agents, runbooks, CLAUDE.md.
3. New or revised eval cases.
4. Risks and mitigations.
Return the Knowledge Update Template.
For every recommendation, cite the source signal(s) by id.
Mark hypotheses vs facts.
Do not invent sources.
Knowledge Update Templateβ
This is the single document the synthesizer produces and humans review weekly.
# Knowledge Update β {{date}}
## Signals In
- Postmortems: {{ids}}
- Eval failures: {{ids}}
- Reviews: {{ids}}
- Incidents: {{ids}}
- Policy updates: {{ids}}
## Key Themes
1. ...
2. ...
3. ...
## Recommended Changes
### Prompts
- {{file}} β {{change}} (why: {{signal_ids}})
### Agents
- {{agent}} β {{change}} (why: {{signal_ids}})
### Commands / Skills
- {{file}} β {{change}} (why: {{signal_ids}})
### Docs / CLAUDE.md
- {{file}} β {{change}} (why: {{signal_ids}})
### Runbooks
- {{file}} β {{change}} (why: {{signal_ids}})
## New Eval Cases
- {{name}} β {{purpose}}
## Risks & Mitigations
- {{risk}} β {{mitigation}}
Change management rulesβ
Every recommended change must include:
- π‘ Signal β why
- π€ Owner β who
- π PR / link β where
- π§ͺ Evaluation β how we'll verify
π₯ Golden rule: No silent changes. Everything in code β everything reviewed.
Audit Trail & Traceabilityβ
Every artifact change is provable end-to-end.
{
"ts": "2025-05-20T14:03:47Z",
"trace_id": "c7f3wabu2",
"actor": "u_123",
"action": "prompt_update",
"artifact": "agents/code-reviewer.yml",
"change_type": "update",
"reason": "Recurring 'NPE findings in reviews' theme",
"sources": [
"postmortem:inc-2025-05-18",
"eval:case-041-fail"
],
"PR": "https://github.com/org/repo/pull/512",
"approved_by": ["ai-platform-lead", "tech-lead"],
"status": "merged"
}
Traceability must-havesβ
- β Who did what, when
- β What changed
- β Why it changed
- β Where the signal came from
- β Who approved it
- β Link to PR / commit
- β Immutable & searchable
- β Retained per policy
β οΈ If it isn't logged, it didn't happen.
Step-by-Step Setupβ
1. Pick your sources & sinksβ
- Sources: postmortems, evals, reviews, incidents, telemetry, policy, feedback, research.
- Sinks: prompts, agents, commands, docs,
CLAUDE.md, runbooks, policies.
2. Standardize the log schemaβ
Adopt the audit-trail JSON shape above. One trace_id everywhere.
3. Stand up the Synthesizer agentβ
agents/knowledge-synthesizer.yml:
name: knowledge-synthesizer
description: Synthesizes weekly learnings from all AI signals.
model: claude-sonnet-4
tools: [Read, WebSearch]
permissions:
allow: ["Read", "WebSearch"]
deny: ["Write"]
system_prompt: |
You are the Knowledge Synthesizer.
Be precise, cited, and honest about uncertainty.
Output the Knowledge Update Template exactly.
triggers: ["weekly digest", "knowledge update", "synthesize"]
timeout_ms: 180000
max_tokens: 12000
4. Add a /digest slash commandβ
.claude/commands/digest.md:
---
description: Generate this week's Knowledge Update digest
usage: /digest [--from <date>] [--to <date>]
permissions:
allow: ["Read", "WebSearch", "MCP:datadog", "MCP:github", "MCP:slack"]
deny: ["Write"]
---
Run @knowledge-synthesizer against signals between {{from?}} and {{to?}}.
Emit the Knowledge Update Template.
Open a draft PR titled "Knowledge Update: <date>".
5. Wire the weekly review meetingβ
30β60 minutes. Approve, reject, or revise each recommendation. Ship the PR.
6. Connect to the eval suiteβ
Every applied change creates or updates at least one eval case. Block the merge if safety evals fail.
7. Publish the digestβ
Slack/Teams + wiki. Onboarding kit auto-imports the latest themes.
8. Run a monthly deep-diveβ
Cross-source patterns, library cleanup, retire stale artifacts.
Variants for Different Team Settingsβ
π€ Solo developerβ
- Capture: a single
notes/learnings.md+ Git history. - Cadence: weekly 30-min self-debrief.
- Sinks: one
CLAUDE.md, one prompt library.
π₯ Small team (2β10)β
- Capture: shared
docs/, eval suite in CI, postmortem template. - Cadence: weekly 60-min review + Demo Friday.
- Sinks: shared
agents/,.claude/commands/,CLAUDE.md.
π’ Enterprise / regulatedβ
- Capture: SIEM-grade audit trail, signed model cards.
- Cadence: weekly digest, monthly deep-dive, quarterly governance.
- Sinks: model registry, policy library, training program.
- Every change links to a control in the governance framework.
π Open-source / communityβ
- Public digest with anonymized sources.
- Community PRs to prompts / agents.
- Public eval cases & rubrics.
Bottom line: Same loop, escalating rigor.
Common Patterns & Recipesβ
Pattern 1 β Source β Sink mappingβ
postmortem.action_items β runbook updates
eval.failing_cases β prompt / agent updates
review.findings β CLAUDE.md conventions
incident.timeline β alert + runbook tuning
policy.update β permission / hook changes
telemetry.drift β eval suite expansion
Pattern 2 β Hypothesis-driven changeβ
**Hypothesis:** Adding a "cite sources" instruction to code-reviewer
will reduce hallucination rate by β₯ 20%.
**Change:** agents/code-reviewer.yml
**Eval:** add 5 fact-checking cases
**Baseline:** 4.2% hallucination
**Target:** β€ 3.4% over 7 days
Pattern 3 β Retire stale artifactsβ
Monthly: list unused prompts/commands/skills > 90 days, archive with reason.
Pattern 4 β Cross-incident pattern detectionβ
Across last 10 postmortems, find recurring root-cause categories.
For top 3, propose system-level mitigations + eval coverage.
Pattern 5 β Knowledge graph (lightweight)β
Tag every artifact with topic:, risk:, domain: so the synthesizer can cluster.
Pattern 6 β Onboarding feedback β kitβ
New hires file friction notes in week 1; kit updates monthly.
Pattern 7 β External knowledge ingestβ
Weekly: synthesizer reads team's saved research links and proposes 1 update.
Pattern 8 β Quarterly "loop on the loop"β
Apply the loop to itself: what's working, what's noise, what to retire?
Best Practices β β
- π§· Capture by default, manually only as backup.
- π One
trace_idties signals to artifacts. - π§ͺ Every change has an eval.
- π Every change has a reviewer.
- π¦ Smallest useful change β easier to attribute impact.
- π―οΈ Retire ruthlessly β fewer, better artifacts.
- π‘ Share widely β the more eyes, the faster the compound.
- π Measure both quality and velocity β never optimize one alone.
Anti-Patterns ββ
- π« No capture pipeline β learnings die in Slack threads.
- π« No connection step β raw data, no insight.
- π« Silent changes to prompts/agents (no PR, no signal).
- π« Changes without evals β can't tell if you helped or hurt.
- π« One-shot "retrospectives" that never produce artifacts.
- π« Library sprawl β too many stale artifacts.
- π« No share step β knowledge stays in one team.
Troubleshootingβ
| Symptom | Likely cause | Fix |
|---|---|---|
| Same issues repeat | Capture missing or unmonitored | Wire missing sources; add tags |
| Digest is noise | No theme clustering | Improve synthesizer prompt + tagging |
| Changes don't help | No baseline / eval | Require baseline + eval per change |
| Library bloated | No retirement policy | Quarterly retire-stale review |
| Adoption is low | No share step | Add weekly digest + Demo Friday |
| Trust erodes | Silent changes | Enforce PR + audit trail on every artifact |
| Loop becomes ritual | No measurement | Tie the loop to outcome metrics |
Quick-Start Checklistβ
- β Source list defined (postmortems, evals, reviews, incidents, telemetry, policy)
- β
Sink list defined (prompts, agents, commands, docs,
CLAUDE.md, runbooks, policies) - β Audit-log schema standardized
- β Synthesizer agent shipped
- β
/digestcommand live - β Weekly review on the calendar
- β Eval-gated change process
- β Quarterly "loop on the loop"
π§ Mantra: Observe β Analyze β Improve β Validate β Share β Repeat.
Maturity Pathβ
π± Week 1 β Start smallβ
- Capture key signals (postmortems + evals).
- Standard log schema.
- One eval suite.
- One Knowledge Update digest.
πͺ΄ Month 1 β Level upβ
- Full traces end-to-end.
- Governance policies live.
- Model cards for all systems.
- Dashboards & alerts.
π³ Quarter 1+ β Scaleβ
- Auto-synthesizer in CI.
- Red teaming cadence.
- Exception process.
- Quarterly review.
Success Looks Likeβ
- π» Fewer incidents
- π More confidence
- πΈ Lower cost
- π Happier teams
How This Anatomy Ties the Library Togetherβ
| Library piece | Feeds the loop with⦠| Receives back⦠|
|---|---|---|
| Claude Code Project Structure | A consistent home for artifacts | Updated layout patterns |
| MCP Servers | Tool usage telemetry | Tighter scopes, new servers |
| Subagents | Agent performance signals | Refined playbooks |
| Hook Lifecycles | Hook outcomes & blocks | New / tuned hooks |
| CLAUDE.md | Convention drift | Updated conventions & decisions |
| Skills | Skill success / failure rates | Refined skills, new triggers |
| Plugins | Plugin adoption & issues | New plugin versions |
| Agentic Workflows | Workflow telemetry | Better plans & critics |
.claude/settings.json | Permission / hook regressions | Tighter defaults |
| Slash Commands | Command usage patterns | Better commands, retired ones |
| Context Management | Context drift, compaction wins | Better defaults & rituals |
| AI-Powered Dev Loop | Cycle-time signals | Process refinements |
| Prompt Engineering for Repos | Prompt quality scores | Better prompt patterns |
| AI Cost & Token Economics | Cost anomalies | Routing & batching tactics |
| AI Onboarding Kit | New-hire friction | Updated kit & buddy guidance |
| AI Code Review Workflows | Review acceptance + escape rate | Better review subagents |
| AI Observability | Drift & alerts | New evals & dashboards |
| AI-Powered Postmortem | Root causes & actions | Runbook + policy updates |
| AI Incident Response Playbook | MTTR & timelines | Better paging & runbooks |
| AI Governance & Risk | Policy violations & approvals | Updated controls & training |
π‘ Tip: The Knowledge Loop is the operating system. Every other anatomy is an app running on it.
Glossaryβ
- Capture β Collecting raw signals across the AI system.
- Connect β Correlating signals across sources and time.
- Codify β Turning insights into versioned artifacts.
- Apply β Changing real behavior (prompts, agents, docs, policies).
- Measure β Tracking impact, quality, and outcomes.
- Share β Distributing artifacts so they compound.
- Knowledge artifact β A versioned, reusable piece (prompt, agent, runbook, etc.).
- Synthesizer β The AI copilot that drafts the weekly Knowledge Update.
- Knowledge Update β The weekly digest of signals β recommended changes.
- Loop on the loop β Periodically improving the loop itself.
Further Readingβ
- Search: "learning organizations Peter Senge"
- Search: "knowledge management for AI teams"
- Search: "continuous improvement DORA metrics"
- Search: "retrospective antipatterns"
πͺ Rememberβ
The goal is not perfection. The goal is a system that improves every day.
The mantra: Observe β Analyze β Improve β Validate β Share β Repeat β