Local Deep Research Skill
This skill interfaces with a locally-hosted LDR (Local Deep Research) service to perform multi-cycle, iterative research with full citations and source tracking.
What to consider before installing
- - LDR service: The script talks only to the URL in
LDR_BASE_URL (default http://127.0.0.1:5000). Only point it at an LDR instance you control. Do not set it to an unknown or untrusted remote host. - Required binaries: Ensure
curl and jq are installed on the host where the skill runs. - Credentials: If your LDR instance requires login, set
LDR_SERVICE_USER and LDR_SERVICE_PASSWORD (or LDR_USERNAME/LDR_PASSWORD) via environment variables or a local .env file only. Use a dedicated, low-privilege LDR account (e.g. openclaw_service). Do not store secrets in committed config or in the skill directory. - Sourced .env: The script optionally sources
~/.config/local_deep_research/config/.env if that file exists. That file may expose any variables it contains to the script. Verify the contents of that path before use; do not place unrelated secrets there. - Review the script: The script performs form-based session+CSRF login and uses an ephemeral cookie jar. It does not send data to any endpoint other than the configured LDR service. You can review
scripts/ldr-research.sh before use. For higher assurance, run it in an isolated environment (e.g. container or VM) with network restricted to your LDR host.
Configuration
Credentials (local-only, never transmitted)
LDR uses session-cookie auth with CSRF protection (not HTTP Basic Auth). The skill script performs a proper login flow: GET login page → obtain session cookie and CSRF token → POST credentials + CSRF → reuse session cookie (and CSRF for POSTs) for all API calls. Username and password are used only to create a session with your local LDR instance; they are never sent to ClawHub, GitHub, or any other server.
Do not put credentials in skill config or committed files. Use environment variables or a local .env file only (e.g. LDR_SERVICE_USER, LDR_SERVICE_PASSWORD, or LDR_USERNAME/LDR_PASSWORD). Optional: LDR’s ~/.config/local_deep_research/config/.env is sourced by the script if present. Use a dedicated LDR user (e.g. openclaw_service) for this skill.
All configuration options
- -
LDR_BASE_URL — LDR service URL (default: http://127.0.0.1:5000) - INLINECODE21 — Login page URL for session + CSRF (default:
$LDR_BASE_URL/auth/login) - INLINECODE23 or
LDR_USERNAME — LDR account username (local auth only) - INLINECODE25 or
LDR_PASSWORD — LDR account password (local auth only) - INLINECODE27 — Default research mode:
quick (Quick Summary) or detailed (Detailed Report) (default: detailed) - INLINECODE31 — Default output language code for report/summary (e.g.
en, es, fr, de, zh, ja); empty = LDR default - INLINECODE38 — Default search tool:
searxng, auto, local_all (default: auto)
Research modes (Quick Summary vs Detailed Report)
- -
quick — Quick Summary: fewer cycles, shorter output, faster. Use when the user wants a concise summary or a quick overview. detailed — Detailed Report: full multi-cycle research, full markdown report, full citations and sources. Use when the user wants comprehensive analysis, literature review, or in-depth coverage.
Actions
start_research
Fire-and-forget: submit a query to LDR and return a research ID immediately.
Inputs:
- -
query (required) — The research question or topic - INLINECODE46 (optional) —
quick (Quick Summary) or detailed (Detailed Report) (default from config) - INLINECODE49 (optional) — Output language for the report/summary, e.g.
en, es, fr, de, zh, ja (default from config or LDR default) - INLINECODE56 (optional) —
searxng, auto, local_all (default from config) - INLINECODE60 (optional) — Number of research cycles (default: LDR's default)
- INLINECODE61 (optional) — Questions to generate per cycle
Returns:
CODEBLOCK0
Usage:
CODEBLOCK1
get_status
Check the status of a research job.
Inputs:
- -
research_id (required) — The research job ID from start_research
Returns:
CODEBLOCK2
Usage:
CODEBLOCK3
get_result
Fetch the complete research report once finished.
Inputs:
- -
research_id (required) — The research job ID
Returns:
CODEBLOCK4
Usage:
CODEBLOCK5
Orchestration Pattern
One-shot (wait for completion)
For interactive sessions where the user can wait:
- 1. Call INLINECODE64
- Poll
get_status every 10-30 seconds - When
state == "completed", call INLINECODE67 - Present the report to the user
Async (fire-and-forget with follow-up)
For background processing:
- 1. Call
start_research, return the research_id to the user - User can check status later with INLINECODE70
- When ready, call
get_result to fetch the complete report
Chained workflows
After research completes:
- 1. Call
get_result to get sources - Pass sources to other skills (e.g.,
markdown-converter, summarize) - Build RAG indexes or knowledge bases from the sources
Error Handling
start_research failures
- - HTTP/network errors — Retry with exponential backoff (3 attempts)
- LDR validation errors — Return error to user (bad query, invalid params)
- Auth failures — Check credentials, return clear error
getstatus / getresult failures
- - Temporarily unavailable — Retry 2-3 times before surfacing error
- Research not found — Return "unknown research_id" error
- Timeout — Return state with timeout reason
Timeouts
- - Per HTTP request — 30-60 seconds (configurable)
- Total research duration — No client-side limit (LDR manages this)
- Status polling interval — 10-30 seconds recommended
Example Session
CODEBLOCK6
Related Skills
- - academic-deep-research — Alternative for academic-focused research with APA 7th citations
- deep-research-pro — Web-based deep research (no local LDR required)
- tavily / searxng — Simple web search for quick lookups
- summarize — Process LDR output for additional summarization
Troubleshooting
LDR service not responding
- 1. Check
LDR_BASE_URL is correct - Verify LDR service is running: INLINECODE76
- Check LDR logs for errors
Authentication failures
- 1. Ensure credentials are set via env or local .env only (e.g.
LDR_SERVICE_USER, LDR_SERVICE_PASSWORD), not in committed config. - LDR uses session + CSRF (not Basic Auth). The script GETs the login page, extracts the CSRF token, then POSTs the login form. If LDR uses a different login path or field names, set
LDR_LOGIN_URL or see the script’s login section. - Test: run the script with credentials set and check for "Login successful"; or open
LDR_LOGIN_URL in a browser and sign in there to verify LDR is up.
Research stuck in "running" state
- 1. Check LDR service health
- Review LDR logs for stuck jobs
- Consider timeout and restart if >30 minutes with no progress
本地深度研究技能
该技能与本地托管的LDR(本地深度研究)服务交互,执行多周期、迭代式研究,并提供完整引用和来源追踪。
安装前注意事项
- - LDR服务:脚本仅与LDRBASEURL(默认http://127.0.0.1:5000)中的URL通信。请仅指向您控制的LDR实例。不要将其设置为未知或不受信任的远程主机。
- 必需二进制文件:确保运行该技能的主机上已安装curl和jq。
- 凭据:如果您的LDR实例需要登录,请仅通过环境变量或本地.env文件设置LDRSERVICEUSER和LDRSERVICEPASSWORD(或LDRUSERNAME/LDRPASSWORD)。使用专用的低权限LDR账户(例如openclawservice)。不要将密钥存储在已提交的配置或技能目录中。
- 来源.env:如果存在~/.config/localdeep_research/config/.env文件,脚本可选择性地引用该文件。该文件可能将其包含的任何变量暴露给脚本。使用前请验证该路径的内容;不要将无关的密钥放置其中。
- 审查脚本:脚本执行基于表单的会话+CSRF登录,并使用临时cookie存储。它不会向配置的LDR服务之外的任何端点发送数据。您可以在使用前审查scripts/ldr-research.sh。为获得更高安全性,请在隔离环境(例如容器或虚拟机)中运行,并将网络限制为仅连接您的LDR主机。
配置
凭据(仅本地,绝不传输)
LDR使用带CSRF保护的会话cookie认证(而非HTTP基本认证)。技能脚本执行完整的登录流程:GET登录页面 → 获取会话cookie和CSRF令牌 → POST凭据+CSRF → 对所有API调用重用会话cookie(以及用于POST的CSRF)。用户名和密码仅用于与您的本地LDR实例创建会话;它们绝不会发送到ClawHub、GitHub或任何其他服务器。
不要将凭据放入技能配置或已提交的文件中。仅使用环境变量或本地.env文件(例如LDRSERVICEUSER、LDRSERVICEPASSWORD或LDRUSERNAME/LDRPASSWORD)。可选:如果存在,脚本会引用LDR的~/.config/localdeepresearch/config/.env。为此技能使用专用的LDR用户(例如openclaw_service)。
所有配置选项
- - LDRBASEURL — LDR服务URL(默认:http://127.0.0.1:5000)
- LDRLOGINURL — 用于会话+CSRF的登录页面URL(默认:$LDRBASEURL/auth/login)
- LDRSERVICEUSER或LDRUSERNAME — LDR账户用户名(仅本地认证)
- LDRSERVICEPASSWORD或LDRPASSWORD — LDR账户密码(仅本地认证)
- LDRDEFAULTMODE — 默认研究模式:quick(快速摘要)或detailed(详细报告)(默认:detailed)
- LDRDEFAULTLANGUAGE — 报告/摘要的默认输出语言代码(例如en、es、fr、de、zh、ja);空值表示LDR默认
- LDRDEFAULTSEARCHTOOL — 默认搜索工具:searxng、auto、localall(默认:auto)
研究模式(快速摘要 vs 详细报告)
- - quick — 快速摘要:更少周期、更短输出、更快速度。当用户需要简洁摘要或快速概览时使用。
- detailed — 详细报告:完整多周期研究、完整Markdown报告、完整引用和来源。当用户需要全面分析、文献综述或深入覆盖时使用。
操作
start_research
即发即弃:向LDR提交查询并立即返回研究ID。
输入:
- - query(必需)— 研究问题或主题
- mode(可选)— quick(快速摘要)或detailed(详细报告)(默认来自配置)
- language(可选)— 报告/摘要的输出语言,例如en、es、fr、de、zh、ja(默认来自配置或LDR默认)
- searchtool(可选)— searxng、auto、localall(默认来自配置)
- iterations(可选)— 研究周期数(默认:LDR默认值)
- questionsperiteration(可选)— 每周期生成的问题数
返回:
json
{
research_id: uuid-string,
mode: detailed,
search_tool: auto,
submitted_at: 2026-03-10T08:00:00Z,
status: queued
}
用法:
bash
快速摘要(更快、更短)
scripts/ldr-research.sh start_research --query 固态电池进展 --mode quick
详细报告,输出为西班牙语
scripts/ldr-research.sh start_research \
--query 固态电池的最新发展是什么? \
--mode detailed \
--language es \
--search_tool searxng
get_status
检查研究任务的状态。
输入:
- - researchid(必需)— 来自startresearch的研究任务ID
返回:
json
{
research_id: uuid-string,
state: pending|running|completed|failed|timeout,
progress: 45,
message: 正在综合第2周期的来源...,
last_milestone: 从8个来源生成了12个问题
}
用法:
bash
scripts/ldr-research.sh getstatus --researchid
get_result
完成后获取完整的研究报告。
输入:
- - research_id(必需)— 研究任务ID
返回:
json
{
research_id: uuid-string,
query: 原始查询,
mode: detailed,
summary: 执行摘要文本,
report_markdown: 完整Markdown报告,
sources: [
{
id: 1,
title: 来源标题,
url: https://example.com,
snippet: 相关摘录,
type: web|local_doc
}
],
iterations: 3,
created_at: 2026-03-10T08:00:00Z,
completed_at: 2026-03-10T08:15:00Z
}
用法:
bash
scripts/ldr-research.sh getresult --researchid
编排模式
一次性(等待完成)
适用于用户可以等待的交互式会话:
- 1. 调用startresearch
- 每10-30秒轮询getstatus
- 当state == completed时,调用get_result
- 向用户呈现报告
异步(即发即弃,后续跟进)
适用于后台处理:
- 1. 调用startresearch,向用户返回researchid
- 用户稍后可使用getstatus --researchid 检查状态
- 准备就绪时,调用get_result获取完整报告
链式工作流
研究完成后:
- 1. 调用get_result获取来源
- 将来源传递给其他技能(例如markdown-converter、summarize)
- 从来源构建RAG索引或知识库
错误处理
start_research失败
- - HTTP/网络错误 — 使用指数退避重试(3次尝试)
- LDR验证错误 — 向用户返回错误(错误查询、无效参数)
- 认证失败 — 检查凭据,返回明确错误
getstatus / getresult失败
- - 暂时不可用 — 在显示错误前重试2-3次
- 研究未找到 — 返回未知research_id错误
- 超时 — 返回带有超时原因的状态
超时设置
- - 每个HTTP请求 — 30-60秒(可配置)
- 总研究时长 — 无客户端限制(由LDR管理)
- 状态轮询间隔 — 建议10-30秒
示例会话
用户:研究量子计算的最新发展
助手:正在使用LDR启动深度研究...
→ start_research(query=量子计算的最新发展, mode=detailed)
→ 返回:research_id=abc-123, status