Skip to content

ref(tools): move tool guidance into descriptions, deprecate promptSnippet/promptGuidelines#460

Merged
dcramer merged 2 commits into
mainfrom
fix/tool-guidance-into-descriptions
May 31, 2026
Merged

ref(tools): move tool guidance into descriptions, deprecate promptSnippet/promptGuidelines#460
dcramer merged 2 commits into
mainfrom
fix/tool-guidance-into-descriptions

Conversation

@sentry-junior
Copy link
Copy Markdown
Contributor

@sentry-junior sentry-junior Bot commented May 31, 2026

What

Moves all tool-selection and usage guidance for built-in tools from the <tool-guidance> system-prompt block into each tool's description field and parameter descriptions. Deprecates promptSnippet/promptGuidelines on the ToolDefinition and AgentPluginToolDefinition interfaces.

Also rewords the advisor tool description to lead with proactive triggers instead of fallback framing.

Why

Research across Codex (GPT-5.5), Claude Code, and pi (earendil-works/pi-mono) shows none of them use a separate structured guidance block. Anthropic's published context-engineering guidance explicitly recommends putting selection/usage guidance in tool descriptions, where the model sees it at tool-selection time. The <tool-guidance> block was duplicating information already in the tool schemas, wasting context-window attention budget.

Changes

  • editFile / writeFile: comparative preference guidance moved into descriptions ("prefer this over writeFile for targeted changes"; "use editFile instead for targeted changes")
  • slackCanvasEdit / slackCanvasWrite: same pattern
  • scheduler tools (5 tools): all 8 behavioral guidelines distributed across tool description and parameter description fields; removed dead ACTIVE_DESTINATION_GUIDELINE, ACTIVE_TASK_ID_GUIDELINE, RECURRING_GUIDELINE constants
  • advisor: description reordered to lead with "Use this before committing to a non-obvious technical plan or declaring complex work complete" — proactive rather than last-resort; spec (specs/advisor-tool.md) updated to match
  • ToolDefinition / AgentPluginToolDefinition: promptSnippet and promptGuidelines marked @deprecated with migration note; infrastructure retained for plugin backward compatibility

Verified

  • pnpm typecheck passes (all packages)
  • tests/unit/ — 877 tests pass
  • tests/integration/slack-schedule-tools.test.ts — 25 tests pass
  • No built-in tool definitions retain promptSnippet or promptGuidelines; only infrastructure respond.ts reads them (for plugin compat) and one test fixture still exercises the mechanism

Not Changed

The formatToolGuidanceForPrompt infrastructure in prompt.ts and the collection in respond.ts are retained so external plugins using promptGuidelines continue to work. The <tool-guidance> block will now only appear when a plugin tool actually populates these deprecated fields.

Action taken on behalf of David Cramer.


View Session in Sentry

…ppet/promptGuidelines

All guidance for built-in tools (editFile, writeFile, slackCanvasEdit,
slackCanvasWrite, all scheduler tools) now lives in the tool description
and parameter descriptions — where the model sees it at selection time —
rather than in the <tool-guidance> system-prompt block.

Research across Codex, Claude Code, and pi (earendil-works/pi-mono)
shows none of them use a separate structured guidance block. Anthropic
explicitly recommends putting selection/usage guidance in tool descriptions.
The <tool-guidance> block was duplicating information already visible in
tool schemas, burning context-window tokens needlessly.

Changes:
- editFile: comparative preference over writeFile moved into description
- writeFile: redirect to editFile moved into description
- slackCanvasEdit/Write: same pattern as editFile/writeFile
- scheduler tools: all 8 behavioral guidelines distributed across tool
  descriptions and parameter descriptions; removed dead ACTIVE_DESTINATION_
  GUIDELINE, ACTIVE_TASK_ID_GUIDELINE, RECURRING_GUIDELINE constants
- advisor: description reordered to lead with proactive triggers
  ('before committing to a non-obvious plan') rather than fallback/stuck
  framing; spec updated to match
- ToolDefinition and AgentPluginToolDefinition: promptSnippet and
  promptGuidelines marked @deprecated with migration note; infrastructure
  retained for plugin compatibility

Co-Authored-By: claude-opus-4-5 <noreply@anthropic.com>

---
[View Session in Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC0AHB7N2JCR%3A1780251764.433629%22)

Co-authored-by: David Cramer <david@sentry.io>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment May 31, 2026 6:55pm

Request Review

…recurrence union

- slackCanvasWrite: removed trailing 'Do not use for targeted edits'
  which was redundant after the redirect to slackCanvasEdit already stated
- schedule-tools: dropped recurrenceInputSchema constant (now only used
  once); inlined literals in Update tool as a flat Union with Null to
  avoid the nested Union([Union([...]), Null]) shape

Co-Authored-By: claude-opus-4-5 <noreply@anthropic.com>

Co-authored-by: David Cramer <david@sentry.io>
@dcramer dcramer merged commit 18906a3 into main May 31, 2026
16 checks passed
@dcramer dcramer deleted the fix/tool-guidance-into-descriptions branch May 31, 2026 18:58
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.

1 participant