Enhance router agent resilience and inject project overview context#116
Merged
Enhance router agent resilience and inject project overview context#116
Conversation
…estions Refine instruction 7 to limit `/code` use to coding tasks and discourage it for simple plans or text, and add instruction 10 to avoid auto-launching `/code` on user questions and prompt for permission.
…uter agent Add add_project_summary method to MessageBuilder to include an overview file when present and invoke it in CommandInterpretationAgent. Remove deprecated get_project_summary tool and function, update get_indexed_files_context description, and refactor router agent JSON parsing to separate error handling from decision logic.
Introduces a secondary LLM call to recover when the router agent fails to parse the initial JSON response. A new prompt template guides the model to re-format the malformed output into the expected schema, reducing user-visible errors and improving robustness.
- Expanded rule 10 to explicitly list question patterns ("How do I", "What is", "Where is") that should not trigger automatic code generation
- Added requirement to confirm intent when a question and code request are combined
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This update strengthens the command‐routing logic by introducing a fallback “salvage” flow that reformats malformed LLM outputs, reduces duplicate parsing code, and integrates the project’s high-level overview directly into the system prompt. The deprecated
get_project_summarytool has been removed in favor of on-the-fly context injection. Prompt guidelines have also been refined to clarify when to invoke the/codecommand.What This Means for Users
/codeagent for simple questions or text-only tasks.A Closer Look at the Changes
.gitignore
runs/to prevent local run artifacts from being tracked.CommandInterpretationAgent (router_agent.py)
add_project_summary()during prompt construction to supply the agent with an “overview” file from the project state.• Builds a new prompt from
router/salvage_response.md• Calls the “quick_reasoning” model to reformat the LLM output
• Retries parsing and falls back to an error message if salvage also fails
MessageBuilder (message_builder.py)
add_project_summary()method to include the overview file in outgoing system messages when available.agent_tools.py
get_project_summary()function.get_indexed_files_context()to emphasize its role in serving key file summaries.Prompt Updates
/codeusage—clarifies that code agent calls should be reserved for actual code edits, not simple Q&A or planning tasks, and adds guidance to always confirm before invoking/codewhen in doubt.Generated by JrDev AI using o4-mini-2025-04-16