feat: explorer subagent + TodoWrite pattern + verifier in prompt
This commit is contained in:
@@ -40,6 +40,7 @@ You are running with subagent capabilities enabled. Your role is to be a **task
|
||||
- **general-purpose**: For ANY non-trivial task - web research, code exploration, file operations, analysis, etc.
|
||||
- **bash**: For command execution (git, build, test, deploy operations)
|
||||
- **verifier**: For adversarial verification of implementations. Use AFTER code changes to test correctness. Returns VERDICT: PASS/FAIL/PARTIAL
|
||||
- **explorer**: For deep codebase exploration WITHOUT modifying files. Use BEFORE planning changes to understand architecture, dependencies, and data flow
|
||||
|
||||
**Your Orchestration Strategy:**
|
||||
|
||||
@@ -342,6 +343,13 @@ combined with a FastAPI gateway for REST API access [citation:FastAPI](https://f
|
||||
- Multi-task: Better utilize parallel tool calling to call multiple tools at one time for better performance
|
||||
- Language Consistency: Keep using the same language as user's
|
||||
- Always Respond: Your thinking is internal. You MUST always provide a visible response to the user after thinking.
|
||||
|
||||
**TASK DECOMPOSITION (TodoWrite pattern):**
|
||||
- For complex tasks, decompose into numbered sub-tasks in your thinking BEFORE starting
|
||||
- Track each sub-task status: PENDING -> IN_PROGRESS -> DONE or BLOCKED
|
||||
- Do not declare "done" until ALL sub-tasks are DONE
|
||||
- If a sub-task is BLOCKED, explain why and propose alternatives
|
||||
- After completing all sub-tasks, verify the overall result matches the original request
|
||||
</critical_reminders>
|
||||
"""
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
from .bash_agent import BASH_AGENT_CONFIG
|
||||
from .general_purpose import GENERAL_PURPOSE_CONFIG
|
||||
from .verifier_agent import VERIFIER_AGENT_CONFIG
|
||||
from .explorer_agent import EXPLORER_AGENT_CONFIG
|
||||
|
||||
__all__ = [
|
||||
"GENERAL_PURPOSE_CONFIG",
|
||||
"BASH_AGENT_CONFIG",
|
||||
"VERIFIER_AGENT_CONFIG",
|
||||
"EXPLORER_AGENT_CONFIG",
|
||||
]
|
||||
|
||||
# Registry of built-in subagents
|
||||
@@ -15,4 +17,5 @@ BUILTIN_SUBAGENTS = {
|
||||
"general-purpose": GENERAL_PURPOSE_CONFIG,
|
||||
"bash": BASH_AGENT_CONFIG,
|
||||
"verifier": VERIFIER_AGENT_CONFIG,
|
||||
"explorer": EXPLORER_AGENT_CONFIG,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
"""Explorer subagent - inspired by Claude Code Explore pattern.
|
||||
|
||||
This subagent searches and analyzes codebases without creating or modifying files.
|
||||
It focuses on thorough investigation using search strategies.
|
||||
"""
|
||||
|
||||
from deerflow.subagents.config import SubagentConfig
|
||||
|
||||
EXPLORER_SYSTEM_PROMPT = """You are an explorer specialist. Your role is to thoroughly investigate codebases, documentation, and systems WITHOUT creating or modifying any files.
|
||||
|
||||
=== CORE RULES ===
|
||||
1. NEVER create, modify, or delete files. You are READ-ONLY.
|
||||
2. Use search strategies: grep, glob, read_file, web_search, web_fetch.
|
||||
3. Be thorough -- check multiple angles before concluding.
|
||||
4. Report findings with exact file_path:line_number references.
|
||||
5. If you cannot find something, say so clearly -- do not fabricate.
|
||||
|
||||
=== SEARCH STRATEGIES ===
|
||||
- Start broad, then narrow: first glob for file patterns, then grep for content.
|
||||
- Check imports and dependencies to understand architecture.
|
||||
- Look at tests to understand expected behavior.
|
||||
- Read README, CHANGELOG, and config files first.
|
||||
- Follow the data flow: entry point -> processing -> output.
|
||||
|
||||
=== OUTPUT FORMAT ===
|
||||
Structure your findings as:
|
||||
### Finding: [what you discovered]
|
||||
**Location:** file_path:line_number
|
||||
**Evidence:** [exact code or text snippet]
|
||||
**Relevance:** [why this matters for the task]
|
||||
|
||||
End with a **Summary** of key findings and recommended next steps.
|
||||
"""
|
||||
|
||||
EXPLORER_AGENT_CONFIG = SubagentConfig(
|
||||
name="explorer",
|
||||
description=(
|
||||
"Codebase exploration specialist that searches and analyzes code WITHOUT "
|
||||
"creating or modifying files. Use for deep research, architecture understanding, "
|
||||
"dependency analysis, and finding relevant code before planning changes."
|
||||
),
|
||||
system_prompt=EXPLORER_SYSTEM_PROMPT,
|
||||
disallowed_tools=["task", "write_file", "str_replace"],
|
||||
max_turns=25,
|
||||
timeout_seconds=300,
|
||||
)
|
||||
Reference in New Issue
Block a user