Lesson 24 of 30 ~15 min
Course progress
0%

When to Stop and Do It Manually

Rozpoznejte kdy AI nepomáhá a je lepší úlohu dokončit ručně.

Někdy je nejefektivnější řešení přestat používat AI. Naučte se rozpoznat tyto situace.

Signály pro escalation

1. Diminishing Returns

Attempt 1: 70% correct
Attempt 2: 75% correct
Attempt 3: 73% correct
Attempt 4: 74% correct
Attempt 5: 72% correct

Indikátor: Po 3+ pokusech se kvalita nezlepšuje.

2. Circular Fixes

You: "Fix bug A"
Claude: Fixes A, introduces B
You: "Fix bug B"  
Claude: Fixes B, re-introduces A

Indikátor: Opravy vytváří nové problémy.

3. Time Investment

Time spent on AI attempts: 45 minutes
Estimated manual time: 20 minutes

Pravidlo: Pokud AI pokusy trvají déle než 2× manuální čas, přestaňte.

4. Domain Mismatch

Request: "Optimize this legacy COBOL code"
Claude: Generic suggestions that don't apply

Indikátor: Model nemá dostatečnou expertise v dané doméně.

Decision Framework

class EscalationChecker:
    def __init__(self):
        self.attempts = 0
        self.quality_scores = []
        self.time_spent = 0
        self.estimated_manual_time = None
    
    def record_attempt(self, quality: float, time_seconds: float):
        self.attempts += 1
        self.quality_scores.append(quality)
        self.time_spent += time_seconds
    
    def should_escalate(self) -> tuple[bool, str]:
        # Too many attempts
        if self.attempts >= 5:
            return True, "Maximum attempts reached"
        
        # Quality plateau
        if len(self.quality_scores) >= 3:
            recent = self.quality_scores[-3:]
            if max(recent) - min(recent) < 0.05:
                return True, "Quality not improving"
        
        # Time exceeded
        if self.estimated_manual_time:
            if self.time_spent > self.estimated_manual_time * 2:
                return True, "Would be faster manually"
        
        # Quality regression
        if len(self.quality_scores) >= 2:
            if self.quality_scores[-1] < self.quality_scores[-2] - 0.1:
                return True, "Quality degrading"
        
        return False, ""

Kdy AI NENÍ vhodná

Komplexní business logic

# ❌ Příliš komplexní pro AI bez deep context
"""
Calculate commission based on:
- Sales region (affects base rate)
- Product category (different margins)
- Customer tier (volume discounts)
- Seasonal adjustments
- Special promotions
- Currency conversions
- Tax implications by jurisdiction
"""

# ✅ Lepší: Napište ručně, pak použijte AI pro review

Přesná regulatorní compliance

# ❌ AI může něco přehlédnout
"Generate GDPR-compliant privacy policy"

# ✅ Lepší: Použijte právníka, AI pro draft

Debugging bez reprodukce

# ❌ AI nemůže hádat
"Why does my app randomly crash on production?"

# ✅ Lepší: Nejdřív reprodukujte, pak použijte AI

Partial AI Usage

Místo úplné AI nebo úplně manuální práce:

Pattern: AI pro 80%, člověk pro 20%

# 1. AI vygeneruje scaffold
scaffold = claude("Generate Express.js API structure")

# 2. Člověk dopíše business logic
# (domain-specific parts)

# 3. AI napíše testy
tests = claude(f"Write tests for: {business_logic}")

# 4. Člověk review a fix

Pattern: AI pro research, člověk pro implementation

# 1. AI prozkoumá možnosti
options = claude("Compare React state management libraries")

# 2. Člověk vybere a implementuje
# (based on project-specific factors AI doesn't know)

Pattern: Člověk pro core, AI pro boilerplate

# 1. Člověk napíše core algoritmus
core_algorithm = manual_implementation()

# 2. AI vygeneruje supporting code
supporting = claude(f"""
Given this core algorithm:
{core_algorithm}

Generate:
- Input validation
- Error handling
- Logging
- Documentation
""")

Graceful Degradation Checklist

Před escalation zkuste:

□ Zjednodušte prompt
□ Poskytněte více kontextu
□ Rozdělte na menší úlohy
□ Zkuste jiný model
□ Zkuste jinou formulaci
□ Resetujte kontext

Pokud nic nepomáhá:
□ Dokumentujte co AI nefungovalo
□ Dokončete manuálně
□ Zvažte proč AI selhala (pro příště)

Lessons Learned Log

class LessonsLog:
    """Zaznamenávejte kdy AI selhala pro budoucí reference"""
    
    def log_escalation(
        self,
        task: str,
        attempts: int,
        failure_reason: str,
        what_worked: str
    ):
        entry = {
            "date": datetime.now().isoformat(),
            "task": task,
            "attempts": attempts,
            "failure_reason": failure_reason,
            "what_worked": what_worked
        }
        
        with open("ai_lessons.jsonl", "a") as f:
            f.write(json.dumps(entry) + "\n")

# Po každé escalation
lessons.log_escalation(
    task="Optimize legacy COBOL",
    attempts=4,
    failure_reason="Model lacks COBOL expertise",
    what_worked="Manual rewrite with AI for documentation only"
)

Vědět kdy přestat je stejně důležité jako vědět kdy začít.