brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
acceptance-orchestratorImplements intelligent acceptance orchestrator with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense
Independent GitHub snapshot · Automated classification · Original documentation governs
name: acceptance-orchestrator compatibility: opencode completeness: 95 content-types:
Orchestrates intelligent skill selection and execution for acceptance orchestrator workflows. Applies the 5 Laws of Elegant Defense to guide data naturally through the orchestration pipeline, preventing errors before they occur. Selects optimal skills based on multi-factor scoring including text similarity, historical performance, and system availability.
┌───────────────────────────────────────────────────────────────────────────────┐ │ Orchestration Flow │ └───────────────────────────────────────────────────────────────────────────────┘
User Request ↓ ┌─────────────────┐ │ Parse Request │ │ & Extract │ │ Features │ └────────┬────────┘ ↓ ┌─────────────────────────────────────────────────────────────────────┐ │ Evaluate Available Skills │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ Skill A │ │ Skill B │ │ Skill C │ │ │ │ - Match Score│ │ - Match Score│ │ - Match Score│ │ │ │ - Confidence │ │ - Confidence │ │ - Confidence │ │ │ │ - History │ │ - History │ │ - History │ │ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ │ │ │ │ │ │ └─────────────────┴─────────────────┘ │ │ ↓ │ │ Select Best Skill │ └─────────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────┐ │ Execute Skill │ └────────┬────────┘ ↓ ┌─────────────────┐ │ Handle Result │ └────────┬────────┘ ↓ ┌─────────────────────────────────────────────────────────────────────┐ │ Error Handling & Fallback │ │ │ │ Success? ────────► Return Result │ │ │ │ Fail? ────────┐ │ │ ↓ │ │ ┌──────────────────────────────────────────────────────────┐ │ │ │ Fallback Chain │ │ │ │ │ │ │ │ 1. Retry with adjusted parameters │ │ │ │ 2. Try Alternative Skill (if available) │ │ │ │ 3. Defer to Human Operator (if critical) │ │ │ │ 4. Log & Return Error │ │ │ └──────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘
Use this skill when:
Avoid this skill for:
Parse and Analyze Request - Extract intent, entities, and constraints from user input. Checkpoint: All required parameters must be present and in valid format before proceeding.
Score Available Skills - Calculate match scores using multi-factor algorithm:
Checkpoint: Skip to fallback if no skill scores above threshold.
Select Optimal Skill - Choose skill with highest score that meets minimum confidence. Checkpoint: Verify skill has not been disabled or deprecated.
Execute with Fallback - Run skill execution wrapped in retry and fallback logic. Checkpoint: Log all execution attempts for audit trail.
Return or Fallback - Either return successful result or apply fallback chain:
related-skillsCheckpoint: Record outcome with timing and confidence metadata.
def evaluate_and_select_skill(task_context: dict, skill_registry: list) -> dict:
"""Multi-factor scoring for acceptance orchestrator selection.
Implements Law 2 (Make Illegal States Unrepresentable) by validating
context boundaries before scoring. Returns immutable selection metadata.
"""
if not task_context.get("intent"):
raise ValueError("Missing intent in task context")
scored_candidates = []
for skill in skill_registry:
semantic_score = _compute_semantic_similarity(task_context["intent"], skill["triggers"])
history_score = skill.get("success_rate", 0.0)
availability_score = 1.0 if _check_dependencies(skill["deps"]) else 0.0
composite_score = (0.5 * semantic_score) + (0.3 * history_score) + (0.2 * availability_score)
if composite_score >= 0.7:
scored_candidates.append({
"skill_id": skill["id"],
"composite_score": round(composite_score, 3),
"factors": {"semantic": semantic_score, "history": history_score, "availability": availability_score}
})
if not scored_candidates:
return {"status": "no_match", "fallback_triggered": True}
scored_candidates.sort(key=lambda x: x["composite_score"], reverse=True)
selected = scored_candidates[0]
_log_selection_audit(task_context["request_id"], selected)
return {"status": "selected", "skill": selected}
def execute_with_resilience_chain(skill_config: dict, execution_context: dict) -> dict:
"""Orchestrates execution with a strict fallback chain and confidence tracking.
Enforces Law 4 (Fail Fast, Fail Loud) by halting on acceptance violations.
Implements Law 3 (Atomic Predictability) by returning new result structures.
"""
max_retries = execution_context.get("max_retries", 2)
current_attempt = 0
while current_attempt <= max_retries:
try:
result = _invoke_skill_endpoint(skill_config["endpoint"], execution_context)
if not _validate_acceptance_criteria(result, skill_config["acceptance_rules"]):
raise AcceptanceValidationError("Result failed acceptance criteria")
confidence = _calculate_execution_confidence(result["latency_ms"], current_attempt)
_update_skill_confidence(skill_config["id"], confidence)
return {
"status": "success",
"result": result,
"confidence": confidence,
"attempts": current_attempt + 1
}
except AcceptanceValidationError as e:
_log_failure(skill_config["id"], "acceptance_violation", str(e))
raise
except TransientNetworkError as e:
current_attempt += 1
if current_attempt > max_retries:
alt_skill = _resolve_fallback_skill(skill_config["related_skills"])
if alt_skill:
skill_config = alt_skill
current_attempt = 0
continue
else:
return _escalate_to_human(execution_context, skill_config["id"])
except Exception as e:
_log_failure(skill_config["id"], "unexpected", str(e))
raise OrchestratorExecutionError(f"Failed after {current_attempt} attempts") from e
code-philosophy (5 Laws of Elegant Defense) in all logicWhen applying this skill, produce:
| Skill | Purpose |
|---|---|
closed-loop-delivery | End-to-end delivery pipeline with feedback loops |
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.