Skip to content

Commit a68a9be

Browse files
author
Atlas
committed
refactor: concise prompts - 5-10 words, precise but brief
- Tool description: 'Describe what this PR does in 5-10 words' - SYSTEM_PROMPT: minimal 4-line instructions - User message: simple and direct - Example: 'Fix null pointer in login when email is empty' - Tests: 1197 pass
1 parent 034e9ac commit a68a9be

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/swe_forge/llm/tools.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,20 @@ def submit_tests_tool_schema() -> ToolDefinition:
125125
def set_dataset_prompt_tool_schema() -> ToolDefinition:
126126
"""Create the set_dataset_prompt tool schema.
127127
128-
This tool is used by the agent to set a natural description of the PR changes.
129-
The prompt describes what the PR does, in natural language.
128+
This tool is used by the agent to set a concise description of what the PR does.
130129
131130
Returns:
132131
ToolDefinition for the set_dataset_prompt tool.
133132
"""
134133
return ToolDefinition.create(
135134
name="set_dataset_prompt",
136-
description="Set a natural language description of what this PR does. Use this to describe the changes in simple terms.",
135+
description="Describe what this PR does in 5-10 words. Be specific but brief.",
137136
parameters={
138137
"type": "object",
139138
"properties": {
140139
"prompt": {
141140
"type": "string",
142-
"description": "Natural description of the PR changes (e.g., 'Fixes null pointer exception in login when email is empty')",
141+
"description": "Short description (e.g., 'Fix null pointer in login when email is empty' or 'Add dark mode toggle to settings')",
143142
},
144143
},
145144
"required": ["prompt"],

src/swe_forge/swe/test_generator.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@
4949
# System Prompt
5050
# ─────────────────────────────────────────────────────────────────────────────
5151

52-
SYSTEM_PROMPT = """Analyze the GitHub PR and write verification tests.
52+
SYSTEM_PROMPT = """Write tests for this PR.
5353
54-
First, describe what the PR does using set_dataset_prompt.
55-
Then explore the repo, install dependencies, write tests, and submit."""
54+
1. Call set_dataset_prompt with a short description (5-10 words)
55+
2. Explore and install dependencies
56+
3. Write tests
57+
4. Submit"""
5658

5759

5860
# ─────────────────────────────────────────────────────────────────────────────
@@ -486,11 +488,11 @@ def _truncate(self, s: str, max_len: int = 4000) -> str:
486488

487489
def _build_user_message(self, task: SweTask) -> str:
488490
"""Build the initial user message for the agent."""
489-
return f"""PR in {task.repo}:
491+
return f"""{task.repo}
490492
491493
{self._truncate(task.patch, 4000)}
492494
493-
Describe what this PR does, then write tests."""
495+
Use set_dataset_prompt first, then write tests."""
494496

495497
def _test_commands_for_language(self, language: str) -> tuple[list[str], list[str]]:
496498
"""Get suggested build and test commands for a language.

0 commit comments

Comments
 (0)