|
24 | 24 |
|
25 | 25 | # Tool usage instructions for the model - simplified and clear |
26 | 26 | AGENTIC_TOOLS_PROMPT = """ |
27 | | -## REPOSITORY ACCESS COMMANDS |
| 27 | +## AVAILABLE COMMANDS (USE ONLY THESE!) |
28 | 28 |
|
29 | | -You can access ANY file in the repository (not just the diff). Use these commands: |
| 29 | +⚠️ **ONLY these 3 commands exist. Any other command will NOT work:** |
30 | 30 |
|
31 | | -### STEP 1: Find file paths with SEARCH_CODE |
| 31 | +| Command | Purpose | Example | |
| 32 | +|---------|---------|---------| |
| 33 | +| `SEARCH_CODE:term` | Find files by name/content | `print("SEARCH_CODE:rlm.py")` | |
| 34 | +| `FETCH_FILE:path` | Read file contents | `print("FETCH_FILE:dspy/predict/rlm.py")` | |
| 35 | +| `LIST_DIR:path` | List directory contents | `print("LIST_DIR:dspy/predict")` | |
| 36 | +
|
| 37 | +### ❌ FORBIDDEN - These commands DO NOT EXIST: |
| 38 | +- `READ_FILE` - WRONG! Use `FETCH_FILE` instead |
| 39 | +- `READ_CODE` - WRONG! Use `FETCH_FILE` instead |
| 40 | +- `GET_FILE` - WRONG! Use `FETCH_FILE` instead |
| 41 | +- `LIST_FILES` - WRONG! Use `LIST_DIR` instead |
| 42 | +- `open()` / `os.path` - WRONG! Won't work in sandbox |
| 43 | +- Any other command not listed above |
| 44 | +
|
| 45 | +--- |
| 46 | +
|
| 47 | +### SEARCH_CODE - Find files by name or content |
32 | 48 | ```python |
33 | | -# CORRECT - no quotes around the search term after the colon |
34 | 49 | print("SEARCH_CODE:rlm.py") |
35 | 50 | print("SEARCH_CODE:enable_tool_optimization") |
36 | | -print("SEARCH_CODE:llm_query_batched") |
37 | | -
|
38 | | -# WRONG - do NOT add extra quotes or parentheses |
39 | | -# print("SEARCH_CODE:rlm.py")") # ❌ Extra quote/paren |
40 | | -# print("SEARCH_CODE:'rlm.py'") # ❌ Quoted search term |
41 | 51 | ``` |
42 | 52 | Results appear in `search_results` on your NEXT step. |
43 | 53 |
|
44 | | -### STEP 2: Fetch files with FETCH_FILE |
| 54 | +### FETCH_FILE - Read file contents (NOT read_file, NOT read_code!) |
45 | 55 | ```python |
46 | | -# CORRECT - exact path, no extra quotes |
47 | 56 | print("FETCH_FILE:dspy/predict/rlm.py") |
48 | 57 | print("FETCH_FILE:tests/predict/test_rlm.py") |
49 | | -
|
50 | | -# WRONG - do NOT add extra quotes or parentheses |
51 | | -# print("FETCH_FILE:dspy/predict/rlm.py")") # ❌ Extra quote/paren |
52 | 58 | ``` |
53 | 59 | Content appears in `repo_files['dspy/predict/rlm.py']` on your NEXT step. |
54 | 60 |
|
55 | | -### STEP 3: List directories with LIST_DIR |
| 61 | +### LIST_DIR - List directory contents |
56 | 62 | ```python |
57 | | -# CORRECT - use LIST_DIR (NOT LIST_FILES!) |
58 | 63 | print("LIST_DIR:dspy/predict") |
59 | | -print("LIST_DIR:dspy/predict/") # trailing slash is OK |
60 | 64 | print("LIST_DIR:tests") |
61 | | -
|
62 | | -# WRONG - do NOT use these non-existent commands |
63 | | -# print("LIST_FILES:dspy/predict") # ❌ No such command as LIST_FILES |
64 | | -# print("LIST_DIRECTORY:dspy/predict") # ❌ Wrong name |
65 | | -# print("LS:dspy/predict") # ❌ Not supported |
66 | 65 | ``` |
67 | | -Entries appear in `repo_dirs['dspy/predict']` on your NEXT step as a list of dicts with 'path', 'type', and 'size'. |
| 66 | +Entries appear in `repo_dirs['dspy/predict']` on your NEXT step. |
68 | 67 |
|
69 | | -### IMPORTANT NOTES: |
70 | | -- Commands print EXACTLY as shown, the system intercepts them |
71 | | -- The command is `LIST_DIR` not `LIST_FILES` or `LIST_DIRECTORY` |
72 | | -- Do NOT try os.walk() or open() - those won't work |
73 | | -- Data becomes available on your NEXT step |
74 | | -- Check `repo_files`, `repo_dirs`, `search_results` dicts |
75 | | -- SYNTAX: Make sure print statements are properly closed with exactly ONE `")` |
76 | | -
|
77 | | -### WORKFLOW EXAMPLE (finding if rlm.py contains X): |
78 | | -Step 1: `print("LIST_DIR:dspy/predict")` → get directory contents |
79 | | -Step 2: Check `repo_dirs['dspy/predict']` for file list, then `print("FETCH_FILE:dspy/predict/rlm.py")` |
80 | | -Step 3: Check `repo_files['dspy/predict/rlm.py']` for content |
| 68 | +### WORKFLOW: |
| 69 | +1. `print("SEARCH_CODE:filename")` → find paths |
| 70 | +2. `print("FETCH_FILE:path/to/file.py")` → read content |
| 71 | +3. Check `repo_files['path/to/file.py']` in next step |
81 | 72 | """ |
82 | 73 |
|
83 | 74 |
|
84 | 75 |
|
85 | 76 |
|
| 77 | + |
86 | 78 | class VirtualReviewRunner: |
87 | 79 | """Run RLM code reviews on GitHub PRs without a local repository. |
88 | 80 | |
|
0 commit comments