dspy-gepa-reflective

dspy-gepa-reflective is a skill for Claude Code from build-with-dhiraj/ai-workflow-framework-portability-kit. It costs 80 tokens per session (1,808 once invoked), scanned A, original, MIT.

A method for improving multi-step AI agents by having a language model review their execution traces and search through alternative instructions. GEPA is a reflective, feedback-driven optimizer for agent programs.

In plain words
What is it for?
Use it to optimize tool-using agents or other complex workflows when you have training examples and a score with written feedback.
Why use it?
It helps improve agents whose quality depends on several decisions and tool calls, where judging only the final answer may not show what went wrong.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to optimize tool-using agents or other complex workflows when you have training examples and a score with written feedback.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/build-with-dhiraj/ai-workflow-framework-portability-kit/dspy-gepa-reflective
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add build-with-dhiraj/ai-workflow-framework-portability-kit --skill dspy-gepa-reflective
Clone the repo
git clone --depth 1 https://github.com/build-with-dhiraj/ai-workflow-framework-portability-kit

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dspy-gepa-reflective

README.md
[![agentmods](https://agentmods.dev/badge/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/dspy-gepa-reflective/github.svg)](https://agentmods.dev/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/dspy-gepa-reflective)
Your own site
<a href="https://agentmods.dev/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/dspy-gepa-reflective"><img src="https://agentmods.dev/badge/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/dspy-gepa-reflective/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dspy-gepa-reflective

Your own site · 80×15
<a href="https://agentmods.dev/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/dspy-gepa-reflective"><img src="https://agentmods.dev/badge/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/dspy-gepa-reflective.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,808 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00080 $0.01808
Opus 5.5 $0.00032 $0.00723
Sonnet 5.5 $0.00016 $0.00362
Haiku 4.5 $0.00008 $0.00181

Measured 25d ago against content hash 364b19eab03a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

dspy-gepa-reflective scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 25d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Skills/dspy-gepa-reflective/SKILL.md · 206 lines

How it starts

The opening of the file, as written. The whole thing — 206 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DSPy GEPA Optimizer

Goal

Optimize complex agentic systems using LLM reflection on full execution traces with Pareto-based evolutionary search.

When to Use

  • Agentic systems with tool use
  • When you have rich textual feedback on failures
  • Complex multi-step workflows
  • Instruction-only optimization needed

Inputs

Input Type Description
program dspy.Module Agent or complex program
trainset list[dspy.Example] Training examples
metric callable Accepts five arguments and returns dspy.Prediction(score=..., feedback=...)
reflection_lm dspy.LM Strong LM for reflection (GPT-4)
auto str "light", "medium", "heavy"

Outputs

Output Type Description
compiled_program dspy.Module Reflectively optimized program

Workflow

Phase 1: Define Feedback Metric

GEPA requires metrics that return textual feedback:

def gepa_metric(example, pred, trace=None, pred_name=None, pred_trace=None):
    """Return score and actionable feedback for GEPA reflection."""
    is_correct = example.answer.lower() in pred.answer.lower()
    
    if is_correct:
        feedback = "Correct. The answer accurately addresses the question."
    else:
        feedback = f"Incorrect. Expected '{example.answer}' but got '{pred.answer}'. The model may have misunderstood the question or retrieved irrelevant information."
    
    return dspy.Prediction(score=float(is_correct), feedback=feedback)

Phase 2: Setup Agent

import dspy

def search(query: str) -> list[str]:
    """Search knowledge base for relevant information."""
    rm = dspy.ColBERTv2(url='http://20.102.90.50:2017/wiki17_abstracts')
    results = rm(query, k=3)
    return results if isinstance(results, list) else [results]

def calculate(expression: str) -> float:
    """Safely evaluate mathematical expressions."""
    with dspy.PythonInterpreter() as interp:
        return interp(expression)

agent = dspy.ReAct("question -> answer", tools=[search, calculate])

Read the full file on GitHub · 206 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 25d ago First seen · 206 lines · 80 tokens per session scan A 364b19eab03a

Subscribe to this mod's changes

dspy-gepa-reflective is a skill published in the GitHub repository build-with-dhiraj/ai-workflow-framework-portability-kit (5 stars, last pushed 12d ago), licensed MIT. It adds 80 tokens to every session and 1,808 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-21.