Golden Iron Triangle Autonomous Pipeline (P3 Specification)

Autonomous Self-Healing Execution Pipeline

Close the loop between Rules (AgentRules.org), Protocols (mcp-serverlist.com), and Skills (askills.dev). When an invariant violation is detected, agents mount MCP system tools and execute deterministic AST codemods to automatically heal your code.

1. Rules Layer (AgentRules.org)

Defines architectural invariants & RFC constraints (e.g. Next.js 15 must await cookies; MCP stdio must not console.log).

2. Protocol Layer (mcp-serverlist.com)

Dispatches standardized system access via Model Context Protocol tools (filesystem, postgres-mcp, docker-mcp).

3. Execution Layer (askills.dev)

Runs actionable AST transformation codemods and verified recipes to rewrite violating code into verified compliant patterns.

Select Breach Scenario:
11. Detect Invariant Breach
RFC-001 (Clause 1: Asynchronous Request Context)
22. Mount MCP Tool
filesystem:write_file
33. Run askills Codemod
nextjs-async-migrator
44. Verify Zero Invariants
Grade A+ (100% Compliant)
Phase 1: Invariant Violation Detected
CRITICAL BREAK
// ❌ INVARIANT BREACH: Synchronous cookies() call
import { cookies } from "next/headers";

export default function Page() {
  const session = cookies().get("session_token");
  return <div>Welcome {session?.value}</div>;
}
Violated Invariant: Synchronous cookies().get() in Next.js 15 (RFC-001 (Clause 1: Asynchronous Request Context))
Phase 4: Verified Auto-Healed AST
GRADE A+ VERIFIED
// ✅ HEALED: Fully compliant with RFC-001
import { cookies } from "next/headers";

export default async function Page() {
  const session = (await cookies()).get("session_token");
  return <div>Welcome {session?.value}</div>;
}
Remediation Applied: Executed Next.js 15 Async Request Context Codemod via filesystem
Cursor / Claude Code Autonomous Directive

Paste this directive into Cursor or Claude Code to instruct the model to invoke the MCP protocol tool and trigger the askills recipe.

[AUTONOMOUS SELF-HEALING DIRECTIVE - IRON TRIANGLE]
Rule Invariant: Next.js 15 App Router & Server Actions Standard (RFC-001 (Clause 1: Asynchronous Request Context))
Violation Detected: Synchronous cookies().get() in Next.js 15

STEP 1: Mount Protocol Layer (mcp-serverlist.com):
- Protocol Tool: filesystem:write_file
- Action: Inspect target file and preserve AST syntax integrity.

STEP 2: Dispatch Execution Skill (askills.dev):
- Skill Recipe: Next.js 15 Async Request Context Codemod (nextjs-async-migrator)
- Command: npx askills run nextjs-async-migrator --path src/app

STEP 3: Verify Invariant Compliance:
- Ensure zero instances of Synchronous cookies().get() in Next.js 15 remain.
- Confirm AST linter returns Grade A+ (100% compliant).
GitHub Actions Autonomous PR Self-Healing

Automatically commits healed code directly to pull requests when junior devs or AI models introduce invariant bugs.

name: AgentRules Autonomous Self-Healing Pipeline
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  auto-heal-invariants:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.GITHUB_TOKEN }}

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Detect Architectural Invariant Breaches
        id: check
        run: |
          npx agentrules check src/ --output-json report.json || echo "violations_found=true" >> $GITHUB_OUTPUT

      - name: Mount MCP Protocol & Execute askills Auto-Remediation
        if: steps.check.outputs.violations_found == 'true'
        run: |
          echo "🔧 Invariant violations detected. Mounting Iron Triangle Remediation..."
          npx agentrules check src/ --fix

      - name: Commit & Push Verified Auto-Healed Code
        if: steps.check.outputs.violations_found == 'true'
        run: |
          git config user.name "AgentRules Iron Triangle Bot"
          git config user.email "[email protected]"
          git add .
          git diff-index --quiet HEAD || (git commit -m "chore(auto-heal): remediate invariant violations via askills.dev" && git push)