Skip to content

Expose promptGuidelines on ToolInfo #4879

@kylesnowschwartz

Description

@kylesnowschwartz

What do you want to change?

Add promptGuidelines to ToolInfo so extensions can read per-tool guideline ownership at runtime.

Two small changes in packages/coding-agent:

// src/core/extensions/types.ts (around line 1426)
export type ToolInfo = Pick<
  ToolDefinition,
  "name" | "description" | "parameters" | "promptGuidelines"
> & {
  sourceInfo: SourceInfo;
};
// src/core/agent-session.ts (around line 805)
return Array.from(this._toolDefinitions.values()).map(({ definition, sourceInfo }) => ({
  name: definition.name,
  description: definition.description,
  parameters: definition.parameters,
  promptGuidelines: definition.promptGuidelines,
  sourceInfo,
}));

By my read this is purely additive.

Why?

buildSystemPrompt flattens every active tool's promptGuidelines into one bulleted Guidelines: block, dropping per-tool ownership. Extensions can read the rendered block via ctx.getSystemPrompt() but cannot recover which tool owns each bullet — getAllTools() returns ToolInfo, which omits promptGuidelines.

This blocks any extension operating on guidelines per-tool. My case is an extension that rewrites the flat list into <tool name="..."> blocks for clearer model attribution. I wanted to build this because many extension builders don't realize that their guidelines have no attribution in the system prompt, resulting in contradictory or confusing instructions.

How? (optional)

The change outlined above. I'd be happy to implement it myself if approved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions