feat(coding-agent): include custom tools in system prompt#1237
feat(coding-agent): include custom tools in system prompt#1237semtexzv wants to merge 2 commits intobadlogic:mainfrom
Conversation
|
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
|
Updated the behavior to keep the previous system prompt for existing callers. Additionally:
|
|
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.
|
Updated. Kept it as a separate commit, will rebase for submission |
a7284c1 to
be92c79
Compare
Leverages upstream PR badlogic#1237 to make ask_user visible in the system prompt and guide the LLM to use it instead of guessing.
|
I'm curious - does this really matter? In fact I was surprised even about the system prompt talking about the default tools. In my experience, just keeping clear tool descriptions should be enough guidance for modern models - that's why tool descriptions exist after all? |
Agreed. I can see the value in a "guidelines" property that can (deterministically) inject into the system prompt on session start, but tools literally already have a description, so |
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.