fix(coding-agent): identify user-invoked skills and expose skill directory

User-invoked skills (typed /skill:, steered, follow-up, interrupted/
resumed via compaction, ACP, RPC) only appended a bare "Skill: <path>"
line, so the model neither learned the user had invoked that specific
skill nor where the skill directory was. Relative paths in skill bodies
(scripts/, templates/) could not be resolved.

Route all user-invoked paths through a self-identifying, baseDir-aware
prompt template; keep hidden autoload skills on the minimal non-user
format. Interactive skillCommands now carries the loaded Skill object
instead of a bare path so baseDir flows through without reconstruction.
The invocation kind defaults to "user" to keep buildSkillPromptMessage
source-compatible.

Op: correct
Restores: spec:user-invoked-skill-prompt-self-identifies-and-exposes-skill-directory
This commit is contained in:
metaphorics
2026-06-30 23:11:05 +09:00
parent 5bc68f57cd
commit fa64097992
15 changed files with 163 additions and 63 deletions
@@ -65,6 +65,7 @@ import type {
ExtensionWidgetOptions,
} from "../extensibility/extensions";
import type { CompactOptions } from "../extensibility/extensions/types";
import type { Skill } from "../extensibility/skills";
import { loadSlashCommands } from "../extensibility/slash-commands";
import { type GuidedGoalMessage, runGuidedGoalTurn } from "../goals/guided-setup";
import type { Goal, GoalModeState } from "../goals/state";
@@ -478,7 +479,7 @@ export class InteractiveMode implements InteractiveModeContext {
lastStatusSpacer: Spacer | undefined = undefined;
lastStatusText: Text | undefined = undefined;
fileSlashCommands: Set<string> = new Set();
skillCommands: Map<string, string> = new Map();
skillCommands: Map<string, Skill> = new Map();
oauthManualInput: OAuthManualInputManager = new OAuthManualInputManager();
collabHost?: CollabHost;
collabGuest?: CollabGuestLink;
@@ -687,7 +688,7 @@ export class InteractiveMode implements InteractiveModeContext {
if (settings.get("skills.enableSkillCommands")) {
for (const skill of this.session.skills) {
const commandName = `skill:${skill.name}`;
this.skillCommands.set(commandName, skill.filePath);
this.skillCommands.set(commandName, skill);
skillCommandList.push({ name: commandName, description: skill.description });
}
}