Agent Prime / The System / The Recursive Loop
Layer 07

The Recursive Loop

The loop isn’t a file — it’s what happens when the other six layers work together. Every correction becomes a permanent rule. Every session makes the next one smarter. The system improves itself every time you use it.

Emerges from layers 1–6 · No setup required

The problem

Most AI setups are static. You set them up, they stay the same. There’s no mechanism for the system to get better on its own. You make a correction and it’s a one-time fix, not a compounding improvement.

You tell the AI “stop using jargon in the executive summary” and it does — this session. Next session, it’s back to jargon. The correction never sticks. The same mistake costs you the same effort to fix, over and over.

What gets encoded

The loop isn’t a file — it’s what happens when the other six layers work together. Four mechanisms make it recursive:

Learning Capture
Every correction becomes a permanent rule. The first action after any feedback is to identify the pattern, add it to learnings.md, and mark propagation targets. One correction, zero recurrence.
Automatic Propagation
When a learning is captured, the dependency map shows which agent prompts need updating. The correction reaches every agent that needs it — not just the one that received the feedback.
Successor Chaining
When an agent finishes a task, it writes the next logical task to the dispatch queue. Work chains forward without manual intervention. The system knows what comes next.
Self-Audit
Scripts detect staleness (work items not updated in 7+ days), broken dependencies, and in-progress items that may have crashed. The system flags its own problems before you notice them.

Real example

Here’s how a single correction compounds across sessions in Agent Prime:

The Recursive Loop in Action
Session 1: Writer produces a draft
  → Parth: "Too many frameworks, no reader guide"
  → Learning captured: FM-8 (Right Frameworks Wrong Question)
  → Learning captured: FM-9 (Expert-Only Document)
  → Propagated to: ALL agent prompts

Session 2: Writer reads updated learnings
  → Automatically adds Reader Navigation
  → Automatically adds Context Gate
  → Draft quality jumps

Session 3: New correction surfaces
  → "Framework jargon in Executive Summary"
  → Learning captured: "Zero-jargon exec summary"
  → Propagated to: Writer, Synthesizer, Analyst agents

Each session makes the next one smarter.
The cost of each correction drops to zero
because it never needs to be made again.

The correction in Session 1 is never re-made. It becomes infrastructure. By Session 10, the system has internalized dozens of Parth’s preferences — all applied automatically, before any output is produced.

How to set it up

The loop emerges from the other layers. If you have Identity (layer 1) and Memory (layer 2), you already have a basic loop — corrections persist and compound. Add Agents (layer 3) and the corrections propagate across specialists. Add Orchestration (layer 4) and work chains forward automatically.

The full loop requires all six layers, but you start getting compounding returns from just the first two. The earlier you start capturing corrections, the more sessions you have to compound on.

Layer 1 (Identity) + Layer 2 (Memory)
  → Basic loop: corrections persist

+ Layer 3 (Agents)
  → Corrections propagate to all specialists

+ Layer 4 (Orchestration)
  → Work chains forward automatically

+ Layer 5 (Skills) + Layer 6 (Craft)
  → Expert methodology + publication quality
  → Full recursive loop: system improves itself

You don’t need to build this deliberately. The loop is what you get when you use the other six layers correctly. The files and scripts that power it — learnings.md for corrections, dispatch.md for chaining, integrity_check.py for self-audit, generate_briefing.py for session planning — are already part of the layers above.

What you get

No new files
The loop is the emergent behavior of layers 1–6 working together. What you get is a system that improves itself every time you use it. The compounding is the product.
shared/learnings.md · prime/dispatch.md · meta/scripts/integrity_check.py · meta/scripts/generate_briefing.py