Research — Hybrid Router + Fallback
Default entry point for any research request — a hybrid router that classifies the question deterministically and either delegates to a specialist research skill (pulse for trends/sentiment, grants for NIH funding, litreview for academic literature, syllabus for course reading, patent for prior-art + IP landscape, dossier for entity research, deepread for evidence-first reading of supplied documents) or runs its own plan-decompose-multi-source-search-synthesize-cite fallback workflow when no specialist matches.
How to use it
Claude Code
- Run the line below. It pulls the whole folder into
~/.claude/skills/research, including the files SKILL.md points to. - Describe your job in plain words. Claude Code follows the skill from there.
npx degit alirezarezvani/claude-skills/research/research/skills/research#main ~/.claude/skills/researchFor one project only, change the path to .claude/skills/research. This skill also uses Node.js, routing_transparency_logger.py — copying SKILL.md alone won't be enough. See the folder on GitHub.
Claude (web or desktop app)
- On this page open ⋯ → Download .md.
- Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
- Pick the file and Save. Claude shows the name and description and runs a security scan.
- Check the skill is switched on.
- Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
- ChatGPT: make a Project and paste it into Instructions.
- Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
- Check which app you pasted it into — the steps above name the right one.
- Some skills need the paid tier of Claude or ChatGPT.
Paste into Claude, ChatGPT or Cursor.
Source of Research — Hybrid Router + Fallback
Show the full text254 lines
| name | description |
|---|---|
| research | Default entry point for any research request — a hybrid router that classifies the question deterministically and either delegates to a specialist research skill (pulse for trends/sentiment, grants for NIH funding, litreview for academic literature, syllabus for course reading, patent for prior-art + IP landscape, dossier for entity research, deepread for evidence-first reading of supplied documents) or runs its own plan-decompose-multi-source-search-synthesize-cite fallback workflow when no specialist matches. Always surfaces the routing decision so users can override. Use when the user makes any research request that doesn't obviously match a more-specific specialist skill (e.g., "research [topic]", "look into [topic]", "what do we know about [topic]", "investigate [topic]", "find me information on [topic]", "do some research on [topic]", "I need to understand [topic]"). Output is a markdown briefing (default) or .docx document (on request) with full citations and an audit log. |
Research — Hybrid Router + Fallback
The runtime orchestrator for the research domain. Architecture C: deterministic classification → specialist delegation OR own plan-decompose-search-synthesize-cite workflow.
Portability
Requires WebSearch + WebFetch for the fallback workflow; specialist skills (pulse, grants, litreview, syllabus, patent, dossier, deepread) must be present for delegation to work. Node.js with docx package required if Q2 = document mode. Works in Claude Code CLI natively. In Claude.ai with web tools + Code Execution, the workflow is supported.
Distinct From engineering/autoresearch-agent
These two skills share the word "research" but serve completely different use cases:
research/research/(this skill) — research-query router + fallback workflow ("Research X")engineering/autoresearch-agent/— Karpathy's autonomous file-optimization experiment loop ("Make this code faster")
No overlap. They coexist.
Hybrid Architecture (C)
Every invocation produces one of three outcomes:
- Delegation — Classified as specialist-domain. Routes there. User sees the specialist's output.
- Fallback execution — Classified as general research. Runs own plan → search → synthesize workflow.
- Clarification request — Classification ambiguous OR a single bare-noun signal matched. Asks one forcing question (with a recommended answer) to disambiguate, then routes.
The skill never silently runs its fallback when a specialist would have done better. Routing transparency is what makes the hybrid architecture trustworthy.
Specialist Registry
| Specialist | Routing signals | Domain |
|---|---|---|
pulse |
reddit / hn / x / buzz / sentiment / trending / "what's people saying" / "pulse on" / "take the pulse" / "current conversation" | Multi-source recency research |
grants |
NIH / grant / R01 / K-award / RePORTER / NOSI / "grants for" / FDA / "study section" / "principal investigator" | NIH grant-funding intelligence |
litreview |
literature review / PICO / SPIDER / systematic review / "review papers on" / meta-analysis | Academic literature orientation |
syllabus |
syllabus / course outline / curriculum / "reading list" / "for my class" / "for my students" | Course supplementary reading |
patent |
prior art / FTO / freedom to operate / patent / "patent landscape" / invention / novelty search / "ip landscape" | Patent prior-art + landscape |
dossier |
"dossier on" / "due diligence" / "background check" / "prep me for" / "competitor research" / "investor diligence" / "interview prep" / "background on" | Decision-grade entity research |
deepread |
"deep read" / "deeply read" / "read this book" / "read this pdf" / "read this document" / "extract the claims" / "knowledge map" / "feynman" | Evidence-first reading of supplied documents |
Escalation → deep-research: when a wrong answer is expensive (strategy, comparing N options, hypothesis validation, mapping a field) and rigor matters more than speed, escalate to the deep-research skill instead of the fast fallback workflow — it runs a triangulated, multi-round, adversarial investigation and persists an auditable, reusable research folder. This router is the fast path; deep-research is the heavyweight one.
Agent Integrity Rules
This skill obeys the research-pack convention:
- Execution discipline (fallback only): Sequential searches. 1 q/sec rate limit. Confirm response received before next call.
- Source discipline: Cite only sources returned by this session's tool calls. Training knowledge labeled
[Background — not from search]and excluded from counts. - Three-count tracking (fallback only): Queries sent / sources received / sources cited.
- Retry policy: On failure → wait 3s → retry once → log. After 3 consecutive failures: stop, alert user.
- Routing discipline: Never delegate silently. Always state the decision + accept override.
Phase 1: Grill-Me Intake (2–4 Questions)
Intake is intentionally minimal — the goal is to route fast, not to interrogate. One question per turn.
Q1 (always) — Research question
What's the research question? State it in 1–2 sentences. Specific is better than broad — "AI for healthcare" gets you a vague survey; "How are health systems integrating LLM-based clinical decision support?" gets you a useful answer.
Refuse mush. If user says "research AI", push back once: "What about AI specifically — adoption, safety, capability, funding, regulation, comparison? Pick an angle."
Q2 (always) — Output preference
What output do you want? Pick one:
- Quick chat briefing (5-min read, markdown in chat)
- Standalone document (.docx with citations, shareable)
Forcing choice. Document mode triggers deeper search budgets and full audit logs.
Q3 (asked only when classification returns ask or fallback with no signals) — Domain disambiguation
Quick clarification — pick the closest match (recommended: {N} — your question matched a
{specialist}signal):
- Academic literature (papers, peer-reviewed)
- Industry / trends (what's the buzz, news, sentiment)
- Specific entity (a company, person, organization)
- Technology / patents (prior art, IP landscape)
- Grant funding (NIH, foundations)
- Course material (syllabus or curriculum)
- None of the above — run general research
When the classifier returned ask (single bare-noun signal), pre-mark the recommended option. Skip if classification produced a silent route (≥2 signals OR one strong multi-word phrase).
Q4 (asked only if Q3 was needed AND user picked "none of the above") — General-research scope
For general research, what's your time horizon — quick scan (5 searches) or thorough (15 searches)?
Skip if a specialist took over.
Stop condition: After Q4 (or earlier if dependency skips applied), commit and start Phase 2. Most invocations exit intake after Q1 + Q2.
Phase 2: Deterministic Classification
This is deterministic, not LLM-reasoned — for speed, debuggability, and consistency.
SIGNALS = {
pulse: ["reddit", "hn", "hacker news", "x.com", "twitter", "buzz",
"sentiment", "trending", "what are people saying",
"what's happening", "the conversation around",
"pulse on", "take the pulse", "current conversation"],
grants: ["nih", "grant", "grants for", "r01", "r21", "k-award", "reporter",
"nosi", "funding", "fda", "study section", "principal investigator"],
litreview:["literature review", "lit review", "litreview", "pico", "spider",
"systematic review", "review papers on", "research papers on",
"papers about", "meta-analysis"],
syllabus: ["syllabus", "course outline", "curriculum", "reading list",
"for my class", "for my students", "course material"],
patent: ["prior art", "fto", "freedom to operate", "patent",
"patent landscape", "invention", "novelty search",
"patent search", "ip landscape"],
dossier: ["dossier on", "due diligence", "background check",
"prep me for", "competitor research", "investor diligence",
"interview prep", "research my competitor", "background on"],
deepread: ["deep read", "deeply read", "read this book", "read this pdf",
"read this document", "extract the claims", "extract claims from",
"knowledge map", "feynman", "argument map"]
}
# Signals are case-insensitive literal phrases (multi-word substring match).
# Bracketed placeholders (e.g., "research [company]") are intentionally NOT
# signals — they over-trigger on generic "research X" queries that should
# fall back to general research, not auto-route to dossier.
# STRONG signal = multi-word phrase (contains a space): pairs verb with noun
# ("dossier on", "prior art") and routes reliably.
# BARE-NOUN signal = single word ("funding", "fda", "patent", "grant"):
# too weak to silent-route on alone — it must trigger Q3 with a
# recommended answer instead.
For each specialist S:
score[S] = count of SIGNALS[S] phrases matched in question (case-insensitive substring)
if max(score) >= 2:
route_to = argmax(score) # high confidence — silent route
elif max(score) == 1 and only one specialist has score 1:
if the matched phrase is multi-word (contains a space):
route_to = that specialist # strong phrase — silent route
else:
route_to = "ask" # bare noun — ask Q3, recommend that specialist
else:
route_to = "fallback" # ambiguous or no match — ask Q3 / run fallback
Implementation: scripts/classifier.py --question "..." returns the routing decision + matched signals + per-specialist scores + (for ask) the recommended specialist. Use it; don't re-implement. The SIGNALS map and rules above are kept phrase-for-phrase in sync with the script — drift = bug.
Phase 3a: Specialist Delegation (≥2 signals OR one strong multi-word phrase)
When delegating:
- Pass the user's question verbatim plus the output preference (Q2)
- Let the specialist run its own grill-me intake — do NOT pre-answer specialist questions
- Return specialist output as the user-visible result
- Tag the result with
[Delegated to: research → {specialist}]in the chat output so the user knows what skill produced it - Tag the audit log via
scripts/routing_transparency_logger.py --action record_delegation
Phase 3b: Own Fallback Workflow
If routing produced no specialist match (and Q3 confirmed general research), run the 8-step fallback:
- Decompose — break the question into 3–5 sub-questions (what / why / how / who / what's next). Show the decomposition before searching.
scripts/fallback_decomposer.py --question "..."gives a deterministic starting point. - Source selection — per sub-question: recency → WebSearch+WebFetch (+Reddit/HN on signal); technical/docs → WebSearch+WebFetch; academic → Consensus MCP if connected, else WebSearch with
scholar.google.comsite filter; data/numbers → WebFetch primary documents; entity-level → offerdossierre-route. - Search — sequential per sub-question, 1 q/sec, 2–4 queries per source, broad-to-narrow.
- Read + extract — WebFetch high-signal results; note every source URL.
- Synthesize — 2–4 paragraphs per sub-question with inline citations; surface disagreement when sources disagree.
- Cross-cutting patterns — 1–2 paragraphs across sub-questions: consensus, controversy, gaps.
- Output — markdown brief by default; DOCX if user picked document mode.
- Audit log — three counts (sent / received / cited) + per-source reliability tier (primary / secondary / tertiary).
Routing Transparency Protocol (Mandatory)
After classification, the skill always:
- States the decision in one sentence: "Routing to
litreviewbecause you mentioned PICO and meta-analysis (2 signals)." - Offers override: "If you want general research instead OR a different specialist, say so now."
- Proceeds with the recommended route if the user doesn't object — no timers, no countdowns.
- If user overrides → accept, re-route, log the override via
routing_transparency_logger.py --action record_override.
Never delegates silently. This is the trust-building property that makes the hybrid pattern work.
Output Format
Markdown brief (Q2 = quick chat briefing): title + *Generated: [DATE] | Routed: [specialist | fallback]*, then TL;DR (2-3 sentences) → Findings (one H3 per sub-question, inline citations) → Cross-Cutting Patterns → Sources (numbered, hyperlinked, reliability tier each) → Audit (three counts + failures).
DOCX (Q2 = standalone document): standard research-pack DOCX patterns — Arial 12pt, navy headings, blue table headers, hyperlinked sources, mandatory audit log section. Reference the docx skill for setup.
Audit log block (fallback mode)
Queries sent: N | Sources received: M | Sources cited: K
Failures: F (3-consecutive-failures triggered: yes/no)
Per-source tier: [URL — primary | secondary | tertiary]
Routing decision: fallback (no specialist matched)
Sub-questions: [list]
All routing decisions + overrides also logged to ~/.research_sessions/<session>.json via routing_transparency_logger.py.
Failure Modes
| Failure | Behavior |
|---|---|
| Single bare-noun signal (e.g., "funding", "fda") | Ask Q3 with the matched specialist pre-marked as the recommended answer. Never silent-route. |
| Classification ambiguous (multiple 1-signal matches or none) | Ask Q3 (domain disambiguation). |
| Specialist delegation fails | Note in chat. Offer to retry or fall back to general research. |
| User overrides routing | Accept. Re-route. Log the override. |
| Fallback search returns thin results | Surface explicitly. Suggest the question may be too niche or too new. Do not fabricate. |
| 3 consecutive tool failures in fallback | Stop, alert user, share what was collected. |
| Question is non-research (e.g., "write me code") | Decline politely. Suggest the appropriate skill. |
| Sub-question can't be answered | Note as "limited public signal on this"; don't omit silently. |
| Output format mismatch | Honor Q2; if unavailable, fall back to markdown with note. |
| Specialist skill missing from environment | Skip it in classification scoring; route to fallback or next-best specialist. |
Anti-Patterns Rejected
- LLM-reasoned classification (must be deterministic keyword + intent matching)
- Silent delegation (always surface routing decision)
- Refusing to route to a specialist when ≥2 signals match
- Silent-routing on a single bare-noun signal ("research FDA approval trends" must ask, not auto-route to grants)
- Wall-clock affordances ("auto-proceed after Ns") — the model cannot wait; proceed with the recommended route if the user doesn't object
- Pre-answering the specialist's grill-me intake (let it run its own)
- Fabricating sources in fallback when search is thin
- Skipping audit log in fallback mode
- Treating "dossier on [company]" as fallback when
dossieris the right specialist (the verb-noun-paired phrase routes; the generic "research X" form does not) - Auto-routing generic "research [topic]" queries to a specialist ("research Microsoft" alone is ambiguous — could be dossier or general; ask Q3 instead of guessing)
Tooling
scripts/classifier.py— Deterministic SIGNALS matching → routing decision (specialist/ask+ recommended /fallback) + per-specialist score + matched phrases.--question "..." --output json.scripts/routing_transparency_logger.py— JSON-backed audit log at~/.research_sessions/<session>.json. Records every routing decision, override, and delegation handoff.scripts/fallback_decomposer.py— Heuristic question → 3–5 sub-questions (what / why / how / who / what's next).
Reference Docs (each cites 7+ authoritative sources)
references/hybrid_router_architecture.md— router-vs-run trade-offs + routing transparency principlereferences/deterministic_classification_canon.md— why keyword > LLM-reasoned for routingreferences/fallback_workflow_canon.md— plan-decompose-search-synthesize methodology
Dependencies
WebSearch+WebFetch— Required for fallback workflow- Specialist skills — Required for delegation:
pulse,grants,litreview,syllabus,patent,dossier. If a specialist is missing, the router skips it and routes to fallback instead. - Node.js
docxlibrary — Required if user picks document output (Q2 = standalone) - Consensus MCP — Optional; used in fallback if academic sub-questions surface
Version: 1.1.0
Source spec: megaprompts/13-research-megaprompt.md (maintainer-local draft spec — gitignored, not present in the public repository)
Build pattern: Path B (direct conversion). v1.1.0: bare-noun signals now ask instead of silent-routing; 5s auto-proceed affordance removed; context-economy trim per the 2026-06 newgen audit.
| 1 | |
| 2 | name research |
| 3 | description Default entry point for any research request — a hybrid router that classifies the question deterministically and either delegates to a specialist research skill (pulse for trends/sentiment, grants for NIH funding, litreview for academic literature, syllabus for course reading, patent for prior-art + IP landscape, dossier for entity research, deepread for evidence-first reading of supplied documents) or runs its own plan-decompose-multi-source-search-synthesize-cite fallback workflow when no specialist matches. Always surfaces the routing decision so users can override. Use when the user makes any research request that doesn't obviously match a more-specific specialist skill (e.g., "research [topic]", "look into [topic]", "what do we know about [topic]", "investigate [topic]", "find me information on [topic]", "do some research on [topic]", "I need to understand [topic]"). Output is a markdown briefing (default) or .docx document (on request) with full citations and an audit log. |
| 4 | |
| 5 | |
| 6 | # Research — Hybrid Router + Fallback |
| 7 | |
| 8 | **The runtime orchestrator for the research domain.** Architecture C: deterministic classification → specialist delegation OR own plan-decompose-search-synthesize-cite workflow. |
| 9 | |
| 10 | ## Portability |
| 11 | |
| 12 | Requires `WebSearch` + `WebFetch` for the fallback workflow; specialist skills (`pulse`, `grants`, `litreview`, `syllabus`, `patent`, `dossier`, `deepread`) must be present for delegation to work. Node.js with `docx` package required if Q2 = document mode. Works in Claude Code CLI natively. In Claude.ai with web tools + Code Execution, the workflow is supported. |
| 13 | |
| 14 | ## Distinct From `engineering/autoresearch-agent` |
| 15 | |
| 16 | These two skills share the word "research" but serve **completely different use cases**: |
| 17 | |
| 18 | **`research/research/`** (this skill) — research-query router + fallback workflow ("Research X") |
| 19 | **`engineering/autoresearch-agent/`** — Karpathy's autonomous file-optimization experiment loop ("Make this code faster") |
| 20 | |
| 21 | No overlap. They coexist. |
| 22 | |
| 23 | ## Hybrid Architecture (C) |
| 24 | |
| 25 | Every invocation produces one of three outcomes: |
| 26 | |
| 27 | **Delegation** — Classified as specialist-domain. Routes there. User sees the specialist's output. |
| 28 | **Fallback execution** — Classified as general research. Runs own plan → search → synthesize workflow. |
| 29 | **Clarification request** — Classification ambiguous OR a single bare-noun signal matched. Asks one forcing question (with a recommended answer) to disambiguate, then routes. |
| 30 | |
| 31 | The skill **never silently runs its fallback** when a specialist would have done better. **Routing transparency** is what makes the hybrid architecture trustworthy. |
| 32 | |
| 33 | ## Specialist Registry |
| 34 | |
| 35 | | Specialist | Routing signals | Domain | |
| 36 | |---|---|---| |
| 37 | | `pulse` | reddit / hn / x / buzz / sentiment / trending / "what's people saying" / "pulse on" / "take the pulse" / "current conversation" | Multi-source recency research | |
| 38 | | `grants` | NIH / grant / R01 / K-award / RePORTER / NOSI / "grants for" / FDA / "study section" / "principal investigator" | NIH grant-funding intelligence | |
| 39 | | `litreview` | literature review / PICO / SPIDER / systematic review / "review papers on" / meta-analysis | Academic literature orientation | |
| 40 | | `syllabus` | syllabus / course outline / curriculum / "reading list" / "for my class" / "for my students" | Course supplementary reading | |
| 41 | | `patent` | prior art / FTO / freedom to operate / patent / "patent landscape" / invention / novelty search / "ip landscape" | Patent prior-art + landscape | |
| 42 | | `dossier` | "dossier on" / "due diligence" / "background check" / "prep me for" / "competitor research" / "investor diligence" / "interview prep" / "background on" | Decision-grade entity research | |
| 43 | | `deepread` | "deep read" / "deeply read" / "read this book" / "read this pdf" / "read this document" / "extract the claims" / "knowledge map" / "feynman" | Evidence-first reading of supplied documents | |
| 44 | |
| 45 | **Escalation → `deep-research`:** when a wrong answer is expensive (strategy, comparing N options, hypothesis validation, mapping a field) and rigor matters more than speed, escalate to the `deep-research` skill instead of the fast fallback workflow — it runs a triangulated, multi-round, adversarial investigation and persists an auditable, reusable research folder. This router is the fast path; `deep-research` is the heavyweight one. |
| 46 | |
| 47 | ## Agent Integrity Rules |
| 48 | |
| 49 | This skill obeys the research-pack convention: |
| 50 | |
| 51 | **Execution discipline (fallback only)**: Sequential searches. 1 q/sec rate limit. Confirm response received before next call. |
| 52 | **Source discipline**: Cite only sources returned by this session's tool calls. Training knowledge labeled `[Background — not from search]` and excluded from counts. |
| 53 | **Three-count tracking (fallback only)**: Queries sent / sources received / sources cited. |
| 54 | **Retry policy**: On failure → wait 3s → retry once → log. After 3 consecutive failures: stop, alert user. |
| 55 | **Routing discipline**: Never delegate silently. Always state the decision + accept override. |
| 56 | |
| 57 | ## Phase 1: Grill-Me Intake (2–4 Questions) |
| 58 | |
| 59 | Intake is intentionally minimal — the goal is to route fast, not to interrogate. One question per turn. |
| 60 | |
| 61 | ### Q1 (always) — Research question |
| 62 | |
| 63 | > **What's the research question? State it in 1–2 sentences. Specific is better than broad — "AI for healthcare" gets you a vague survey; "How are health systems integrating LLM-based clinical decision support?" gets you a useful answer.** |
| 64 | |
| 65 | **Refuse mush.** If user says "research AI", push back once: "What about AI specifically — adoption, safety, capability, funding, regulation, comparison? Pick an angle." |
| 66 | |
| 67 | ### Q2 (always) — Output preference |
| 68 | |
| 69 | > **What output do you want? Pick one:** |
| 70 | > 1. Quick chat briefing (5-min read, markdown in chat) |
| 71 | > 2. Standalone document (.docx with citations, shareable) |
| 72 | |
| 73 | Forcing choice. Document mode triggers deeper search budgets and full audit logs. |
| 74 | |
| 75 | ### Q3 (asked only when classification returns `ask` or `fallback` with no signals) — Domain disambiguation |
| 76 | |
| 77 | > **Quick clarification — pick the closest match** *(recommended: {N} — your question matched a `{specialist}` signal)*: |
| 78 | > 1. Academic literature (papers, peer-reviewed) |
| 79 | > 2. Industry / trends (what's the buzz, news, sentiment) |
| 80 | > 3. Specific entity (a company, person, organization) |
| 81 | > 4. Technology / patents (prior art, IP landscape) |
| 82 | > 5. Grant funding (NIH, foundations) |
| 83 | > 6. Course material (syllabus or curriculum) |
| 84 | > 7. None of the above — run general research |
| 85 | |
| 86 | When the classifier returned `ask` (single bare-noun signal), pre-mark the recommended option. **Skip if classification produced a silent route (≥2 signals OR one strong multi-word phrase).** |
| 87 | |
| 88 | ### Q4 (asked only if Q3 was needed AND user picked "none of the above") — General-research scope |
| 89 | |
| 90 | > **For general research, what's your time horizon — quick scan (5 searches) or thorough (15 searches)?** |
| 91 | |
| 92 | Skip if a specialist took over. |
| 93 | |
| 94 | **Stop condition:** After Q4 (or earlier if dependency skips applied), commit and start Phase 2. **Most invocations exit intake after Q1 + Q2.** |
| 95 | |
| 96 | ## Phase 2: Deterministic Classification |
| 97 | |
| 98 | This is **deterministic, not LLM-reasoned** — for speed, debuggability, and consistency. |
| 99 | |
| 100 | |
| 101 | SIGNALS = { |
| 102 | pulse: ["reddit", "hn", "hacker news", "x.com", "twitter", "buzz", |
| 103 | "sentiment", "trending", "what are people saying", |
| 104 | "what's happening", "the conversation around", |
| 105 | "pulse on", "take the pulse", "current conversation"], |
| 106 | grants: ["nih", "grant", "grants for", "r01", "r21", "k-award", "reporter", |
| 107 | "nosi", "funding", "fda", "study section", "principal investigator"], |
| 108 | litreview:["literature review", "lit review", "litreview", "pico", "spider", |
| 109 | "systematic review", "review papers on", "research papers on", |
| 110 | "papers about", "meta-analysis"], |
| 111 | syllabus: ["syllabus", "course outline", "curriculum", "reading list", |
| 112 | "for my class", "for my students", "course material"], |
| 113 | patent: ["prior art", "fto", "freedom to operate", "patent", |
| 114 | "patent landscape", "invention", "novelty search", |
| 115 | "patent search", "ip landscape"], |
| 116 | dossier: ["dossier on", "due diligence", "background check", |
| 117 | "prep me for", "competitor research", "investor diligence", |
| 118 | "interview prep", "research my competitor", "background on"], |
| 119 | deepread: ["deep read", "deeply read", "read this book", "read this pdf", |
| 120 | "read this document", "extract the claims", "extract claims from", |
| 121 | "knowledge map", "feynman", "argument map"] |
| 122 | } |
| 123 | |
| 124 | # Signals are case-insensitive literal phrases (multi-word substring match). |
| 125 | # Bracketed placeholders (e.g., "research [company]") are intentionally NOT |
| 126 | # signals — they over-trigger on generic "research X" queries that should |
| 127 | # fall back to general research, not auto-route to dossier. |
| 128 | # STRONG signal = multi-word phrase (contains a space): pairs verb with noun |
| 129 | # ("dossier on", "prior art") and routes reliably. |
| 130 | # BARE-NOUN signal = single word ("funding", "fda", "patent", "grant"): |
| 131 | # too weak to silent-route on alone — it must trigger Q3 with a |
| 132 | # recommended answer instead. |
| 133 | |
| 134 | For each specialist S: |
| 135 | score[S] = count of SIGNALS[S] phrases matched in question (case-insensitive substring) |
| 136 | |
| 137 | if max(score) >= 2: |
| 138 | route_to = argmax(score) # high confidence — silent route |
| 139 | elif max(score) == 1 and only one specialist has score 1: |
| 140 | if the matched phrase is multi-word (contains a space): |
| 141 | route_to = that specialist # strong phrase — silent route |
| 142 | else: |
| 143 | route_to = "ask" # bare noun — ask Q3, recommend that specialist |
| 144 | else: |
| 145 | route_to = "fallback" # ambiguous or no match — ask Q3 / run fallback |
| 146 | |
| 147 | |
| 148 | **Implementation:** `scripts/classifier.py --question "..."` returns the routing decision + matched signals + per-specialist scores + (for `ask`) the recommended specialist. Use it; don't re-implement. The SIGNALS map and rules above are kept phrase-for-phrase in sync with the script — drift = bug. |
| 149 | |
| 150 | ## Phase 3a: Specialist Delegation (≥2 signals OR one strong multi-word phrase) |
| 151 | |
| 152 | When delegating: |
| 153 | |
| 154 | Pass the user's question **verbatim** plus the output preference (Q2) |
| 155 | **Let the specialist run its own grill-me intake** — do NOT pre-answer specialist questions |
| 156 | Return specialist output as the user-visible result |
| 157 | Tag the result with `[Delegated to: research → {specialist}]` in the chat output so the user knows what skill produced it |
| 158 | Tag the audit log via `scripts/routing_transparency_logger.py --action record_delegation` |
| 159 | |
| 160 | ## Phase 3b: Own Fallback Workflow |
| 161 | |
| 162 | If routing produced no specialist match (and Q3 confirmed general research), run the 8-step fallback: |
| 163 | |
| 164 | **Decompose** — break the question into 3–5 sub-questions (what / why / how / who / what's next). Show the decomposition before searching. `scripts/fallback_decomposer.py --question "..."` gives a deterministic starting point. |
| 165 | **Source selection** — per sub-question: recency → WebSearch+WebFetch (+Reddit/HN on signal); technical/docs → WebSearch+WebFetch; academic → Consensus MCP if connected, else WebSearch with `scholar.google.com` site filter; data/numbers → WebFetch primary documents; entity-level → offer `dossier` re-route. |
| 166 | **Search** — sequential per sub-question, 1 q/sec, 2–4 queries per source, broad-to-narrow. |
| 167 | **Read + extract** — WebFetch high-signal results; note every source URL. |
| 168 | **Synthesize** — 2–4 paragraphs per sub-question with inline citations; surface disagreement when sources disagree. |
| 169 | **Cross-cutting patterns** — 1–2 paragraphs across sub-questions: consensus, controversy, gaps. |
| 170 | **Output** — markdown brief by default; DOCX if user picked document mode. |
| 171 | **Audit log** — three counts (sent / received / cited) + per-source reliability tier (primary / secondary / tertiary). |
| 172 | |
| 173 | ## Routing Transparency Protocol (Mandatory) |
| 174 | |
| 175 | After classification, the skill **always**: |
| 176 | |
| 177 | **States the decision** in one sentence: "Routing to `litreview` because you mentioned PICO and meta-analysis (2 signals)." |
| 178 | **Offers override**: "If you want general research instead OR a different specialist, say so now." |
| 179 | **Proceeds with the recommended route if the user doesn't object** — no timers, no countdowns. |
| 180 | **If user overrides** → accept, re-route, log the override via `routing_transparency_logger.py --action record_override`. |
| 181 | |
| 182 | **Never delegates silently.** This is the trust-building property that makes the hybrid pattern work. |
| 183 | |
| 184 | ## Output Format |
| 185 | |
| 186 | **Markdown brief** (Q2 = quick chat briefing): title + `*Generated: [DATE] | Routed: [specialist | fallback]*`, then **TL;DR** (2-3 sentences) → **Findings** (one H3 per sub-question, inline citations) → **Cross-Cutting Patterns** → **Sources** (numbered, hyperlinked, reliability tier each) → **Audit** (three counts + failures). |
| 187 | |
| 188 | **DOCX** (Q2 = standalone document): standard research-pack DOCX patterns — Arial 12pt, navy headings, blue table headers, hyperlinked sources, mandatory audit log section. Reference the `docx` skill for setup. |
| 189 | |
| 190 | ### Audit log block (fallback mode) |
| 191 | |
| 192 | |
| 193 | Queries sent: N | Sources received: M | Sources cited: K |
| 194 | Failures: F (3-consecutive-failures triggered: yes/no) |
| 195 | Per-source tier: [URL — primary | secondary | tertiary] |
| 196 | Routing decision: fallback (no specialist matched) |
| 197 | Sub-questions: [list] |
| 198 | |
| 199 | |
| 200 | All routing decisions + overrides also logged to `~/.research_sessions/<session>.json` via `routing_transparency_logger.py`. |
| 201 | |
| 202 | ## Failure Modes |
| 203 | |
| 204 | | Failure | Behavior | |
| 205 | |---|---| |
| 206 | | Single bare-noun signal (e.g., "funding", "fda") | Ask Q3 with the matched specialist pre-marked as the recommended answer. Never silent-route. | |
| 207 | | Classification ambiguous (multiple 1-signal matches or none) | Ask Q3 (domain disambiguation). | |
| 208 | | Specialist delegation fails | Note in chat. Offer to retry or fall back to general research. | |
| 209 | | User overrides routing | Accept. Re-route. Log the override. | |
| 210 | | Fallback search returns thin results | Surface explicitly. Suggest the question may be too niche or too new. Do not fabricate. | |
| 211 | | 3 consecutive tool failures in fallback | Stop, alert user, share what was collected. | |
| 212 | | Question is non-research (e.g., "write me code") | Decline politely. Suggest the appropriate skill. | |
| 213 | | Sub-question can't be answered | Note as "limited public signal on this"; don't omit silently. | |
| 214 | | Output format mismatch | Honor Q2; if unavailable, fall back to markdown with note. | |
| 215 | | Specialist skill missing from environment | Skip it in classification scoring; route to fallback or next-best specialist. | |
| 216 | |
| 217 | ## Anti-Patterns Rejected |
| 218 | |
| 219 | LLM-reasoned classification (must be deterministic keyword + intent matching) |
| 220 | Silent delegation (always surface routing decision) |
| 221 | Refusing to route to a specialist when ≥2 signals match |
| 222 | Silent-routing on a single bare-noun signal ("research FDA approval trends" must ask, not auto-route to grants) |
| 223 | Wall-clock affordances ("auto-proceed after Ns") — the model cannot wait; proceed with the recommended route if the user doesn't object |
| 224 | Pre-answering the specialist's grill-me intake (let it run its own) |
| 225 | Fabricating sources in fallback when search is thin |
| 226 | Skipping audit log in fallback mode |
| 227 | Treating "dossier on [company]" as fallback when `dossier` is the right specialist (the verb-noun-paired phrase routes; the generic "research X" form does not) |
| 228 | Auto-routing generic "research [topic]" queries to a specialist ("research Microsoft" alone is ambiguous — could be dossier or general; ask Q3 instead of guessing) |
| 229 | |
| 230 | ## Tooling |
| 231 | |
| 232 | **`scripts/classifier.py`** — Deterministic SIGNALS matching → routing decision (`specialist` / `ask` + recommended / `fallback`) + per-specialist score + matched phrases. `--question "..." --output json`. |
| 233 | **`scripts/routing_transparency_logger.py`** — JSON-backed audit log at `~/.research_sessions/<session>.json`. Records every routing decision, override, and delegation handoff. |
| 234 | **`scripts/fallback_decomposer.py`** — Heuristic question → 3–5 sub-questions (what / why / how / who / what's next). |
| 235 | |
| 236 | ### Reference Docs (each cites 7+ authoritative sources) |
| 237 | |
| 238 | **`references/hybrid_router_architecture.md`** — router-vs-run trade-offs + routing transparency principle |
| 239 | **`references/deterministic_classification_canon.md`** — why keyword > LLM-reasoned for routing |
| 240 | **`references/fallback_workflow_canon.md`** — plan-decompose-search-synthesize methodology |
| 241 | |
| 242 | ## Dependencies |
| 243 | |
| 244 | **`WebSearch`** + **`WebFetch`** — Required for fallback workflow |
| 245 | **Specialist skills** — Required for delegation: `pulse`, `grants`, `litreview`, `syllabus`, `patent`, `dossier`. If a specialist is missing, the router skips it and routes to fallback instead. |
| 246 | **Node.js `docx` library** — Required if user picks document output (Q2 = standalone) |
| 247 | **Consensus MCP** — Optional; used in fallback if academic sub-questions surface |
| 248 | |
| 249 | |
| 250 | |
| 251 | **Version:** 1.1.0 |
| 252 | **Source spec:** `megaprompts/13-research-megaprompt.md` (maintainer-local draft spec — gitignored, not present in the public repository) |
| 253 | **Build pattern:** Path B (direct conversion). v1.1.0: bare-noun signals now ask instead of silent-routing; 5s auto-proceed affordance removed; context-economy trim per the 2026-06 newgen audit. |
| 254 |
Discussion
Browse more free Claude skills or everything in Product.