:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(skills): support disable-model-invocation skill frontmatter (#76464)
Charles Vienb2c5e41330eb
diff --git a/products/desktop/apps/web/src/web-skill-bundler.ts b/products/desktop/apps/web/src/web-skill-bundler.tsindex 3444d6a40173..cab9ff97037f 100644--- a/products/desktop/apps/web/src/web-skill-bundler.ts+++ b/products/desktop/apps/web/src/web-skill-bundler.ts@@ -51,7 +51,11 @@ export async function bundleExportedSkill(// split), matching how desktop's installTeamSkill writes it to disk.files["SKILL.md"] = strToU8(serializeSkillMarkdown(- { name: exported.name, description: exported.description },+ {+ name: exported.name,+ description: exported.description,+ disableModelInvocation: exported.disableModelInvocation,+ },exported.body,),);diff --git a/products/desktop/packages/api-client/src/posthog-client.ts b/products/desktop/packages/api-client/src/posthog-client.tsindex 328ec208c4b8..3bb335a8802a 100644--- a/products/desktop/packages/api-client/src/posthog-client.ts+++ b/products/desktop/packages/api-client/src/posthog-client.ts@@ -5460,6 +5460,7 @@ export class PostHogAPIClient {description: string;body: string;files?: LlmSkillFileInput[];+ metadata?: Record<string, unknown>;}): Promise<LlmSkill> {const teamId = await this.getTeamId();const urlPath = `/api/environments/${teamId}/llm_skills/`;@@ -5492,6 +5493,7 @@ export class PostHogAPIClient {body: string;description?: string;files?: LlmSkillFileInput[];+ metadata?: Record<string, unknown>;base_version: number;},): Promise<LlmSkill> {diff --git a/products/desktop/packages/core/src/skills/teamSkillsService.test.ts b/products/desktop/packages/core/src/skills/teamSkillsService.test.tsindex 4aaf6fbc8937..66348c395fad 100644--- a/products/desktop/packages/core/src/skills/teamSkillsService.test.ts+++ b/products/desktop/packages/core/src/skills/teamSkillsService.test.ts@@ -147,11 +147,71 @@ describe("TeamSkillsService.publishSkill", () => {body: "# Body",description: "Shepherds PRs",files: exported.files,+ metadata: {},base_version: 2,});expect(result).toEqual({ version: 3 });});+ it("stores disable-model-invocation in metadata on first publish", async () => {+ const createLlmSkill = vi.fn().mockResolvedValue(makeItem({ version: 1 }));+ const client = {+ listLlmSkills: vi.fn().mockResolvedValue([]),+ createLlmSkill,+ } as unknown as PostHogAPIClient;++ await makeService().publishSkill(client, {+ ...exported,+ disableModelInvocation: true,+ });++ expect(createLlmSkill).toHaveBeenCalledWith(+ expect.objectContaining({+ metadata: { "disable-model-invocation": true },+ }),+ );+ });++ it.each([+ {+ case: "sets the key and keeps other metadata",+ disableModelInvocation: true as const,+ existingMetadata: { author: "dev" },+ expected: { author: "dev", "disable-model-invocation": true },+ },+ {+ case: "clears the key when the flag is gone",+ disableModelInvocation: undefined,+ existingMetadata: { author: "dev", "disable-model-invocation": true },+ expected: { author: "dev" },+ },+ ])(+ "republish $case",+ async ({ disableModelInvocation, existingMetadata, expected }) => {+ const publishLlmSkillVersion = vi+ .fn()+ .mockResolvedValue(makeItem({ version: 3 }));+ const client = {+ listLlmSkills: vi+ .fn()+ .mockResolvedValue([+ makeItem({ version: 2, metadata: existingMetadata }),+ ]),+ publishLlmSkillVersion,+ } as unknown as PostHogAPIClient;++ await makeService().publishSkill(client, {+ ...exported,+ disableModelInvocation,+ });++ expect(publishLlmSkillVersion).toHaveBeenCalledWith(+ "pr-shepherd",+ expect.objectContaining({ metadata: expected }),+ );+ },+ );+it("rejects publishing without a description", async () => {await expect(makeService().publishSkill(makeClient([]), {@@ -207,6 +267,26 @@ describe("TeamSkillsService.fetchSkillForInstall", () => {],});});++ it("maps disable-model-invocation metadata onto the exported skill", async () => {+ const client = {+ getLlmSkillByName: vi.fn().mockResolvedValue({+ name: "pr-shepherd",+ description: "Shepherds PRs",+ body: "# Body",+ metadata: { "disable-model-invocation": true },+ files: [],+ }),+ getLlmSkillFile: vi.fn(),+ } as unknown as PostHogAPIClient;++ const skill = await makeService().fetchSkillForInstall(+ client,+ "pr-shepherd",+ );++ expect(skill.disableModelInvocation).toBe(true);+ });});describe("TeamSkillsService.publishLocalSkill", () => {diff --git a/products/desktop/packages/core/src/skills/teamSkillsService.ts b/products/desktop/packages/core/src/skills/teamSkillsService.tsindex df8557afa7de..69f2152267ec 100644--- a/products/desktop/packages/core/src/skills/teamSkillsService.ts+++ b/products/desktop/packages/core/src/skills/teamSkillsService.ts@@ -2,7 +2,10 @@ import type {LlmSkillListItem,PostHogAPIClient,} from "@posthog/api-client/posthog-client";-import type { ExportedSkill } from "@posthog/shared";+import {+ DISABLE_MODEL_INVOCATION_METADATA_KEY,+ type ExportedSkill,+} from "@posthog/shared";import { inject, injectable } from "inversify";import { SKILLS_WORKSPACE_CLIENT } from "./identifiers";@@ -127,6 +130,10 @@ export class TeamSkillsService {body: exported.body,description: exported.description,files: exported.files,+ metadata: withDisableModelInvocation(+ existing.metadata,+ exported.disableModelInvocation,+ ),base_version: existing.latest_version ?? existing.version,}): await client.createLlmSkill({@@ -134,6 +141,9 @@ export class TeamSkillsService {description: exported.description,body: exported.body,files: exported.files,+ ...(exported.disableModelInvocation+ ? { metadata: { [DISABLE_MODEL_INVOCATION_METADATA_KEY]: true } }+ : {}),});return { version: published.version };@@ -158,11 +168,26 @@ export class TeamSkillsService {name: detail.name,description: detail.description,body: detail.body,+ ...(detail.metadata?.[DISABLE_MODEL_INVOCATION_METADATA_KEY] === true+ ? { disableModelInvocation: true }+ : {}),files,};}}+// Clearing the key keeps a republish that dropped the frontmatter from staying manual-only.+function withDisableModelInvocation(+ metadata: Record<string, unknown> | undefined,+ disableModelInvocation: boolean | undefined,+): Record<string, unknown> {+ const { [DISABLE_MODEL_INVOCATION_METADATA_KEY]: _removed, ...rest } =+ metadata ?? {};+ return disableModelInvocation+ ? { ...rest, [DISABLE_MODEL_INVOCATION_METADATA_KEY]: true }+ : rest;+}+function toTeamSkillInfo(item: LlmSkillListItem): TeamSkillInfo {return {id: item.id,diff --git a/products/desktop/packages/shared/src/index.ts b/products/desktop/packages/shared/src/index.tsindex d4978ada0eae..3dc6d66c502a 100644--- a/products/desktop/packages/shared/src/index.ts+++ b/products/desktop/packages/shared/src/index.ts@@ -326,6 +326,7 @@ export type {UploadableSkillSource,} from "./skills";export {+ DISABLE_MODEL_INVOCATION_METADATA_KEY,SKILL_EXISTS_MARKER,serializeSkillMarkdown,stripFrontmatter,diff --git a/products/desktop/packages/shared/src/skills.ts b/products/desktop/packages/shared/src/skills.tsindex 540b92eba505..9932101128ef 100644--- a/products/desktop/packages/shared/src/skills.ts+++ b/products/desktop/packages/shared/src/skills.ts@@ -11,6 +11,8 @@ export interface SkillInfo {editable: boolean;/** Size of SKILL.md in bytes (context-cost signal). */skillMdBytes: number;+ /** Frontmatter `disable-model-invocation: true`: only an explicit user invocation runs the skill, never the agent on its own. */+ disableModelInvocation?: boolean;}export interface SkillFileEntry {@@ -31,8 +33,11 @@ export interface ExportedSkill {description: string;body: string;files: ExportedSkillFile[];+ disableModelInvocation?: boolean;}+export const DISABLE_MODEL_INVOCATION_METADATA_KEY = "disable-model-invocation";+/*** Serializes a SKILL.md file from frontmatter metadata plus a markdown body.*@@ -44,13 +49,18 @@ export interface ExportedSkill {* sandbox, so it must not drift between hosts.*/export function serializeSkillMarkdown(- meta: { name: string; description: string },+ meta: {+ name: string;+ description: string;+ disableModelInvocation?: boolean;+ },body: string,): string {const frontmatter = ["---",`name: ${serializeSkillScalar(meta.name)}`,`description: ${serializeSkillScalar(meta.description)}`,+ ...(meta.disableModelInvocation ? ["disable-model-invocation: true"] : []),"---",].join("\n");diff --git a/products/desktop/packages/ui/src/features/skills/SkillCard.tsx b/products/desktop/packages/ui/src/features/skills/SkillCard.tsxindex 5f896404a910..8ba28b62ab0c 100644--- a/products/desktop/packages/ui/src/features/skills/SkillCard.tsx+++ b/products/desktop/packages/ui/src/features/skills/SkillCard.tsx@@ -92,6 +92,13 @@ export function SkillCard({{skill.repoName}</Badge>)}+ {skill.disableModelInvocation && (+ <Tooltip content="The agent won't use this skill on its own. It runs only when you invoke it">+ <Badge size="1" variant="soft" color="gray" className="shrink-0">+ Manual+ </Badge>+ </Tooltip>+ )}</>}/>diff --git a/products/desktop/packages/ui/src/features/skills/SkillDetailPanel.tsx b/products/desktop/packages/ui/src/features/skills/SkillDetailPanel.tsxindex 0feb3da4d341..78a8cf1ef9eb 100644--- a/products/desktop/packages/ui/src/features/skills/SkillDetailPanel.tsx+++ b/products/desktop/packages/ui/src/features/skills/SkillDetailPanel.tsx@@ -3,6 +3,7 @@ import {DownloadSimple,FilePlus,Folder,+ HandTap,LockSimple,PencilSimple,Trash,@@ -286,6 +287,14 @@ export function SkillDetailPanel({Read-only</Badge>)}+ {skill.disableModelInvocation && (+ <Tooltip content="The agent won't use this skill on its own. It runs only when you invoke it">+ <Badge size="1" variant="soft" color="gray">+ <HandTap size={10} className="text-gray-9" />+ Manual-only+ </Badge>+ </Tooltip>+ )}{skill.source === "codex" && (<Buttonsize="1"diff --git a/products/desktop/packages/ui/src/features/skills/SkillManifestEditor.tsx b/products/desktop/packages/ui/src/features/skills/SkillManifestEditor.tsxindex f048a1858e38..1ea18c2ec7f9 100644--- a/products/desktop/packages/ui/src/features/skills/SkillManifestEditor.tsx+++ b/products/desktop/packages/ui/src/features/skills/SkillManifestEditor.tsx@@ -1,6 +1,14 @@import type { SkillInfo } from "@posthog/shared";import { toast } from "@posthog/ui/primitives/toast";-import { Box, Button, Flex, Text, TextArea, TextField } from "@radix-ui/themes";+import {+ Box,+ Button,+ Flex,+ Switch,+ Text,+ TextArea,+ TextField,+} from "@radix-ui/themes";import { useRef, useState } from "react";import { SkillCodeEditor } from "./SkillCodeEditor";import { skillErrorDescription } from "./skillErrors";@@ -25,6 +33,9 @@ export function SkillManifestEditor({}: SkillManifestEditorProps) {const [name, setName] = useState(skill.name);const [description, setDescription] = useState(skill.description);+ const [disableModelInvocation, setDisableModelInvocation] = useState(+ skill.disableModelInvocation ?? false,+ );// Captured at mount: background refetches must not reset in-flight edits.const [mountedBody] = useState(initialBody);const bodyRef = useRef(mountedBody);@@ -37,6 +48,7 @@ export function SkillManifestEditor({name,description,body: bodyRef.current,+ disableModelInvocation,});onSaved();} catch (error) {@@ -72,6 +84,22 @@ export function SkillManifestEditor({placeholder="When should an agent use this skill?"/></Box>+ <Flex align="center" justify="between" gap="2">+ <Box>+ <Text className="block text-[12px] text-gray-12">+ Manual invocation only+ </Text>+ <Text className="block text-[11px] text-gray-10">+ The agent won't use this skill on its own. It runs only when you+ invoke it+ </Text>+ </Box>+ <Switch+ size="1"+ checked={disableModelInvocation}+ onCheckedChange={setDisableModelInvocation}+ />+ </Flex></Flex><Box className="min-h-0 flex-1 border-t border-t-(--gray-5)">diff --git a/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.test.ts b/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.test.tsindex 43b336bf51eb..448d2eab04f9 100644--- a/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.test.ts+++ b/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.test.ts@@ -1,5 +1,63 @@import { describe, expect, it } from "vitest";-import { parseSkillDependencies } from "./parse-skill-frontmatter";+import {+ parseSkillDependencies,+ parseSkillFrontmatter,+} from "./parse-skill-frontmatter";++describe("parseSkillFrontmatter disable-model-invocation", () => {+ it.each([+ ["absent", `---\nname: a\ndescription: d\n---\nbody`, false],+ [+ "true",+ `---\nname: a\ndescription: d\ndisable-model-invocation: true\n---\nbody`,+ true,+ ],+ [+ "capitalized True",+ `---\nname: a\ndescription: d\ndisable-model-invocation: True\n---\nbody`,+ true,+ ],+ [+ "quoted true",+ `---\nname: a\ndescription: d\ndisable-model-invocation: "true"\n---\nbody`,+ true,+ ],+ [+ "false",+ `---\nname: a\ndescription: d\ndisable-model-invocation: false\n---\nbody`,+ false,+ ],+ [+ "non-boolean value",+ `---\nname: a\ndescription: d\ndisable-model-invocation: maybe\n---\nbody`,+ false,+ ],+ [+ "true with trailing comment",+ `---\nname: a\ndescription: d\ndisable-model-invocation: true # manual only\n---\nbody`,+ true,+ ],+ [+ "quoted true with trailing comment",+ `---\nname: a\ndescription: d\ndisable-model-invocation: "true" # manual only\n---\nbody`,+ true,+ ],+ [+ "false with trailing comment",+ `---\nname: a\ndescription: d\ndisable-model-invocation: false # keep automatic\n---\nbody`,+ false,+ ],+ [+ "quoted string that only starts with true",+ `---\nname: a\ndescription: d\ndisable-model-invocation: "true # manual only"\n---\nbody`,+ false,+ ],+ ])("parses %s", (_label, content, expected) => {+ expect(parseSkillFrontmatter(content)?.disableModelInvocation).toBe(+ expected,+ );+ });+});describe("parseSkillDependencies", () => {it.each([diff --git a/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.ts b/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.tsindex 0704a3cb0a6d..12395a0eb98f 100644--- a/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.ts+++ b/products/desktop/packages/workspace-server/src/services/skills/parse-skill-frontmatter.ts@@ -1,15 +1,17 @@/*** Parses YAML frontmatter from a SKILL.md file.- * Extracts `name` and `description` fields.+ * Extracts `name`, `description`, and `disable-model-invocation` fields.** Handles:* - Simple values: `name: my-skill`* - Quoted strings: `description: 'Some text'` or `description: "Some text"`* - Multi-line folded: `description: >-\n line1\n line2`*/-export function parseSkillFrontmatter(- content: string,-): { name: string; description: string } | null {+export function parseSkillFrontmatter(content: string): {+ name: string;+ description: string;+ disableModelInvocation: boolean;+} | null {const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);if (!match) return null;@@ -18,7 +20,15 @@ export function parseSkillFrontmatter(if (!name) return null;const description = extractYamlValue(yaml, "description") ?? "";- return { name, description };+ const disableModelInvocation = parseYamlBoolean(+ extractYamlValue(yaml, "disable-model-invocation"),+ );+ return { name, description, disableModelInvocation };+}++// YAML 1.2 core schema: only `true` (any casing) is boolean true, never `yes`/`on`.+function parseYamlBoolean(value: string | null): boolean {+ return value !== null && value.toLowerCase() === "true";}/**@@ -100,7 +110,8 @@ function extractYamlValue(yaml: string, key: string): string | null {return collectIndentedLines(lines, i + 1).join("\n");}- // Quoted string (single or double)+ // Quoted string (single or double): a `#` inside quotes is literal in+ // YAML, so no comment stripping here.if ((rawValue.startsWith("'") && rawValue.endsWith("'")) ||(rawValue.startsWith('"') && rawValue.endsWith('"'))@@ -108,8 +119,10 @@ function extractYamlValue(yaml: string, key: string): string | null {return rawValue.slice(1, -1);}- // Plain scalar- return rawValue;+ // Plain scalar: a `#` preceded by whitespace starts a trailing comment.+ // Stripping it may uncover a quoted scalar (`"true" # manual only`).+ const withoutComment = rawValue.replace(/\s+#.*$/, "").trim();+ return unquoteYamlScalar(withoutComment);}return null;diff --git a/products/desktop/packages/workspace-server/src/services/skills/schemas.ts b/products/desktop/packages/workspace-server/src/services/skills/schemas.tsindex 7c08afadd566..9f8c8a85aea7 100644--- a/products/desktop/packages/workspace-server/src/services/skills/schemas.ts+++ b/products/desktop/packages/workspace-server/src/services/skills/schemas.ts@@ -17,6 +17,7 @@ export const skillInfo = z.object({repoName: z.string().optional(),editable: z.boolean(),skillMdBytes: z.number(),+ disableModelInvocation: z.boolean().optional(),});export const listSkillsOutput = z.array(skillInfo);@@ -59,6 +60,7 @@ export const saveSkillManifestInput = z.object({name: z.string(),description: z.string(),body: z.string(),+ disableModelInvocation: z.boolean().optional(),});export const saveSkillFileInput = z.object({@@ -98,6 +100,7 @@ export const exportSkillOutput = z.object({description: z.string(),body: z.string(),files: z.array(exportedSkillFile),+ disableModelInvocation: z.boolean().optional(),/** Files excluded from the export (binary or oversized). */skipped: z.array(z.string()),}) satisfies z.ZodType<SharedExportedSkill & { skipped: string[] }>;@@ -112,6 +115,7 @@ export const installTeamSkillInput = z.object({description: z.string(),body: z.string(),files: z.array(exportedSkillFile),+ disableModelInvocation: z.boolean().optional(),overwrite: z.boolean().optional(),}) satisfies z.ZodType<SharedExportedSkill & { overwrite?: boolean }>;diff --git a/products/desktop/packages/workspace-server/src/services/skills/skill-discovery.ts b/products/desktop/packages/workspace-server/src/services/skills/skill-discovery.tsindex 7bb0f7c679f7..72ea3fcd95a2 100644--- a/products/desktop/packages/workspace-server/src/services/skills/skill-discovery.ts+++ b/products/desktop/packages/workspace-server/src/services/skills/skill-discovery.ts@@ -176,7 +176,7 @@ export async function readSkillMetadataFromDir(if (skillNames.length === 0) return [];const results = await Promise.all(- skillNames.map(async (skillName) => {+ skillNames.map(async (skillName): Promise<SkillInfo | null> => {const skillPath = path.join(skillsDir, skillName);try {const content = await fs.promises.readFile(@@ -192,6 +192,9 @@ export async function readSkillMetadataFromDir(...(repoName ? { repoName } : {}),editable: isEditableSource(source),skillMdBytes: Buffer.byteLength(content, "utf-8"),+ ...(frontmatter?.disableModelInvocation+ ? { disableModelInvocation: true }+ : {}),} satisfies SkillInfo;} catch {return null;diff --git a/products/desktop/packages/workspace-server/src/services/skills/skills.test.ts b/products/desktop/packages/workspace-server/src/services/skills/skills.test.tsindex 8feeb6a074c5..fb71744234b4 100644--- a/products/desktop/packages/workspace-server/src/services/skills/skills.test.ts+++ b/products/desktop/packages/workspace-server/src/services/skills/skills.test.ts@@ -85,6 +85,24 @@ describe("listSkills", () => {expect(repoSkill?.editable).toBe(true);expect(bundledSkill?.editable).toBe(false);});++ it("surfaces disable-model-invocation from frontmatter", async () => {+ await createSkill(+ repoSkillsDir,+ "manual-skill",+ `---\nname: manual-skill\ndescription: d\ndisable-model-invocation: true\n---\nbody`,+ );+ await createSkill(repoSkillsDir, "auto-skill");++ const skills = await makeService().listSkills();++ expect(+ skills.find((s) => s.name === "manual-skill")?.disableModelInvocation,+ ).toBe(true);+ expect(+ skills.find((s) => s.name === "auto-skill")?.disableModelInvocation,+ ).toBeUndefined();+ });});describe("getSkillContents", () => {@@ -294,6 +312,18 @@ describe("exportSkill", () => {});});+ it("carries disable-model-invocation out of the frontmatter", async () => {+ const skillPath = await createSkill(+ repoSkillsDir,+ "manual-only",+ "---\nname: manual-only\ndescription: Manual\ndisable-model-invocation: true\n---\n\n# Body",+ );++ const exported = await makeService().exportSkill(skillPath);++ expect(exported.disableModelInvocation).toBe(true);+ });+it("refuses to export non-writable skills", async () => {await createSkill(path.join(pluginPath, "skills"), "bundled-skill");@@ -333,6 +363,18 @@ describe("installTeamSkill", () => {expect(guide).toBe("guide");});+ it("writes disable-model-invocation back into the frontmatter", async () => {+ const service = makeService();+ const { path: target } = await service.installTeamSkill({+ ...input,+ name: "manual-team-skill",+ disableModelInvocation: true,+ });++ const manifest = await service.readSkillFile(target, "SKILL.md");+ expect(manifest).toContain("disable-model-invocation: true");+ });+it("rejects invalid names and unsafe file paths", async () => {const service = makeService();@@ -682,6 +724,35 @@ describe("skill mutations", () => {expect(content).toContain("# Alpha");});+ it("writes and clears disable-model-invocation through manifest saves", async () => {+ const skillPath = await createSkill(repoSkillsDir, "alpha");+ const service = makeService();++ await service.saveSkillManifest(skillPath, {+ name: "alpha",+ description: "d",+ body: "body",+ disableModelInvocation: true,+ });+ let skills = await service.listSkills();+ expect(+ skills.find((s) => s.path === skillPath)?.disableModelInvocation,+ ).toBe(true);++ await service.saveSkillManifest(skillPath, {+ name: "alpha",+ description: "d",+ body: "body",+ disableModelInvocation: false,+ });+ skills = await service.listSkills();+ expect(+ skills.find((s) => s.path === skillPath)?.disableModelInvocation,+ ).toBeUndefined();+ const content = await service.readSkillFile(skillPath, "SKILL.md");+ expect(content).not.toContain("disable-model-invocation");+ });+it("rejects manifest saves without a name", async () => {const skillPath = await createSkill(repoSkillsDir, "alpha");diff --git a/products/desktop/packages/workspace-server/src/services/skills/skills.ts b/products/desktop/packages/workspace-server/src/services/skills/skills.tsindex 039a875935ba..741908b75739 100644--- a/products/desktop/packages/workspace-server/src/services/skills/skills.ts+++ b/products/desktop/packages/workspace-server/src/services/skills/skills.ts@@ -133,11 +133,20 @@ export class SkillsService {async saveSkillManifest(skillPath: string,- manifest: { name: string; description: string; body: string },+ manifest: {+ name: string;+ description: string;+ body: string;+ disableModelInvocation?: boolean;+ },): Promise<void> {const skillDir = await this.resolveWritableSkillDir(skillPath);const content = serializeSkillMarkdown(- { name: manifest.name.trim(), description: manifest.description.trim() },+ {+ name: manifest.name.trim(),+ description: manifest.description.trim(),+ disableModelInvocation: manifest.disableModelInvocation ?? false,+ },manifest.body,);// The writer and parser must agree, or the skill vanishes from the list.@@ -268,6 +277,9 @@ export class SkillsService {name,description,body,+ ...(frontmatter?.disableModelInvocation+ ? { disableModelInvocation: true }+ : {}),files: results.filter((r): r is { path: string; content: string } => r.content !== null,),@@ -303,7 +315,11 @@ export class SkillsService {await fs.promises.writeFile(path.join(staging, "SKILL.md"),serializeSkillMarkdown(- { name, description: input.description },+ {+ name,+ description: input.description,+ disableModelInvocation: input.disableModelInvocation,+ },input.body,),"utf-8",diff --git a/products/desktop/packages/workspace-server/src/services/skills/write-skill-frontmatter.test.ts b/products/desktop/packages/workspace-server/src/services/skills/write-skill-frontmatter.test.tsindex ed4b6eae46d1..7f1967edd0a8 100644--- a/products/desktop/packages/workspace-server/src/services/skills/write-skill-frontmatter.test.ts+++ b/products/desktop/packages/workspace-server/src/services/skills/write-skill-frontmatter.test.ts@@ -28,10 +28,40 @@ describe("serializeSkillMarkdown", () => {const parsed = parseSkillFrontmatter(content);- expect(parsed).toEqual({ name, description });+ expect(parsed).toEqual({+ name,+ description,+ disableModelInvocation: false,+ });},);+ it("emits disable-model-invocation and round-trips it", () => {+ const content = serializeSkillMarkdown(+ { name: "my-skill", description: "d", disableModelInvocation: true },+ "The body",+ );++ expect(content).toBe(+ "---\nname: my-skill\ndescription: d\ndisable-model-invocation: true\n---\n\nThe body\n",+ );+ expect(parseSkillFrontmatter(content)).toEqual({+ name: "my-skill",+ description: "d",+ disableModelInvocation: true,+ });+ });++ it("omits disable-model-invocation when false", () => {+ const content = serializeSkillMarkdown(+ { name: "my-skill", description: "d", disableModelInvocation: false },+ "The body",+ );++ expect(content).not.toContain("disable-model-invocation");+ expect(parseSkillFrontmatter(content)?.disableModelInvocation).toBe(false);+ });+it("appends the body after the frontmatter with a trailing newline", () => {const content = serializeSkillMarkdown({ name: "my-skill", description: "d" },