Goal
The research_node currently sends the user'"'"'s question to the planner model with zero file access or code context. It reliably produces hallucinated answers for questions like "what does auth_middleware do?" or "where is X used?". Fix it to use the code intelligence, search, and file-reading tools that already exist and are wired into the coding workflow.
Current behavior
def research_node(state: GraphState) -> dict:
prompt = "Answer the user'"'"'s request in analysis mode only.\n\n" + state.user_request
answer = _invoke_agent("planner", [HumanMessage(content=prompt)])
# ^ No tools. No repo context. Planner just guesses.
Target behavior
Research queries get the same context and tools as a coder, minus any write/git tools.
What changes
research_node rewrite
- Ensure context is loaded (
context_loader_node result available in state)
- Build prompt including:
_format_intelligence_summary_for_prompt(state) (call graph, smells, dep graph — already implemented)
_format_context_summary(state.repo_facts) (tech stack, structure)
- Invoke agent with read-only tools:
read_file, list_directory, search_in_repo
- Stream response to UI as normal
Read-only tool set
RESEARCH_TOOLS = [read_file, list_directory, search_in_repo]
# Explicitly excludes: write_file, git_command, run_shell, run_terminal
Code intelligence trigger
If state.call_graph is empty (intelligence not yet run), trigger code_intelligence_node first, then research. This ensures call graph is available for structural questions.
Example queries that must work correctly after this fix
- "What does
planner_plan_node do?" → reads the function, explains it
- "Where is
GraphState used?" → searches repo, lists files
- "What are the main entry points of this codebase?" → uses context listing + call graph
- "Find all places where we call the OpenAI API" → searches for API calls
Acceptance criteria
Dependencies
None — all required tools and intelligence already exist.
Goal
The
research_nodecurrently sends the user'"'"'s question to the planner model with zero file access or code context. It reliably produces hallucinated answers for questions like "what doesauth_middlewaredo?" or "where is X used?". Fix it to use the code intelligence, search, and file-reading tools that already exist and are wired into the coding workflow.Current behavior
Target behavior
Research queries get the same context and tools as a coder, minus any write/git tools.
What changes
research_noderewritecontext_loader_noderesult available in state)_format_intelligence_summary_for_prompt(state)(call graph, smells, dep graph — already implemented)_format_context_summary(state.repo_facts)(tech stack, structure)read_file,list_directory,search_in_repoRead-only tool set
Code intelligence trigger
If
state.call_graphis empty (intelligence not yet run), triggercode_intelligence_nodefirst, then research. This ensures call graph is available for structural questions.Example queries that must work correctly after this fix
planner_plan_nodedo?" → reads the function, explains itGraphStateused?" → searches repo, lists filesAcceptance criteria
research_nodeusesread_file,list_directory,search_in_repotoolscode_intelligence_noderuns firstDependencies
None — all required tools and intelligence already exist.