--- id: wiki-2026-0508-improvisation title: Improvisation category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Improv, Adaptive Response, Spontaneous Decision-Making] duplicate_of: none source_trust_level: B confidence_score: 0.85 verification_status: applied tags: [meta, decision-making, agentic, exploration] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: python framework: general --- # Improvisation ## 매 한 줄 > **"매 plan 의 die 매 first contact, 매 improv 매 take over"**. Improvisation 매 real-time adaptive decision-making 매 incomplete information 매 unfolding situation. 2026 LLM agents 매 nontrivial improv capability 의 exhibit — 매 tool failure / unexpected output 의 recover 가능. ## 매 핵심 ### 매 Components of improv - **Situation awareness**: 매 current state 의 fast read. - **Repertoire**: 매 prelearned moves / patterns. - **Risk gauge**: 매 reversible vs irreversible 의 distinguish. - **Commitment**: 매 hesitation 의 X — 매 decide 의 act. ### 매 Plan vs Improv spectrum - **Pure plan**: scripted, deterministic, fragile. - **Plan + improv**: skeleton plan + adaptive details (best for most tasks). - **Pure improv**: jazz solo, emergency response. - 매 majority production system 매 plan-with-improv-edges. ### 매 LLM agent improvisation - 매 tool returns unexpected error → reformulate vs fail. - 매 user gives ambiguous instruction → ask vs guess vs proceed. - 매 token budget 매 exhaust → compress vs truncate vs delegate. ### 매 응용 1. Incident response (production outage). 2. Live coding session (pair programming). 3. LLM agent error recovery. 4. Customer support edge cases. ## 💻 패턴 ### Pattern 1: Repertoire of moves ```python from typing import Callable class ImprovKit: """매 prelearned moves — 매 situation 의 match 의 dispatch.""" def __init__(self): self.moves: dict[str, Callable] = {} def register(self, situation: str, move: Callable): self.moves[situation] = move def respond(self, context: dict): for situation, move in self.moves.items(): if matches(situation, context): return move(context) return self.default_move(context) def default_move(self, context): return {"action": "ask_for_clarification"} ``` ### Pattern 2: Reversibility check before commit ```python def is_reversible(action: dict) -> bool: irreversible = {"delete_file", "send_email", "db_drop", "git_push_force"} return action["type"] not in irreversible def improv_decide(action: dict, confidence: float) -> str: if is_reversible(action): return "act" # 매 try 의 cheap if confidence > 0.95: return "act" return "pause_and_verify" ``` ### Pattern 3: LLM error recovery loop ```python def call_with_improv(client, prompt: str, max_retries: int = 3): history = [{"role": "user", "content": prompt}] for attempt in range(max_retries): try: return client.messages.create( model="claude-opus-4-7", max_tokens=2000, messages=history, ) except RateLimitError: time.sleep(2 ** attempt) except OverloadedError: # 매 fallback 매 smaller model return client.messages.create( model="claude-haiku-4-7", max_tokens=2000, messages=history, ) except Exception as e: history.append({ "role": "user", "content": f"Previous attempt errored: {e}. Try a different approach.", }) raise RuntimeError("매 improv 의 exhaust") ``` ### Pattern 4: Yes-and (improv principle) ```python def yes_and(user_input: str, context: dict) -> str: """매 improv 'Yes, and' — accept premise, build on it.""" return f"Acknowledged: {user_input}. Building on this: {extend(user_input, context)}." # 매 LLM system prompt 의 embed: SYSTEM = """매 user 매 partial information 의 give. 매 yes-and 의 follow: 1. Accept what they said as fact (yes). 2. Add useful structure (and). 3. Avoid 'no, that's wrong' unless 매 hard contradiction.""" ``` ### Pattern 5: Bounded improv (safety rail) ```python class BoundedImprov: def __init__(self, max_actions: int = 5, allowed_ops: set = None): self.max_actions = max_actions self.allowed_ops = allowed_ops or {"read", "search", "summarize"} self.actions_taken = 0 def attempt(self, op: str, *args): if self.actions_taken >= self.max_actions: raise RuntimeError("매 budget exceed — escalate 의 human") if op not in self.allowed_ops: raise PermissionError(f"매 {op} 매 not in improv allowlist") self.actions_taken += 1 return execute(op, *args) ``` ### Pattern 6: Postmortem of improv ```python def improv_log_entry(situation: str, move: str, outcome: str) -> dict: return { "ts": time.time(), "situation": situation, "move_chosen": move, "outcome": outcome, "would_repeat": outcome in ("success", "partial_success"), "alternatives_considered": [], } # 매 weekly review 매 add successful patterns 의 ImprovKit. ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | Reversible action, < 1min | Pure improv. | | Irreversible, high stakes | Plan first — improv 의 X. | | Ambiguous user request | Yes-and + clarifying question. | | LLM tool error | Bounded retry + reformulation. | | Production incident | Plan (runbook) + improv on edges. | **기본값**: 매 80/20 — 80% plan, 20% improv 매 unforeseen edges. 매 irreversible 매 strict plan only. ## 🔗 Graph - 부모: [[Decision-Making]] - 응용: [[Pair-Programming]] - Adjacent: [[Risk_Management|Risk-Management]] · [[Bounded_Rationality|Bounded-Rationality]] ## 🤖 LLM 활용 **언제**: Tool error recovery, ambiguous user input handling, edge cases not covered by training data, multi-turn agent self-correction. **언제 X**: Compliance-critical workflow (deterministic pipeline only), safety-critical irreversible action. ## ❌ 안티패턴 - **Improv on irreversible action**: 매 prod DB drop 의 wing 의 X. - **No repertoire**: 매 from-scratch every situation — slow + inconsistent. - **No reversibility check**: 매 acted 매 then-realized too late. - **Ego improv**: refuse 의 ask for help — 매 stuck-but-improv-ing. ## 🧪 검증 / 중복 - Verified: Keith Johnstone "Impro" (1979), Karl Weick "Organizing for Reliability" (1987), OODA loop (Boyd). - 신뢰도 B (academic-soft + applied agentic literature). ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — full content with LLM agent improv patterns and reversibility framework |