AgentSkillsCN

optimization-workflow-orchestrator

【统筹者】负责管理 Truffle 语言的性能优化工作流程。入口条件:用户希望优化性能。工作流程:首先明确当前状态,依次执行相应阶段的技能(1→2→3/4→4),直至达成性能目标。其中,第三阶段的执行与否取决于“需深入探究”字段的设置。重要提示:这是所有优化工作的统一入口点。

SKILL.md
--- frontmatter
name: optimization-workflow-orchestrator
description: "[ORCHESTRATOR] Manages performance optimization workflow for Truffle languages. Entry: User wants to optimize performance. Process: Determines current state, executes appropriate phase skill (1→2→3/4→4), loops until performance goals met. Phase 3 is conditional based on 'Deeper Investigation' field. IMPORTANT: Single entry point for all optimization work."

Optimization Workflow Orchestrator

Orchestrates the complete performance optimization workflow. Single entry point that manages state, transitions, and termination.

Quick Start

Step 1: Determine current state (see State Detection below)

Step 2: Execute the appropriate phase skill

Step 3: After phase completes, re-evaluate state and continue or terminate

State Detection

Check files in this order to determine current phase:

text
1. BENCHMARK_BASELINE.md exists?
   NO  → Execute PHASE 1 (establishing-benchmark-baseline)
   YES → Continue to check 2

2. PERFORMANCE_THEORIES.md exists?
   NO  → Execute PHASE 2 (broad-performance-investigation)
   YES → Continue to check 3

3. Any theory with status "verified"?
   YES → Execute PHASE 4 (implementing-performance-fixes) for highest severity verified theory
   NO  → Continue to check 4

4. Any theory with status "pending"?
   YES → Select highest severity pending theory:
         - If "Deeper Investigation: SKIP" → Execute PHASE 4 (implementing-performance-fixes)
         - If "Deeper Investigation: REQUIRED" → Execute PHASE 3 (deep-performance-investigation)
   NO  → Continue to check 5

5. All theories have status "fixed" or "fix-failed" or "falsified"?
   YES → Evaluate termination (see below)
   NO  → Error state, ask user

Priority Order for Theory Selection:

  1. Prioritize by Severity: Critical > High > Medium > Low
  2. If multiple theories share the same severity, select the first one
  3. Respect "Deeper Investigation" decision (SKIP→Phase 4, REQUIRED→Phase 3)
  4. This ensures critical performance issues are addressed before easy fixes

Phase Skills

PhaseSkillPurpose
1establishing-benchmark-baselineCreate benchmarks and baseline
2broad-performance-investigationAnalyze code, generate theories
3deep-performance-investigationProve/disprove theories with tools
4implementing-performance-fixesImplement fix, validate improvement

Termination Criteria

After all theories are processed (fixed/fix-failed/falsified), evaluate:

Continue optimization (loop to PHASE 2) if:

  • User requests more optimization

Stop optimization if:

  • One optimization iteration completed
  • User didn't request more optimization
  • Performance meets or exceeds baseline expectations
  • User indicates satisfaction
  • No more theories can be generated (diminishing returns)
  • All recent fixes failed (indicates deeper issues)

Edge Cases

SituationAction
All theories falsifiedLoop to PHASE 2 with different focus
No performance gap foundOptimization complete, congratulate user

Workflow Visualization

mermaid
flowchart TD
    Start([Start]) --> P1[PHASE 1<br/>Baseline]
    P1 --> P2[PHASE 2<br/>Theories]

    P2 -->|Deeper Investigation:<br/>SKIP| P4[PHASE 4<br/>Fix]
    P2 -->|Deeper Investigation:<br/>REQUIRED| P3[PHASE 3<br/>Verify]

    P3 --> P4

    P4 -->|Gaps remain| P3
    P4 -->|Done| End([Complete])

Key paths:

  • Phase 2 → Phase 4 directly if "Deeper Investigation: SKIP" (definitive evidence + low-risk fix)
  • Phase 2 → Phase 3 → Phase 4 if "Deeper Investigation: REQUIRED" (circumstantial evidence OR high-risk fix)

Orchestrator Checklist

Copy this to track progress:

text
Optimization Progress:
- [ ] State determined
- [ ] PHASE 1: Baseline established (BENCHMARK_BASELINE.md exists)
- [ ] PHASE 2: Theories generated (PERFORMANCE_THEORIES.md exists)
- [ ] PHASE 3: Theory verified (at least one verified)
- [ ] PHASE 4: Fix implemented and validated
- [ ] Termination evaluated
- [ ] Loop or complete

Integration

This skill CALLS the phase skills:

  • establishing-benchmark-baseline (PHASE 1)
  • broad-performance-investigation (PHASE 2)
  • deep-performance-investigation (PHASE 3)
  • implementing-performance-fixes (PHASE 4)

This skill does NOT call tool skills directly. Tool skills are called by PHASE 3.