mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-08 04:10:35 -07:00
fix(core): inject skill system instructions into subagent prompts if activated (#24620)
This commit is contained in:
@@ -30,7 +30,7 @@ import { CompressionStatus } from '../core/turn.js';
|
||||
import { type ToolCallRequestInfo } from '../scheduler/types.js';
|
||||
import { ChatCompressionService } from '../context/chatCompressionService.js';
|
||||
import { getDirectoryContextString } from '../utils/environmentContext.js';
|
||||
import { renderUserMemory } from '../prompts/snippets.js';
|
||||
import { renderUserMemory, renderAgentSkills } from '../prompts/snippets.js';
|
||||
import { promptIdContext } from '../utils/promptIdContext.js';
|
||||
import {
|
||||
logAgentStart,
|
||||
@@ -78,7 +78,10 @@ import {
|
||||
runWithScopedWorkspaceContext,
|
||||
} from '../config/scoped-config.js';
|
||||
import { CompleteTaskTool } from '../tools/complete-task.js';
|
||||
import { COMPLETE_TASK_TOOL_NAME } from '../tools/definitions/base-declarations.js';
|
||||
import {
|
||||
COMPLETE_TASK_TOOL_NAME,
|
||||
ACTIVATE_SKILL_TOOL_NAME,
|
||||
} from '../tools/definitions/base-declarations.js';
|
||||
|
||||
/** A callback function to report on agent activity. */
|
||||
export type ActivityCallback = (activity: SubagentActivityEvent) => void;
|
||||
@@ -1318,6 +1321,21 @@ export class LocalAgentExecutor<TOutput extends z.ZodTypeAny> {
|
||||
// Inject user inputs into the prompt template.
|
||||
let finalPrompt = templateString(promptConfig.systemPrompt, inputs);
|
||||
|
||||
// Inject skill SI if ACTIVATE_SKILL_TOOL_NAME is available to this agent.
|
||||
if (this.toolRegistry.getTool(ACTIVATE_SKILL_TOOL_NAME) !== undefined) {
|
||||
const skills = this.context.config.getSkillManager().getSkills();
|
||||
if (skills.length > 0) {
|
||||
const skillsPrompt = renderAgentSkills(
|
||||
skills.map((s) => ({
|
||||
name: s.name,
|
||||
description: s.description,
|
||||
location: s.location,
|
||||
})),
|
||||
);
|
||||
finalPrompt += `\n\n${skillsPrompt}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Append memory context if available.
|
||||
const systemMemory = this.context.config.getSystemInstructionMemory();
|
||||
if (systemMemory) {
|
||||
|
||||
Reference in New Issue
Block a user