Files
dsh-skills/skills/research-deep/SKILL.md

105 lines
4.4 KiB
Markdown

---
name: research-deep
description: Read research outline, launch independent agent for each item for deep research. Disable task output.
user-invocable: true
---
# Research Deep - Deep Research
## Trigger
`/research-deep`
## Workflow
### Step 1: Auto-locate Outline
Find `*/outline.yaml` file in current working directory, read items list, execution config (including items_per_agent).
### Step 2: Resume Check
- Check completed JSON files in output_dir
- Skip completed items
### Step 3: Batch Execution
- Batch by batch_size (before launching the next batch, ask the user to confirm via `ask_user_question`)
- Each agent handles items_per_agent items
- Launch one background web-search subagent per batch via the `subagent` tool (run_in_background: true). Its prompt is the Prompt Template below with the {xxx} variables filled, immediately followed by the research methodology loaded from `.agents/skills/research/agents/web-search-agent.md` (resolved against the session workspace) with every `{RESEARCH_SKILL_DIR}` placeholder replaced by the absolute `research` skill directory. The subagent writes its JSON file itself and returns only a one-line completion note (task output disabled).
**Parameter Retrieval**:
- `{topic}`: topic field from outline.yaml
- `{item_name}`: item's name field
- `{item_related_info}`: item's complete yaml content (name + category + description etc.)
- `{output_dir}`: execution.output_dir from outline.yaml (default: ./results)
- `{fields_path}`: absolute path to {topic}/fields.yaml
- `{output_path}`: absolute path to {output_dir}/{item_name_slug}.json (slugify item_name: replace spaces with _, remove special chars)
- `{validator_path}`: absolute path to this skill's bundled `validate_json.py` (this skill's Base directory from `<skill_resources>` + `validate_json.py`)
**Hard Constraint**: The following prompt must be strictly reproduced, only replacing variables in {xxx}, do not modify structure or wording.
**Prompt Template**:
```python
prompt = f"""## Task
Research {item_related_info}, output structured JSON to {output_path}
## Field Definitions
Read {fields_path} to get all field definitions
## Output Requirements
1. Output JSON according to fields defined in fields.yaml
2. Mark uncertain field values with [uncertain]
3. Add uncertain array at the end of JSON, listing all uncertain field names
4. All field values must be in English
## Output Path
{output_path}
## Validation
After completing JSON output, run validation script to ensure complete field coverage:
python3 {validator_path} -f {fields_path} -j {output_path}
Task is complete only after validation passes.
"""
```
**One-shot Example** (assuming researching GitHub Copilot):
```
## Task
Research name: GitHub Copilot
category: International Product
description: Developed by Microsoft/GitHub, first mainstream AI coding assistant, ~40% market share, output structured JSON to {project_dir}/results/GitHub_Copilot.json
## Field Definitions
Read {project_dir}/fields.yaml to get all field definitions
## Output Requirements
1. Output JSON according to fields defined in fields.yaml
2. Mark uncertain field values with [uncertain]
3. Add uncertain array at the end of JSON, listing all uncertain field names
4. All field values must be in English
## Output Path
{project_dir}/results/GitHub_Copilot.json
## Validation
After completing JSON output, run validation script to ensure complete field coverage:
python3 {validator_path} -f {project_dir}/fields.yaml -j {project_dir}/results/GitHub_Copilot.json
Task is complete only after validation passes.
```
### Step 4: Wait and Monitor
- Wait for current batch to complete
- Launch next batch
- Display progress
### Step 5: Summary Report
After all complete, output:
- Completion count
- Failed/uncertain marked items
- Output directory
## Agent Config
- Background execution: Yes
- Task Output: Disabled (agent has explicit output file when complete)
- Resume support: Yes
## Prerequisites
Require python3 with PyYAML. Export RESEARCH_DEEP_SKILL_DIR as this skill's absolute directory (the Base directory from `<skill_resources>`) on its own line before running the validator, e.g. `python3 "$RESEARCH_DEEP_SKILL_DIR/validate_json.py" -f <fields.yaml> -j <result.json>`; the launcher fills `{validator_path}` with that absolute path. (On the Windows shell tool the export is `$env:RESEARCH_DEEP_SKILL_DIR = "<path>"` on its own line within the same pwsh invocation.)