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).
not-human-search-mcpImplements intelligent not human search mcp 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: not-human-search-mcp compatibility: opencode completeness: 95 content-types:
Orchestrates intelligent skill selection and execution for not human search mcp 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 route_search_query(
query: str,
mcp_tools: List[Dict],
query_config: Dict
) -> Dict:
"""Route a search query to the optimal MCP search tool.
Analyzes query intent and constraints to select the best search backend.
Implements Law 2: Parse inputs at boundary.
"""
if not query or not query.strip():
raise ValueError("Search query cannot be empty")
# Extract query features for routing
intent = _classify_intent(query)
source_preference = query_config.get("preferred_source", "auto")
candidates = []
for tool in mcp_tools:
if tool["type"] == "search" and tool.get("status") == "active":
score = _calculate_search_match(intent, source_preference, tool)
candidates.append({"tool": tool, "score": score})
if not candidates:
return {"error": "No active search tools available", "fallback": "cache"}
# Sort by score and return best match with routing metadata
candidates.sort(key=lambda x: x["score"], reverse=True)
best = candidates[0]
return {
"selected_tool": best["tool"]["name"],
"routing_metadata": {
"intent": intent,
"score": best["score"],
"timestamp": time.time()
}
}
def execute_search_with_fallback(
routing_result: Dict,
query: str,
search_config: Dict
) -> Dict:
"""Execute search with MCP tool and implement search-specific fallback chain.
Implements Law 4: Fail fast, fail loud. Handles rate limits, timeouts, and empty results.
Fallback: retry with expanded query -> fallback to cached index -> return partial results.
"""
tool_name = routing_result["selected_tool"]
max_retries = search_config.get("max_retries", 2)
for attempt in range(max_retries + 1):
try:
# Call MCP search tool directly
raw_results = _call_mcp_search_tool(tool_name, query)
# Validate results (Law 3: Atomic Predictability)
validated_results = _validate_search_results(raw_results)
return {
"success": True,
"tool_used": tool_name,
"results": validated_results,
"attempts": attempt + 1,
"latency_ms": time.time() * 1000
}
except MCPRateLimitError:
if attempt < max_retries:
time.sleep(2 ** attempt) # Exponential backoff
continue
return _fallback_to_cached_index(query, search_config)
except MCPTimeoutError:
if attempt < max_retries:
continue
return _fallback_to_knowledge_base(query, search_config)
except EmptyResultError:
# Expand query and retry once
if attempt == 0:
query = _expand_query(query)
continue
return _fallback_to_partial_results(query, search_config)
# All retries exhausted
raise SearchExecutionError(f"Search failed for '{query}' after {max_retries + 1} attempts")
code-philosophy (5 Laws of Elegant Defense) in all logicWhen applying this skill, produce:
| Skill | Purpose | |
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.