Learning & Feedback

How agents accumulate knowledge over time -- from raw signal capture to rule promotion. Fix patterns, review issues, build errors, and execution metrics feed back into future runs.

Existing

Existing Feedback Mechanisms

Mechanisms that capture signals during execution. Most are per-session and lose memory between runs.

Self-Healing Loop

Scope: Per-session, per-step. dx-step-fix recovers from failures during execution (targeted fix + root cause escalation). Memory is lost after the session ends — each run starts fresh.

Review-Fix Loop

Scope: Per-session, per-story. dx-step-verify runs up to 3 review-fix cycles. Same issues may recur across stories because findings are not persisted.

Policy Gate

Scope: Global, static. pipeline-policy.yaml restricts what each agent role can do. Manually maintained — human updates after incidents.

Shared Rules

Scope: Project-wide, git-tracked. .ai/rules/ files read by dx skills and automation agents. Manual only — no automated discovery or suggestion.

Across runs

Only fix patterns carry over between runs — see Fix Pattern Promotion below.

Capture

What Gets Recorded

Coordinator skills append one JSON line per event to .ai/learning/raw/. Nothing else reads or writes there.

FileWritten byContents
runs.jsonldx-step-all, dx-bug-all, dx-estimateOne record per run: ticket, flow, steps completed, fix and heal counts, stop reason
fixes.jsonldx-step-allOne record per fix attempt: error type, fix applied, success or failure
bugs.jsonldx-bug-allOne record per fixed bug: component, root cause, files changed
Promotion

Fix Pattern Promotion

A fix that keeps working becomes a rule.

Promotion Flow

dx-step-all checks after every logged fix attempt, and once more at the end of the run.

Fix attempt fixes.jsonl
3+ successes 0 failures same error + fix
Rule written .claude/rules/ learned-fix-*.md

How rules are used

Claude Code auto-loads .claude/rules/ on every run. dx-step-all also reads learned-fix-*.md before its loop and passes the patterns to the step skills, so Copilot CLI (which does not load .claude/rules/) gets them too.

Bug notes

dx-bug-all prints a note when a component has 3+ entries in bugs.jsonl (hotspot), or when the root cause matches an error_type already in fixes.jsonl. Notes only — no files are written.

Review the rules

Promotion is automatic. Rules land in .claude/rules/ like any other file — review them in the diff before committing, and delete one that turns out wrong.

Layout

Consumer Project Layout

.ai/learning/raw/
runs.jsonl
fixes.jsonl
bugs.jsonl
.claude/rules/
learned-fix-<slug>.md     -- promoted fix patterns

Not built

An earlier design also had aggregated summaries (fixes.md, metrics.md), a retrospective skill, review-issue tracking and a learning: config block. None of these exist; the raw files above and fix promotion are the whole system.

KAI by Dragan Filipovic