Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

feat: Enhance report subsection prompts with section context

LearningCircuit46ef433da279
diff --git a/src/local_deep_research/report_generator.py b/src/local_deep_research/report_generator.py
index d066e2fb68..85033b4d6d 100644
--- a/src/local_deep_research/report_generator.py
+++ b/src/local_deep_research/report_generator.py
@@ -180,18 +180,44 @@ class IntegratedReportGenerator:
section_content.append(f"## {subsection['name']}\n")
section_content.append(f"_{subsection['purpose']}_\n\n")
+ # Get other subsections in this section for context
+ other_subsections = [
+ f"- {s['name']}: {s['purpose']}"
+ for s in section["subsections"]
+ if s["name"] != subsection["name"]
+ ]
+ other_subsections_text = (
+ "\n".join(other_subsections)
+ if other_subsections
+ else "None"
+ )
+
+ # Get all other sections for broader context
+ other_sections = [
+ f"- {s['name']}"
+ for s in structure
+ if s["name"] != section["name"]
+ ]
+ other_sections_text = (
+ "\n".join(other_sections) if other_sections else "None"
+ )
+
# Generate a specific search query for this subsection
# Create a more focused and directive query to avoid repetition
subsection_query = (
- f"Research task: You are creating content for ONE SPECIFIC SUBSECTION of a comprehensive report about '{query}'. "
- f"This subsection '{subsection['name']}' has a specific purpose: {subsection['purpose']} "
- f"It belongs to the larger section '{section['name']}'. "
- f"Your goal is to find and present information that ONLY addresses this subsection's specific purpose. "
- f"Focus on unique details, specific examples, and concrete information relevant to this aspect only. "
- f"Do not include general overview information about the topic. "
- f"Use tables to organize information if applicable. "
- f"Remember: Other subsections will cover other aspects, so stay focused on your specific purpose. "
- f"Note: Initial research has already been conducted on this topic, so look for specific angles and details related to your subsection's purpose."
+ f"Research task: Create content for subsection '{subsection['name']}' in a report about '{query}'. "
+ f"This subsection's purpose: {subsection['purpose']} "
+ f"Part of section: '{section['name']}' "
+ f"\n"
+ f"Other sections in the report:\n{other_sections_text}\n"
+ f"\n"
+ f"Other subsections in this section will cover:\n{other_subsections_text}\n"
+ f"\n"
+ f"Focus ONLY on information specific to your subsection's purpose. "
+ f"Include unique details, specific examples, and concrete data. "
+ f"Use tables to organize information where applicable. "
+ f"IMPORTANT: Avoid repeating information that would logically be covered in other sections - focus on what makes this subsection unique. "
+ f"Previous research exists - find specific angles for this subsection."
)
logger.info(