agent-patterns

reflexive-loop

flowchart TD
    Run([Pipeline run]) --> Output[Agent output]
    Output --> Feedback[External feedback\ncapture]
    Feedback --> Learn[learn agent\nextracts rules]
    Learn --> Persist[Append rules to\nCLAUDE.md]
    Persist --> NextRun([Next pipeline run\nloads updated rules])
    NextRun --> Output

A pipeline observes its own past outputs and modifies its instruction set persistently. Rules extracted from human feedback are encoded into CLAUDE.md (or equivalent prompt files) and loaded automatically on every subsequent run — no human re-intervention required.

How it works

  1. The pipeline produces an output (PR, doc, code review).
  2. A human reviews and provides feedback — inline comments, corrections, explicit instructions.
  3. A learn agent reads the session transcript and feedback, extracts discrete, actionable rules.
  4. Rules are appended to CLAUDE.md (workspace root, repo-level, or a per-domain skill file).
  5. The next pipeline run loads the enriched instruction set automatically — the agent is stricter, more aligned, without any prompt editing by the developer.

Status

Reference implementation only (impl.mjs). Neither repo runs an automated learn step yet; both expose the persistence vector it would write to:

ai-dev-tools

autonomous-dev-loop

When to use

When not to use

Trade-offs

   
Pro Nit-pick rate decreases measurably across runs without prompt engineering effort
Pro Rules are visible, versioned, and reviewable — unlike fine-tuning or vector memory
Con Incorrect feedback produces incorrect rules; garbage in, garbage persists
Con CLAUDE.md grows unbounded without a pruning strategy; contradictions accumulate
Con Rule extraction quality depends on session transcript completeness

Failure modes