- When key snippets are emitted, snippet files are auto added to related files.

- Add base task to research subtask prompt.
- Adjust research prompt to make sure related files are related to the base task, not just the research subtask.
This commit is contained in:
AI Christianson 2024-12-17 09:41:52 -05:00
parent ac82fb9e3d
commit aff629e13c
5 changed files with 19 additions and 2 deletions

View File

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- When key snippets are emitted, snippet files are auto added to related files.
- Add base task to research subtask prompt.
- Adjust research prompt to make sure related files are related to the base task, not just the research subtask.
## [0.6.0] - 2024-12-17 ## [0.6.0] - 2024-12-17
### Added ### Added

View File

@ -280,7 +280,7 @@ def run_research_subtasks(base_task: str, config: dict, model, expert_enabled: b
) )
# Run the subtask agent # Run the subtask agent
subtask_prompt = f"Research Subtask: {subtask}\n\n{RESEARCH_PROMPT}" subtask_prompt = f"Base Task: {base_task}\nResearch Subtask: {subtask}\n\n{RESEARCH_PROMPT}"
run_agent_with_retry(subtask_agent, subtask_prompt, config) run_agent_with_retry(subtask_agent, subtask_prompt, config)

View File

@ -47,12 +47,12 @@ Tools and Methodology
Reporting Findings Reporting Findings
Use emit_research_notes to record detailed, fact-based observations about what currently exists. Use emit_research_notes to record detailed, fact-based observations about what currently exists.
For each significant file or directory that is part of the codebase, use emit_related_files to list it.
Your research notes should be strictly about what you have observed: Your research notes should be strictly about what you have observed:
Document files by their names and locations. Document files by their names and locations.
Document discovered documentation files and their contents at a high level (e.g., "There is a README.md in the root directory that explains the folder structure"). Document discovered documentation files and their contents at a high level (e.g., "There is a README.md in the root directory that explains the folder structure").
Document code files by type or apparent purpose (e.g., "There is a main.py file containing code to launch an application"). Document code files by type or apparent purpose (e.g., "There is a main.py file containing code to launch an application").
Document configuration files, dependencies (like package.json, requirements.txt), testing files, and anything else present. Document configuration files, dependencies (like package.json, requirements.txt), testing files, and anything else present.
Use emit_related_files to note all files that are relevant to the base task.
No Planning or Problem-Solving No Planning or Problem-Solving
@ -154,6 +154,8 @@ Guidelines:
API contracts, endpoints, or protocols it requires or provides API contracts, endpoints, or protocols it requires or provides
Testing strategies appropriate to the complexity of that sub-task Testing strategies appropriate to the complexity of that sub-task
You may include pseudocode, but not full code. You may include pseudocode, but not full code.
If you need to consult with the expert, do that *BEFORE* emitting any tasks.
After finalizing the overall approach: After finalizing the overall approach:
Use emit_plan to store the high-level implementation plan. Use emit_plan to store the high-level implementation plan.

View File

@ -173,6 +173,7 @@ def skip_implementation(reason: str) -> str:
@tool("emit_key_snippets") @tool("emit_key_snippets")
def emit_key_snippets(snippets: List[SnippetInfo]) -> str: def emit_key_snippets(snippets: List[SnippetInfo]) -> str:
"""Store multiple key source code snippets in global memory. """Store multiple key source code snippets in global memory.
Automatically adds the filepaths of the snippets to related files.
Args: Args:
snippets: List of snippet information dictionaries containing: snippets: List of snippet information dictionaries containing:
@ -184,6 +185,9 @@ def emit_key_snippets(snippets: List[SnippetInfo]) -> str:
Returns: Returns:
List of stored snippet confirmation messages List of stored snippet confirmation messages
""" """
# First collect unique filepaths to add as related files
_global_memory['related_files'].update(snippet_info['filepath'] for snippet_info in snippets)
results = [] results = []
for snippet_info in snippets: for snippet_info in snippets:
# Get and increment snippet ID # Get and increment snippet ID

View File

@ -267,6 +267,8 @@ def test_key_snippets_integration(reset_memory):
result = emit_key_snippets.invoke({"snippets": snippets}) result = emit_key_snippets.invoke({"snippets": snippets})
assert result == "Snippets stored." assert result == "Snippets stored."
assert _global_memory['key_snippet_id_counter'] == 3 assert _global_memory['key_snippet_id_counter'] == 3
# Verify related files were tracked
assert _global_memory['related_files'] == {"file1.py", "file2.py", "file3.py"}
# Verify all snippets were stored correctly # Verify all snippets were stored correctly
assert len(_global_memory['key_snippets']) == 3 assert len(_global_memory['key_snippets']) == 3
@ -296,6 +298,8 @@ def test_key_snippets_integration(reset_memory):
result = emit_key_snippets.invoke({"snippets": [new_snippet]}) result = emit_key_snippets.invoke({"snippets": [new_snippet]})
assert result == "Snippets stored." assert result == "Snippets stored."
assert _global_memory['key_snippet_id_counter'] == 4 assert _global_memory['key_snippet_id_counter'] == 4
# Verify new file was added to related files
assert _global_memory['related_files'] == {"file1.py", "file2.py", "file3.py", "file4.py"}
# Delete remaining snippets # Delete remaining snippets
result = delete_key_snippets.invoke({"snippet_ids": [1, 3]}) result = delete_key_snippets.invoke({"snippet_ids": [1, 3]})