Skip to content

Add per-run system prompt extension hook - #597

Open
KirschBluteX wants to merge 3 commits into
huggingface:mainfrom
KirschBluteX:codex/issue-532-system-prompt-hook
Open

Add per-run system prompt extension hook#597
KirschBluteX wants to merge 3 commits into
huggingface:mainfrom
KirschBluteX:codex/issue-532-system-prompt-hook

Conversation

@KirschBluteX

@KirschBluteX KirschBluteX commented Aug 17, 2026

Copy link
Copy Markdown

Summary

  • Add a before_agent_start extension hook that chains run-scoped system prompt replacements in registration order.
  • Pass the final prompt through a keyword-only AgentHarness run argument so initial, tool-loop, and overflow-retry requests share it while the configured base prompt and transcript stay unchanged.
  • Expose frozen, repr-hidden prompt inputs without skill content, and document the hook with a tested packaged example and release note.

Handler exceptions and invalid returns are diagnosed and skipped, so later handlers still run. Static prompt guidelines remain supported and are included in the structured input snapshot. Reload and session replacement refresh that snapshot without persisting run-specific replacements.

Verification

  • Linux/Python 3.12: 1533 passed, 3 skipped
  • Focused hook, harness, example, and package-metadata tests: 142 passed
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy: no issues in 102 source files
  • Hugo 0.152.2: 33 pages built
  • Windows full-suite failures are limited to existing path-casing, shell, permission, and TUI platform differences; focused feature tests pass

Closes #532

@KirschBluteX
KirschBluteX force-pushed the codex/issue-532-system-prompt-hook branch from d7e7018 to 54a2dda Compare August 18, 2026 01:27
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.

Allow extensions to override the system prompt per agent run

1 participant