feat(agent-core): align model-facing prompts with actual tool behavior - #1296
Conversation
A hunk-by-hunk accuracy pass over every model-visible prompt surface (system.md, tool .md descriptions, zod describes, profile role prompts, and injected reminder strings), with each claim verified against the implementation and, where possible, empirically (ripgrep semantics). Fix descriptions that drifted from the code: - Grep `glob` matches against each file's absolute path, so `src/**/*.ts` silently matches nothing — document the working forms - Glob `path` accepts relative paths; results are files-only - FetchURL no longer promises a content-type-to-mode mapping the default provider does not honor - cron: a pinned-date 5-field expression repeats yearly unless `recurring: false`; drop a bench-only env knob from cron-list - skill `args` expansion covers $NAME/$1/$ARGUMENTS and the trailing ARGUMENTS: line; goal reminder no longer cites a nonexistent developer-message channel Disclose enforced-but-silent behavior: - cron fires deliver only while the session is idle; expressions with no fire within 5 years are rejected at create time - VCS metadata directories are always excluded from Glob/Grep, even with include_ignored; sensitive-file guard exemptions (.env.example/.env.sample/.env.template, public SSH keys) - large images may be downsampled while the <system> block reports original dimensions; subagent summaries under the length floor are sent back for expansion; background-disabled Agent calls are rejected before launch; AGENTS.md beyond ~32 KB triggers a performance warning (surfaced in the /init prompt) Resolve cross-surface contradictions: - AskUserQuestion background describe/envelope no longer teach polling - AgentSwarm subagent_type documents that resume keeps original types - bash.md scopes &&-chaining to dependent commands and steers independent read-only commands to parallel calls - the shared system prompt no longer names tools that read-only subagent profiles lack Add missing guidance: - denied/rejected tool calls mean the user declined that action — adjust, don't retry or route around (root agent) - plan subagent now knows it is read-only; coder subagent knows its final message is the entire handoff; explore subagent knows web tools are in scope - gh CLI routing for GitHub-hosted work; FetchURL login-wall note; a dual-use content-safety boundary; scope discipline, surrounding-idiom, and dependency-verification norms; file:line citation convention; progress notes on long multi-phase tasks
🦋 Changeset detectedLatest commit: c476b17 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3e5bd4b62
ℹ️ 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".
| 'next_step: Continue your current work; the answer will arrive automatically when the user responds.\n' + | ||
| 'next_step: Use TaskOutput with this task_id for a non-blocking status/answer snapshot.\n' + | ||
| 'next_step: Use TaskOutput with this task_id only to re-read the answer if you missed the notification — do not poll for it.\n' + |
There was a problem hiding this comment.
Let agents fetch completed background answers
When the session has background persistence (normal CLI agents have BackgroundTaskPersistence), a background question's output is persisted to output.log; the automatic completion notification built by BackgroundManager.buildBackgroundTaskNotificationContext then contains an <output-file> pointer rather than the answer text. With this next_step, the model is told TaskOutput is only for missed notifications, so after a normal completion notification it can continue without ever reading the user's answer. Please allow TaskOutput or the returned output file after completion, while still discouraging polling before the user responds.
Useful? React with 👍 / 👎.
…mpletion notice
In sessions with background persistence (any agent with a homedir), a
background question's answer is flushed to output.log and the completion
notification carries an <output-file> pointer, not the answer text. The
previous envelope wording ("use TaskOutput only to re-read the answer if
you missed the notification") gated the normal post-completion fetch
behind a missed-notification condition, so a model could acknowledge the
notice and continue without ever reading the user's answer.
Reword the envelope to state that the completion notice may carry a
pointer and to direct the model to read that file (or call TaskOutput
once) for the answer, while still forbidding polling before the user
responds. Align the background param describe the same way ("notified
automatically" rather than "the answer arrives", polling scoped to the
pending window).
What
A prompt-text-only accuracy pass over every model-visible prompt surface in
agent-core:system.md, tool.mddescriptions, zod.describe()strings, subagent profile role prompts (plan/coder/explore/agent.yaml),init.md, and injected reminder strings. 23 files, 57 insertions / 33 deletions — no behavior or schema changes.Every hunk was cross-checked against the implementation it describes; the ripgrep-related claims were additionally verified empirically with the exact argument order the tools use.
Why
Tool descriptions had drifted from the code in places, and several enforced behaviors were never disclosed to the model — both classes make the model confidently wrong (e.g. concluding code does not exist because a natural
Grepglob silently matches nothing, or promising exact cron delivery times the scheduler cannot honor).Changes by theme
Fix descriptions that contradict the code
globmatches each file's full absolute path, sosrc/**/*.tssilently returns nothing — documented the working forms (*.ts,**/src/**/*.ts, or scope withpath); verified empirically (0 vs 338 vs 571 matches)pathaccepts relative paths; Glob results are files-only (.md+ routing text inread.md)extracted, so the description no longer promises a content-type-to-mode mapping; the result note states which mode you got"30 14 28 2 *"repeats yearly unlessrecurring: false(the describe previously said "once"); removed a bench-only env knob fromcron-list.mdargs: expansion also covers$1/$ARGUMENTS, and with no placeholders the string is appended as a trailingARGUMENTS:line — the old text made models withhold args from skills with no declared parameterssystem.md:.git/**returns nothing (VCS metadata is always pruned) — the old text claimed it "traverses in full"Disclose enforced-but-silent behavior
include_ignored=true.env.example/.env.sample/.env.templateand public SSH keys (id_rsa.pubetc.) read normally — prevents over-refusal on a common legitimate task<system>block reports original dimensions (grounds the relative-coordinates rule)/initprompt now discloses the ~32 KB AGENTS.md performance-warning budget and steers toward information-dense outputResolve cross-surface contradictions
backgrounddescribe and its result envelope no longer teach polling with TaskOutput (the tool body and every other background surface forbid it)subagent_typedocuments that resumed subagents keep their original type, so combining it withresume_agent_idsis allowed — the opposite of the Agent tool's hard rejection, which burned models into avoiding valid callsbash.mdscopes&&-chaining to genuinely dependent commands and steers independent read-only commands to parallel calls; example no longer models thecd-chaining the same file advises againstsystem.mdno longer names tools that read-only subagent profiles lack (Write/Bashimperative,TodoList,date-via-Bash)Add missing guidance
ghCLI routing for GitHub-hosted work (hedged on availability); FetchURL login-wall note (no credentials are carried to the target site)file:linecitation convention; sparse progress notes on long multi-phase tasksValidation
agent-coresuite: 3402 passed / 0 failed (4 expected-fail, 1 todo)tsc --noEmitclean; repo lint 0 errorspackages/agent-core/testfor pinned phrases before changing; pinned strings (e.g.agent.test.tsbackground-disabled opener,fetch-url.test.tsextracted/verbatim,read.test.tssensitive regexes) are preserved