Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0x4m4 Hexstrike ai Error Classification and Recovery

From Leeroopedia
Knowledge Sources
Domains Error_Handling, Recovery, Reliability
Last Updated 2026-10-10 00:00 GMT

Overview

Technique for classifying errors via pattern matching and selecting recovery strategies by scoring success probability against time cost, with automatic parameter adjustment.

Description

The Error Classification and Recovery principle describes a two-stage approach to error handling. First, errors are classified into discrete types using regex pattern matching on error messages and exception type checking. Each error type maps to a set of recovery strategies. Second, the best strategy is selected by scoring each viable strategy's adjusted success probability (discounted by attempt count) minus its time cost. This ensures the system prefers fast, high-probability strategies early and escalates only when all options are exhausted.

Usage

Apply this principle when building systems that need autonomous error recovery:

  • Multi-strategy recovery: Not just retry—classify, then choose the right action
  • Strategy scoring: Balance success probability against time cost
  • Attempt-aware discounting: Later attempts get lower success probabilities

Theoretical Basis

The strategy selection formula:

score=Psuccess×0.9(n−1)−testimated1000

Where n is the attempt count, Psuccess is the base success probability, and testimated is the estimated recovery time in seconds.

# Abstract pattern (NOT real implementation)
def select_best_strategy(strategies, context):
    viable = [s for s in strategies if context.attempt_count <= s.max_attempts]
    if not viable:
        return escalate_strategy()

    scored = []
    for s in viable:
        adjusted_prob = s.success_probability * (0.9 ** (context.attempt_count - 1))
        score = adjusted_prob - (s.estimated_time / 1000.0)
        scored.append((score, s))

    return max(scored, key=lambda x: x[0])[1]

Related Pages

Uses Heuristic

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment