davepoon/buildwithclaude / plugins/foresight-intelligence/skills/hard-predict-future
hard-predict-future
VerifiedActivate this agent for any future-oriented question that requires deep quantitative analysis, historical precedents, and structured scenario planning. Triggers include: "Will [X]?", "Who will win [X]?", "What happens to [X]?", prediction requests with high stakes, foresight analysis, STEEEP scenario planning, futures cone, competitive race analysis, technology adoption curves, geopolitical shifts, or any question about a future outcome that deserves rigorous multi-step analysis. This agent runs a 12-step deterministic pipeline: Claude handles intelligence, Python handles all arithmetic. Year is NOT required — the engine infers the horizon. REQUIRES: Bash tool + Python 3.x. Not compatible with claude.ai web (use Soft Predict Future instead).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 17.4 KB |
| scripts/confidence_calc.py | script | 5.4 KB |
| scripts/decision_guidance.py | script | 6.4 KB |
| scripts/input_validator.py | script | 10.2 KB |
| scripts/matrix_builder.py | script | 5.2 KB |
| scripts/probability_calc.py | script | 12.2 KB |
| scripts/regional_context.py | script | 10.7 KB |
| scripts/report_formatter.py | script | 18.6 KB |
| scripts/signal_scorer.py | script | 23.9 KB |
scripts/input_validator.py
View on GitHub#!/usr/bin/env python3
"""
input_validator.py - Binary gate for query validation.
Pure deterministic logic. No AI, no web calls.
Author: Santhosh Gandhi
Usage: python src/input_validator.py "query string"
Output: JSON to stdout
"""
from __future__ import annotations
import re
import sys
import json
from dataclasses import dataclass, asdict
from typing import Callable, List, Optional
@dataclass
class ValidationResult:
valid: bool
rule_failed: Optional[str]
failure_reason: Optional[str]
scope_note: Optional[str]
proceed: bool
# --- KNOWN FICTIONAL / NON-EXISTENT SETS ---
_FICTIONAL_CHARACTERS = {
"harry potter", "sherlock holmes", "batman", "superman",
"iron man", "spider-man", "spiderman", "gandalf", "frodo",
"darth vader", "voldemort", "hermione", "dumbledore", "tony stark",
"captain america", "thanos", "hermione granger",
}
_NON_EARTH_BODIES = {
"mars", "moon", "jupiter", "saturn", "neptune", "uranus",
"pluto", "venus", "mercury", "galaxy", "universe", "multiverse",
"planet x", "nibiru",
}
_POLITICAL_TITLES = {
"president", "prime minister", "pm", "king", "queen", "emperor",
"chancellor", "premier", "secretary general", "governor", "dictator",
}
_GEOLOGICAL_PATTERNS = [
r"\b(million|billion)\s+years?\b",
r"\b[1-9]\d{4,}\s*(ad|ce|bc|bce)?\b",
r"\bpost.?human\b",
r"\bheat.?death\b",
r"\bend\s+of\s+(all\s+)?life\b",
]
_VAGUE_CATCHALL_PATTERNS = [
r"^what\s+will\s+happen\s*\??$",
r"^what\s+happens\s+next\s*\??$",
r"^what\s+is\s+the\s+future\s*\??$",
r"^predict\s+the\s+future\s*\??$",
r"^what\s+comes\s+next\s*\??$",
r"^tell\s+me\s+the\s+future\s*\??$",
]
_PRIVATE_INDIVIDUAL_PATTERNS = [
r"\bmy\s+(friend|neighbor|neighbour|colleague|classmate|boss|wife|husband|partner|sibling|brother|sister)\b",
r"\bthis\s+(guy|person|girl|woman|man)\b",
r"\bsomeone\s+i\s+know\b",
r"\ba\s+person\s+i\s+know\b",
]
_PUBLIC_DOMAIN_KEYWORDS = {
"india", "china", "us", "usa", "uk", "europe", "global", "world",
"sector", "industry", "market", "technology", "tech", "ai",
"ev", "electric", "saas", "fintech", "healthcare", "energy",
"policy", "government", "economy", "startup", "company",
"bitcoin", "crypto", "stock", "real estate", "climate", "war",
"election", "will", "could", "might", "would", "become", "happen",
}
# --- RULE IMPLEMENTATIONS ---
def _rule1_entity_reality(query: str) -> Optional[ValidationResult]:
q = query.lower()
for char in _FICTIONAL_CHARACTERS:
if char in q:
return ValidationResult(
valid=False,
rule_failed="RULE_1",
failure_reason=f"'{char.title()}' is a fictional character, not a real-world entity.",
scope_note="Rephrase with a real named person, company, sector, technology, policy, or country.",
proceed=False,
)
for pattern in _PRIVATE_INDIVIDUAL_PATTERNS:
if re.search(pattern, q):
return ValidationResult(
valid=False,
rule_failed="RULE_1",
failure_reason="Query references an unnamed private individual with no public presence.",
scope_note="Rephrase with a named public figure, company, sector, or policy.",
proceed=False,
)
return None
def _rule2_system_existence(query: str) -> Optional[ValidationResult]:
q = query.lower()
for body in _NON_EARTH_BODIES:
for title in _POLITICAL_TITLES:
if (re.search(rf"\b{re.escape(title)}\s+of\s+(the\s+)?{re.escape(body)}\b", q)
or re.search(rf"\b{re.escape(body)}\b.*\b{re.escape(title)}\b", q)
or re.search(rf"\b{re.escape(title)}\b.{{0,30}}\b{re.escape(body)}\b", q)):
return ValidationResult(
valid=False,
rule_failed="RULE_2",
failure_reason=f"{body.title()} has no political system or human governance structure.",
scope_note="Rephrase with a real-world political office or system.",
proceed=False,
)
if re.search(r"\b(king|queen|president|ruler)\s+of\s+(the\s+)?internet\b", q):
return ValidationResult(
valid=False,
rule_failed="RULE_2",
failure_reason="The Internet has no political governance structure.",
scope_note="Rephrase with a real-world institution or jurisdiction.",
proceed=False,
)
return None
def _rule3_time_horizon(query: str) -> Optional[ValidationResult]:
q = query.lower()
for pattern in _GEOLOGICAL_PATTERNS:
if re.search(pattern, q):
return ValidationResult(
valid=False,
rule_failed="RULE_3",
failure_reason="Query implies a geological or post-human timescale beyond the 30-year analysis window.",
scope_note="Rephrase with a specific near/medium/long-term timeframe (e.g., by 2030, within a decade).",
proceed=False,
)
for year_str in re.findall(r"\b(20[6-9]\d|2[1-9]\d{2}|[3-9]\d{3,})\b", query):
if int(year_str) > 2056:
return ValidationResult(
valid=False,
rule_failed="RULE_3",
failure_reason=f"Year {year_str} is beyond the 30-year analysis window.",
scope_note="Use a timeframe within 30 years for meaningful signal-based forecasting.",
proceed=False,
)
return None
def _rule4_signal_availability(query: str) -> Optional[ValidationResult]:
q = query.lower()
private_patterns = [
r"\bmy\s+(company|firm|startup|business)\s+(internal|private)\b",
r"\binternal\s+(decision|policy|plan)\s+of\b",
r"\bprivate\s+(conversation|meeting|email)\b",
]
for pattern in private_patterns:
if re.search(pattern, q):
return ValidationResult(
valid=False,
rule_failed="RULE_4",
failure_reason="Query references purely private internal decisions with no public signal trail.",
scope_note="Rephrase to focus on publicly observable outcomes or industry trends.",
proceed=False,
)
unknowable_patterns = [
r"\bwill\s+my\s+(neighbor|neighbour|colleague|classmate)\b",
]
for pattern in unknowable_patterns:
if re.search(pattern, q):
return ValidationResult(
valid=False,
rule_failed="RULE_4",
failure_reason="Private individuals have no public signal trail for web-based analysis.",
scope_note="Rephrase with a public figure, company, sector, or policy.",
proceed=False,
)
return None
def _rule5_minimum_specificity(query: str) -> Optional[ValidationResult]:
stripped = query.strip()
q = stripped.lower()
for pattern in _VAGUE_CATCHALL_PATTERNS:
if re.match(pattern, q):
return ValidationResult(
valid=False,
rule_failed="RULE_5",
failure_reason="Query has no identifiable subject or domain.",
scope_note="Add a specific subject: 'Will [X] happen?' where X is a named entity, sector, or trend.",
proceed=False,
)
words = stripped.split()
if len(words) < 5:
return ValidationResult(
valid=False,
rule_failed="RULE_5",
failure_reason=f"Query is too short ({len(words)} words). Insufficient context for analysis.",
scope_note="Provide at least a subject and a specific outcome to analyze.",
proceed=False,
)
has_proper_noun = bool(re.search(r"\b[A-Z][a-z]{1,}\b", stripped))
has_domain_term = any(kw in q for kw in _PUBLIC_DOMAIN_KEYWORDS)
if not has_proper_noun and not has_domain_term:
return ValidationResult(
valid=False,
rule_failed="RULE_5",
failure_reason="Query lacks any identifiable named entity, sector, or domain.",
scope_note="Name a specific person, company, industry, policy, or technology to analyze.",
proceed=False,
)
return None
# --- PUBLIC API ---
_RULES: List[Callable[[str], Optional[ValidationResult]]] = [
_rule1_entity_reality,
_rule2_system_existence,
_rule3_time_horizon,
_rule4_signal_availability,
_rule5_minimum_specificity,
]
def validate(query: str) -> ValidationResult:
if not query or not query.strip():
return ValidationResult(
valid=False,
rule_failed="RULE_5",
failure_reason="Empty query provided.",
scope_note="Provide a specific forecasting question.",
proceed=False,
)
for rule in _RULES:
result = rule(query)
if result is not None:
return result
return ValidationResult(
valid=True,
rule_failed=None,
failure_reason=None,
scope_note=None,
proceed=True,
)
def format_rejection(result: ValidationResult) -> str:
rule_names = {
"RULE_1": "Entity reality",
"RULE_2": "System existence",
"RULE_3": "Time horizon",
"RULE_4": "Signal availability",
"RULE_5": "Minimum specificity",
}
rule_name = rule_names.get(result.rule_failed or "", result.rule_failed or "")
lines = [
"INVALID QUERY",
f"Rule failed: {result.rule_failed} - {rule_name}",
f"Reason: {result.failure_reason}",
]
if result.scope_note:
lines.append(f"Suggestion: {result.scope_note}")
return "\n".join(lines)
def main():
if len(sys.argv) < 2:
result = ValidationResult(
valid=False,
rule_failed="RULE_5",
failure_reason="No query provided.",
scope_note="Provide a query string as argument.",
proceed=False,
)
print(json.dumps(asdict(result), indent=2))
sys.exit(1)
query = " ".join(sys.argv[1:])
result = validate(query)
print(json.dumps(asdict(result), indent=2))
if not result.valid:
print()
print(format_rejection(result))
sys.exit(1)
sys.exit(0)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |