feat(coding-agent): include custom tools in system prompt#1237
Open
semtexzv wants to merge 2 commits intobadlogic:mainfrom
Open
feat(coding-agent): include custom tools in system prompt#1237semtexzv wants to merge 2 commits intobadlogic:mainfrom
semtexzv wants to merge 2 commits intobadlogic:mainfrom
Conversation
Owner
|
Default behavior change: buildSystemPrompt currently defaults to read/bash/edit/write when callers pass no tools. This PR makes the implicit default all built-ins via DEFAULT_TOOL_ORDER. Please keep the default at read/bash/edit/write for direct buildSystemPrompt callers. |
b23e76e to
8d2a911
Compare
…escription and systemGuidelines - Include custom tools in the system prompt tool list alongside built-in tools - Add shortDescription field for concise system prompt entries (falls back to first line of description) - Add systemGuidelines field for tool-specific guideline bullets - Stable tool ordering: built-ins first (fixed order), then custom tools alphabetically - Deduplicate guidelines via Set - Update extensions.md and sdk.md docs
8d2a911 to
62a7be3
Compare
Author
|
Updated the behavior to keep the previous system prompt for existing callers. Additionally:
|
Owner
|
Signaling exclusion via empty string is not great. I think it should be opt in: if shortDescription is givren, include, otherwise don't, guidelines optional. |
…iption Custom tools only appear in the system prompt 'Available tools' section when shortDescription is explicitly provided. Previously, omitting it fell back to the first line of description, and empty string was used to signal exclusion. Now: provided = shown, omitted = hidden. Guidelines still work regardless of visibility.
Author
|
Updated. Kept it as a separate commit, will rebase for submission |
a7284c1 to
be92c79
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Custom tools registered via extensions or the SDK are available to the LLM through the API tool listing, but invisible in the system prompt. The "Available tools" and "Guidelines" sections only show built-ins. This means the LLM gets no high-level orientation about custom tools and extension authors can't inject behavioral guidelines.
Changes
Add two optional fields to
ToolDefinition:shortDescription— one-liner for the system prompt tool list (falls back to first line ofdescription)systemGuidelines— bullet points appended to the system prompt guidelines sectionCustom tools now appear in the system prompt alongside built-ins, with stable ordering: built-ins first (fixed order), then custom tools alphabetically. Guidelines are deduplicated via Set.
Example:
Produces:
Files
extensions/types.ts— addshortDescription?,systemGuidelines?toToolDefinitionsystem-prompt.ts—SystemPromptToolInfo,resolveShortDescription()fallback,addGuideline()dedup, exportDEFAULT_TOOL_ORDERagent-session.ts— buildSystemPromptToolInfomap from built-in + custom tools, stable ordering, passtoolstobuildSystemPrompt()docs/extensions.md— document new fields with examplesdocs/sdk.md— document new fields for SDK usagePossible follow-up: Per-tool system prompt sections
This is out of scope for this PR but worth considering:
systemPromptSectionfield that emits a dedicated block per tool in the system prompt, similar to how skills get<available_skills>and context files get## pathsections.