LoopForge icon indicating copy to clipboard operation
LoopForge copied to clipboard

[Feature]: Native Asset Governance & Evaluation SOP Pipeline

Open iamvince opened this issue 1 week ago • 2 comments

Problem Statement

In LLM engineering teams, modifying Prompts, Agents, Rules, or Skills can trigger regressions in production workflows. Today in LoopForge:

  1. Linear Revisions Without Gatekeeping: While LoopForge supports linear snapshot revisions for Agents and Workflows (agents_revisions_list, agents_revision_restore), updates are committed immediately without an intermediate candidate staging or evaluation phase.
  2. Missing Formal Asset Lifecycle: There is no native multi-stage status tracking (e.g., DRAFT → IN_REVIEW → APPROVED / CHANGES_REQUESTED → PUBLISHED → ARCHIVED).
  3. No Automated Regression Benchmarking: Changes to system instructions or rules are not automatically verified in an isolated Docker sandbox against baseline evaluation suites before going live.

Proposed Solution

We propose introducing a Native Asset Governance & Evaluation SOP Template (generic-asset-governance) into LoopForge’s built-in catalog, along with asset lifecycle state tracking.

This allows LoopForge to self-govern its own assets (Prompts, Agents, Rules, Skills) using its existing workflow runner, sandboxes, and approval APIs.

1. Asset Lifecycle State Machine

Each asset version candidate moves through five discrete states:

 [ DRAFT / FORK ] 
        │
        ▼
 [ IN_REVIEW ] ───────► (Automated Sandbox Eval + Diff Linting)
        │
        ├───► [ CHANGES_REQUESTED ] ──► (Feedback fed back to author)
        │
        ▼
 [ APPROVED ]  ───────► (Human Approval via /api/runs/:id/approve)
        │
        ▼
 [ PUBLISHED ] ───────► (Active in catalog; previous version marked ARCHIVED)

Workflow DAG Architecture (generic-asset-governance)

The proposed built-in template runs as an autonomous 5-node SOP:

graph TD
    A[Node 1: Draft Ingestion & Fork] --> B[Node 2: Sandbox Regression Eval]
    B --> C[Node 3: Diff & Quality Linting]
    C --> D[Node 4: Human Review & Approval Gate]
    D -->|Approved| E[Node 5: Publish & Snapshot Revision]
    D -->|Rejected / Revise| F[Node 5b: Reopen Issue with Feedback]

Node Specifications:

  1. draft_ingestion (Draft & Fork):

    • Inputs: Candidate asset payload (e.g. updated prompt/agent instructions), target asset ID, benchmark dataset reference.
    • Action: Clones the active version into a staging draft state without affecting the production asset.
  2. automated_sandbox_eval (Docker Sandbox Execution):

    • Utilizes LoopForge's native sandbox environment (sandboxes_save, Docker runner).
    • Runs candidate prompt/agent against test cases in the sandbox.
    • Measures token consumption, latency, and assertion pass rates against the currently published baseline.
    • Emits: eval-report.json and summary table.
  3. diff_and_policy_check (Verification & Diff Generation):

    • Computes structured line-by-line diff between the candidate and active production version.
    • Performs static analysis (Jinja2 syntax validity, forbidden tokens, parameter schemas).
    • Generates an artifact: CHANGE_SUMMARY.md with visual diffs and evaluation score comparison.
  4. human_approval_gate (Human-in-the-Loop Gate):

    • Pauses the workflow execution run (is_paused=true).
    • Presents the CHANGE_SUMMARY.md and benchmark delta to reviewers in the UI.
    • Integrates directly with LoopForge's existing endpoints:
      • POST /api/runs/:id/approve (Lead/Admin approvals)
      • POST /api/runs/:id/reject (Changes requested)
  5. publish_and_snapshot (Catalog Commit):

    • On approval:
      • Creates an immutable revision snapshot (agents_revisions_save).
      • Points the active catalog reference to the new version.
      • Tags the release with an automated changelog.

Implementation Mapping in LoopForge Codebase

  1. Catalog Seed Template:
    • Add generic-asset-governance to migrations/seed/001_public_catalog.sql under public workflow templates.
  2. SOP Lane Classification:
    • Utilize the existing internal/domain/sop_lane.go classification (other or dedicated governance lane).
  3. Execution & Approval:
    • Leverage internal/httpapi/project_write_access.go and internal/httpapi/runs.go which already support RBAC-controlled run approvals and cancellations.

Benefits to LoopForge

  • Zero External Dependencies: Eliminates the need to integrate third-party prompt/agent VCS tools.
  • True CI/CD for AI Agents: Gives LoopForge users automated regression testing for agent instructions inside isolated Docker containers before merging to production.
  • Dogfooding LoopForge's Own Strengths: Demonstrates the power of LoopForge's SOP engine by using it to manage and test its own agent/prompt assets.

Related Issues

  • Complements #1324 ([Feature]: Add first-class Prompt asset registry and Jinja2 dynamic templating)

Pre-submission Checks

  • [x] I have searched existing issues and PRs to ensure this is not a duplicate.
  • [x] I have read the Contributing Guidelines.
  • [x] This is a feature request directly enhancing LoopForge's asset lifecycle and workflow capabilities.

iamvince avatar Nov 25 '26 06:11 iamvince

Thanks for the feedback. I understand this as a request for a built-in asset governance flow, so changes to prompts, agents, rules, and skills can go through draft, evaluation, review, and publish instead of taking effect immediately.

We've seen this issue and will look at it along with the existing issue queue.

cocofhu00 avatar Nov 25 '26 08:11 cocofhu00

Any update on this?

iamvince avatar Nov 30 '26 21:11 iamvince