~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
feat: add show_all_strategies setting to toggle advanced strategies (#3315)
LearningCircuitbd4fa69bf98f
diff --git a/src/local_deep_research/constants.py b/src/local_deep_research/constants.pyindex 0bdef78eb2..725ece69f3 100644--- a/src/local_deep_research/constants.py+++ b/src/local_deep_research/constants.py@@ -110,6 +110,21 @@ AVAILABLE_STRATEGIES: List[Dict[str, str]] = ["label": "Focused Iteration - Comprehensive (Needs >16,000 context window)","description": "Detailed long-form output with citations. Uses standard citation handler for comprehensive answers.",},+ {+ "name": "mcp",+ "label": "MCP ReAct (Agentic research - LLM decides tools)",+ "description": "Agentic research using ReAct pattern. LLM decides what tools to call, analyzes results, and iterates.",+ },+ {+ "name": "langgraph-agent",+ "label": "LangGraph Agent (Autonomous agentic research)",+ "description": "Agentic research where the LLM autonomously decides what to search, which engines to use, and when to synthesize. Supports all search engines as tools.",+ },+]+++ALL_STRATEGIES: List[Dict[str, str]] = [+ *AVAILABLE_STRATEGIES,{"name": "iterative-refinement","label": "Iterative Refinement (Progressive refinement)",@@ -121,22 +136,132 @@ AVAILABLE_STRATEGIES: List[Dict[str, str]] = ["description": "Clusters sources into topics with lead texts. Organizes research by themes for structured output.",},{- "name": "mcp",- "label": "MCP ReAct (Agentic research - LLM decides tools)",- "description": "Agentic research using ReAct pattern. LLM decides what tools to call, analyzes results, and iterates.",+ "name": "news_aggregation",+ "label": "News Aggregation (Current events)",+ "description": "Specialized for news aggregation and current events.",},{- "name": "langgraph-agent",- "label": "LangGraph Agent (Autonomous agentic research)",- "description": "Agentic research where the LLM autonomously decides what to search, which engines to use, and when to synthesize. Supports all search engines as tools.",+ "name": "rapid",+ "label": "Rapid (Quick single-pass search)",+ "description": "Quick single-pass search for fast results. Good for simple queries.",+ },+ {+ "name": "iterative",+ "label": "Iterative (Loop-based reasoning)",+ "description": "Loop-based reasoning with persistent knowledge accumulation and confidence tracking.",+ },+ {+ "name": "parallel",+ "label": "Parallel (Multiple queries simultaneously)",+ "description": "Runs multiple search queries in parallel for comprehensive coverage.",+ },+ {+ "name": "recursive",+ "label": "Recursive (Query decomposition)",+ "description": "Recursive decomposition of complex queries into simpler sub-queries.",+ },+ {+ "name": "adaptive",+ "label": "Adaptive (Step-by-step reasoning)",+ "description": "Adaptive step-by-step reasoning that adjusts strategy based on results.",+ },+ {+ "name": "smart",+ "label": "Smart (Auto sub-query generation)",+ "description": "Smart decomposition with automatic sub-query generation.",+ },+ {+ "name": "standard",+ "label": "Standard (Basic iterative search)",+ "description": "Basic iterative search strategy for general use.",+ },+ {+ "name": "iterdrag",+ "label": "IterDRAG (Iterative retrieval and generation)",+ "description": "IterDRAG strategy for iterative document retrieval and generation.",+ },+ {+ "name": "iterative-reasoning",+ "label": "Iterative Reasoning (Depth-based exploration)",+ "description": "Iterative reasoning with depth-based exploration.",+ },+ {+ "name": "browsecomp",+ "label": "BrowseComp (Confidence-based iteration)",+ "description": "BrowseComp optimized strategy with confidence-based iteration.",+ },+ {+ "name": "evidence",+ "label": "Evidence (Verification with candidate discovery)",+ "description": "Enhanced evidence-based verification with candidate discovery and pattern learning.",+ },+ {+ "name": "constrained",+ "label": "Constrained (Progressive narrowing)",+ "description": "Progressive constraint-based search that narrows candidates step by step.",+ },+ {+ "name": "parallel-constrained",+ "label": "Parallel Constrained (Combined constraint execution)",+ "description": "Parallel constraint-based search with combined constraint execution.",+ },+ {+ "name": "early-stop-constrained",+ "label": "Early Stop Constrained (With early stopping at 99%)",+ "description": "Parallel constraint search with immediate evaluation and early stopping.",+ },+ {+ "name": "smart-query",+ "label": "Smart Query (LLM query generation)",+ "description": "Smart query generation strategy using LLM-generated queries.",+ },+ {+ "name": "dual-confidence",+ "label": "Dual Confidence (Positive/negative/uncertainty scoring)",+ "description": "Dual confidence scoring with positive/negative/uncertainty.",+ },+ {+ "name": "dual-confidence-with-rejection",+ "label": "Dual Confidence + Rejection (Early rejection)",+ "description": "Dual confidence with early rejection of poor candidates.",+ },+ {+ "name": "concurrent-dual-confidence",+ "label": "Concurrent Dual Confidence (Concurrent search & evaluation)",+ "description": "Concurrent search and evaluation with progressive constraint relaxation.",+ },+ {+ "name": "constraint-parallel",+ "label": "Constraint Parallel (Parallel constraint checking)",+ "description": "Parallel constraint checking with entity seeding and direct property search.",+ },+ {+ "name": "modular",+ "label": "Modular (Modular architecture with constraint checking)",+ "description": "Modular architecture using constraint checking and candidate exploration modules.",+ },+ {+ "name": "modular-parallel",+ "label": "Modular Parallel (Modular with parallel exploration)",+ "description": "Modular strategy with parallel exploration.",+ },+ {+ "name": "browsecomp-entity",+ "label": "BrowseComp Entity (Entity-focused with knowledge graph)",+ "description": "Entity-focused search for BrowseComp questions with knowledge graph building.",},]-def get_available_strategies() -> List[Dict[str, str]]:+def get_available_strategies(show_all: bool = False) -> List[Dict[str, str]]:"""Get the list of available research strategies.+ Args:+ show_all: If True, return all strategies including advanced/experimental ones.+Returns:List of dictionaries with 'name', 'label', and 'description' keys."""+ if show_all:+ return ALL_STRATEGIES.copy()return AVAILABLE_STRATEGIES.copy()diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.jsonindex 89b9e63118..a92b175d98 100644--- a/src/local_deep_research/defaults/default_settings.json+++ b/src/local_deep_research/defaults/default_settings.json@@ -970,6 +970,20 @@"value": 10,"visible": true},+ "search.show_all_strategies": {+ "category": "search_parameters",+ "description": "When enabled, all available search strategies (including advanced and experimental ones) are shown in strategy dropdowns. When disabled, only the recommended strategies are shown.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Show All Strategies",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": false,+ "visible": true+ },"search.search_strategy": {"category": "search_parameters","description": "Research methodology. 'source-based': Finds and extracts from sources (good for comprehensive research). 'focused-iteration': Uses entity-based progressive exploration (optimized for factual Q&A, ~95% SimpleQA accuracy, requires larger context windows). 'focused-iteration-standard': Comprehensive variant of focused-iteration with broader exploration. 'iterative-refinement': LLM-guided progressive refinement with gap analysis. 'topic-organization': Organizes research around discovered topic clusters. 'mcp': Agentic ReAct-pattern research using MCP tools.",diff --git a/src/local_deep_research/mcp/server.py b/src/local_deep_research/mcp/server.pyindex 0dd0b49fa6..b3287584cd 100644--- a/src/local_deep_research/mcp/server.py+++ b/src/local_deep_research/mcp/server.py@@ -182,7 +182,7 @@ def _validate_strategy(strategy: Optional[str]) -> Optional[str]:strategy = strategy.strip()if not strategy:return None- available = get_available_strategies()+ available = get_available_strategies(show_all=True)available_names = [s["name"] for s in available]if strategy not in available_names:raise ValidationError(@@ -801,7 +801,7 @@ def list_strategies() -> Dict[str, Any]:try:return {"status": "success",- "strategies": get_available_strategies(),+ "strategies": get_available_strategies(show_all=True),}except Exception as e:diff --git a/src/local_deep_research/news/web.py b/src/local_deep_research/news/web.pyindex 71721c3f73..6a7f1c4dac 100644--- a/src/local_deep_research/news/web.py+++ b/src/local_deep_research/news/web.py@@ -26,13 +26,40 @@ def create_news_blueprint():# Register the API blueprint as sub-blueprintbp.register_blueprint(news_api_bp) # type: ignore[attr-defined,unused-ignore]+ def _show_all_strategies() -> bool:+ """Check if user has enabled show_all_strategies setting."""+ from flask import session++ username = session.get("username", "anonymous")+ if username == "anonymous":+ return False+ try:+ from local_deep_research.database.session_context import (+ get_user_db_session,+ )+ from local_deep_research.utilities.db_utils import (+ get_settings_manager,+ )++ with get_user_db_session(username) as db_session:+ settings_manager = get_settings_manager(db_session, username)+ return bool(+ settings_manager.get_setting(+ "search.show_all_strategies", False+ )+ )+ except Exception:+ return False+# Page routes@bp.route("/")def news_page():"""Render the main news page."""return render_template("pages/news.html",- strategies=get_available_strategies(),+ strategies=get_available_strategies(+ show_all=_show_all_strategies()+ ),)@bp.route("/subscriptions")@@ -72,7 +99,9 @@ def create_news_blueprint():"pages/news-subscription-form.html",subscription=None,default_settings=default_settings,- strategies=get_available_strategies(),+ strategies=get_available_strategies(+ show_all=_show_all_strategies()+ ),)@bp.route("/subscriptions/<subscription_id>/edit")@@ -109,7 +138,9 @@ def create_news_blueprint():subscription=None,error="Subscription not found",default_settings=default_settings,- strategies=get_available_strategies(),+ strategies=get_available_strategies(+ show_all=_show_all_strategies()+ ),)# Load user's default settings if logged in@@ -129,14 +160,18 @@ def create_news_blueprint():subscription=None,error="Error loading subscription",default_settings=default_settings,- strategies=get_available_strategies(),+ strategies=get_available_strategies(+ show_all=_show_all_strategies()+ ),)return render_template("pages/news-subscription-form.html",subscription=subscription,default_settings=default_settings,- strategies=get_available_strategies(),+ strategies=get_available_strategies(+ show_all=_show_all_strategies()+ ),)# Health checkdiff --git a/src/local_deep_research/search_system_factory.py b/src/local_deep_research/search_system_factory.pyindex 52a28ee48e..8f7c2aaf20 100644--- a/src/local_deep_research/search_system_factory.py+++ b/src/local_deep_research/search_system_factory.py@@ -9,7 +9,11 @@ from typing import Optional, Dict, Any, Listfrom langchain_core.language_models import BaseChatModel# Re-export from constants so existing importers don't break-from .constants import AVAILABLE_STRATEGIES, get_available_strategies # noqa: F401+from .constants import ( # noqa: F401+ ALL_STRATEGIES,+ AVAILABLE_STRATEGIES,+ get_available_strategies,+)def _get_setting(diff --git a/src/local_deep_research/settings/manager.py b/src/local_deep_research/settings/manager.pyindex 63bfd413f7..27836873c4 100644--- a/src/local_deep_research/settings/manager.py+++ b/src/local_deep_research/settings/manager.py@@ -426,11 +426,17 @@ class SettingsManager(ISettingsManager):# Inject search strategy options from code (single source of truth)if "search.search_strategy" in settings:- from local_deep_research.constants import AVAILABLE_STRATEGIES+ from local_deep_research.constants import get_available_strategies+ # Check the show_all_strategies setting to decide which list+ show_all = False+ if "search.show_all_strategies" in settings:+ val = settings["search.show_all_strategies"].get("value", False)+ show_all = val is True or val == "true"++ strategies = get_available_strategies(show_all=show_all)settings["search.search_strategy"]["options"] = [- {"label": s["label"], "value": s["name"]}- for s in AVAILABLE_STRATEGIES+ {"label": s["label"], "value": s["name"]} for s in strategies]logger.debug(f"Loaded {len(settings)} total settings")@@ -804,6 +810,20 @@ class SettingsManager(ISettingsManager):# variable is set.result[str(setting.key)]["editable"] = False+ # Re-inject search strategy options from code after DB merge,+ # since the DB stores options=null for this setting.+ if "search.search_strategy" in result:+ from local_deep_research.constants import get_available_strategies++ show_all_val = result.get("search.show_all_strategies", {}).get(+ "value", False+ )+ show_all = show_all_val is True or show_all_val == "true"+ strategies = get_available_strategies(show_all=show_all)+ result["search.search_strategy"]["options"] = [+ {"label": s["label"], "value": s["name"]} for s in strategies+ ]+return resultdef get_settings_snapshot(self) -> Dict[str, Any]:diff --git a/src/local_deep_research/web/app_factory.py b/src/local_deep_research/web/app_factory.pyindex 82016af315..41d7918de2 100644--- a/src/local_deep_research/web/app_factory.py+++ b/src/local_deep_research/web/app_factory.py@@ -682,6 +682,7 @@ def register_blueprints(app):# Load current settings from database using proper session contextusername = session.get("username")settings = {}+ show_all = Falsewith get_user_db_session(username) as db_session:if db_session:settings_manager = get_settings_manager(db_session, username)@@ -715,6 +716,9 @@ def register_blueprints(app):"search.search_strategy", "source-based"),}+ show_all = settings_manager.get_setting(+ "search.show_all_strategies", False+ )# Debug logginglog_settings(settings, "Research page settings loaded")@@ -722,7 +726,7 @@ def register_blueprints(app):return render_template_with_defaults("pages/research.html",settings=settings,- strategies=get_available_strategies(),+ strategies=get_available_strategies(show_all=bool(show_all)),)# Register auth blueprint FIRST (so login page is accessible)diff --git a/tests/mcp/test_additional_coverage.py b/tests/mcp/test_additional_coverage.pyindex 508072cb5a..6354a845a7 100644--- a/tests/mcp/test_additional_coverage.py+++ b/tests/mcp/test_additional_coverage.py@@ -378,12 +378,12 @@ class TestAvailableStrategiesContent:)def test_key_strategies_included(self):- """Test that key strategies are included."""+ """Test that key strategies are included in the full list."""from local_deep_research.search_system_factory import (get_available_strategies,)- strategies = get_available_strategies()+ strategies = get_available_strategies(show_all=True)names = [s["name"] for s in strategies]# These are the actual strategies defined in the systemdiff --git a/tests/mcp/test_mcp_protocol.py b/tests/mcp/test_mcp_protocol.pyindex 4884ac113f..d591bf0bbb 100644--- a/tests/mcp/test_mcp_protocol.py+++ b/tests/mcp/test_mcp_protocol.py@@ -193,7 +193,11 @@ class TestMCPLogging:class TestAvailableStrategies:- """Tests for the get_available_strategies function."""+ """Tests for the get_available_strategies function.++ MCP server exposes all strategies (show_all=True), so these tests+ validate the full list.+ """def test_available_strategies_is_list(self):"""Verify get_available_strategies returns a list."""@@ -201,7 +205,7 @@ class TestAvailableStrategies:get_available_strategies,)- strategies = get_available_strategies()+ strategies = get_available_strategies(show_all=True)assert isinstance(strategies, list)def test_available_strategies_has_entries(self):@@ -210,8 +214,8 @@ class TestAvailableStrategies:get_available_strategies,)- strategies = get_available_strategies()- assert len(strategies) >= 7 # We defined 7 strategies+ strategies = get_available_strategies(show_all=True)+ assert len(strategies) >= 10def test_available_strategies_have_required_fields(self):"""Verify each strategy has name and description."""@@ -219,7 +223,7 @@ class TestAvailableStrategies:get_available_strategies,)- strategies = get_available_strategies()+ strategies = get_available_strategies(show_all=True)for strategy in strategies:assert "name" in strategy, f"Strategy missing 'name': {strategy}"assert "description" in strategy, (@@ -236,7 +240,7 @@ class TestAvailableStrategies:get_available_strategies,)- strategies = get_available_strategies()+ strategies = get_available_strategies(show_all=True)strategy_names = [s["name"] for s in strategies]assert "source-based" in strategy_names@@ -246,7 +250,7 @@ class TestAvailableStrategies:get_available_strategies,)- strategies = get_available_strategies()+ strategies = get_available_strategies(show_all=True)strategy_names = [s["name"] for s in strategies]assert "focused-iteration" in strategy_namesdiff --git a/tests/mcp/test_validation.py b/tests/mcp/test_validation.pyindex 3ed461c139..81c2ca186d 100644--- a/tests/mcp/test_validation.py+++ b/tests/mcp/test_validation.py@@ -425,7 +425,7 @@ class TestGetAvailableStrategies:)result = list_strategies()- expected = get_available_strategies()+ expected = get_available_strategies(show_all=True)assert result["status"] == "success"assert result["strategies"] == expecteddiff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.jsonindex bdff93b89a..dd557dc65a 100644--- a/tests/settings/golden_master_settings.json+++ b/tests/settings/golden_master_settings.json@@ -7449,14 +7449,6 @@"label": "Focused Iteration - Comprehensive (Needs >16,000 context window)","value": "focused-iteration-standard"},- {- "label": "Iterative Refinement (Progressive refinement)",- "value": "iterative-refinement"- },- {- "label": "Topic Organization (Clusters by topic)",- "value": "topic-organization"- },{"label": "MCP ReAct (Agentic research - LLM decides tools)","value": "mcp"@@ -7486,6 +7478,20 @@"value": 2,"visible": true},+ "search.show_all_strategies": {+ "category": "search_parameters",+ "description": "When enabled, all available search strategies (including advanced and experimental ones) are shown in strategy dropdowns. When disabled, only the recommended strategies are shown.",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Show All Strategies",+ "options": null,+ "step": null,+ "type": "SEARCH",+ "ui_element": "checkbox",+ "value": false,+ "visible": true+ },"search.skip_relevance_filter": {"category": "search_parameters","description": "When ON, LLM relevance filtering is disabled for all search engines. When OFF, each engine decides automatically: academic engines (arXiv, PubMed) enable filtering since they use keyword matching, while generic engines (Google, Brave) skip it since they already rank by relevance.",diff --git a/tests/test_search_system_factory_high_value.py b/tests/test_search_system_factory_high_value.pyindex ce3f6b63f8..9ce8f5eed3 100644--- a/tests/test_search_system_factory_high_value.py+++ b/tests/test_search_system_factory_high_value.py@@ -7,6 +7,7 @@ without importing any strategy classes.import pytestfrom local_deep_research.search_system_factory import (+ ALL_STRATEGIES,AVAILABLE_STRATEGIES,_get_setting,get_available_strategies,@@ -20,7 +21,7 @@ class TestAvailableStrategiesList:assert isinstance(AVAILABLE_STRATEGIES, list)def test_expected_count(self):- assert len(AVAILABLE_STRATEGIES) == 7+ assert len(AVAILABLE_STRATEGIES) == 5def test_all_entries_are_dicts(self):for entry in AVAILABLE_STRATEGIES:@@ -50,9 +51,8 @@ class TestAvailableStrategiesList:"source-based","focused-iteration","focused-iteration-standard",- "iterative-refinement",- "topic-organization","mcp",+ "langgraph-agent",],)def test_contains_known_strategy(self, strategy_name):@@ -100,6 +100,35 @@ class TestGetAvailableStrategies:assert len(AVAILABLE_STRATEGIES) == original_len+class TestAllStrategiesList:+ """Tests for the ALL_STRATEGIES list (show_all=True)."""++ def test_all_contains_more_than_available(self):+ assert len(ALL_STRATEGIES) > len(AVAILABLE_STRATEGIES)++ def test_all_starts_with_available(self):+ """ALL_STRATEGIES should begin with AVAILABLE_STRATEGIES entries."""+ for i, entry in enumerate(AVAILABLE_STRATEGIES):+ assert ALL_STRATEGIES[i]["name"] == entry["name"]++ def test_all_entries_have_required_keys(self):+ for entry in ALL_STRATEGIES:+ assert set(entry.keys()) == {"name", "label", "description"}++ def test_no_duplicate_names_in_all(self):+ names = [entry["name"] for entry in ALL_STRATEGIES]+ assert len(names) == len(set(names))++ def test_get_available_show_all_returns_all(self):+ result = get_available_strategies(show_all=True)+ assert result == ALL_STRATEGIES++ def test_get_available_default_returns_subset(self):+ result = get_available_strategies()+ assert result == AVAILABLE_STRATEGIES+ assert len(result) < len(ALL_STRATEGIES)++class TestGetSetting:"""Tests for _get_setting() helper function."""