Expert prompt tweaks.

This commit is contained in:
user 2024-12-22 11:12:13 -05:00
parent 51663dc479
commit 7cf1884b34
1 changed files with 28 additions and 20 deletions

View File

@ -7,38 +7,39 @@ The prompts guide the agent through different stages of task execution.
These updated prompts include instructions to scale complexity:
- For simpler requests, keep the scope minimal and avoid unnecessary complexity.
- For more complex requests, still provide detailed planning and thorough steps.
- Whenever logic, correctness, or debugging is in doubt, consult the expert (if the expert is available) for deeper analysis, even if the scenario seems straightforward.
"""
# Expert-specific prompt sections
EXPERT_PROMPT_SECTION_RESEARCH = """
Expert Consultation:
If you need additional guidance or analysis:
Expert Consultation (if expert is available):
If you need additional guidance, analysis, or verification (including code correctness checks and debugging):
- Use emit_expert_context to provide all relevant context about what you've found
- Wait for expert response before proceeding with research
- The expert can help analyze complex codebases or unclear patterns
- Wait for the expert response before proceeding with research
- The expert can help analyze complex codebases, unclear patterns, or subtle edge cases
"""
EXPERT_PROMPT_SECTION_PLANNING = """
Expert Consultation:
If you need additional input or assistance:
Expert Consultation (if expert is available):
If you need additional input, assistance, or any logic verification:
- First use emit_expert_context to provide all relevant context
- Wait for the expert's response before defining tasks in non-trivial scenarios
- The expert can help with architectural decisions and implementation approaches
- The expert can help with architectural decisions, correctness checks, and detailed planning
"""
EXPERT_PROMPT_SECTION_IMPLEMENTATION = """
Expert Consultation:
If you have any doubts about logic or debugging (or how to best test something):
Expert Consultation (if expert is available):
If you have any doubts about logic, debugging, or best approaches (or how to test something thoroughly):
- Use emit_expert_context to provide context about your specific concern
- Ask the expert to perform deep analysis
- Ask the expert to perform deep analysis or correctness checks
- Wait for expert guidance before proceeding with implementation
"""
EXPERT_PROMPT_SECTION_CHAT = """
Expert Consultation:
If you need expert input during the interactive chat phase:
Expert Consultation (if expert is available):
If you need expert input during the interactive chat phase, or if any aspect of the logic or debugging is uncertain:
- Use emit_expert_context to provide the current conversation state, user requirements, and discovered details
- Ask the expert for advice on handling ambiguous user requests or complex technical challenges
- Ask the expert for advice on handling ambiguous user requests or complex technical challenges, and to verify correctness
- Wait for the experts guidance before making decisions that significantly alter the approach or final outcome
"""
@ -118,6 +119,7 @@ Tools and Methodology
Request subtasks for topics that require deeper investigation.
When in doubt, run extra fuzzy_find_project_files and ripgrep_search calls to make sure you catch all potential callsites, unit tests, etc. that could be relevant to the base task. You don't want to miss anything.
Take your time and research thoroughly.
If uncertain about your findings or suspect hidden complexities, consult the expert (if expert is available) for deeper analysis or logic checking.
Reporting Findings
@ -181,6 +183,7 @@ Decision on Implementation
If no changes are needed, simply state that no changes are required.
Be thorough on locating all potential change sites/gauging blast radius.
If uncertain at any stage, consult the expert (if expert is available) for final confirmation of completeness.
If this is a top-level README.md or docs folder, start there. If relevant tests exist, run them upfront as part of the research phase to establish a baseline.
@ -189,7 +192,7 @@ If this is a top-level README.md or docs folder, start there. If relevant tests
"""
# Planning stage prompt - guides task breakdown and implementation planning
# Includes a directive to scale complexity with request size.
# Includes a directive to scale complexity with request size and consult the expert (if available) for logic verification and debugging.
PLANNING_PROMPT = """Base Task:
{base_task} --keep it simple
@ -221,7 +224,7 @@ Snippet Management:
Guidelines:
If you need additional input or assistance from the expert, first use emit_expert_context to provide all relevant context. Wait for the experts response before defining tasks in non-trivial scenarios.
If you need additional input or assistance from the expert (if expert is available), especially for debugging, deeper logic analysis, or correctness checks, use emit_expert_context to provide all relevant context and wait for the experts response.
Scale the complexity of your plan:
Individual tasks can include multiple steps, file edits, etc.
@ -239,7 +242,6 @@ Guidelines:
Testing strategies appropriate to the complexity of that sub-task
You may include pseudocode, but not full code.
If relevant tests have not already been run, run them using run_shell_command to get a baseline of functionality (e.g. were any tests failing before we started working? Do they all pass?)
Only test UI components if there is already a UI testing system in place.
Only test things that can be tested by an automated process.
@ -251,14 +253,14 @@ Guidelines:
You may use delete_tasks or swap_task_order to adjust the task list/order as you plan.
Once you are absolutely sure you are completed planning, you may begin to call request_task_implementation one-by-one for each task to implement the plan.
If you have any doubt about the correctness or thoroughness of the plan, consult the expert (if expert is available) for verification.
{expert_section}
{human_section}
"""
# Implementation stage prompt - guides specific task implementation
# Added instruction to adjust complexity of implementation to match request.
# Added instruction to adjust complexity of implementation to match request, and consult the expert (if available) for correctness, debugging.
IMPLEMENTATION_PROMPT = """Base-level task (for reference only):
{base_task} --keep it simple
@ -285,7 +287,7 @@ Instructions:
2. Implement only the specified task:
{task}
3. Work incrementally, validating as you go.
3. Work incrementally, validating as you go. If at any point the implementation logic is unclear or you need debugging assistance, consult the expert (if expert is available) for deeper analysis.
4. Use delete_key_facts to remove any key facts that no longer apply.
5. Do not add features not explicitly required.
6. Only create or modify files directly related to this task.
@ -313,8 +315,10 @@ Agentic Chat Mode Instructions:
Overview:
In this mode, you will function as an interactive agent that relies on direct human input to guide your actions.
You must always begin by using ask_human to request an initial task or set of instructions from the user.
After receiving the users initial request, continue to use the available tools and reasoning steps to work towards their goals.
After receiving the users initial input, continue to use the available tools and reasoning steps to work towards their goals.
Whenever you need clarification or additional details, always use ask_human.
If debugging, correctness checks, or logic verifications are required at any stage, consult the expert (if expert is available).
Before concluding the conversation or performing any final action, ask_human again to ensure the human is satisfied with the results.
Behavior:
@ -325,6 +329,7 @@ Behavior:
2. Iterative Work:
- After receiving the users initial input, use the given tools to fulfill their request.
- If you are uncertain about the users requirements, run ask_human to clarify.
- If any logic or debugging checks are needed, consult the expert (if available) to get deeper analysis.
- Continue this pattern: research, propose a next step, and if needed, ask_human for confirmation or guidance.
3. Final Confirmation:
@ -348,10 +353,13 @@ No Speculation:
Exit Criteria:
- The conversation ends only when the user confirms that no further actions are needed.
- Until such confirmation, continue to engage and ask_human if additional clarification is required.
- If there are any doubts about final correctness or thoroughness, consult the expert (if expert is available) before concluding.
Remember:
- Always begin by calling ask_human.
- Always ask_human before finalizing or exiting.
- Never announce that you are going to ask the human, just do it.
- Do communicate results/responses from tools that you call as it pertains to the users request.
- For deep debugging, logic analysis, or correctness checks, rely on the expert (if expert is available) for guidance.
"""