deep-research
Create educational documents that build understanding progressively with citations
$ Installieren
git clone https://github.com/cbgbt/bottlerocket-forest /tmp/bottlerocket-forest && cp -r /tmp/bottlerocket-forest/skills/deep-research ~/.claude/skills/bottlerocket-forest// tip: Run this command in your terminal to install the skill
name: deep-research description: Create educational documents that build understanding progressively with citations
Research Document
A systematic approach to creating educational documentation through tiered research.
Purpose
Creates in-depth explanatory documents that:
- Build understanding from fundamentals to specifics
- Use progressive disclosure to guide the reader
- Provide complete citations for all information
- Use visual summaries and tables for dense information
Roles
You (reading this file) are the orchestrator.
| Role | Reads | Does |
|---|---|---|
| Orchestrator (you) | SKILL.md, next-step.py output | Runs state machine, spawns subagents, writes outputs |
| State machine | progress.json, workspace files | Decides next action, validates gates |
| Subagent | Phase file (e.g., SCOUT.md) | Executes phase instructions |
â ïž Do not read the files in phases/ â they are instructions for your subagents. Pass them via context_files.
When to Use
- User asks for comprehensive explanations of systems or features
- Need to document how components work end-to-end
- Creating educational content about architecture or processes
- Questions like "Explain how X works" or "What is the Y process?"
For quick factual lookups, use fact-find instead.
Directory Structure
skills/deep-research/
âââ SKILL.md # This file (for orchestrator)
âââ next-step.py # State machine
âââ phases/ # For subagents only - do not read
âââ SCOUT.md
âââ RESEARCH.md
âââ ASSEMBLE.md
âââ VERIFY.md
Workspace Layout
All artifacts go to planning/<question-slug>/:
planning/how-twoliter-builds-kits/
âââ progress.json # State machine state
âââ question.txt # Original question
âââ 00-scout.md # Scout findings + sub-questions
âââ 01-kit-structure.md # Sub-question answer
âââ 02-build-command.md # Sub-question answer
âââ verify-1.txt # Citation verification
âââ verify-2.txt # Citation verification
âââ FINAL.md # Assembled document
Orchestrator Loop
The orchestrator runs the state machine and spawns subagents.
Pseudocode (any agentic system)
slug = slugify(user_question)
workspace = "planning/" + slug
create workspace directory
write user_question to workspace/question.txt
loop:
# Ask state machine what to do next
action = run("python3 skills/deep-research/next-step.py <workspace>")
parse action as JSON
if action.type == "done":
read workspace/FINAL.md
break
if action.type == "gate_failed":
log "Gate failed: " + action.reason
break
if action.type == "spawn":
# Spawn subagent with phase file - DO NOT read it yourself
result = spawn_subagent(
prompt = action.prompt,
context_files = action.context_files, # includes phase file
context_data = action.context_data
)
write result to workspace/<action.output_file>
Python variant (run_agent_program systems)
import json
slug = "question-slug" # derive from user question
workspace = f"planning/{slug}"
bash(f"mkdir -p {workspace}", on_error="raise")
write("create", f"{workspace}/question.txt", file_text=user_question)
while True:
result = bash(f"python3 skills/deep-research/next-step.py {workspace}", on_error="raise")
action = json.loads(result)
if action["type"] == "done":
final = fs_read("Line", f"{workspace}/FINAL.md", 1, 9999)
break
if action["type"] == "gate_failed":
log(f"Gate failed: {action['reason']}")
break
if action["type"] == "spawn":
r = spawn(
action["prompt"],
context_files=action["context_files"],
context_data=action.get("context_data"),
allow_tools=True
)
write("create", f"{workspace}/{action['output_file']}", file_text=r.response)
Handling Exceptions
The state machine handles the happy path. When things go wrong, exercise judgment:
| Exception | Response |
|---|---|
| Spawn times out | Assess: retry with longer timeout? Report partial progress? |
| Spawn returns error | Report failure to state machine, let it track retries |
| Empty/invalid response | Treat as failure, report to state machine |
Don't silently advance past failures. Either retry, fail explicitly, or document gaps.
Phases
Phase 1: Scout
Discovers what exists and formulates sub-questions. Writes 00-scout.md.
Phase 2: Research
Answers each sub-question from the scout phase. Writes NN-*.md files.
The state machine loops until all sub-questions are answered.
Phase 3: Assemble
Combines all research files into FINAL.md.
Phase 4: Verify
Checks each citation in FINAL.md. Spawns one verifier per citation.
Gates
The state machine validates between phases:
| Gate | Validation |
|---|---|
| Scout â Research | 00-scout.md exists with sub-questions |
| Research â Assemble | Count of NN-*.md files matches sub-question count |
| Assemble â Verify | FINAL.md exists |
| Verify â Done | All citations verified |
Research Quality Indicator
Documents end with one of:
- â Answered from documentation - Fully answered from README files, design docs
- â ïž Answered from source code - Had to read implementation files
- đ Partial documentation - Required both docs and source code
- â Gaps remain - Some sub-questions could not be answered
Repository
