feat: enhance system prompt and tool descriptions to match TS version

Phase 1A implementation:

SystemPromptBuilder.java (142 lines -> ~290 lines):
- Add CyberRisk security boundary instruction
- Add System section (permission modes, prompt injection defense)
- Add Doing Tasks section (coding style, security, collaboration)
- Add Actions section (operation risk management, dangerous ops protection)
- Add Tone & Style section (emoji control, concise output, code references)
- Add Output Efficiency section (direct communication)
- Add Language preference support
- Restructure into modular section builder methods matching TS architecture

Tool description enhancements (8 tools):
- BashTool: add security boundaries, git best practices, no-substitute rule
- FileWriteTool: add must-Read-first rule, prefer-Edit guidance
- GrepTool: add never-use-Bash-grep rule, search guidance
- AgentTool: add when-to-use/not-use guidance, sub-prompt enhanced
- FileEditTool: add indentation preservation, prefer-edit-existing rule
- TodoWriteTool: add proactive usage guidance, state machine rules
- TaskUpdateTool: add status workflow documentation
- ConfigTool: add available settings list

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
abel533
2026-04-05 09:06:04 +08:00
co-authored by Copilot
parent 3b47c5e818
commit c5440a2b4c
9 changed files with 416 additions and 91 deletions
@@ -29,8 +29,18 @@ public class GrepTool implements Tool {
@Override
public String description() {
return """
Search for a pattern in file contents using regex. Returns matching lines with \
file paths and line numbers. Uses ripgrep (rg) if available, falls back to grep.""";
A powerful search tool built on ripgrep. Searches for a regex pattern in file contents \
and returns matching lines with file paths and line numbers.
IMPORTANT: ALWAYS use this Grep tool for searching file content. NEVER invoke `grep`, \
`rg`, or `findstr` as a Bash command — using this dedicated tool allows the user to \
better understand and review your searches.
Uses ripgrep (rg) if available, falls back to system grep/findstr. Supports full regex \
syntax. Use the 'include' parameter to filter by file type (e.g., '*.java', '*.ts').
When you are doing an open-ended search that may require multiple rounds of searching, \
consider using the Agent tool instead to keep the main context clean.""";
}
@Override