SuperAPI AI Directory

triple-loop-learning

Agents & models

View repository

Updated 10-16 08:00

About this skill

Dependencies

This skill requires Python 3.8+ and standard library only.

Evaluation gate: NOT included in this primitive. The calling system (e.g., agent-agentic-os os-improvement-loop) is responsible for wrapping this skill with an eval gate and experiment log.


Triple-Loop Learning (Meta-Learning System)

This skill defines the orchestration pattern for the Triple-Loop Architecture. Pattern 5 is a robust, autonomous feedback loop where an independent Meta-Learning Orchestrator governs a long-horizon pipeline of execution, planning, and tactical problem-solving.

This architecture is entirely framework-agnostic. While originally developed for agent-agentic-os, it models the core loop defined by Meta-Harness research where autonomous systems evolve their own operating instructions based strictly on headless evaluators.

Architecture Overview

flowchart TD
    subgraph Outer["Outer Loop (Meta-Learning & Orchestration)"]
        Hypothesize[Hypothesis Generation] --> StrategyBridge[Strategy Packet]
        Report --> EvalBridge[Score Analysis]
        EvalBridge --> Conclude[Accept / Reject Hypothesis]
    end

    subgraph Mid["Strategic Planner (Dual-Loop Integration)"]
        Plan[Define Sub-tasks] --> TacticalBridge[Handoff Packet]
        Result[Aggregate Results] --> Report[Generate Report]
    end

    subgraph Inner["Tactical Executor (Single-Loop Integration)"]
        Execute[Code Mutation] --> Test[Headless Evaluation]
        Test --> ResultBridge[Pass/Fail Signal]
    end

    StrategyBridge --> Plan
    TacticalBridge --> Execute
    ResultBridge --> Result

The Workflow Protocol

Step 1: Friction Aggregation (Outer Loop)

  1. The Orchestrator constantly ingests execution logs from existing operations. Look for repeated uncertainties, API errors, test failures, or syntax flaws.
  2. Group the friction into clustered tasks.

Step 2: Hypothesis Generation (Outer Loop)

  1. Define a singular thesis: "If we change instruction X, the accuracy score on benchmark Y will improve by N."
  2. Write a rigid Strategy Packet for the Mid-level Planner.

Step 3: Distribution (Strategic Planner)

  1. Interactively Determine CLI and Model (ask once during bootstrap): Interactively prompt the user to select the CLI backend (agy, claude, copilot, etc.) and the specific model to run mutations and evaluation.
  2. The Planner assigns disjoint code fixes to one or multiple Tactical Executors using the selected CLI and model.
  3. Ensure test boundaries and standard input redirection (appending < /dev/null to commands) are defined to prevent SIGTTIN process freezes.

Step 4: Mutation & Headless Scoring (Tactical Executor)

Constraint: Subjective LLM analysis is expressly prohibited.

  1. Apply the instruction set or code adjustment.
  2. Run pure, headless deterministic tests. Return an objective integer/float score, not opinions.

Step 5: Verification & Promotion (Outer Loop - Trust But Verify)

  1. Read the objective score differentials. No blind trust is allowed.
  2. TDD / Test Check: The promotion logic MUST be backed by headless evaluation. Run the full regression test suite on mutated code.
  3. Delta Inspection: Check the source diffs for any stub placeholders ("TODO", "TBD", "[NEEDS INPUT]") and verify syntax cleanliness.
  4. KEEP only if Accuracy AND F1 score pass the current baseline. Reject otherwise.
  5. Postulate a retrospective mapping for continuous system-wide instructions improvement.