Skip to content

Add OpenAI Codex prompt bundle support - #508

Open
0xAWM wants to merge 1 commit into
berabuddies:masterfrom
0xAWM:master
Open

Add OpenAI Codex prompt bundle support#508
0xAWM wants to merge 1 commit into
berabuddies:masterfrom
0xAWM:master

Conversation

@0xAWM

@0xAWM 0xAWM commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds first-class OpenAI Codex-style prompt bundle support to the OpenAI runtime.

It moves the Codex prompt shape into editable bundled resources, wires those resources into OpenAI request assembly, and fixes project/global memory loading so Codex-style prompts receive the
expected AGENTS.md / CLAUDE.md context.

Changes

  • Added Codex prompt resources:

    • resources/prompts/openai-codex-base.yaml
    • resources/prompts/openai-codex-developer.yaml
    • resources/prompts/openai-codex-contextual-user.yaml
  • Added OpenAI Codex prompt context assembly:

    • Builds prompt bundles from current resources instead of hardcoded test text.
    • Separates base instructions from dynamic environment and project context.
    • Supports developer-message emission when the model/provider advertises support.
    • Falls back to folding developer/contextual text into instructions when unsupported.
  • Updated OpenAI runtime paths to use the new prompt bundle plumbing across responses, streaming, and websocket flows.

  • Updated provider metadata for OpenAI Codex compatibility options.

  • Fixed global memory handling for Codex-style prompts:

    • Loads project AGENTS.md from repo root to cwd.
    • Includes global AGENTS.md from supported home config locations.
    • Preserves AGENTS.md priority over CLAUDE.md.
    • Falls back to project/global CLAUDE.md only when no AGENTS.md context exists.
  • Added/updated specs under specs/puffer-core/ documenting the prompt bundle and compatibility behavior.

Compatibility Notes

  • Anthropic prompt behavior is not changed.
  • Non-Codex OpenAI prompt behavior is preserved.
  • Codex-style OpenAI requests now keep dynamic context out of the static base prompt when the provider supports the richer message shape.
  • Providers that do not support developer/contextual-user channels still receive equivalent prompt content through the fallback path.

Verification

Ran:

  • cargo test -p puffer-core openai::prompt_context::tests
    • 16 passed
  • cargo fmt --all --check
  • cargo check -p puffer-core
  • git diff --check

cargo check still reports existing warnings, but exits successfully.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant