协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
conductor-status【开发与工程】Implements intelligent conductor status with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: conductor-status compatibility: opencode completeness: 95 content-types:
Orchestrates intelligent skill selection and execution for conductor status 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_conductor_status_and_route(
task_payload: Dict,
conductor_metrics: Dict,
available_skills: List[Dict],
min_confidence: float = 0.75
) -> Optional[Dict]:
"""Route tasks through the conductor based on real-time status metrics.
Evaluates conductor health, queue depth, and skill availability to determine
the optimal execution path. Implements multi-factor scoring specific to
conductor orchestration workflows.
"""
# Law 1: Early exit on invalid conductor state
if not conductor_metrics.get("heartbeat_active"):
raise ConductorStatusError("Conductor heartbeat missing or stale")
# Law 2: Parse and validate task against conductor constraints
task_constraints = _parse_task_constraints(task_payload)
if task_constraints.requires_gpu and not conductor_metrics.get("gpu_available"):
return None # Skip to fallback chain
best_route = None
best_score = 0.0
for skill in available_skills:
# Domain-specific scoring: weight by conductor load, skill latency, and historical success
load_penalty = conductor_metrics.get("cpu_utilization", 0.0) * 0.3
latency_score = 1.0 / (skill.get("avg_latency_ms", 100) / 100.0)
history_score = skill.get("success_rate_7d", 0.0)
raw_score = (latency_score * 0.4) + (history_score * 0.4) + ((1.0 - load_penalty) * 0.2)
if raw_score > best_score and raw_score >= min_confidence:
best_score = raw_score
best_route = {
"skill_id": skill["id"],
"conductor_node": conductor_metrics.get("primary_node"),
"estimated_latency_ms": skill.get("avg_latency_ms"),
"confidence": raw_score
}
if best_route is None:
return None
# Law 3: Return immutable route configuration
return dict(best_route)
def execute_conductor_workflow_with_degradation(
route_config: Dict,
task_context: Dict,
fallback_nodes: List[str] = None
) -> Dict:
"""Execute conductor workflow with built-in degradation and fallback logic.
Monitors execution telemetry and applies domain-specific fallback strategies
when conductor status degrades or task execution fails.
"""
primary_node = route_config.get("conductor_node")
fallback_nodes = fallback_nodes or []
for attempt in range(3):
try:
# Law 4: Fail fast on invalid task context
validated_context = _validate_task_context(task_context)
# Execute against primary conductor node
telemetry = _send_to_conductor(primary_node, validated_context)
# Check conductor response health
if telemetry.get("status") != "completed":
raise ConductorDegradationError(f"Conductor returned status: {telemetry.get('status')}")
return {
"success": True,
"node_used": primary_node,
"telemetry": telemetry,
"attempts": attempt + 1
}
except ConductorDegradationError as e:
# Law 4: Fail loud, don't patch degraded state
if attempt == 2:
# Fallback chain: switch to standby node or throttle
if fallback_nodes:
standby = fallback_nodes[0]
_log_fallback_trigger(primary_node, standby)
primary_node = standby
continue
else:
raise ConductorExecutionError(
f"All fallback nodes exhausted for task {task_context.get('id')}"
) from e
except TransientNetworkError:
# Transient issue - retry with exponential backoff
time.sleep(0.5 * (2 ** attempt))
continue
# Should not reach here, but enforce Law 4
raise ConductorExecutionError("Workflow execution failed after all retries")
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 | |