Skip to main content

Anatomy of AI Knowledge Loop

The self-improving loop that ties it all back together.

Knowledge Loop

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​

#StepQuestion it answers
1️⃣CaptureWhat did we just learn?
2️⃣ConnectWhat does it mean?
3️⃣CodifyHow do we save it?
4️⃣ApplyWhere does it change behavior?
5️⃣MeasureDid it actually help?
6️⃣ShareHow 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.

SourceWhat you learn
πŸ“’ PostmortemsRoot causes, actions, learnings
πŸ§ͺ EvaluationsQuality scores, failure cases, edge cases
πŸ” Code ReviewsFindings, patterns, anti-patterns
🚨 IncidentsAlerts, timelines, mitigations
πŸ’¬ User feedbackRatings, comments, support tickets
πŸ“Š Usage & telemetryMetrics, prompts, costs, adoption
πŸ“œ Policy & complianceUpdates, audits, exceptions
🌍 Research & externalNew 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:

  1. Top recurring themes.
  2. Recommended changes to prompts, agents, runbooks, CLAUDE.md.
  3. New or revised eval cases.
  4. 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.

ArtifactPurposeOwnerExample
🧩 Prompt patternsReusable prompts that workAI Platformprompt-patterns/code-reviewer.md
πŸ€– Agent playbooksHow agents should behaveAI Platformagents/code-reviewer.yml
⚑ Skills / commandsRepeatable workflowsEngineering.claude/commands/review.md
🧠 CLAUDE.md updatesTeam memory, conventions, decisionsTech LeadCLAUDE.md
πŸ“’ RunbooksOperational how-toSRErunbooks/db-connection.md
πŸ“š Postmortem libraryIncident learningsSREdocs/postmortems/
⭐ Eval casesQuality guardrailsAI Platformevals/cases/
πŸ“œ Policy updatesGovernance & complianceGovernancepolicies/

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.

CadenceActivities
⏰ ContinuousCapture 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.

CopilotRole
πŸ”— CollectorPulls data from all sources (postmortems, evals, reviews, incidents)
🧩 SynthesizerSummarizes and connects patterns
πŸ’‘ Insight FinderFinds anomalies, trends, root causes
✍️ DraftsmanWrites timelines, mitigations, drafts
❓ CriticChallenges assumptions and gaps
πŸŽ“ TeacherSuggests 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_id ties 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​

SymptomLikely causeFix
Same issues repeatCapture missing or unmonitoredWire missing sources; add tags
Digest is noiseNo theme clusteringImprove synthesizer prompt + tagging
Changes don't helpNo baseline / evalRequire baseline + eval per change
Library bloatedNo retirement policyQuarterly retire-stale review
Adoption is lowNo share stepAdd weekly digest + Demo Friday
Trust erodesSilent changesEnforce PR + audit trail on every artifact
Loop becomes ritualNo measurementTie 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
  • βœ… /digest command 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 pieceFeeds the loop with…Receives back…
Claude Code Project StructureA consistent home for artifactsUpdated layout patterns
MCP ServersTool usage telemetryTighter scopes, new servers
SubagentsAgent performance signalsRefined playbooks
Hook LifecyclesHook outcomes & blocksNew / tuned hooks
CLAUDE.mdConvention driftUpdated conventions & decisions
SkillsSkill success / failure ratesRefined skills, new triggers
PluginsPlugin adoption & issuesNew plugin versions
Agentic WorkflowsWorkflow telemetryBetter plans & critics
.claude/settings.jsonPermission / hook regressionsTighter defaults
Slash CommandsCommand usage patternsBetter commands, retired ones
Context ManagementContext drift, compaction winsBetter defaults & rituals
AI-Powered Dev LoopCycle-time signalsProcess refinements
Prompt Engineering for ReposPrompt quality scoresBetter prompt patterns
AI Cost & Token EconomicsCost anomaliesRouting & batching tactics
AI Onboarding KitNew-hire frictionUpdated kit & buddy guidance
AI Code Review WorkflowsReview acceptance + escape rateBetter review subagents
AI ObservabilityDrift & alertsNew evals & dashboards
AI-Powered PostmortemRoot causes & actionsRunbook + policy updates
AI Incident Response PlaybookMTTR & timelinesBetter paging & runbooks
AI Governance & RiskPolicy violations & approvalsUpdated 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 ∞