Skip to content

[Plan Mode 9/9] (OPTIONAL) GPT-5 prompt foundation#69449

Closed
100yenadmin wants to merge 1 commit into
openclaw:mainfrom
electricsheephq:restack/68939-pr1-prompt-foundation
Closed

[Plan Mode 9/9] (OPTIONAL) GPT-5 prompt foundation#69449
100yenadmin wants to merge 1 commit into
openclaw:mainfrom
electricsheephq:restack/68939-pr1-prompt-foundation

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

📋 Stack position: This is [Plan Mode 9/9] (OPTIONAL) — the GPT-5 prompt foundation, an independent track that can land before, alongside, or after the main 8-PR plan-mode stack.

  • Main stack (sequential): [Plan Mode 1/9] Plan-state foundation is currently open; [Plan Mode 2/9] opens after 1/9 merges; etc.
  • This PR (9/9): independent of the main stack — does NOT need to merge in order. Can be reviewed and merged whenever the GPT-5 prompt-overlay area is ready for changes.
  • Why optional: this PR's content is GPT-5.4 prompt-layer churn (system prompt reorder, context-file injection scan, agent scope refinement). Maintainers may want to defer it until they've evaluated whether the recent main-branch GPT-5 prompt evolution (e.g., agents: split GPT-5 prompt and retry behavior #65597 split GPT-5 prompt and retry behavior, OpenAI: reduce repeated heartbeat alerts #65148 strengthen heartbeat overlay guidance, openai: add heartbeat guidance to GPT-5 overlay #65069 add heartbeat guidance to GPT-5 overlay) and this PR's overlay are coherent — that's a separate review concern from the rest of the plan-mode work.

Numbering history: this PR was originally [Plan Mode 1/9] (the foundation). Per maintainer-readability feedback, the numbering was reordered so [Plan Mode 1/9] is now the plan-state foundation (which actually starts the plan-mode feature) and the GPT-5 prompt foundation moved to 9/9 as an optional independent track. The original 9-part fork stack (#10-#18 on 100yenadmin/openclaw-1, all closed) used the old numbering.


Summary

This PR carves the GPT-5 and prompt-layer foundation out of the original plan-mode umbrella PR (#68939, closed; replaced by the 8-PR sequential decomposition).

It exists to land the model-facing groundwork: prompt overlay behavior, agent scope, context-file injection scanning, and system-prompt ordering. Keeping this work separate lets reviewers validate prompt semantics without also reviewing plan persistence, approval gates, UI, or channel behavior.

What This PR Includes

  • OpenAI prompt overlay (extensions/openai/prompt-overlay.ts) — GPT-5 specific overlay configuration
  • Agent scope (src/agents/agent-scope.ts) — reorganized scope semantics for the new prompt foundation
  • Context-file injection scanning (src/agents/context-file-injection-scan.ts) — security-oriented scan for prompt-injection patterns in context files
  • System-prompt ordering (src/agents/system-prompt.ts, src/agents/pi-embedded-runner/system-prompt.ts, src/agents/system-prompt-contribution.ts) — reordered to put GPT-5-specific guidance first
  • GPT-5 boot reorder test (src/agents/system-prompt-gpt5-boot-reorder.test.ts)

Files In Scope

Primary review targets (11 files):

  • extensions/openai/prompt-overlay.ts — overlay logic
  • extensions/openai/index.test.ts — overlay tests
  • src/agents/agent-scope.ts, src/agents/agent-scope.test.ts
  • src/agents/context-file-injection-scan.ts, src/agents/context-file-injection-scan.test.ts
  • src/agents/system-prompt.ts
  • src/agents/system-prompt-contribution.ts
  • src/agents/system-prompt-gpt5-boot-reorder.test.ts
  • src/agents/pi-embedded-runner/system-prompt.ts
  • src/auto-reply/reply/commands-system-prompt.ts

Reviewer Guide

  1. Start with extensions/openai/prompt-overlay.ts — the core overlay change
  2. Then src/agents/system-prompt.ts + src/agents/pi-embedded-runner/system-prompt.ts — reorder logic
  3. Finally src/agents/context-file-injection-scan.ts — security additions

Validation:

  • Run pnpm vitest run extensions/openai/index.test.ts src/agents/system-prompt-gpt5-boot-reorder.test.ts src/agents/context-file-injection-scan.test.ts
  • Manual: spin up gateway with a GPT-5 model + verify the system prompt order matches expected sequence

What This PR Does NOT Include

  • Plan persistence — see [Plan Mode 1/9] Plan-state foundation (open now)
  • Approval gates / mutation gate / nudges — see [Plan Mode 2/9] Core backend MVP (next)
  • Plan UI — see [Plan Mode 5/9] Web UI + i18n (later)
  • Channel integration — see [Plan Mode 6/9] Text channels + Telegram (later)

Issue references

Architecture references

  • docs/plans/PLAN-MODE-ARCHITECTURE.md — see "GPT-5 Prompt Layer" section (added by this PR or earlier)

Test Status

Carry-forward commitments

  • This PR's foundation is required by NOTHING in the main 8-PR stack (verified: each of Parts 1-8 in the new numbering does not touch extensions/openai/prompt-overlay.ts or the system-prompt.ts files this PR modifies). Hence it can land in any order relative to the main stack.

Status

DRAFT — pending the focused rebase + GPT-5 prompt evolution audit.

@100yenadmin

Copy link
Copy Markdown
Contributor Author

Plan Mode Restack Overview

This stack is a clean rewrite of the oversized plan-mode umbrella PR at openclaw/openclaw#68939.

The original branch mixed prompt work, plan-state storage, backend plan-mode behavior, advanced approval flows, automation hooks, web UI, text-channel rendering, Telegram delivery, and documentation into one surface. The live diff was 202 files / +39,013 / -335, which made review order and ship boundaries hard to trust.

This restack deliberately turns that branch into a reviewable sequence:

  1. Prompt foundation
  2. Plan-state foundation
  3. Core backend MVP
  4. Advanced plan interactions
  5. Automation and subagent follow-ups
  6. Web UI and i18n
  7. Text channels
  8. Telegram attachments
  9. Docs, QA, and help

Global cleanup applied across the whole stack

  • docs/plans/rollout/openclaw-plan-mode-rollout.patch is removed from the rewritten stack.
  • docs/plans/rollout/README.md is removed from the rewritten stack.
  • CHANGELOG.md is removed from the rewritten stack.
  • planMode.approvalTimeoutSeconds is not carried forward in the rewritten branches.
  • planMode.autoEnableFor is held out of the core backend MVP and appears only in the automation-focused PR.
  • Telegram markdown document upload is held out of the core stack and appears only in the Telegram follow-up PR.
  • ui/src/i18n/** churn is isolated to the UI PR so earlier backend reviews do not pay the localization cost.

Draft PR map

Why the child PRs live in the fork

GitHub only allows a PR base branch to live in the target repository. Because these are truly stacked follow-on branches, only the root PR can target openclaw/openclaw directly.

The child PRs are therefore opened as draft stacked PRs in 100yenadmin/openclaw-1 so reviewers can still inspect each layer against its immediate parent.

Review guidance

  • Review each PR against its immediate parent, not against main, unless the PR explicitly says otherwise.
  • Treat PR 3 as the shipping backend MVP boundary.
  • Treat PRs 4 through 8 as follow-on capability layers that can be reasoned about separately.
  • Treat PR 9 as documentation and operationalization for the final shipped surface, not as the feature definition itself.

Validation expectations

  • PR 1: prompt overlay, injection scan, and system-prompt ordering tests
  • PR 2: update_plan, plan store, hydration, and skill frontmatter tests
  • PR 3: plan-mode approval, mutation gate, integration, and session patch tests
  • PR 4: accept-edits, ask-user-question, and plan archetype tests
  • PR 5: automation, heartbeat, cron, subagent, and pending-injection tests
  • PR 6: UI tests and i18n validation
  • PR 7: plan rendering and text command tests
  • PR 8: Telegram bridge and delivery tests
  • PR 9: docs and QA scenario review after the feature stack is in place

Intent of the restack

The goal here is not just smaller diffs. The goal is to make the feature line truthful:

  • what is foundational
  • what is optional
  • what is operational
  • what is transport-specific
  • what should not have shipped in the first place

That is why stale rollout artifacts are removed entirely, advanced config is not exposed before its runtime exists, and transport-specific extras are pushed to the edge of the stack instead of living in the middle of the backend review surface.

@100yenadmin

Copy link
Copy Markdown
Contributor Author

Closing — GPT-5 prompt foundation will be revisited as a separate focused PR after the main 7-part stack lands. This work needs a deeper review against recent upstream prompt-overlay churn (#65597, #65148, #65069) which is its own audit cycle.

The remaining plan-mode work has been restructured into 7 per-part PRs ([Plan Mode 1/7] through [Plan Mode 7/7]) + 1 [Plan Mode FULL] integration bundle. This PR (formerly [Plan Mode 9/9] OPTIONAL) is independent of that rollout and will return on its own.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant