feat(coding-agent/prompts): added an Intent Gate to the system prompt#2666
feat(coding-agent/prompts): added an Intent Gate to the system prompt#2666metaphorics wants to merge 1 commit into
Conversation
- Added an Intent Gate section between I/O and Tool Priority: a surface-form to true-intent routing table (research, implementation, investigation, evaluation, fix, open-ended), a required one-line routing statement before acting, turn-local intent reset so a new turn is re-evaluated from scratch, and a context-completion gate that inspects before acting.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an “Intent Gate” to the coding agent’s system prompt to improve intent routing and prevent stale-plan execution, and documents the change in the changelog.
Changes:
- Introduces an Intent Gate section with a required one-line routing statement and an intent→approach table.
- Adds guidance for turn-local intent reset and a context-completion gate.
- Updates CHANGELOG with an Unreleased entry describing the addition.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/coding-agent/src/prompts/system/system-prompt.md | Adds the “Intent Gate” prompt section to guide intent identification and execution flow. |
| packages/coding-agent/CHANGELOG.md | Documents the prompt change in the Unreleased changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - In user-visible terminal prose and final chat, avoid LaTeX math delimiters (such as $ or $$) and LaTeX math commands (such as \text, \times) — the terminal cannot render them. Write equations in plain text / Unicode instead (e.g. BMR = 370 + (21.6 × 63.87) = 1,750 kcal). This does NOT apply to tool output or LaTeX/Markdown/KaTeX content you are asked to write to files. | ||
|
|
||
| # Intent Gate | ||
| Before acting on a message, identify what the user actually wants and state it in one short line: `I read this as [intent] — [plan].` The routing line anchors your decision and keeps reasoning transparent; it does NOT commit you to implementation — only the user's explicit request does. |
| | Surface form | True intent | Approach | | ||
| |---|---|---| | ||
| | "explain X", "how does Y work" | Research | Read the relevant code, then answer | | ||
| | "implement X", "add Y", "create Z" | Implementation | Assess the codebase, plan, then execute | | ||
| | "look into X", "check Y", "investigate" | Investigation | Search and read, then report findings | | ||
| | "what do you think about X?" | Evaluation | Evaluate, propose, wait for confirmation | | ||
| | "I'm seeing error X" / "Y is broken" | Fix | Diagnose from the error context, fix minimally | | ||
| | "refactor", "improve", "clean up" | Open-ended | Assess the codebase first, propose an approach | |
| | "I'm seeing error X" / "Y is broken" | Fix | Diagnose from the error context, fix minimally | | ||
| | "refactor", "improve", "clean up" | Open-ended | Assess the codebase first, propose an approach | | ||
|
|
||
| - **Turn-local reset.** Re-evaluate the latest user turn from scratch; do not keep pursuing an earlier intent when the newest turn changes direction. Queued steering messages outrank stale plans. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21ca2035d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - In user-visible terminal prose and final chat, avoid LaTeX math delimiters (such as $ or $$) and LaTeX math commands (such as \text, \times) — the terminal cannot render them. Write equations in plain text / Unicode instead (e.g. BMR = 370 + (21.6 × 63.87) = 1,750 kcal). This does NOT apply to tool output or LaTeX/Markdown/KaTeX content you are asked to write to files. | ||
|
|
||
| # Intent Gate | ||
| Before acting on a message, identify what the user actually wants and state it in one short line: `I read this as [intent] — [plan].` The routing line anchors your decision and keeps reasoning transparent; it does NOT commit you to implementation — only the user's explicit request does. |
There was a problem hiding this comment.
Preserve exact-output prompts in print mode
When the user asks for an exact response or uses omp -p in a script (for example, “print only OK”), this unconditional system-level instruction has higher priority than the user's formatting constraint and requires the model to include I read this as ... before answering. Print mode then writes the final assistant text blocks directly to stdout, so direct no-tool answers can no longer be safely used as exact/plain outputs unless the user overrides the system prompt.
Useful? React with 👍 / 👎.
| | "look into X", "check Y", "investigate" | Investigation | Search and read, then report findings | | ||
| | "what do you think about X?" | Evaluation | Evaluate, propose, wait for confirmation | | ||
| | "I'm seeing error X" / "Y is broken" | Fix | Diagnose from the error context, fix minimally | | ||
| | "refactor", "improve", "clean up" | Open-ended | Assess the codebase first, propose an approach | |
There was a problem hiding this comment.
Treat concrete refactor requests as implementation
For concrete edit requests such as “refactor this function” or “clean up this file,” this route sends the agent down a propose-only path instead of executing the explicitly requested code change. The surrounding text says only explicit user requests commit to implementation, but these surface forms are common explicit implementation requests; classifying all of them as open-ended will make the agent stop after assessment/proposal unless the user asks a second time.
Useful? React with 👍 / 👎.
| - In user-visible terminal prose and final chat, avoid LaTeX math delimiters (such as $ or $$) and LaTeX math commands (such as \text, \times) — the terminal cannot render them. Write equations in plain text / Unicode instead (e.g. BMR = 370 + (21.6 × 63.87) = 1,750 kcal). This does NOT apply to tool output or LaTeX/Markdown/KaTeX content you are asked to write to files. | ||
|
|
||
| # Intent Gate | ||
| Before acting on a message, identify what the user actually wants and state it in one short line: `I read this as [intent] — [plan].` The routing line anchors your decision and keeps reasoning transparent; it does NOT commit you to implementation — only the user's explicit request does. |
There was a problem hiding this comment.
Do not emit routing prose in subagents
Subagent sessions inherit this default prompt before the subagent prompt is inserted, and non-schema task runs currently accept any non-empty assistant text as a successful fallback when yield was not called (task/executor.ts lines 511-513). If a child stops after obeying this required I read this as ... line but before calling yield, the parent can treat that routing sentence as a successful task result instead of surfacing the missing-yield failure, masking incomplete delegated work.
Useful? React with 👍 / 👎.
Summary
Adds an Intent Gate to the system prompt: a surface-form to true-intent routing table (research / implementation / investigation / evaluation / fix / open-ended), a required one-line routing statement, turn-local intent reset, and a context-completion gate.
Note: touches
prompts/system/system-prompt.mdalongside #2657 and #2659 (distinct sections); rebase if flagged.Closes #2658