🎯

dag-iteration-detector

🎯Skill

from erichowens/some_claude_skills

VibeIndex|
What it does

dag-iteration-detector skill from erichowens/some_claude_skills

πŸ“¦

Part of

erichowens/some_claude_skills(148 items)

dag-iteration-detector

Installation

Add MarketplaceAdd marketplace to Claude Code
/plugin marketplace add erichowens/some_claude_skills
Install PluginInstall plugin from marketplace
/plugin install adhd-design-expert@some-claude-skills
Install PluginInstall plugin from marketplace
/plugin install some-claude-skills@some-claude-skills
git cloneClone repository
git clone https://github.com/erichowens/some_claude_skills.git
Claude Desktop ConfigurationAdd this to your claude_desktop_config.json
{ "mcpServers": { "prompt-learning": { "command": "npx", "args...
πŸ“– Extracted from docs: erichowens/some_claude_skills
10Installs
21
-
Last UpdatedJan 23, 2026

Skill Details

SKILL.md

Identifies when task outputs require iteration based on quality signals, unmet requirements, or explicit feedback. Triggers appropriate re-execution strategies. Activate on 'needs iteration', 'retry needed', 'not good enough', 'try again', 'refine output'. NOT for feedback generation (use dag-feedback-synthesizer) or convergence tracking (use dag-convergence-monitor).

Overview

You are a DAG Iteration Detector, an expert at identifying when task outputs require additional iteration. You analyze quality signals, validation results, confidence scores, and explicit feedback to determine when re-execution is needed and what type of iteration strategy is appropriate.

Core Responsibilities

1. Iteration Trigger Detection

  • Analyze validation failures
  • Check confidence thresholds
  • Detect incomplete outputs
  • Process explicit feedback

2. Iteration Strategy Selection

  • Determine retry vs refinement
  • Select appropriate iteration type
  • Configure iteration parameters

3. Iteration Budget Management

  • Track iteration counts
  • Enforce iteration limits
  • Prevent infinite loops

4. Improvement Potential Assessment

  • Estimate likelihood of improvement
  • Assess diminishing returns
  • Recommend escalation when needed

Detection Architecture

```typescript

interface IterationDecision {

needsIteration: boolean;

triggers: IterationTrigger[];

strategy: IterationStrategy;

priority: 'low' | 'medium' | 'high' | 'critical';

budget: IterationBudget;

recommendation: IterationRecommendation;

}

interface IterationTrigger {

type: TriggerType;

source: string;

severity: number; // 0-1

details: string;

fixable: boolean;

}

type TriggerType =

| 'validation_failure'

| 'low_confidence'

| 'incomplete_output'

| 'explicit_feedback'

| 'hallucination_detected'

| 'requirement_unmet'

| 'quality_threshold'

| 'user_rejection';

interface IterationStrategy {

type: 'retry' | 'refine' | 'expand' | 'simplify' | 'escalate';

modifications: StrategyModification[];

contextAdjustments: ContextAdjustment[];

}

```

Trigger Detection

```typescript

interface QualitySignals {

validation: ValidationResult;

confidence: ConfidenceScore;

hallucination: HallucinationReport;

userFeedback?: UserFeedback;

requirements: RequirementStatus[];

}

function detectIterationTriggers(

output: TaskOutput,

signals: QualitySignals,

config: DetectionConfig

): IterationTrigger[] {

const triggers: IterationTrigger[] = [];

// Check validation failures

if (!signals.validation.valid) {

triggers.push(...extractValidationTriggers(signals.validation));

}

// Check confidence threshold

if (signals.confidence.calibrated < config.minConfidence) {

triggers.push({

type: 'low_confidence',

source: 'confidence-scorer',

severity: 1 - signals.confidence.calibrated,

details: Confidence ${(signals.confidence.calibrated 100).toFixed(0)}% below threshold ${(config.minConfidence 100).toFixed(0)}%,

fixable: true,

});

}

// Check for hallucinations

if (signals.hallucination.overallRisk !== 'low') {

triggers.push(...extractHallucinationTriggers(signals.hallucination));

}

// Check explicit user feedback

if (signals.userFeedback?.sentiment === 'negative') {

triggers.push({

type: 'explicit_feedback',

source: 'user',

severity: 0.9,

details: signals.userFeedback.message,

fixable: true,

});

}

// Check unmet requirements

const unmetRequirements = signals.requirements.filter(r => !r.met);

for (const req of unmetRequirements) {

triggers.push({

type: 'requirement_unmet',

source: 'requirement-checker',

severity: req.priority === 'required' ? 0.9 : 0.5,

details: Requirement not met: ${req.description},

fixable: req.fixable,

});

}

// Check for incomplete output

const completeness = assessCompleteness(output);

if (completeness < config.minCompleteness) {

triggers.push({

type: 'incomplete_output',

source: 'completeness-checker',

severity: 1 - completeness,

details: Output ${(completeness 100).toFixed(0)}% complete, minimum ${(config.minCompleteness 100).toFixed(0)}%,

fixable: true,

});

}

return triggers;

}

function extractValidationTriggers(validation: ValidationResult): IterationTrigger[] {

return validation.errors.map(error => ({

type: 'validation_failure' as const,

source: 'output-validator',

severity: error.severity === 'critical' ? 1.0 : 0.7,

details: ${error.path}: ${error.message},

fixable: !['TYPE_MISMATCH', 'SCHEMA_VIOLATION'].includes(error.code),

}));

}

function extractHallucinationTriggers(report: HallucinationReport): IterationTrigger[] {

return report.findings

.filter(f => f.severity !== 'warning')

.map(finding => ({

type: 'hallucination_detected' as const,

source: 'hallucination-detector',

severity: finding.severity === 'confirmed' ? 1.0 : 0.7,

details: ${finding.type}: ${finding.claim},

fixable: true,

}));

}

```

Strategy Selection

```typescript

function selectIterationStrategy(

triggers: IterationTrigger[],

history: IterationHistory,

context: TaskContext

): IterationStrategy {

// Analyze trigger patterns

const triggerTypes = new Set(triggers.map(t => t.type));

const avgSeverity = triggers.reduce((sum, t) => sum + t.severity, 0) / triggers.length;

// Check iteration history

const previousAttempts = history.attempts;

const lastStrategy = history.lastStrategy;

// If same triggers after retry, try refinement

if (lastStrategy?.type === 'retry' && hasSameTriggers(triggers, history.lastTriggers)) {

return {

type: 'refine',

modifications: generateRefinementModifications(triggers),

contextAdjustments: [

{ type: 'add_guidance', content: 'Focus on specific issues identified' },

{ type: 'increase_detail', factor: 1.5 },

],

};

}

// Validation failures - retry with fixes

if (triggerTypes.has('validation_failure')) {

return {

type: 'retry',

modifications: [

{ type: 'fix_errors', targets: triggers.filter(t => t.type === 'validation_failure') },

],

contextAdjustments: [

{ type: 'add_schema_guidance', schema: context.expectedSchema },

],

};

}

// Low confidence - expand with more detail

if (triggerTypes.has('low_confidence')) {

return {

type: 'expand',

modifications: [

{ type: 'request_evidence', areas: extractLowConfidenceAreas(triggers) },

{ type: 'request_sources' },

],

contextAdjustments: [

{ type: 'add_guidance', content: 'Provide more evidence and reasoning' },

],

};

}

// Hallucinations - retry with verification emphasis

if (triggerTypes.has('hallucination_detected')) {

return {

type: 'retry',

modifications: [

{ type: 'remove_claims', claims: extractFalseClaims(triggers) },

{ type: 'require_verification' },

],

contextAdjustments: [

{ type: 'add_guidance', content: 'Verify all factual claims before including' },

{ type: 'restrict_sources', allowedSources: context.verifiedSources },

],

};

}

// Too many iterations - escalate

if (previousAttempts >= context.maxIterations - 1) {

return {

type: 'escalate',

modifications: [

{ type: 'flag_for_human', reason: 'Max iterations reached' },

],

contextAdjustments: [],

};

}

// Default: simple retry

return {

type: 'retry',

modifications: [],

contextAdjustments: [

{ type: 'add_guidance', content: 'Address the identified issues' },

],

};

}

```

Iteration Budget

```typescript

interface IterationBudget {

maxIterations: number;

currentIteration: number;

remainingIterations: number;

tokenBudget: number;

usedTokens: number;

remainingTokens: number;

timeoutMs: number;

elapsedMs: number;

remainingMs: number;

}

function checkIterationBudget(

current: IterationBudget,

estimatedCost: IterationCost

): BudgetCheck {

const checks = {

iterations: current.remainingIterations > 0,

tokens: current.remainingTokens >= estimatedCost.tokens,

time: current.remainingMs >= estimatedCost.estimatedMs,

};

return {

canIterate: checks.iterations && checks.tokens && checks.time,

blockers: Object.entries(checks)

.filter(([_, ok]) => !ok)

.map(([resource]) => resource),

warnings: generateBudgetWarnings(current, estimatedCost),

};

}

function updateBudget(

budget: IterationBudget,

iterationResult: IterationResult

): IterationBudget {

return {

...budget,

currentIteration: budget.currentIteration + 1,

remainingIterations: budget.remainingIterations - 1,

usedTokens: budget.usedTokens + iterationResult.tokensUsed,

remainingTokens: budget.remainingTokens - iterationResult.tokensUsed,

elapsedMs: budget.elapsedMs + iterationResult.durationMs,

remainingMs: budget.remainingMs - iterationResult.durationMs,

};

}

```

Improvement Assessment

```typescript

interface ImprovementAssessment {

likelihood: number; // 0-1 probability of improvement

expectedGain: number; // 0-1 expected quality improvement

diminishingReturns: boolean; // Whether we're seeing diminishing returns

recommendation: 'iterate' | 'accept' | 'escalate' | 'abort';

}

function assessImprovementPotential(

history: IterationHistory,

triggers: IterationTrigger[],

budget: IterationBudget

): ImprovementAssessment {

// Calculate improvement trend

const qualityScores = history.iterations.map(i => i.qualityScore);

const trend = calculateTrend(qualityScores);

// Check for plateauing

const recentScores = qualityScores.slice(-3);

const variance = calculateVariance(recentScores);

const isPlateauing = variance < 0.02 && recentScores.length >= 3;

// Estimate likelihood based on trigger fixability

const fixableTriggers = triggers.filter(t => t.fixable);

const fixabilityRatio = fixableTriggers.length / triggers.length;

// Calculate expected gain

const avgTriggerSeverity = triggers.reduce((sum, t) => sum + t.severity, 0) / triggers.length;

const expectedGain = fixabilityRatio avgTriggerSeverity (isPlateauing ? 0.3 : 0.7);

// Determine recommendation

let recommendation: ImprovementAssessment['recommendation'];

if (budget.remainingIterations === 0) {

recommendation = 'accept'; // Out of budget

} else if (isPlateauing && trend < 0.01) {

recommendation = 'escalate'; // Not improving

} else if (expectedGain < 0.1) {

recommendation = 'accept'; // Not worth iterating

} else if (fixabilityRatio < 0.3) {

recommendation = 'escalate'; // Can't fix most issues

} else {

recommendation = 'iterate';

}

return {

likelihood: fixabilityRatio * (1 - (isPlateauing ? 0.5 : 0)),

expectedGain,

diminishingReturns: isPlateauing,

recommendation,

};

}

```

Decision Report

```yaml

iterationDecision:

taskId: code-review-task

outputId: review-attempt-2

decidedAt: "2024-01-15T10:30:00Z"

decision:

needsIteration: true

priority: high

triggers:

- type: validation_failure

source: output-validator

severity: 0.8

details: "$.analysis.security: Required field 'security' is missing"

fixable: true

- type: low_confidence

source: confidence-scorer

severity: 0.4

details: "Confidence 62% below threshold 75%"

fixable: true

- type: requirement_unmet

source: requirement-checker

severity: 0.6

details: "Requirement not met: Must include performance analysis"

fixable: true

strategy:

type: refine

modifications:

- type: fix_errors

targets: ["security field", "performance analysis"]

- type: request_evidence

areas: ["security assessment", "performance metrics"]

contextAdjustments:

- type: add_guidance

content: "Add security section and performance analysis with metrics"

- type: increase_detail

factor: 1.3

budget:

maxIterations: 5

currentIteration: 2

remainingIterations: 3

tokenBudget: 50000

usedTokens: 12500

remainingTokens: 37500

assessment:

likelihood: 0.75

expectedGain: 0.35

diminishingReturns: false

recommendation: iterate

nextSteps:

- "Add security analysis section"

- "Include performance metrics"

- "Increase evidence and citations"

```

Integration Points

  • Input: Quality signals from validation, confidence, hallucination detection
  • Output: Iteration decisions to dag-dynamic-replanner
  • Feedback: Sends triggers to dag-feedback-synthesizer
  • Tracking: Reports to dag-convergence-monitor

Best Practices

  1. Multi-Signal Analysis: Don't rely on single trigger
  2. Budget Awareness: Always check remaining budget
  3. Trend Detection: Identify plateauing early
  4. Escalation Path: Know when to stop iterating
  5. Strategy Variety: Don't repeat failed strategies

---

Smart iteration. Know when to retry. Know when to stop.