238 lines
21 KiB
Markdown
238 lines
21 KiB
Markdown
---
|
||
name: deep-research
|
||
description: Dispatch exhaustive deep web research to the research profile. Triggered by "deep research", "ask web", or "research this". The research profile runs with the deep-web-research skill loaded — six-move flow, external ledger, mechanical saturation, disconfirmation, condensation from disk.
|
||
version: 2.5.0
|
||
author: Hermes Agent
|
||
license: MIT
|
||
platforms: [linux]
|
||
metadata:
|
||
hermes:
|
||
tags: [research, deep-research, delegation, web-search, scraping, research-ladder]
|
||
related_skills: [ask-hermes, ask-claude, ask-dev, deep-web-research, writing-plans, better-search, searxng-smart-search]
|
||
---
|
||
|
||
# deep-research — Exhaustive Web Research Delegation
|
||
|
||
## Overview
|
||
|
||
Dispatches a research question to the research profile, which runs with the `deep-web-research` skill loaded. The research agent does exhaustive, trail-following research — any tool, any trail, no rush — then condenses everything into a tight, concrete, evidence-backed answer. This agent just relays the result.
|
||
|
||
See `references/design-rationale.md` for the v2.0 architecture decisions and Claude validation findings. See `references/research-ladder-and-two-skill-pattern.md` for the three-tier research ladder (`searxng-smart-search` / `better-search` / `deep-research`), the two-skill contract pattern (dispatcher + methodology), and the "don't overcomplicate" rule that emerged from the operator's plan-build sessions. See `references/inventory-before-dispatch.md` for the SSH probe script and workflow for inventorying a target box before dispatching environment-specific research.
|
||
|
||
**Trigger phrases:** "deep research", "ask web", "research this", "deep dive on", "exhaustive research on"
|
||
|
||
## Clarifying Questions (Before Dispatch)
|
||
|
||
If the operator's question is ambiguous enough that the research agent would waste the first ~20 turns guessing, ask clarifying questions BEFORE dispatching. The user wants maximum clarity — err on the side of asking.
|
||
|
||
**Limits:**
|
||
- **Default cap: 5 questions.** Most well-formed questions need 0–5.
|
||
- **Hard cap: 10 questions.** For complex, multi-branch research where precision matters.
|
||
- **Abort at 11+:** If you think you need more than 10, the question is under-specified. Stop and tell the operator: "This question has too many branches to dispatch cleanly. Can you narrow it to [specific scope]?" Do NOT fire 11+ questions.
|
||
|
||
**When to ask vs. when to dispatch:**
|
||
- Ask when the answer would change the research strategy (e.g., "Are you researching a person, a company, or a topic?" — different toolkits).
|
||
- Do NOT ask when the research agent can sensibly find out (e.g., "What year did X happen?" — the research will find it).
|
||
- Do NOT ask to delay dispatching. Asking is a cost, not a hedge.
|
||
|
||
**Scope dimensions to confirm before dispatch (high-value, often-missed):**
|
||
Beyond the question's subject, confirm any dimension that changes the *output shape* of the plan/research. Missing one forces a kill + re-dispatch mid-run, wasting the first session's turns. Known dimensions:
|
||
- **Hardware/environment target** — when the deliverable maps tools to specific hardware (e.g., "build a local pipeline on our hardware"), confirm *which* hardware before dispatch. Do not assume the full fleet from memory; the operator may be scoping to a single box. This is the #1 missed dimension.
|
||
- **Cloud vs. local vs. hybrid** — when a workflow could be replicated with cloud APIs, local self-hosted, or a mix, confirm which before dispatch.
|
||
- **Build-on-existing vs. fresh** — when the target environment already has partial tooling installed, confirm whether to reuse it or design from scratch.
|
||
These are NOT generic clarifying questions — they are scope axes specific to plan-building research. Ask at most one `clarify` round covering whichever of these are genuinely unresolved before dispatching.
|
||
|
||
**Multi-turn narrowing:** If after that one round the scope is still unclear, abandon the dispatch and ask the operator to rewrite the question with the scope made explicit. Do not loop.
|
||
|
||
## Command
|
||
|
||
**Dispatch as a background terminal process with `notify_on_complete=true`.** Do NOT pipe through `head` or any other truncating filter — that kills the hermes process via SIGPIPE before the session_id is emitted.
|
||
|
||
```bash
|
||
terminal(background=true, notify_on_complete=true, timeout=14400,
|
||
command="hermes -p research -s deep-web-research chat -q \"<question>\" -Q --max-turns 4000 --yolo",
|
||
workdir="/home/n8n/workspace/research")
|
||
```
|
||
|
||
- The session_id appears near the END of stdout. Extract it from the process log with `process(action='log', session_id=...)` after completion — read the last ~20 lines for `session_id: <id>`.
|
||
- The research agent writes the condensed answer to `/home/n8n/workspace/research/results/<YYYY-MM-DD>-<slug>.md` (absolute path)
|
||
- Hold the session_id for follow-up questions
|
||
- **Session_id capture:** After the background process completes, read the last ~20 lines of the process log to find `session_id: <id>`. If the session_id is lost, `session_search` on the research profile may NOT find `-Q` quiet-mode sessions — in that case, do NOT re-dispatch Stage 3 of the validate-fix pipeline; apply validated corrections directly to the plan file yourself (you have the full plan text + validation report). This is equally correct and avoids a redundant 600-turn run.
|
||
|
||
**Subsequent asks (resume the session):**
|
||
```bash
|
||
terminal(background=true, notify_on_complete=true, timeout=14400,
|
||
command="hermes -p research -s deep-web-research chat --resume <session_id> -q \"<follow-up>\" -Q --max-turns 4000 --yolo",
|
||
workdir="/home/n8n/workspace/research")
|
||
```
|
||
|
||
## Delivery Method (MANDATORY)
|
||
|
||
**File-only delivery.** The research agent writes the full condensed answer to a markdown file and reports the path. Nothing is relayed inline.
|
||
|
||
- **Path:** `/home/n8n/workspace/research/results/<YYYY-MM-DD>-<slug>.md` (absolute path)
|
||
- **Slug:** derived from the question (e.g., `minimax-m3-temperature-support`)
|
||
- **Format:** YAML frontmatter (question, date, sources, confidence) + markdown body with structured findings
|
||
- **After dispatch:** report the expected output path to the user. The session_id is not available yet — capture and report it from the process log when the `notify_on_complete` notification arrives (see the Exception at the end of Post-Dispatch Behavior).
|
||
- **When user asks for results:** check for the result file at the path above. If the slug is unknown, use `ls -t /home/n8n/workspace/research/results/ | head` to find the most recent result. If the file ends in `-ABORTED.md`, the question was under-specified — report that to the operator and re-dispatch with narrowed scope rather than treating it as a result. Do NOT inline the answer — the file is the source of truth.
|
||
|
||
The file is the single source of truth. Do not inline the research answer — it's always lossy for 100+ turn sessions.
|
||
|
||
## Post-Dispatch Behavior (MANDATORY — non-negotiable)
|
||
|
||
**After dispatching, return control to the operator IMMEDIATELY. Do NOT poll, do NOT check, do NOT auto-deliver.**
|
||
|
||
- The research runs as a background process (`notify_on_complete=true`). It will complete on its own and you'll be notified.
|
||
- **Do NOT poll.** Do NOT call `session_search` on the research session to check progress.
|
||
- **Do NOT check.** Do NOT call `process wait` or `process poll` on the background process.
|
||
- **Do NOT auto-deliver.** Do NOT inline the answer. Do NOT push to a chat platform (Telegram/etc). Do NOT proactively surface results when the background process completes.
|
||
- **Only check for results when the user explicitly asks** (e.g., "what did the research find?", "is it done?", "show me the results").
|
||
- When the user asks, check for the result file at `/home/n8n/workspace/research/results/<date>-<slug>.md` first. If the slug is unknown, use `ls -t /home/n8n/workspace/research/results/ | head` to find the most recent result. If not found, check for a ledger at `/tmp/research-*.md` with `ls -t /tmp/research-*.md | grep -v gate | head`. Do NOT inline the answer — the file is the source of truth.
|
||
|
||
**This rule is operator-standing and applies to all research delegation skills** (`deep-research`, `better-search`, and any future research-delegation skill). Even "checking once after a delay" violates the rule. The operator reads the result file when they want to.
|
||
|
||
**Exception:** On the `notify_on_complete` notification, reading the process log to capture the session_id is allowed — it is not delivery, it's bookkeeping. Do NOT use this as a pretext to check results.
|
||
|
||
## What the Research Agent Does
|
||
|
||
The `deep-web-research` skill on the research profile enforces:
|
||
|
||
0. **Analyze & Strategize** — analyze the question, select tools from the arsenal, write strategy to ledger
|
||
1. **Decompose** — break the question into sub-questions with time classifications
|
||
2. **Landscape Pass** — shallow sweep, identify key sources and terms
|
||
3. **Deep-Dive** — 3+ search angles per sub-question, full-page reads, citation trails, depth-first
|
||
4. **Disconfirmation** — actively hunt for contradiction and outdated claims
|
||
5. **Condensation** — read the external findings ledger from disk, synthesize into a concrete answer
|
||
|
||
The research agent writes all findings to `/tmp/research-<YYYY-MM-DD>-<slug>.md` (external ledger, stem picked in Move 0) and uses a phase gate file to enforce completion before condensing. Mechanical saturation checks (`grep -c`) prevent endless searching. Re-strategize checkpoints after Move 2 and every ~10 findings during Move 3 enable mid-research pivots.
|
||
|
||
## Tool Selection Strategy
|
||
|
||
The research agent must determine the best tools for each research type — not use a fixed set. Analyze the question and select from the full arsenal:
|
||
|
||
| Research Type | Primary Tools | Secondary Tools |
|
||
|---|---|---|
|
||
| **Person/identity** | SearXNG (people search engines, social media), web scraping (full pages) | Browser (dynamic sites), Python (data enrichment) |
|
||
| **Email/phone** | SearXNG (breach databases, public records), web scraping | Browser (captcha-walled sites), Python (pattern analysis) |
|
||
| **Software/tech** | SearXNG (GitHub, docs, PyPI/npm), web scraping (changelogs, issues) | Terminal (live version checks), Browser (interactive docs) |
|
||
| **Politics/news** | SearXNG (news category, multiple engines), web scraping (primary sources) | Browser (paywalled articles), Python (timeline analysis) |
|
||
| **AI/ML** | SearXNG (arxiv, papers, HuggingFace), web scraping (model cards, benchmarks) | Terminal (live API probes), Python (data analysis) |
|
||
| **General topic** | SearXNG (general + news + scholarly), web scraping (authoritative sources) | Browser (interactive content), Python (synthesis) |
|
||
|
||
**Tool selection rules:**
|
||
- Always use multiple SearXNG engines per search — never rely on a single engine
|
||
- For any claim about a live system, run a terminal probe (curl, ping, API call) — don't just search
|
||
- For version-sensitive claims, check at least 2 independent sources (docs + GitHub + PyPI)
|
||
- For paywalled or JavaScript-heavy content, use the browser tool
|
||
- For data that needs aggregation or analysis, use Python in the terminal
|
||
- Docker-based tools (SearXNG, Playwright) are available and should be used when appropriate
|
||
- The research agent has full terminal, file, web, browser, and Python access — use all of them
|
||
|
||
## When to Use
|
||
|
||
- User says "deep research", "ask web", "research this", "deep dive on"
|
||
- Question requires exhaustive multi-source investigation
|
||
- User wants current, verified, cross-referenced information
|
||
- Phone number lookup, person research, topic investigation, fact verification
|
||
|
||
## When NOT to Use (research ladder — pick the right tier)
|
||
|
||
The research ladder has three tiers. Pick the cheapest one that fits the question:
|
||
|
||
| Tier | Skill | Loops | Use when |
|
||
|---|---|---|---|
|
||
| Light | `searxng-smart-search` (inline MCP) | 1 | Single factual lookup, single search suffices |
|
||
| Medium | `better-search` | 1–3 | "Look into X", "do a better search", 2–3 targeted searches with AI evaluation |
|
||
| Heavy | `deep-research` (this skill) | Many (200+) | "Map the X landscape", OSINT, exhaustive coverage, contradiction-hunting |
|
||
|
||
**Routing decision belongs to the operator, not the dispatcher.** If the question is "what is the capital of France?", use `searxng-smart-search` directly. If it's "look into the latest X", use `better-search`. Only escalate to `deep-research` when the operator explicitly wants exhaustive multi-source work.
|
||
|
||
**Do NOT use `deep-research` for:**
|
||
|
||
- Simple factual question (capital of France, current time)
|
||
- Question I can answer from a single search
|
||
- Task that needs my exact context state
|
||
- User explicitly says "quick search" or "just look it up"
|
||
|
||
## Relay Rule
|
||
|
||
Do NOT relay the research agent's response inline. The file at `/home/n8n/workspace/research/results/<date>-<slug>.md` is the single source of truth. When the user asks for results, report the file path and let them read it directly. If the user asks for a specific finding, you may extract that one section from the file — but never inline the full answer.
|
||
|
||
## Spot-check Rule
|
||
|
||
The research agent self-reports are not verified fact. If it claims a file write, `read_file` the path to confirm. If it claims a specific finding, spot-check the source URL.
|
||
|
||
## Session Persistence
|
||
|
||
**HARD RULE: Same topic = resume. New topic = new session.**
|
||
|
||
- **Same topic / same line of research:** Always `--resume <session_id>`. Capture session_id from the process log after completion. Every follow-up in the same line of research MUST use `--resume <session_id>`. Starting fresh discards the research context and wastes turns.
|
||
- **New topic / new line of research:** Start a fresh session. Do NOT resume an unrelated session — the research context is polluted with the old topic and will produce confused results.
|
||
|
||
## Common Pitfalls
|
||
|
||
1. **Profile flag required.** Always use `-p research`. The sticky default may be general.
|
||
2. **Skill flag required.** Always use `-s deep-web-research`. Without it, the research agent runs in normal mode without the methodology.
|
||
3. **--yolo is required.** The research agent runs headless. Without it, approval prompts fail closed.
|
||
4. **2000 turns is the ceiling, not the target.** The research agent should condense well before 2000. Hitting the ceiling means it failed to condense. The operator's standing rule: 2000 is a safety net, not a budget — "I just want a safety net. I would even be okay with 2000 as a catch. I mostly want the job done right. Not concerned with time or tokens."
|
||
5. **Don't re-condense.** The research agent already produced a condensed answer. Report the file path — the answer is already condensed. Do not re-summarize or inline it.
|
||
6. **Don't do the research yourself.** If the user triggers deep research, dispatch it. Don't run a few searches and call it done. This is the #1 failure mode: the agent runs 2-3 `mcp_searxng_searxng_web_search` calls, gets empty results, and gives up. That's not deep research — that's a casual lookup. If you catch yourself typing `mcp_searxng_searxng_web_search` for a deep research request, STOP. You're doing it wrong. Dispatch to the research profile.
|
||
7. **The methodology skill lives on the research profile.** `deep-web-research` is at `~/.hermes/profiles/research/skills/research/deep-web-research/SKILL.md`. It does NOT exist on the general profile. Don't search for it here — it won't be found. The general profile only has this delegation skill.
|
||
8. **Dispatcher/methodology coordination is a two-skill contract.** This skill (the dispatcher) caps clarifying questions at 5 default / 10 max and aborts the dispatch if the question is under-specified. The `deep-web-research` methodology skill (on the research profile) handles the same problem differently because it's headless — it can't ask the operator, so it aborts with a structured under-specification report naming the plausible interpretations. When updating one, update the other to match. Drift between the two causes the dispatcher to think the question is dispatchable while the methodology aborts it, or vice versa — both waste turns.
|
||
9. **Confirm hardware/environment scope before dispatching a hardware-mapped plan.** If the deliverable maps tools to specific hardware, confirm *which hardware* before dispatch — do not assume the full fleet from memory. The operator may be scoping to a single box (e.g., "I'll provide one LXC"). A 600-turn research artifact built against the wrong hardware scope has its architecture, parallelization, and GPU-scheduling sections wrong and must be killed and re-dispatched. Cheaper to ask one `clarify` round than to re-run 600 turns. (Learned 2026-07-07: dispatched a microdrama-pipeline plan against the full fleet; operator corrected to a single LXC; had to kill and re-dispatch.)
|
||
10. **Inventory the target box before dispatching environment-specific research.** When the plan must build on an existing install, SSH in and inventory the real state (GPU, RAM, disk, running services, installed models/nodes/packages) *before* dispatching, and pass the exact inventory into the research prompt. This lets the research agent research only the genuinely missing pieces instead of guessing or re-researching what's already installed. See `references/inventory-before-dispatch.md` for the probe script.
|
||
|
||
## Tool Inventory
|
||
|
||
The research profile has a comprehensive tool inventory at `~/.hermes/profiles/research/memories/MEMORY_TOOLS.md` — 15 sections organized by use case (Web Search, Scraping, Browser, PDF, OSINT, Social Media, Vector Search, AI/ML, Code, Memory, Tasks, Vision, Skills, Data Formats, Infrastructure). The `deep-web-research` methodology skill references it for tool selection. Before dispatching, confirm the inventory is current by checking the file exists. If the research agent reports missing tools, update the inventory first, then re-dispatch.
|
||
|
||
## Pre-Dispatch Reasoning Check (do NOT mutate the research profile's config)
|
||
|
||
**Do NOT call `hermes -p research config set reasoning_effort high` before dispatching.** That is a persistent side-effect — it writes to the research profile's `config.yaml` and the change survives the dispatch, affecting every subsequent research-profile session (interactive use, cron jobs, other research delegations).
|
||
|
||
**Correct approach:** The research profile's `reasoning_effort` is already set to `high` by the operator (operator's standing rule: thoroughness > speed; thoroughness > tokens). Read it before dispatching to confirm it's at a high value, but do NOT write to it:
|
||
|
||
```bash
|
||
# Read-only check — confirm reasoning_effort is set
|
||
grep "reasoning_effort:" ~/.hermes/profiles/research/config.yaml
|
||
# If it's NOT at high, warn the operator — don't silently fix it
|
||
```
|
||
|
||
If the operator wants a different reasoning effort for this specific dispatch, they set it themselves; the dispatcher does not mutate other profiles' configs on every invocation. The `high` value the operator wants is achieved by the operator setting it once in `config.yaml`; the dispatcher reads and confirms, never writes.
|
||
|
||
This rule also applies to all research-dispatching skills (`better-search`, future research delegation skills). The dispatcher is not authorized to mutate the target profile's config.
|
||
|
||
## Research → Validate → Fix Pipeline
|
||
|
||
When the user wants a research deliverable validated and corrected, use this three-stage pipeline:
|
||
|
||
```
|
||
Stage 1: Deep research → produces <plan>.md
|
||
Stage 2: Ask-hermes validation → produces <plan>_validation.md
|
||
Stage 3: Deep research fix pass → updates <plan>.md with corrections
|
||
```
|
||
|
||
**Operational guide (exact prompts, session handling, failure modes):** `references/research-validate-fix.md`. The summary below is the quick reference; the reference file is the deep version.
|
||
|
||
**Stage 2 prompt template** (dispatch to `ask-hermes`):
|
||
```
|
||
Validate the plan at <path>. Read the full file first.
|
||
CRITICAL: Use mcp_searxng_searxng_web_search for EVERY claim and cite the source URL.
|
||
Validate: model versions, license claims, VRAM claims, tool availability, new tools since plan was written, hardware benchmarks.
|
||
For each finding: CLAIM → VERIFIED/CONTRADICTED/UPDATED → source URL → recommended fix.
|
||
Save to <path>_validation.md.
|
||
```
|
||
|
||
**Stage 3 prompt template** (resume the research session):
|
||
```
|
||
Read the validation report at <path>_validation.md. Read the current plan at <path>.
|
||
Apply ALL fixes from the validation report. Keep all existing content. Make targeted edits only. Do NOT rewrite the whole plan.
|
||
```
|
||
|
||
**Key rules:**
|
||
- Stage 2 and 3 can run in parallel with other work (both are background processes).
|
||
- Stage 3 MUST use `--resume <session_id>` from Stage 1 — same research session, same context.
|
||
- The validation agent (Stage 2) is a fresh `ask-hermes` session each time — no resume needed.
|
||
- If Stage 2 finds CRITICAL omissions, Stage 3 must address them before the plan is considered complete.
|
||
- Operator must apply the **Disagreement Scan** (see `ask-hermes` skill) to Stage 2 findings before applying them in Stage 3 — peer findings are input, not commands.
|