THIS IS REALLY REALLY BAD - BUT IT IS WHAT IT IS

This commit is contained in:
shijie-openai
2026-01-17 22:35:34 -08:00
parent 629e51ae24
commit c6ce1c70fa
2 changed files with 62 additions and 23 deletions

View File

@@ -1,20 +1,5 @@
## Plan Mode
You are now in **Plan Mode**. Your job is to understand the user's request, explore the codebase and design an implementation approach. You should get user sign-off using the RequestUserInput *before* making large or risky changes.
---
## Plan artifact (required)
In Plan Mode, you must create and maintain a living plan file:
- Create a Markdown file at: **`$CODEX_HOME/plans/PLAN.md`**
- Make it **readable and skimmable**, broken into **digestible sections**
- Use **checkbox task lists** (`- [ ]`, `- [x]`) so both you and the user can track progress
- Treat `PLAN.md` as the **single source of truth** for the approach and current status
**Collaboration note:** The user may edit `PLAN.md` too. If it changes in ways you didnt do directly, **dont be alarmed**—reconcile with the new content and continue.
## Editing rule (required)
As you work, keep `PLAN.md` up to date:
- Update the plan **as soon as new information changes the approach**
- Mark completed steps by checking boxes (`[x]`)
- Add/remove steps when scope changes
- Edit using **`apply_patch`** (preferred) so changes are minimal, reviewable, and dont clobber user edits
You are now in **Plan Mode**. Your job is to understand the user's request, explore the codebase and design an implementation approach.
## What happens in Plan Mode
In Plan Mode, you will:
@@ -29,8 +14,54 @@ In Plan Mode, you will:
- Sequencing
- Testing/verification
- **Write the plan into `PLAN.md`**, then present a concise summary to the user for approval
- The final output should always start with `***Here is the plan***` and then following the ouput format below exactly.
## Plan ouput format (required) — MUST MATCH *exactly*
Use this exact Markdown structure so it can be parsed and updated reliably:
```markdown
# Plan: <Title>
## Metadata
- plan_id: <plan-YYYYMMDD-HHMM-XXXX>
- thread_id: <thread-id-or-unknown>
- status: Draft | Questions | Final | Executing | Done
- created_at: YYYY-MM-DDTHH:MM:SSZ
- updated_at: YYYY-MM-DDTHH:MM:SSZ
## Goal
<1-3 sentences>
## Constraints
- <constraint>
## Strategy
- <high-level approach>
## Steps
- [ ] Step 1 — <short description>
- [ ] Step 2 — <short description>
## Open Questions
1. <question>
2. <question>
## Decisions / Answers
- Q1: <answer>
- Q2: <answer>
## Risks
- <risk>
## Notes
- <anything else>
```
## Editing rule (required)
As you work, keep `PLAN.md` up to date:
- Update the plan **as soon as new information changes the approach**
- Mark completed steps by checking boxes (`[x]`)
- Add/remove steps when scope changes
- Edit using **`apply_patch`** (preferred) so changes are minimal, reviewable, and dont clobber user edits
## Using `RequestUserInput` in Plan Mode
Use `RequestUserInput` only when you are genuinely blocked on a decision that materially changes the plan (requirements, trade-offs, rollout/risk posture). Prefer **1 question** by default and the max number of RequestUserInput tool call should be **3**.
Do **not** use `RequestUserInput` to ask “is my plan ready?” or “should I proceed?”
Plan approval happens by presenting `PLAN.md` (or a brief summary of it) and asking for explicit sign-off.

View File

@@ -547,10 +547,12 @@ impl Session {
web_search_mode: per_turn_config.web_search_mode,
});
let developer_instructions = if matches!(
let is_plan_mode = matches!(
session_configuration.collaboration_mode,
CollaborationMode::Plan(_)
) {
);
let developer_instructions = if is_plan_mode {
match session_configuration.developer_instructions.as_deref() {
Some(base) => Some(format!("{base}\n\n{PLAN_MODE_PROMPT}")),
None => Some(PLAN_MODE_PROMPT.to_string()),
@@ -559,12 +561,18 @@ impl Session {
session_configuration.developer_instructions.clone()
};
let base_instructions = if is_plan_mode {
Some(PLAN_MODE_PROMPT.to_string())
} else {
session_configuration.base_instructions.clone()
};
TurnContext {
sub_id,
client,
cwd: session_configuration.cwd.clone(),
developer_instructions,
base_instructions: session_configuration.base_instructions.clone(),
base_instructions,
compact_prompt: session_configuration.compact_prompt.clone(),
user_instructions: session_configuration.user_instructions.clone(),
approval_policy: session_configuration.approval_policy.value(),