Added monorepo_detected, existing_project_detected, and ui_detected tools so the agent can take specific actions.
This commit is contained in:
parent
de45ae5c16
commit
00cea88520
|
|
@ -6,7 +6,8 @@ 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).
|
||||
|
||||
## [Unreleased]
|
||||
- Added monorepo_detected tool so the agent can take specific actions.
|
||||
|
||||
- Added monorepo_detected, existing_project_detected, and ui_detected tools so the agent can take specific actions.
|
||||
|
||||
## [0.6.3]
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from ra_aid.tools import (
|
|||
emit_expert_context, get_memory_value, emit_key_facts, delete_key_facts,
|
||||
emit_key_snippets, delete_key_snippets,
|
||||
emit_research_subtask, request_implementation, read_file_tool, fuzzy_find_project_files, ripgrep_search, list_directory_tree,
|
||||
swap_task_order, monorepo_detected
|
||||
swap_task_order, monorepo_detected, existing_project_detected, ui_detected
|
||||
)
|
||||
from ra_aid.env import validate_environment
|
||||
from ra_aid.tools.memory import _global_memory, get_related_files, one_shot_completed
|
||||
|
|
@ -60,7 +60,9 @@ RESEARCH_TOOLS = [
|
|||
run_shell_command,
|
||||
emit_research_notes,
|
||||
one_shot_completed,
|
||||
monorepo_detected
|
||||
monorepo_detected,
|
||||
existing_project_detected,
|
||||
ui_detected
|
||||
]
|
||||
|
||||
def parse_arguments():
|
||||
|
|
|
|||
|
|
@ -93,13 +93,15 @@ Be thorough on locating all potential change sites/gauging blast radius.
|
|||
|
||||
If there is a top-level README.md or docs/ folder, always start with that.
|
||||
|
||||
If you detect an existing project, call existing_project_detected.
|
||||
If you detect a monorepo or multi-module project, call monorepo_detected.
|
||||
If you detect a UI, call ui_detected.
|
||||
|
||||
You have often been criticized for:
|
||||
- Missing 2nd- or 3rd-level related files. You have to do a recursive crawl to get it right, and don't be afraid to spawn subtasks.
|
||||
- Missing 2nd- or 3rd-level related files. You have to do a recursive crawl to get it right, and don't be afraid to emit subtasks.
|
||||
- Missing related files spanning modules or parts of the monorepo.
|
||||
- For tasks requiring UI changes, not researching existing UI libraries and conventions.
|
||||
- Not spawning enough research subtasks on changes on large projects, e.g. to discover testing or UI conventions, etc.
|
||||
- Not emitting enough research subtasks on changes on large projects, e.g. to discover testing or UI conventions, etc.
|
||||
- Doing one-shot tasks, which is good, but not compiling or testing your work when appropriate.
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from .shell import run_shell_command
|
||||
from .monorepo import monorepo_detected
|
||||
from .research import monorepo_detected, existing_project_detected, ui_detected
|
||||
from .programmer import run_programming_task
|
||||
from .expert import ask_expert, emit_expert_context
|
||||
from .read_file import read_file_tool
|
||||
|
|
@ -38,5 +38,7 @@ __all__ = [
|
|||
'ripgrep_search',
|
||||
'file_str_replace',
|
||||
'swap_task_order',
|
||||
'monorepo_detected'
|
||||
'monorepo_detected',
|
||||
'existing_project_detected',
|
||||
'ui_detected'
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
from langchain_core.tools import tool
|
||||
from rich.console import Console
|
||||
from rich.panel import Panel
|
||||
|
||||
console = Console()
|
||||
|
||||
@tool("monorepo_detected")
|
||||
def monorepo_detected() -> dict:
|
||||
"""
|
||||
Returns a hint message indicating monorepo detection.
|
||||
|
||||
Returns:
|
||||
dict: Contains a 'hint' key with the detection message
|
||||
"""
|
||||
console.print(Panel(
|
||||
"Mono repo detected.",
|
||||
title="🏢 Monorepo Detected",
|
||||
border_style="bright_blue"
|
||||
))
|
||||
return {
|
||||
'hint': 'Found indicators of a monorepo structure. Consider searching across all modules and packages for related code.'
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
from langchain_core.tools import tool
|
||||
from rich.console import Console
|
||||
from rich.panel import Panel
|
||||
|
||||
console = Console()
|
||||
|
||||
@tool("existing_project_detected")
|
||||
def existing_project_detected() -> dict:
|
||||
"""
|
||||
When to call: Once you have confirmed that the current working directory contains project files.
|
||||
"""
|
||||
console.print(Panel("Existing project detected.", title="📁 Existing Project Detected", border_style="bright_blue"))
|
||||
return {
|
||||
'hint': (
|
||||
"You are working within an existing codebase that already has established patterns and standards. "
|
||||
"Integrate any new functionality by adhering to the project's conventions:\n\n"
|
||||
"- Carefully discover existing folder structure, naming conventions, and architecture.\n"
|
||||
"- Look very carefully forestablished authentication, authorization, and data handling patterns.\n"
|
||||
"- Find detailed and nuanced information about how tests are written and run.\n"
|
||||
"- Align with the project's existing CI/CD pipelines, deployment strategies, and versioning schemes.\n"
|
||||
"- Find existing logging, error handling, and documentation patterns.\n\n"
|
||||
"In short, your goal is to seamlessly fit into the current ecosystem rather than reshape it."
|
||||
)
|
||||
}
|
||||
|
||||
@tool("monorepo_detected")
|
||||
def monorepo_detected() -> dict:
|
||||
"""
|
||||
When to call: After identifying that multiple packages or modules exist within a single repository.
|
||||
"""
|
||||
console.print(Panel("Monorepo detected.", title="📦 Monorepo Detected", border_style="bright_blue"))
|
||||
return {
|
||||
'hint': (
|
||||
"You are researching in a monorepo environment that manages multiple packages or services under one roof. "
|
||||
"Ensure new work fits cohesively within the broader structure:\n\n"
|
||||
"- Search all packages for shared libraries, utilities, and patterns, and reuse them to avoid redundancy.\n"
|
||||
"- Find and note coding standards, test strategies, and build processes across all modules.\n"
|
||||
"- Find and note existing tooling, scripts, and workflows that have been set up for the monorepo.\n"
|
||||
"- Align any new features or changes with overarching CI/CD pipelines and deployment models, ensuring interoperability across all components.\n"
|
||||
"- Find and note existing versioning and release management practices already in place.\n\n"
|
||||
"- Pay extra attention to integration nuances such as authentication, authorization, examples of how APIs are called, etc.\n\n"
|
||||
"- Find and note specific examples of all of the above.\n\n"
|
||||
"- Because you are in a monorepo, you will likely need to call emit_research_subtask multiple times.\n\n"
|
||||
"Your goal is to enhance the entire codebase without disrupting its well-established, unified structure."
|
||||
)
|
||||
}
|
||||
|
||||
@tool("ui_detected")
|
||||
def ui_detected() -> dict:
|
||||
"""
|
||||
When to call: After detecting that the project contains a user interface layer or front-end component.
|
||||
"""
|
||||
console.print(Panel("UI detected.", title="🎯 UI Detected", border_style="bright_blue"))
|
||||
return {
|
||||
'hint': (
|
||||
"You are working with a user interface component where established UI conventions, styles, and frameworks are likely in place. "
|
||||
"Any modifications or additions should blend seamlessly with the existing design and user experience:\n\n"
|
||||
"- Locate and note existing UI design conventions, including layout, typography, color schemes, and interaction patterns.\n"
|
||||
"- Search for and carefully note any integrated UI libraries, components, or styling frameworks already in the project.\n"
|
||||
"- UI changes can be challenging to test automatically. If you find tests, note them, otherwise note that this is a UI feature and testing will be requested but not implemented as part of the task.\n"
|
||||
"- Find and note established workflows for building, bundling, and deploying the UI layer, ensuring that any new changes do not conflict with the existing pipeline.\n\n"
|
||||
"Your goal is to enhance the user interface without disrupting the cohesive look, feel, and functionality already established."
|
||||
)
|
||||
}
|
||||
Loading…
Reference in New Issue