协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
conductor-setup【开发与工程】Implements intelligent conductor setup with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: conductor-setup compatibility: opencode completeness: 95 content-types:
Orchestrates intelligent skill selection and execution for conductor setup 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 build_conductor_routing_table(
request: str,
registered_skills: List[Dict],
historical_metrics: Dict[str, float],
min_confidence: float = 0.75
) -> Optional[Dict]:
"""Builds a conductor routing table by scoring registered skills against the request.
Applies Law 2 (Parse at boundary) and Law 1 (Early exit on invalid state).
"""
if not request or not request.strip():
raise ValueError("Conductor request cannot be empty")
if not registered_skills:
raise ValueError("No skills registered in conductor registry")
# Parse request features at boundary (Law 2)
request_features = _extract_intent_and_entities(request)
best_match = None
best_score = 0.0
for skill in registered_skills:
# Skip disabled or unavailable skills immediately (Law 1)
if not skill.get("enabled") or not skill.get("available"):
continue
# Multi-factor scoring: text match + historical success + availability weight
text_match = _cosine_similarity(request_features, skill.get("triggers", []))
history_score = historical_metrics.get(skill["name"], 0.5)
availability_weight = 1.0 if skill.get("available") else 0.2
score = (text_match * 0.5) + (history_score * 0.3) + (availability_weight * 0.2)
if score > best_score and score >= min_confidence:
best_score = score
best_match = skill
if best_match is None:
return None
# Return new structure, never mutate registry (Law 3)
return {
"selected_skill": dict(best_match),
"confidence": best_score,
"routing_timestamp": time.time(),
"fallback_candidates": [s["name"] for s in registered_skills if s["name"] != best_match["name"]]
}
def execute_conductor_pipeline(
routing_result: Dict,
task_context: Dict,
fallback_chain: List[str],
max_retries: int = 2
) -> Dict:
"""Executes the selected conductor skill with a structured fallback chain.
Applies Law 4 (Fail Fast/Loud) and Law 3 (Atomic Predictability).
"""
skill_name = routing_result["selected_skill"]["name"]
validated_context = _validate_task_context(task_context, skill_name)
for attempt in range(max_retries + 1):
try:
# Execute the actual domain logic for the selected skill
raw_result = _invoke_skill_implementation(skill_name, validated_context)
# Atomic Predictability: Return fresh result, never mutate context
return {
"status": "success",
"skill": skill_name,
"result": raw_result,
"attempts": attempt + 1,
"latency_ms": time.time() * 1000,
"confidence_updated": routing_result["confidence"] + 0.05
}
except InvalidStateError as e:
# Fail Fast: Halt immediately on invalid state, don't patch
raise ConductorExecutionError(f"Invalid state for {skill_name}: {e}") from e
except TransientError as e:
if attempt == max_retries:
# Apply fallback chain (Law 4: Fail Loud with structured fallback)
return _execute_fallback_chain(fallback_chain, validated_context)
# All retries exhausted
raise ConductorExecutionError(f"Conductor pipeline failed for {skill_name} after {max_retries + 1} attempts")
code-philosophy (5 Laws of Elegant Defense) in all logicWhen applying this skill, produce:
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.
| Skill | Purpose | |