Skip to content

Add GPT-5 specific system prompt template#1236

Draft
enyst wants to merge 18 commits intomainfrom
gpt-5-system-prompt
Draft

Add GPT-5 specific system prompt template#1236
enyst wants to merge 18 commits intomainfrom
gpt-5-system-prompt

Conversation

@enyst
Copy link
Collaborator

@enyst enyst commented Nov 23, 2025

This PR adds a new system_prompt_gpt_5.j2 template tailored for GPT-5 usage within the OpenHands Software Agent SDK.

Key points:

  • Reuses the existing system_prompt.j2 base to keep shared behavior and policies centralized.
  • Adapts relevant concepts from OpenAI's Codex CLI prompt, focusing on planning, responsiveness, validation, and presentation of results.
  • Integrates the existing task_tracker tool as the primary mechanism for long-horizon planning and progress tracking (replacing the update_plan concept from the original prompt).

This template is intended as a starting point for GPT-5-specific behavior and can be iterated on as we gain experience running GPT-5 in this environment.

Co-authored-by: openhands openhands@all-hands.dev

@enyst can click here to continue refining the PR


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:e3cca1b-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-e3cca1b-python \
  ghcr.io/openhands/agent-server:e3cca1b-python

All tags pushed for this build

ghcr.io/openhands/agent-server:e3cca1b-golang-amd64
ghcr.io/openhands/agent-server:e3cca1b-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:e3cca1b-golang-arm64
ghcr.io/openhands/agent-server:e3cca1b-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:e3cca1b-java-amd64
ghcr.io/openhands/agent-server:e3cca1b-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:e3cca1b-java-arm64
ghcr.io/openhands/agent-server:e3cca1b-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:e3cca1b-python-amd64
ghcr.io/openhands/agent-server:e3cca1b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-amd64
ghcr.io/openhands/agent-server:e3cca1b-python-arm64
ghcr.io/openhands/agent-server:e3cca1b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-arm64
ghcr.io/openhands/agent-server:e3cca1b-golang
ghcr.io/openhands/agent-server:e3cca1b-java
ghcr.io/openhands/agent-server:e3cca1b-python

About Multi-Architecture Support

  • Each variant tag (e.g., e3cca1b-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., e3cca1b-python-amd64) are also available if needed

enyst and others added 4 commits November 23, 2025 08:09
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>

- Fix the problem at the root cause rather than applying surface-level patches, when possible.
- Avoid unneeded complexity in your solution.
- Do not attempt to fix unrelated bugs or broken tests. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we delete this one 😅

I don't know if it's necessary to forbid it? GPT-5 does some of these, but it's rare and, personally, I found it welcome 🤷


## Sharing progress updates

For especially longer tasks that you work on (i.e. requiring many tool calls, or a plan with multiple steps), you should provide progress updates back to the user at reasonable intervals. These updates should be structured as a concise sentence or two (no more than 8–10 words long) recapping progress so far in plain language: this update demonstrates your understanding of what needs to be done, progress so far (i.e. files explored, subtasks complete), and where you're going next.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes GPT-5 talk


Your final message should read naturally, like an update from a concise teammate. For casual conversation, brainstorming tasks, or quick questions from the user, respond in a friendly, conversational tone. You should ask questions, suggest ideas, and adapt to the user’s style. If you've finished a large amount of work, when describing what you've done to the user, you should follow the final answer formatting guidelines to communicate substantive changes. You don't need to add structured formatting for one-word answers, greetings, or purely conversational exchanges.

You can skip heavy formatting for single, simple actions or confirmations. In these cases, respond in plain sentences with any relevant next step or quick option. Reserve multi-section structured responses for results that need grouping or explanation.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 paragraphs are a bit disputable. They're drafted by OpenAI for codex-cli, to shape the behavior of the LLM towards the user. Personally I like the style of GPT-5 right now, on final answers; and, this guidance is a tad annoying when displaying answers on GitHub, because they will be unformatted. 🤔


You can skip heavy formatting for single, simple actions or confirmations. In these cases, respond in plain sentences with any relevant next step or quick option. Reserve multi-section structured responses for results that need grouping or explanation.

The user is working on the same computer as you, and has access to your work. As such there's no need to show the full contents of large files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files using `apply_patch`, there's no need to tell users to "save the file" or "copy the code into a file"—just reference the file path.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The user is working on the same computer as you, and has access to your work. As such there's no need to show the full contents of large files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files using `apply_patch`, there's no need to tell users to "save the file" or "copy the code into a file"—just reference the file path.
The user has access to your work. As such there's no need to show the full contents of large files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files using `apply_patch`, there's no need to tell users to "save the file" or "copy the code into a file"—just reference the file path.

😅 Ditto, drafted specifically for use in cli

Comment on lines +195 to +204
When referencing files in your response, follow these rules:

- Use inline code to make file paths clickable.
- Each reference should have a stand-alone path, even if it's the same file.
- Accepted: absolute, workspace-relative, `a/` or `b/` diff prefixes, or bare filename/suffix.
- Line/column (1-based, optional): `:line[:column]` or `#Lline[Ccolumn]` (column defaults to 1).
- Do not use URIs like `file://`, `vscode://`, or `https://`.
- Do not provide ranges of lines.
- Examples: `src/app.ts`, `src/app.ts:42`, `b/server/index.js#L10`, `C:\repo\project\main.rs:12:5`.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When referencing files in your response, follow these rules:
- Use inline code to make file paths clickable.
- Each reference should have a stand-alone path, even if it's the same file.
- Accepted: absolute, workspace-relative, `a/` or `b/` diff prefixes, or bare filename/suffix.
- Line/column (1-based, optional): `:line[:column]` or `#Lline[Ccolumn]` (column defaults to 1).
- Do not use URIs like `file://`, `vscode://`, or `https://`.
- Do not provide ranges of lines.
- Examples: `src/app.ts`, `src/app.ts:42`, `b/server/index.js#L10`, `C:\repo\project\main.rs:12:5`.


### Final answer structure and style guidelines

You are producing plain text that will later be styled by the surrounding tools. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very curious how much text goes into the codex-cli system prompt referring to styling and formatting. Maybe that's not a bad idea... Clearly OpenAI doesn't use the same system prompt for codex web and codex-cli, at least in part.


Similarly, once you're confident in correctness, you can suggest or use formatting commands to ensure that your code is well formatted. If there are issues you can iterate up to 3 times to get formatting right, but if you still can't manage it's better to save the user time and present them a correct solution where you call out the formatting in your final message. If the codebase does not have a formatter configured, do not add one.

For all of testing, running, building, and formatting, do not attempt to fix unrelated bugs. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅 IIRC our default prompt has some restraining wording too. And in practice, with it, it seems to me that GPT-5 has mostly this behavior described here: does not usually fix unrelated bugs, does check "around" the issue, and notifies if it sees something suspicious. I can think of exceptions when it fixes stuff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wording is twice in this prompt 🤔

@all-hands-bot
Copy link
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @enyst, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

1 similar comment
@all-hands-bot
Copy link
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @enyst, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

@enyst
Copy link
Collaborator Author

enyst commented Jan 20, 2026

@OpenHands Understand that this PR is an adaptation of the gpt-5 prompt md file from openai/codex repository (somewhere in rs implementation) to openhands.

It's a bit old now, and it was for gpt-5 prompt (that's 5.0, not 5.2) non-codex.

Clone yourself that repo, and compare the current gpt-5.2 prompt file with this, and update it accordingly. Feel free to investigate the SDK to see why we have descriptions of the task tracker, our tool, so we may want to keep that.

@openhands-ai
Copy link

openhands-ai bot commented Jan 20, 2026

I'm on it! enyst can track my progress at all-hands.dev

@openhands-ai
Copy link

openhands-ai bot commented Jan 20, 2026

I have updated the system_prompt_gpt_5.j2 file to align with the gpt_5_2_prompt.md (non-codex) prompt from the OpenAI Codex repository, while preserving OpenHands-specific tool instructions.

Key updates include:

  • Personality & Autonomy: Updated personality traits and added a new "Autonomy and Persistence" section to encourage end-to-end task resolution.
  • AGENTS.md Support: Added the AGENTS.md specification section.
  • Planning: Integrated GPT-5.2's planning philosophy (e.g., scope pivots) while retaining the task_tracker tool usage instructions.
  • Presentation: Significantly expanded the "Presenting your work" section with detailed guidelines on structure, tone, verbosity, and formatting (headers, bullets, etc.).
  • Tool Guidelines: Added specific guidelines for shell commands (preferring rg), and updated task execution criteria.

The changes have been pushed to the gpt-5-system-prompt branch.

View full conversation

@all-hands-bot
Copy link
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @enyst, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

1 similar comment
@all-hands-bot
Copy link
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @enyst, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

@enyst enyst added the behavior-initiative This is related to the system prompt sections and LLM steering. label Feb 14, 2026
@all-hands-bot
Copy link
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @enyst, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

1 similar comment
@all-hands-bot
Copy link
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @enyst, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

@github-actions
Copy link
Contributor

Python API breakage checks — ✅ PASSED

Result:PASSED

Action log

@github-actions
Copy link
Contributor

REST API breakage checks (OpenAPI) — ❌ FAILED

Result:FAILED

⚠️ Breaking REST API changes or policy violations detected.

Log excerpt (first 1000 characters)
Uninstalled 1 package in 1ms
Installed 1 package in 2ms
::error title=openhands-agent-server REST API::Breaking REST API change detected without MINOR version bump (1.14.0 -> 1.14.0).

Breaking REST API changes detected compared to baseline release:
- added '#/components/schemas/ACPAgent-Output, #/components/schemas/Agent-Output' to the '/items/anyOf[subschema #1: ConversationInfo]/agent' response property 'oneOf' list for the response status '200'
- the '/items/anyOf[subschema #1: ConversationInfo]/agent' response's property type/format changed from 'object'/'' to ''/'' for status '200'
- removed the required property '/items/anyOf[subschema #1: ConversationInfo]/agent/kind' from the response with the '200' status
- removed the required property '/items/anyOf[subschema #1: ConversationInfo]/agent/llm' from the response with the '200' status
- the 'agent' request property type/format changed from 'object'/'' to ''/''
- added '#/components/schemas/ACPAgent-Output, #/components/schemas/A

Action log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behavior-initiative This is related to the system prompt sections and LLM steering.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants