From 328a44695fbbb3c0bea684211ac91f2ef36b3223 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Mon, 22 Jun 2026 06:17:14 +0800 Subject: [PATCH] chore(deadcode): remove unused agent-core prompt formatter --- packages/agent-core/package.json | 4 -- .../agent-core/src/harness/system-prompt.ts | 44 ------------------- packages/agent-core/src/harness/types.ts | 9 +--- packages/agent-core/src/index.ts | 1 - tsdown.config.ts | 1 - 5 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 packages/agent-core/src/harness/system-prompt.ts diff --git a/packages/agent-core/package.json b/packages/agent-core/package.json index 1f08fc311438..a6ceec12aaf7 100644 --- a/packages/agent-core/package.json +++ b/packages/agent-core/package.json @@ -89,10 +89,6 @@ "types": "./dist/harness/skills.d.ts", "default": "./dist/harness/skills.js" }, - "./harness/system-prompt": { - "types": "./dist/harness/system-prompt.d.ts", - "default": "./dist/harness/system-prompt.js" - }, "./harness/utils/truncate": { "types": "./dist/harness/utils/truncate.d.ts", "default": "./dist/harness/utils/truncate.js" diff --git a/packages/agent-core/src/harness/system-prompt.ts b/packages/agent-core/src/harness/system-prompt.ts deleted file mode 100644 index 51a83549e400..000000000000 --- a/packages/agent-core/src/harness/system-prompt.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Agent Core module implements system prompt behavior. -import type { Skill } from "./types.js"; - -/** Format model-visible skill metadata for inclusion in the harness system prompt. */ -export function formatSkillsForSystemPrompt(skills: Skill[]): string { - // Hidden skills can still be invoked directly by host code, but should not be - // advertised to the model for autonomous selection. - const visibleSkills = skills.filter((skill) => !skill.disableModelInvocation); - if (visibleSkills.length === 0) { - return ""; - } - - const lines = [ - "The following skills provide specialized instructions for specific tasks.", - "Read the full skill file when the task matches its description.", - "If a skill's differs from a previous turn, re-read its SKILL.md before using it.", - "When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.", - "", - "", - ]; - - for (const skill of visibleSkills) { - lines.push(" "); - lines.push(` ${escapeXml(skill.name)}`); - lines.push(` ${escapeXml(skill.description)}`); - lines.push(` ${escapeXml(skill.filePath)}`); - if (skill.promptVersion) { - lines.push(` ${escapeXml(skill.promptVersion)}`); - } - lines.push(" "); - } - - lines.push(""); - return lines.join("\n"); -} - -function escapeXml(value: string): string { - return value - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); -} diff --git a/packages/agent-core/src/harness/types.ts b/packages/agent-core/src/harness/types.ts index c5d85f7eec19..cba34e3a0220 100644 --- a/packages/agent-core/src/harness/types.ts +++ b/packages/agent-core/src/harness/types.ts @@ -42,8 +42,8 @@ export function toError(error: unknown): Error { /** * Skill loaded from a `SKILL.md` file or provided by an application. * - * `name`, `description`, `filePath`, and optional `promptVersion` are inserted into the system prompt in an XML-formatted block as suggested by agentskills.io. - * Use {@link formatSkillsForSystemPrompt} to generate the spec-compatible system prompt block. + * `name`, `description`, `filePath`, and optional `promptVersion` are available to host-owned prompt builders and + * direct skill invocation. */ export interface Skill { /** Stable skill name used for lookup and model-visible listings. */ @@ -723,11 +723,6 @@ export type AgentHarnessEventResultMap = { settled: undefined; }; -/** Options for a prompt submitted through AgentHarness. */ -export interface AgentHarnessPromptOptions { - images?: ImageContent[]; -} - /** Queued messages removed by an abort operation. */ export interface AbortResult { clearedSteer: AgentMessage[]; diff --git a/packages/agent-core/src/index.ts b/packages/agent-core/src/index.ts index 92d9b5e12644..7a959646bf99 100644 --- a/packages/agent-core/src/index.ts +++ b/packages/agent-core/src/index.ts @@ -11,7 +11,6 @@ export * from "./harness/env/kill-tree.js"; export * from "./harness/messages.js"; export * from "./harness/prompt-template-arguments.js"; export * from "./harness/skills.js"; -export * from "./harness/system-prompt.js"; export * from "./harness/types.js"; export * from "./harness/session/jsonl-storage.js"; export * from "./harness/session/memory-storage.js"; diff --git a/tsdown.config.ts b/tsdown.config.ts index 0714e0d38c35..9418df0141bf 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -351,7 +351,6 @@ function buildAgentCoreDistEntries(): Record { "harness/prompt-template-arguments": "packages/agent-core/src/harness/prompt-template-arguments.ts", "harness/skills": "packages/agent-core/src/harness/skills.ts", - "harness/system-prompt": "packages/agent-core/src/harness/system-prompt.ts", "harness/utils/truncate": "packages/agent-core/src/harness/utils/truncate.ts", }; }