Skip to content

Commit ae72ceb

Browse files
authored
Merge pull request #1 from rasdani/daniel/swe-training
Trim system prompt for RL training efficiency
2 parents ab7aa5a + e81e281 commit ae72ceb

File tree

3 files changed

+5
-48
lines changed

3 files changed

+5
-48
lines changed

packages/opencode/src/session/system.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,10 @@ export namespace SystemPrompt {
2727
}
2828

2929
export async function environment(model: Provider.Model) {
30-
const project = Instance.project
3130
return [
3231
[
33-
`You are powered by the model named ${model.api.id}. The exact model ID is ${model.providerID}/${model.api.id}`,
34-
`Here is some useful information about the environment you are running in:`,
35-
`<env>`,
36-
` Working directory: ${Instance.directory}`,
37-
` Is directory a git repo: ${project.vcs === "git" ? "yes" : "no"}`,
38-
` Platform: ${process.platform}`,
39-
`</env>`,
40-
`<directories>`,
41-
` ${
42-
project.vcs === "git" && false
43-
? await Ripgrep.tree({
44-
cwd: Instance.directory,
45-
limit: 50,
46-
})
47-
: ""
48-
}`,
49-
`</directories>`,
32+
`Working directory: ${Instance.directory}`,
33+
`Platform: ${process.platform}`,
5034
].join("\n"),
5135
]
5236
}
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
1-
Executes a given bash command in a fresh shell session with optional timeout, ensuring proper handling and security measures.
2-
3-
All commands run in ${directory} by default. Use the `workdir` parameter if you need to run a command in a different directory. AVOID using `cd <directory> && <command>` patterns - use `workdir` instead.
4-
5-
When searching for text or files, prefer using rg or rg --files respectively because rg is much faster than alternatives like grep. (If the rg command is not found, then use alternatives.)
6-
7-
1. Directory Verification:
8-
- If the command will create new directories or files, first use `ls` to verify the parent directory exists and is the correct location
9-
- For example, before running "mkdir foo/bar", first use `ls foo` to check that "foo" exists and is the intended parent directory
10-
11-
2. Command Execution:
12-
- Always quote file paths that contain spaces with double quotes (e.g., rm "path with spaces/file.txt")
13-
- Examples of proper quoting:
14-
- mkdir "/Users/name/My Documents" (correct)
15-
- mkdir /Users/name/My Documents (incorrect - will fail)
16-
- python "/path/with spaces/script.py" (correct)
17-
- python /path/with spaces/script.py (incorrect - will fail)
18-
- After ensuring proper quoting, execute the command.
19-
- Capture the output of the command.
20-
21-
Usage notes:
22-
- The command argument is required.
23-
- You can specify an optional timeout in milliseconds. If not specified, commands will time out after 120000ms (2 minutes).
24-
- If the output exceeds ${maxLines} lines or ${maxBytes} bytes, it will be truncated and the full output will be written to a file. Inspect only relevant sections and prefer rg for search when available. Because of this, you do NOT need to use `head`, `tail`, or other truncation commands to limit output - just run the command directly.
1+
Run a shell command. All commands run in ${directory} by default. Use `workdir` to run in a different directory.
2+
Prefer `rg` for searching text/files. Output is truncated at ${maxLines} lines or ${maxBytes} bytes.
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
Performs exact string replacements in files.
2-
3-
Usage:
4-
- The edit will FAIL if `oldString` is not found in the file with an error "oldString not found in content".
5-
- The edit will FAIL if `oldString` is found multiple times in the file with an error "Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match." Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`.
6-
- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
1+
Replace an exact string in a file. `oldString` must appear exactly once, or the edit fails. Use `replaceAll` to replace every occurrence.

0 commit comments

Comments
 (0)