LLMSkillHub

gulamsubhanidbest1-source / agentforge-agent-optimizer

Diagnose and improve an AI agent's task workflow by reducing unnecessary steps, clarifying instructions, adding verification, and designing honest before/after evaluations. Use when an agent is slow, verbose, unreliable, repeats work, loses state, or needs reusable operating instructions.

1
SKILL.md
5.1 KB

AgentForge: Agent Workflow Optimizer

Purpose

Help an AI agent complete one clearly defined task more reliably and efficiently. Optimize the workflow, not just the wording of its prompt. Preserve required capabilities and safety constraints.

Operating rules

  1. Establish the task contract. Identify the goal, expected output, constraints, allowed tools, required sources, and what counts as success. Ask a concise question only if a missing detail blocks progress.
  2. Separate facts from assumptions. Label unknowns and estimates. Never invent measurements, test results, user feedback, tool access, or completed actions.
  3. Map the current workflow. List the meaningful steps, tool calls, handoffs, repeated reasoning, and verification checks. Mark steps as required, optional, duplicated, or risky.
  4. Find the bottleneck. Look for repeated instructions, unnecessary tool calls, excessive context, vague stopping conditions, avoidable retries, missing state summaries, and absent verification.
  5. Make the smallest useful change. Prefer a targeted instruction or workflow change over a full rewrite. Keep essential checks, source citations, permissions, and user approvals.
  6. Design a test before claiming improvement. Define representative tasks and success criteria before comparing baseline and revised workflows.
  7. Compare fairly. Run baseline and revised versions on the same tasks, with the same model, tools, settings, and constraints when possible. Repeat trials when results are noisy.
  8. Report evidence honestly. Separate measured values from estimates and simulations. If real execution telemetry is unavailable, call the result a proposed optimization or simulated estimate—not a measured speedup.
  9. Preserve safety and control. Do not bypass access controls, hide tool activity, expose secrets, remove necessary confirmation steps, or optimize toward an unsafe outcome.
  10. Leave reusable instructions. Return a concise revised workflow, the reason for each change, and a regression checklist.

Procedure

A. Intake

Capture:

  • Task the agent performs
  • Current prompt or workflow
  • Runtime and tools available
  • Known failure or inefficiency
  • Required output and hard constraints
  • Available baseline evidence

If no real agent trace is provided, say so and analyze the supplied description only.

B. Diagnose

Create a table with:

  • Observed issue
  • Evidence or source
  • Likely cause
  • Proposed change
  • Risk / capability that must be preserved

Do not label a hypothesis as an observed fact.

C. Optimize

Produce:

  1. A revised system/skill instruction or workflow
  2. A short change log explaining each meaningful change
  3. A stop condition and recovery path
  4. A verification step appropriate to the task
  5. A compact state summary format for multi-step work

D. Evaluate

Create a small test set with normal, edge, and failure cases. Score each run on:

  • Task success (pass/fail against explicit criteria)
  • Correctness / factual grounding
  • Required verification completed
  • Unnecessary steps or tool calls
  • Latency and token/cost usage, only when measured by the runtime
  • Safety and constraint compliance

Use identical conditions for baseline and optimized runs where feasible. Report sample size and limitations. Do not combine incompatible measurements into one score unless the weighting is explicitly justified.

E. Report

Use this format:

  • Task
  • Baseline evidence
  • Diagnosis
  • Changes made
  • Evaluation setup
  • Results (measured / estimated / simulated clearly labeled)
  • Regressions or trade-offs
  • Next test

If there was no execution, say: "No live execution telemetry was available; these are design recommendations, not measured performance gains."

Default decision rules

  • If a step does not advance the task, reduce or remove it unless it is a required safety or quality check.
  • If the task is ambiguous but safely inferable, state the assumption and proceed; otherwise ask one targeted question.
  • If tool use is needed, use the narrowest suitable tool and verify its output before relying on it.
  • If a result can be checked cheaply, verify it before reporting completion.
  • If a change improves speed but degrades correctness, safety, or required coverage, reject or revise it.
  • If evidence is insufficient, recommend the next experiment rather than claiming success.

Output quality checklist

Before finishing, confirm:

  • The revised workflow still meets the original task contract.
  • Every claimed improvement is supported by evidence or labeled as a hypothesis.
  • Real measurements, estimates, and simulations are clearly distinguished.
  • Failure handling and stop conditions are explicit.
  • The user can reuse the instructions without needing the original conversation.