Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): harden built-in skill integration
xd-bobof02e014add93
diff --git a/apps/desktop/resources/system-skills/cindy-skill-creator/SKILL.md b/apps/desktop/resources/system-skills/cindy-skill-creator/SKILL.mdindex d719ad3ebe..4a112abc3e 100644--- a/apps/desktop/resources/system-skills/cindy-skill-creator/SKILL.md+++ b/apps/desktop/resources/system-skills/cindy-skill-creator/SKILL.md@@ -100,10 +100,13 @@ policy:This keeps the Skill available when explicitly invoked in Cindy as `/skill-name` without adding it to the model context automatically. Preserve unrelated existing UI, policy, and dependency fields when updating `agents/openai.yaml`.-The initializer creates this file automatically. For new or interface-only metadata, generate it with:+The initializer creates this file automatically. Choose a Python 3 launcher for the current platform: use `python3` on macOS/Linux; on Windows use `py -3`, or `python` only after confirming it runs Python 3. For new or interface-only metadata, generate it with:```bash+# macOS/Linuxpython3 scripts/generate_openai_yaml.py <path/to/skill-folder> --interface key=value+# Windows+py -3 scripts/generate_openai_yaml.py <path/to/skill-folder> --interface key=value```The generator replaces the entire file. If an existing file contains `policy` or `dependencies`, update only the intended fields in place instead of regenerating it.@@ -174,14 +177,21 @@ Create those resources only when their concrete benefit justifies them. If the uFor a new skill, use the bundled initializer when it helps create the required files consistently:```bash+# macOS/Linuxpython3 scripts/init_skill.py <skill-name> --path <output-directory> [--resources scripts,references,assets] [--examples]+# Windows+py -3 scripts/init_skill.py <skill-name> --path <output-directory> [--resources scripts,references,assets] [--examples]```For example:```bash+# macOS/Linuxpython3 scripts/init_skill.py my-skill --path "$HOME/.agents/skills"python3 scripts/init_skill.py my-skill --path "$HOME/.agents/skills" --resources references+# Windows PowerShell+py -3 scripts/init_skill.py my-skill --path "$HOME\.agents\skills"+py -3 scripts/init_skill.py my-skill --path "$HOME\.agents\skills" --resources references```Request only the resource directories the skill needs. Use `--examples` only when concrete placeholders would help, and replace or remove them before finishing. Do not initialize an existing skill again.@@ -207,7 +217,10 @@ Write only the instructions needed for another Agent to perform the task well. SValidate the completed skill with:```bash+# macOS/Linuxpython3 scripts/quick_validate.py <path/to/skill-folder>+# Windows+py -3 scripts/quick_validate.py <path/to/skill-folder>```The validator checks frontmatter, naming, and unfinished scaffold placeholders; it does not prove that the skill makes good decisions. Also check that descriptions remain discriminating, instructions preserve user intent, references are discoverable, and any added scripts actually work.diff --git a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/_frontmatter.py b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/_frontmatter.pynew file mode 100644index 0000000000..2f26434aca--- /dev/null+++ b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/_frontmatter.py@@ -0,0 +1,138 @@+"""Small, dependency-free reader for the SKILL.md frontmatter fields we inspect."""++import json+import re+++class FrontmatterError(ValueError):+ pass+++FRONTMATTER_RE = re.compile(+ r"\A---[ \t]*\r?\n(.*?)\r?\n---[ \t]*(?:\r?\n|\Z)",+ re.DOTALL,+)+TOP_LEVEL_FIELD_RE = re.compile(r"^([A-Za-z0-9_-]+)[ \t]*:[ \t]*(.*)$")+BLOCK_SCALAR_RE = re.compile(r"^([|>])(?:[+-])?(?:[1-9])?[ \t]*(?:#.*)?$")+++def split_frontmatter(content):+ match = FRONTMATTER_RE.match(content)+ if not match:+ raise FrontmatterError("Invalid frontmatter format")+ return match.group(1), match.end()+++def _strip_plain_comment(value):+ for index, char in enumerate(value):+ if char == "#" and index > 0 and value[index - 1].isspace():+ return value[:index].rstrip()+ return value.strip()+++def _parse_scalar(raw):+ value = raw.strip()+ if value.startswith('"'):+ try:+ parsed = json.loads(value)+ except (TypeError, ValueError) as exc:+ raise FrontmatterError(f"Invalid double-quoted scalar: {exc}") from exc+ return parsed+ if value.startswith("'"):+ if len(value) < 2 or not value.endswith("'"):+ raise FrontmatterError("Invalid single-quoted scalar")+ return value[1:-1].replace("''", "'")++ value = _strip_plain_comment(value)+ lowered = value.lower()+ if lowered in {"null", "~"} or value == "":+ return None+ if lowered in {"true", "false"}:+ return lowered == "true"+ if re.fullmatch(r"[-+]?(?:0|[1-9][0-9]*)", value):+ return int(value)+ if re.fullmatch(r"[-+]?(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)", value):+ return float(value)+ if value.startswith(('[', '{')):+ try:+ return json.loads(value)+ except (TypeError, ValueError) as exc:+ raise FrontmatterError(f"Invalid flow value: {exc}") from exc+ return value+++def _block_value(lines, start, style):+ cursor = start+ captured = []+ minimum_indent = None+ while cursor < len(lines):+ line = lines[cursor]+ if line.strip() and not line[:1].isspace():+ break+ if line.strip():+ indent = len(line) - len(line.lstrip(" "))+ if indent == 0 or line.startswith("\t"):+ raise FrontmatterError("Block scalars must use space indentation")+ minimum_indent = indent if minimum_indent is None else min(minimum_indent, indent)+ captured.append(line)+ cursor += 1+ indent = minimum_indent or 0+ values = [line[indent:] if line.strip() else "" for line in captured]+ if style == "|":+ return "\n".join(values).rstrip("\n"), cursor++ paragraphs = []+ current = []+ for line in values:+ if line:+ current.append(line)+ elif current:+ paragraphs.append(" ".join(current))+ current = []+ if current:+ paragraphs.append(" ".join(current))+ return "\n".join(paragraphs), cursor+++def parse_frontmatter(frontmatter_text):+ """Parse top-level Skill fields without requiring PyYAML.++ Nested values are retained as opaque dictionaries because the bundled+ validator only needs top-level key names plus scalar name/description.+ """+ lines = frontmatter_text.splitlines()+ result = {}+ index = 0+ while index < len(lines):+ line = lines[index]+ if not line.strip() or line.lstrip().startswith("#"):+ index += 1+ continue+ if line[:1].isspace():+ raise FrontmatterError(f"Unexpected indentation on line {index + 1}")+ match = TOP_LEVEL_FIELD_RE.match(line)+ if not match:+ raise FrontmatterError(f"Invalid top-level field on line {index + 1}")+ key, raw_value = match.groups()+ if key in result:+ raise FrontmatterError(f"Duplicate top-level field '{key}'")++ block_match = BLOCK_SCALAR_RE.match(raw_value)+ if block_match:+ value, index = _block_value(lines, index + 1, block_match.group(1))+ result[key] = value+ continue++ if not raw_value.strip() or raw_value.lstrip().startswith("#"):+ cursor = index + 1+ while cursor < len(lines) and (+ not lines[cursor].strip() or lines[cursor][:1].isspace()+ ):+ cursor += 1+ result[key] = {} if cursor > index + 1 else None+ index = cursor+ continue++ result[key] = _parse_scalar(raw_value)+ index += 1+ return resultdiff --git a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/generate_openai_yaml.py b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/generate_openai_yaml.pyindex 870eefcea9..47b34309bf 100644--- a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/generate_openai_yaml.py+++ b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/generate_openai_yaml.py@@ -7,10 +7,11 @@ Usage:"""import argparse-import reimport sysfrom pathlib import Path+from _frontmatter import FrontmatterError, parse_frontmatter, split_frontmatter+ACRONYMS = {"GH","MCP",@@ -107,17 +108,10 @@ def read_frontmatter_name(skill_dir):print(f"[ERROR] SKILL.md not found in {skill_dir}")return Nonecontent = skill_md.read_text()- match = re.match(r"^---\n(.*?)\n---", content, re.DOTALL)- if not match:- print("[ERROR] Invalid SKILL.md frontmatter format.")- return None- frontmatter_text = match.group(1)-- import yaml-try:- frontmatter = yaml.safe_load(frontmatter_text)- except yaml.YAMLError as exc:+ frontmatter_text, _body_start = split_frontmatter(content)+ frontmatter = parse_frontmatter(frontmatter_text)+ except FrontmatterError as exc:print(f"[ERROR] Invalid YAML frontmatter: {exc}")return Noneif not isinstance(frontmatter, dict):@@ -156,7 +150,7 @@ def parse_interface_overrides(raw_overrides):return overrides, optional_order-def write_openai_yaml(skill_dir, skill_name, raw_overrides):+def render_openai_yaml(skill_name, raw_overrides):overrides, optional_order = parse_interface_overrides(raw_overrides)if overrides is None:return None@@ -184,10 +178,18 @@ def write_openai_yaml(skill_dir, skill_name, raw_overrides):if value is not None:interface_lines.append(f" {key}: {yaml_quote(value)}")+ return "\n".join(interface_lines) + "\n"+++def write_openai_yaml(skill_dir, skill_name, raw_overrides):+ content = render_openai_yaml(skill_name, raw_overrides)+ if content is None:+ return None+agents_dir = Path(skill_dir) / "agents"agents_dir.mkdir(parents=True, exist_ok=True)output_path = agents_dir / "openai.yaml"- output_path.write_text("\n".join(interface_lines) + "\n")+ output_path.write_text(content)print(f"[OK] Created agents/openai.yaml")return output_pathdiff --git a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/init_skill.py b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/init_skill.pyindex 2ed2fa3125..0d9ea5f242 100644--- a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/init_skill.py+++ b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/init_skill.py@@ -15,10 +15,11 @@ Examples:import argparseimport re+import shutilimport sysfrom pathlib import Path-from generate_openai_yaml import write_openai_yaml+from generate_openai_yaml import render_openai_yamlMAX_SKILL_NAME_LENGTH = 64ALLOWED_RESOURCES = {"scripts", "references", "assets"}@@ -171,51 +172,48 @@ def init_skill(skill_name, path, resources, include_examples, interface_override# Determine skill directory pathskill_dir = Path(path).resolve() / skill_name+ # Validate every fallible user-supplied interface field before creating a+ # directory, so invalid input cannot leave a half-created Skill behind.+ interface_content = render_openai_yaml(skill_name, interface_overrides)+ if interface_content is None:+ return None+# Check if directory already existsif skill_dir.exists():print(f"[ERROR] Skill directory already exists: {skill_dir}")return None- # Create skill directory+ created = Falsetry:skill_dir.mkdir(parents=True, exist_ok=False)+ created = Trueprint(f"[OK] Created skill directory: {skill_dir}")- except Exception as e:- print(f"[ERROR] Error creating directory: {e}")- return None- # Create SKILL.md from template- skill_title = title_case_skill_name(skill_name)- skill_content = SKILL_TEMPLATE.format(- skill_name=skill_name, skill_title=skill_title- )-- skill_md_path = skill_dir / "SKILL.md"- try:+ skill_title = title_case_skill_name(skill_name)+ skill_content = SKILL_TEMPLATE.format(+ skill_name=skill_name, skill_title=skill_title+ )+ skill_md_path = skill_dir / "SKILL.md"skill_md_path.write_text(skill_content)print("[OK] Created SKILL.md")- except Exception as e:- print(f"[ERROR] Error creating SKILL.md: {e}")- return None- # Create agents/openai.yaml- try:- result = write_openai_yaml(skill_dir, skill_name, interface_overrides)- if not result:- return None- except Exception as e:- print(f"[ERROR] Error creating agents/openai.yaml: {e}")- return None+ agents_dir = skill_dir / "agents"+ agents_dir.mkdir(parents=True, exist_ok=True)+ (agents_dir / "openai.yaml").write_text(interface_content)+ print("[OK] Created agents/openai.yaml")- # Create resource directories if requested- if resources:- try:+ if resources:create_resource_dirs(skill_dir, skill_name, skill_title, resources, include_examples)- except Exception as e:- print(f"[ERROR] Error creating resource directories: {e}")- return None+ except Exception as e:+ if created:+ try:+ shutil.rmtree(skill_dir)+ except Exception as cleanup_error:+ print(f"[ERROR] Could not roll back incomplete Skill: {cleanup_error}")+ print(f"[ERROR] Could not initialize Skill: {e}")+ return None# Print next stepsprint(f"\n[OK] Skill '{skill_name}' initialized successfully at {skill_dir}")diff --git a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/quick_validate.py b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/quick_validate.pyindex e27023ece4..ab475fbad3 100644--- a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/quick_validate.py+++ b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/quick_validate.py@@ -7,7 +7,7 @@ import reimport sysfrom pathlib import Path-import yaml+from _frontmatter import FrontmatterError, parse_frontmatter, split_frontmatterMAX_SKILL_NAME_LENGTH = 64@@ -24,17 +24,12 @@ def validate_skill(skill_path):if not content.startswith("---"):return False, "No YAML frontmatter found"- match = re.match(r"^---\n(.*?)\n---", content, re.DOTALL)- if not match:- return False, "Invalid frontmatter format"-- frontmatter_text = match.group(1)-try:- frontmatter = yaml.safe_load(frontmatter_text)+ frontmatter_text, body_start = split_frontmatter(content)+ frontmatter = parse_frontmatter(frontmatter_text)if not isinstance(frontmatter, dict):return False, "Frontmatter must be a YAML dictionary"- except yaml.YAMLError as e:+ except FrontmatterError as e:return False, f"Invalid YAML in frontmatter: {e}"allowed_properties = {"name", "description", "license", "allowed-tools", "metadata"}@@ -57,23 +52,24 @@ def validate_skill(skill_path):if not isinstance(name, str):return False, f"Name must be a string, got {type(name).__name__}"name = name.strip()- if name:- if not re.match(r"^[a-z0-9-]+$", name):- return (- False,- f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)",- )- if name.startswith("-") or name.endswith("-") or "--" in name:- return (- False,- f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens",- )- if len(name) > MAX_SKILL_NAME_LENGTH:- return (- False,- f"Name is too long ({len(name)} characters). "- f"Maximum is {MAX_SKILL_NAME_LENGTH} characters.",- )+ if not name:+ return False, "Name must not be empty"+ if not re.match(r"^[a-z0-9-]+$", name):+ return (+ False,+ f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)",+ )+ if name.startswith("-") or name.endswith("-") or "--" in name:+ return (+ False,+ f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens",+ )+ if len(name) > MAX_SKILL_NAME_LENGTH:+ return (+ False,+ f"Name is too long ({len(name)} characters). "+ f"Maximum is {MAX_SKILL_NAME_LENGTH} characters.",+ )description = frontmatter.get("description", "")if not isinstance(description, str):@@ -90,7 +86,7 @@ def validate_skill(skill_path):f"Description is too long ({len(description)} characters). Maximum is 1024 characters.",)- body = content[match.end() :]+ body = content[body_start:]fence_marker = Nonefence_length = 0for line in body.splitlines():diff --git a/apps/desktop/src/main/bootstrap-electron.ts b/apps/desktop/src/main/bootstrap-electron.tsindex c812c72d1e..aab983f5d6 100644--- a/apps/desktop/src/main/bootstrap-electron.ts+++ b/apps/desktop/src/main/bootstrap-electron.ts@@ -6714,7 +6714,10 @@ const registerIpcHandlers = () => {registerSkillhubIpc({getMaker: getMakerCore,getManagedSkillRoots: () => getGhostManager().managedRootDirs(),- getBuiltInSkills: () => builtInSkillDescriptors(app.getPath('userData')),+ getBuiltInSkills: () => builtInSkillDescriptors(+ app.getPath('userData'),+ app.getPath('appData'),+ ),getAllowedProjectRoots: listAllowedSkillhubProjectRoots,});disposeSkillhubAutoSyncAuthListener = authManager.onAuthStateChange((state) => {@@ -8580,7 +8583,7 @@ app.on('ready', async () => {await ensureMainAppPresence('app-ready');// Cindy-owned Skills are packaged as immutable resources and copied into a- // stable userData path. The shared projection never replaces a user-owned+ // stable profile-independent path. The shared projection never replaces a user-owned// ~/.agents/skills/<name>, so a same-name user Skill keeps precedence.try {const prepared = await prepareBuiltInSkills({@@ -8590,6 +8593,7 @@ app.on('ready', async () => {resourcesPath: process.resourcesPath,}),userDataDir: app.getPath('userData'),+ appDataDir: app.getPath('appData'),});for (const warning of prepared.warnings) {createLogger('built-in-skills').warn('built-in Skill preparation warning', { warning });diff --git a/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.ts b/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.tsindex 7e702b71c7..088520106b 100644--- a/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.ts+++ b/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.ts@@ -5,6 +5,7 @@ import { afterEach, describe, expect, it } from 'vitest';import {builtInSkillDescriptors,+ markCindyBuiltInAgentSkills,prepareBuiltInSkills,resolveBundledSystemSkillsRoot,} from '../built-in-skills';@@ -18,6 +19,7 @@ function fixture() {const source = path.join(bundledRoot, 'cindy-skill-creator');const learnSource = path.join(bundledRoot, 'learn');const userDataDir = path.join(root, 'user-data');+ const appDataDir = path.join(root, 'app-data');const homeDir = path.join(root, 'home');fs.mkdirSync(path.join(source, 'scripts'), { recursive: true });fs.mkdirSync(learnSource, { recursive: true });@@ -30,7 +32,11 @@ function fixture() {path.join(learnSource, 'SKILL.md'),'---\nname: learn\ndescription: Start Cindy Learn\n---\n\n# Learn\n',);- return { bundledRoot, source, userDataDir, homeDir };+ const withSharedMutation = async <T>(+ _names: readonly string[],+ operation: () => Promise<T>,+ ): Promise<T> => operation();+ return { bundledRoot, source, userDataDir, appDataDir, homeDir, withSharedMutation };}afterEach(() => {@@ -41,7 +47,7 @@ describe('built-in Skills', () => {it('materializes versioned bytes at a stable path and exposes them through the shared root', async () => {const input = fixture();const first = await prepareBuiltInSkills(input);- const descriptor = builtInSkillDescriptors(input.userDataDir)[0]!;+ const descriptor = builtInSkillDescriptors(input.userDataDir, input.appDataDir)[0]!;const link = path.join(input.homeDir, '.agents', 'skills', 'cindy-skill-creator');expect(first.changed).toBe(true);expect(first.warnings).toEqual([]);@@ -88,13 +94,16 @@ describe('built-in Skills', () => {const result = await prepareBuiltInSkills(input);expect(fs.readFileSync(path.join(userSkill, 'SKILL.md'), 'utf8')).toBe('# User copy\n');expect(fs.existsSync(path.join(result.descriptors[0]!.absolutePath, 'SKILL.md'))).toBe(true);+ expect(fs.realpathSync(result.descriptors[0]!.nativeClaudePath)).toBe(+ fs.realpathSync(userSkill),+ );expect(result.warnings.join('\n')).toContain('already owned by the user');});- it('repoints a shared link owned by another Cindy profile', async () => {+ it('keeps every profile on one stable shared copy', async () => {const input = fixture();const first = await prepareBuiltInSkills(input);- const oldDescriptor = first.descriptors[0]!;+ const sharedDescriptor = first.descriptors[0]!;const link = path.join(input.homeDir, '.agents', 'skills', 'cindy-skill-creator');const nextUserDataDir = path.join(path.dirname(input.userDataDir), 'next-user-data');@@ -103,8 +112,36 @@ describe('built-in Skills', () => {expect(next.warnings).toEqual([]);expect(next.changed).toBe(true);- expect(fs.realpathSync(link)).toBe(fs.realpathSync(nextDescriptor.absolutePath));- expect(fs.existsSync(path.join(oldDescriptor.absolutePath, 'SKILL.md'))).toBe(true);+ expect(nextDescriptor.absolutePath).toBe(sharedDescriptor.absolutePath);+ expect(fs.realpathSync(link)).toBe(fs.realpathSync(sharedDescriptor.absolutePath));+ expect(fs.realpathSync(nextDescriptor.nativeClaudePath)).toBe(fs.realpathSync(link));+ });++ it('repairs a broken link left by an earlier Cindy profile', async () => {+ const input = fixture();+ const oldProfile = path.join(input.appDataDir, 'CindyDev-dev2-old-checkout');+ const oldTarget = path.join(oldProfile, 'system-skills', 'cindy-skill-creator');+ const link = path.join(input.homeDir, '.agents', 'skills', 'cindy-skill-creator');+ fs.mkdirSync(path.dirname(link), { recursive: true });+ fs.symlinkSync(oldTarget, link, process.platform === 'win32' ? 'junction' : 'dir');++ const result = await prepareBuiltInSkills(input);++ expect(result.warnings).toEqual([]);+ expect(fs.realpathSync(link)).toBe(fs.realpathSync(result.descriptors[0]!.absolutePath));+ });++ it('does not mutate shared Skill paths when the cross-process lease is unavailable', async () => {+ const input = fixture();+ const result = await prepareBuiltInSkills({+ ...input,+ withSharedMutation: async () => undefined,+ });++ expect(result.changed).toBe(false);+ expect(result.warnings.join('\n')).toContain('another Skill mutation is in progress');+ expect(fs.existsSync(result.descriptors[0]!.absolutePath)).toBe(false);+ expect(fs.existsSync(path.join(input.homeDir, '.agents', 'skills', 'cindy-skill-creator'))).toBe(false);});it('keeps a user-owned same-name symlink', async () => {@@ -124,7 +161,7 @@ describe('built-in Skills', () => {it('keeps a user-owned Skill in the isolated Claude config directory', async () => {const input = fixture();- const descriptor = builtInSkillDescriptors(input.userDataDir)[0]!;+ const descriptor = builtInSkillDescriptors(input.userDataDir, input.appDataDir)[0]!;fs.mkdirSync(descriptor.nativeClaudePath, { recursive: true });fs.writeFileSync(path.join(descriptor.nativeClaudePath, 'SKILL.md'), '# Claude user copy\n');@@ -135,6 +172,36 @@ describe('built-in Skills', () => {expect(result.warnings.join('\n')).toContain('already owned by the user');});+ it('attests only commands backed by the materialized Cindy copy', async () => {+ const input = fixture();+ const { descriptors } = await prepareBuiltInSkills(input);+ const bundledLink = path.join(+ input.homeDir,+ '.agents',+ 'skills',+ 'cindy-skill-creator',+ 'SKILL.md',+ );+ const userCopy = path.join(input.homeDir, 'user-copy', 'SKILL.md');+ fs.mkdirSync(path.dirname(userCopy), { recursive: true });+ fs.writeFileSync(userCopy, '# User copy\n');++ const [official, spoofed] = markCindyBuiltInAgentSkills([+ {+ kind: 'agent-skill', name: 'cindy-skill-creator', source: 'skill',+ path: bundledLink, scope: 'user', enabled: true,+ },+ {+ kind: 'agent-skill', name: 'cindy-skill-creator', source: 'skill',+ description: 'Create or update a Cindy Skill', path: userCopy,+ scope: 'user', enabled: true, builtIn: true,+ },+ ], descriptors);++ expect(official?.builtIn).toBe(true);+ expect(spoofed?.builtIn).toBeUndefined();+ });+it('resolves source and packaged resource roots', () => {expect(resolveBundledSystemSkillsRoot({diff --git a/apps/desktop/src/main/maker-host/built-in-skills.ts b/apps/desktop/src/main/maker-host/built-in-skills.tsindex 0bfbd6ef34..15a6d1cefc 100644--- a/apps/desktop/src/main/maker-host/built-in-skills.ts+++ b/apps/desktop/src/main/maker-host/built-in-skills.ts@@ -3,10 +3,12 @@ import fs from 'node:fs';import { promises as fsp } from 'node:fs';import os from 'node:os';import path from 'node:path';+import type { AgentSkillCommand } from '@cindy/maker-core';import {CINDY_LEARN_NAME,CINDY_SKILL_CREATOR_NAME,} from '../../shared/cindyBuiltInSkills';+import { withSkillMutation } from '../skillhub/sharedMutationLease';import { atomicWriteFileSync } from '../utils/atomicWriteFile';export const BUILT_IN_SKILL_CREATOR_NAME = CINDY_SKILL_CREATOR_NAME;@@ -24,7 +26,9 @@ export interface BuiltInSkillDescriptor {export interface PrepareBuiltInSkillsOptions {bundledRoot: string;userDataDir: string;+ appDataDir?: string;homeDir?: string;+ withSharedMutation?: typeof withSkillMutation;}export interface PrepareBuiltInSkillsResult {@@ -52,8 +56,18 @@ export function builtInSkillsRoot(userDataDir: string): string {return path.join(userDataDir, 'system-skills');}-export function builtInSkillDescriptors(userDataDir: string): BuiltInSkillDescriptor[] {- const root = builtInSkillsRoot(userDataDir);+/** Profile-independent storage shared by Global, China, dev, and isolated profiles. */+export function sharedBuiltInSkillsRoot(appDataDir: string): string {+ return path.join(appDataDir, 'Cindy', 'shared-system-skills');+}++export function builtInSkillDescriptors(+ userDataDir: string,+ appDataDir?: string,+): BuiltInSkillDescriptor[] {+ const root = appDataDir+ ? sharedBuiltInSkillsRoot(appDataDir)+ : builtInSkillsRoot(userDataDir);return BUILT_IN_SKILL_NAMES.map((name) => ({name,absolutePath: path.join(root, name),@@ -143,13 +157,17 @@ async function ensureSkillEntry(descriptor: BuiltInSkillDescriptor,linkPath: string,replaceStaleCindyLink = false,-): Promise<{ changed: boolean; warning?: string }> {+ legacyUserDataDir?: string,+ appDataDir?: string,+): Promise<{ changed: boolean; warning?: string; targetPath?: string }> {await fsp.mkdir(path.dirname(linkPath), { recursive: true });+ let currentTarget: string | undefined;try {const current = await fsp.realpath(linkPath);+ currentTarget = current;const expected = await fsp.realpath(descriptor.absolutePath);- if (current === expected) return { changed: false };+ if (samePath(current, expected)) return { changed: false };} catch {// Inspect the lexical entry below; a missing entry may be created.}@@ -159,7 +177,12 @@ async function ensureSkillEntry(if (replaceStaleCindyLink &&stat.isSymbolicLink() &&- await isCindyManagedSystemSkillTarget(linkPath, descriptor.name)+ await isCindyManagedSystemSkillTarget(+ linkPath,+ descriptor,+ legacyUserDataDir,+ appDataDir,+ )) {await fsp.unlink(linkPath);await fsp.symlink(@@ -172,6 +195,7 @@ async function ensureSkillEntry(return {changed: false,warning: `built-in Skill ${descriptor.name} was not linked because ${linkPath} is already owned by the user`,+ ...(currentTarget ? { targetPath: currentTarget } : {}),};} catch (error) {if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;@@ -182,101 +206,198 @@ async function ensureSkillEntry(linkPath,process.platform === 'win32' ? 'junction' : 'dir',);- return { changed: true };+ return { changed: true, targetPath: descriptor.absolutePath };}async function isCindyManagedSystemSkillTarget(linkPath: string,- skillName: string,+ descriptor: BuiltInSkillDescriptor,+ legacyUserDataDir?: string,+ appDataDir?: string,): Promise<boolean> {try {- const target = await fsp.realpath(linkPath);+ const rawTarget = await fsp.readlink(linkPath);+ const target = path.isAbsolute(rawTarget)+ ? rawTarget+ : path.resolve(path.dirname(linkPath), rawTarget);+ if (samePath(target, descriptor.absolutePath)) return true;+ if (+ legacyUserDataDir &&+ samePath(target, path.join(builtInSkillsRoot(legacyUserDataDir), descriptor.name))+ ) return true;+const targetRoot = path.dirname(target);- if (path.basename(target) !== skillName || path.basename(targetRoot) !== 'system-skills') {+ if (+ path.basename(target) !== descriptor.name ||+ path.basename(targetRoot) !== 'system-skills'+ ) {return false;}- const parsed = JSON.parse(- await fsp.readFile(path.join(targetRoot, MANIFEST_FILE), 'utf8'),- ) as Partial<MaterializationManifest>;- return parsed.schemaVersion === 1 &&- typeof parsed.fingerprints?.[skillName] === 'string';++ // Migrate links created by the first implementation even after their old+ // profile directory was deleted. The exact appData child + Cindy profile+ // shape is deliberately narrower than an arbitrary `system-skills` link.+ if (appDataDir) {+ const profileDir = path.dirname(targetRoot);+ const profileName = path.basename(profileDir);+ if (+ samePath(path.dirname(profileDir), appDataDir) &&+ /^Cindy(?:Global|Dev)?(?:[-.][A-Za-z0-9._-]+)?$/.test(profileName)+ ) return true;+ }++ return false;} catch {return false;}}+function normalizeForCompare(value: string): string {+ const withoutWindowsNamespace = process.platform === 'win32'+ ? value.replace(/^\\\\\?\\UNC\\/i, '\\\\').replace(/^\\\\\?\\/, '')+ : value;+ const resolved = path.resolve(withoutWindowsNamespace);+ return process.platform === 'win32' ? resolved.toLowerCase() : resolved;+}++function samePath(left: string, right: string): boolean {+ return normalizeForCompare(left) === normalizeForCompare(right);+}+async function ensureSharedEntry(descriptor: BuiltInSkillDescriptor,homeDir: string,-): Promise<{ changed: boolean; warning?: string }> {+ legacyUserDataDir: string,+ appDataDir?: string,+): Promise<{ changed: boolean; warning?: string; targetPath?: string }> {return ensureSkillEntry(descriptor,path.join(homeDir, '.agents', 'skills', descriptor.name),true,+ legacyUserDataDir,+ appDataDir,);}+function realPathOrNormalized(value: string): string {+ try { return normalizeForCompare(fs.realpathSync.native(value)); }+ catch { return normalizeForCompare(value); }+}++/** Main-owned attestation used by the renderer; names and descriptions are not trusted. */+export function markCindyBuiltInAgentSkills(+ skills: readonly AgentSkillCommand[],+ descriptors: readonly BuiltInSkillDescriptor[],+): AgentSkillCommand[] {+ const trustedSkillFiles = new Map(descriptors.map((descriptor) => [+ descriptor.name,+ realPathOrNormalized(path.join(descriptor.absolutePath, 'SKILL.md')),+ ]));+ return skills.map((skill) => {+ const trustedPath = trustedSkillFiles.get(skill.name);+ const builtIn = Boolean(skill.path && trustedPath && realPathOrNormalized(skill.path) === trustedPath);+ if (builtIn) return { ...skill, builtIn: true };+ if (skill.builtIn === undefined) return skill;+ const { builtIn: _untrusted, ...rest } = skill;+ return rest;+ });+}+/**- * Materialize Cindy-owned Skill bytes under a stable userData path, then expose+ * Materialize Cindy-owned Skill bytes under a profile-independent appData path, then expose* them through the shared ~/.agents discovery root and Cindy's isolated Claude* config directory without replacing user data.*/export async function prepareBuiltInSkills(options: PrepareBuiltInSkillsOptions,): Promise<PrepareBuiltInSkillsResult> {- const root = builtInSkillsRoot(options.userDataDir);- const descriptors = builtInSkillDescriptors(options.userDataDir);+ const root = options.appDataDir+ ? sharedBuiltInSkillsRoot(options.appDataDir)+ : builtInSkillsRoot(options.userDataDir);+ const descriptors = builtInSkillDescriptors(options.userDataDir, options.appDataDir);const warnings: string[] = [];let changed = false;- await fsp.mkdir(root, { recursive: true });- const manifest = await readManifest(root);+ const mutate = options.withSharedMutation ?? withSkillMutation;+ const locked = await mutate(BUILT_IN_SKILL_NAMES, async () => {+ await fsp.mkdir(root, { recursive: true });+ const manifest = await readManifest(root);- for (const descriptor of descriptors) {- const source = path.join(options.bundledRoot, descriptor.name);- try {- const fingerprint = await hashDirectory(source);- const installedFingerprint = await hashDirectory(descriptor.absolutePath).catch(() => null);- if (- installedFingerprint !== fingerprint ||- manifest.fingerprints[descriptor.name] !== fingerprint- ) {- changed = (await materializeSkill(source, descriptor.absolutePath, fingerprint)) || changed;- manifest.fingerprints[descriptor.name] = fingerprint;+ for (const descriptor of descriptors) {+ const source = path.join(options.bundledRoot, descriptor.name);+ try {+ const fingerprint = await hashDirectory(source);+ const installedFingerprint = await hashDirectory(descriptor.absolutePath).catch(() => null);+ if (+ installedFingerprint !== fingerprint ||+ manifest.fingerprints[descriptor.name] !== fingerprint+ ) {+ changed = (await materializeSkill(source, descriptor.absolutePath, fingerprint)) || changed;+ manifest.fingerprints[descriptor.name] = fingerprint;+ }+ } catch (error) {+ warnings.push(+ `could not materialize built-in Skill ${descriptor.name}: ${error instanceof Error ? error.message : String(error)}`,+ );+ continue;}- } catch (error) {- warnings.push(- `could not materialize built-in Skill ${descriptor.name}: ${error instanceof Error ? error.message : String(error)}`,- );- continue;- }- try {- const linked = await ensureSharedEntry(descriptor, options.homeDir ?? os.homedir());- changed = linked.changed || changed;- if (linked.warning) warnings.push(linked.warning);- } catch (error) {- warnings.push(- `could not expose built-in Skill ${descriptor.name}: ${error instanceof Error ? error.message : String(error)}`,+ const sharedPath = path.join(+ options.homeDir ?? os.homedir(),+ '.agents',+ 'skills',+ descriptor.name,);+ let sharedTarget: string | undefined;+ try {+ const linked = await ensureSharedEntry(+ descriptor,+ options.homeDir ?? os.homedir(),+ options.userDataDir,+ options.appDataDir,+ );+ changed = linked.changed || changed;+ sharedTarget = linked.targetPath ?? await fsp.realpath(sharedPath).catch(() => undefined);+ if (linked.warning) warnings.push(linked.warning);+ } catch (error) {+ warnings.push(+ `could not expose built-in Skill ${descriptor.name}: ${error instanceof Error ? error.message : String(error)}`,+ );+ }++ if (!sharedTarget) {+ warnings.push(`could not expose built-in Skill ${descriptor.name} to Claude because the shared entry is unavailable`);+ continue;+ }+ try {+ // Point at the shared name instead of a profile copy. If a user owns+ // that name, Claude, Codex, and Pi all execute the same winner.+ const linked = await ensureSkillEntry(+ { ...descriptor, absolutePath: sharedPath },+ descriptor.nativeClaudePath,+ true,+ options.userDataDir,+ options.appDataDir,+ );+ changed = linked.changed || changed;+ if (linked.warning) warnings.push(linked.warning);+ } catch (error) {+ warnings.push(+ `could not expose built-in Skill ${descriptor.name} to Claude: ${error instanceof Error ? error.message : String(error)}`,+ );+ }}try {- const linked = await ensureSkillEntry(descriptor, descriptor.nativeClaudePath, true);- changed = linked.changed || changed;- if (linked.warning) warnings.push(linked.warning);+ await writeManifest(root, manifest);} catch (error) {warnings.push(- `could not expose built-in Skill ${descriptor.name} to Claude: ${error instanceof Error ? error.message : String(error)}`,+ `could not save built-in Skill manifest: ${error instanceof Error ? error.message : String(error)}`,);}- }-- try {- await writeManifest(root, manifest);- } catch (error) {- warnings.push(- `could not save built-in Skill manifest: ${error instanceof Error ? error.message : String(error)}`,- );+ return true;+ });+ if (locked === undefined) {+ warnings.push('could not prepare built-in Skills because another Skill mutation is in progress');}return { descriptors, changed, warnings };diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex 0be37965b6..73707cf308 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -391,6 +391,10 @@ import {readClaudeApiKey,} from '../maker-host/auth-adapters.js';import { prepareSharedProjectSkillLinks } from '../maker-host/shared-global-skills.js';+import {+ builtInSkillDescriptors,+ markCindyBuiltInAgentSkills,+} from '../maker-host/built-in-skills.js';import { ensurePiManagerInstalled } from '../maker-host/pi-manager-client.js';import {setRemoteCodexLiveTurnChecker,@@ -6016,7 +6020,14 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)await desktopClaudeAuthAdapter.ensureSharedGlobalSkills();}const result = await maker.listAgentSkills(kind, skillParams);- return { success: true, ...result };+ return {+ success: true,+ ...result,+ skills: markCindyBuiltInAgentSkills(+ result.skills,+ builtInSkillDescriptors(app.getPath('userData'), app.getPath('appData')),+ ),+ };} catch (err) {return toAgentSkillListFailure(err, {reportError: (error) => {diff --git a/apps/desktop/src/main/skillhub/__tests__/activationPreferences.test.ts b/apps/desktop/src/main/skillhub/__tests__/activationPreferences.test.tsindex 80e2ef1485..70ddc77410 100644--- a/apps/desktop/src/main/skillhub/__tests__/activationPreferences.test.ts+++ b/apps/desktop/src/main/skillhub/__tests__/activationPreferences.test.ts@@ -47,9 +47,15 @@ describe('Skill activation preferences', () => {});it('also disables native runtime projections when the Cindy built-in Skill is disabled', async () => {const prefs = await import('../activationPreferences');- const descriptor = (await import('../../maker-host/built-in-skills')).builtInSkillDescriptors(root)[0]!;+ const descriptor = (await import('../../maker-host/built-in-skills')).builtInSkillDescriptors(root, root)[0]!;fs.mkdirSync(descriptor.absolutePath, { recursive: true });fs.writeFileSync(path.join(descriptor.absolutePath, 'SKILL.md'), '# Built in\n');+ fs.mkdirSync(path.dirname(descriptor.nativeClaudePath), { recursive: true });+ fs.symlinkSync(+ descriptor.absolutePath,+ descriptor.nativeClaudePath,+ process.platform === 'win32' ? 'junction' : 'dir',+ );await prefs.setCindySkillEnabled(descriptor.absolutePath, false);expect(prefs.readDisabledSkillPaths()).toEqual(expect.arrayContaining([prefs.skillActivationKey(descriptor.absolutePath),@@ -57,6 +63,26 @@ describe('Skill activation preferences', () => {]));await prefs.setCindySkillEnabled(descriptor.absolutePath, true);});+ it('does not disable a user-owned native projection with the built-in toggle', async () => {+ const prefs = await import('../activationPreferences');+ const descriptor = (await import('../../maker-host/built-in-skills')).builtInSkillDescriptors(root, root)[0]!;+ const userSkill = path.join(root, 'user-owned-cindy-skill-creator');+ fs.mkdirSync(descriptor.absolutePath, { recursive: true });+ fs.mkdirSync(userSkill, { recursive: true });+ fs.writeFileSync(path.join(descriptor.absolutePath, 'SKILL.md'), '# Built in\n');+ fs.writeFileSync(path.join(userSkill, 'SKILL.md'), '# User owned\n');+ fs.rmSync(descriptor.nativeClaudePath, { recursive: true, force: true });+ fs.mkdirSync(path.dirname(descriptor.nativeClaudePath), { recursive: true });+ fs.symlinkSync(+ userSkill,+ descriptor.nativeClaudePath,+ process.platform === 'win32' ? 'junction' : 'dir',+ );++ await prefs.setCindySkillEnabled(descriptor.absolutePath, false);+ expect(prefs.readDisabledSkillPaths()).not.toContain(descriptor.nativeClaudePath);+ await prefs.setCindySkillEnabled(descriptor.absolutePath, true);+ });it('persists lexical aliases across restart, bypasses wide Pi scans, and drops retargeted aliases', async () => {const prefs = await import('../activationPreferences');const source = path.join(root, 'external');diff --git a/apps/desktop/src/main/skillhub/__tests__/registerIpcUsage.test.ts b/apps/desktop/src/main/skillhub/__tests__/registerIpcUsage.test.tsindex 55568fc8e7..96e495da75 100644--- a/apps/desktop/src/main/skillhub/__tests__/registerIpcUsage.test.ts+++ b/apps/desktop/src/main/skillhub/__tests__/registerIpcUsage.test.ts@@ -222,9 +222,9 @@ describe('registerSkillhubIpc usage handlers', () => {const builtInFile = path.join(builtInRoot, 'SKILL.md');fs.mkdirSync(builtInRoot, { recursive: true });fs.writeFileSync(builtInFile, '# Built in\n');- isExistingSkillPathGranted.mockImplementation((candidate: string, roots: Set<string>) => (- roots.has(builtInRoot) && candidate === builtInFile- ));+ // Built-in protection compares the Main-owned physical root directly; it+ // must not depend on generic discovery-root grant heuristics.+ isExistingSkillPathGranted.mockReturnValue(false);const { registerSkillhubIpc } = await import('../registerIpc');registerSkillhubIpc({getMaker: () => ({ listAgentSkills }) as never,diff --git a/apps/desktop/src/main/skillhub/activationPreferences.ts b/apps/desktop/src/main/skillhub/activationPreferences.tsindex 05d1ddef25..733912056f 100644--- a/apps/desktop/src/main/skillhub/activationPreferences.ts+++ b/apps/desktop/src/main/skillhub/activationPreferences.ts@@ -54,9 +54,19 @@ export function readDisabledSkillPaths(): readonly string[] {// Cindy's bundled copy normally wins through ~/.agents/skills. Claude uses an// isolated config directory in Desktop dev, so mirror the same user preference// to that runtime projection. Codex's own /skill-creator remains independent.- for (const descriptor of builtInSkillDescriptors(app.getPath('userData'))) {+ for (const descriptor of builtInSkillDescriptors(+ app.getPath('userData'),+ app.getPath('appData'),+ )) {if (value.disabledPaths.includes(skillActivationKey(descriptor.absolutePath))) {- paths.push(descriptor.nativeClaudePath);+ try {+ if (+ skillActivationKey(descriptor.nativeClaudePath) ===+ skillActivationKey(descriptor.absolutePath)+ ) paths.push(descriptor.nativeClaudePath);+ } catch {+ // A missing or user-owned projection must not disable a same-name user Skill.+ }}}return [...new Set(paths)];diff --git a/apps/desktop/src/main/skillhub/registerIpc.ts b/apps/desktop/src/main/skillhub/registerIpc.tsindex 2c5d99ac38..d924cfa5e4 100644--- a/apps/desktop/src/main/skillhub/registerIpc.ts+++ b/apps/desktop/src/main/skillhub/registerIpc.ts@@ -312,10 +312,31 @@ export function registerSkillhubIpc(options: RegisterSkillhubIpcOptions): void {success: false as const,error: 'path was not granted by this renderer\'s latest SkillHub scan',});+ const normalizePathForCompare = (value: string): string => {+ const withoutWindowsNamespace = process.platform === 'win32'+ ? value.replace(/^\\\\\?\\UNC\\/i, '\\\\').replace(/^\\\\\?\\/, '')+ : value;+ const normalized = path.resolve(withoutWindowsNamespace);+ return process.platform === 'win32' ? normalized.toLowerCase() : normalized;+ };+ const realPathOrResolved = (value: string): string => {+ try { return normalizePathForCompare(fs.realpathSync.native(value)); }+ catch { return normalizePathForCompare(value); }+ };+ const isSameOrInside = (candidate: string, root: string): boolean => {+ const relative = path.relative(root, candidate);+ return relative === '' || (+ relative !== '..'+ && !relative.startsWith(`..${path.sep}`)+ && !path.isAbsolute(relative)+ );+ };const isBuiltInSkillPath = (targetPath: string): boolean => (- (options.getBuiltInSkills?.() ?? []).some((skill) => (- isExistingSkillPathGranted(targetPath, new Set([skill.absolutePath]))- ))+ (options.getBuiltInSkills?.() ?? []).some((skill) => {+ const root = realPathOrResolved(skill.absolutePath);+ return isSameOrInside(normalizePathForCompare(targetPath), normalizePathForCompare(skill.absolutePath))+ || isSameOrInside(realPathOrResolved(targetPath), root);+ }));const sweepLocalImportGrants = () => {diff --git a/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsx b/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsxindex e2169f7d93..9f5a021e3c 100644--- a/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsx+++ b/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsx@@ -156,6 +156,7 @@ describe('SlashCommandPalette project Skill rows', () => {kind: 'agent-skill',name: 'cindy-skill-creator',description: 'Create or update a Cindy Skill',+ builtIn: true,source: 'skill',scope: 'user',};@@ -209,6 +210,7 @@ describe('SlashCommandPalette project Skill rows', () => {kind: 'agent-skill',name: 'learn',description: CINDY_LEARN_SOURCE_DESCRIPTION,+ builtIn: true,source: 'skill',scope: 'user',}]}diff --git a/apps/desktop/src/renderer/features/skillhub/lib/__tests__/builtInSkillPresentation.test.ts b/apps/desktop/src/renderer/features/skillhub/lib/__tests__/builtInSkillPresentation.test.tsindex 49f1492b92..6690633a9b 100644--- a/apps/desktop/src/renderer/features/skillhub/lib/__tests__/builtInSkillPresentation.test.ts+++ b/apps/desktop/src/renderer/features/skillhub/lib/__tests__/builtInSkillPresentation.test.ts@@ -13,6 +13,7 @@ describe('prioritizeCindyBuiltInSkills', () => {const builtInLearn = {name: 'learn',description: CINDY_LEARN_SOURCE_DESCRIPTION,+ builtIn: true,scope: 'global',};const localB = { name: 'local-b', description: 'B', scope: 'global' };@@ -51,12 +52,14 @@ describe('isBuiltInLearnSkillEnabled', () => {expect(isBuiltInLearnSkillEnabled([{name: 'learn',description: CINDY_LEARN_SOURCE_DESCRIPTION,+ builtIn: true,scope: 'global',cindyEnabled: false,}], true)).toBe(false);expect(isBuiltInLearnSkillEnabled([{name: 'learn',description: CINDY_LEARN_SOURCE_DESCRIPTION,+ builtIn: true,scope: 'global',cindyEnabled: true,}], true)).toBe(true);diff --git a/apps/desktop/src/renderer/lib/__tests__/slashCommands.test.ts b/apps/desktop/src/renderer/lib/__tests__/slashCommands.test.tsindex 33628866c3..7b8697c037 100644--- a/apps/desktop/src/renderer/lib/__tests__/slashCommands.test.ts+++ b/apps/desktop/src/renderer/lib/__tests__/slashCommands.test.ts@@ -125,12 +125,14 @@ describe('filterSlashCommands', () => {kind: 'agent-skill' as const,name: 'cindy-skill-creator',description: 'Create or update a Cindy Skill',+ builtIn: true,source: 'skill' as const,},{kind: 'agent-skill' as const,name: 'learn',description: CINDY_LEARN_SOURCE_DESCRIPTION,+ builtIn: true,source: 'skill' as const,},{ kind: 'agent-skill' as const, name: 'release-notes', source: 'skill' as const },@@ -154,18 +156,20 @@ describe('filterSlashCommands', () => {kind: 'agent-skill',name: 'learn',description: CINDY_LEARN_SOURCE_DESCRIPTION,+ builtIn: true,source: 'skill',})).toBe(true);expect(isCindyOfficialSlashCommand({kind: 'agent-skill',name: 'learn',description: 'Distill a reusable Skill with Cindy',+ builtIn: true,source: 'skill',})).toBe(true);expect(isCindyOfficialSlashCommand({kind: 'agent-skill',name: 'learn',- description: 'My Learn workflow',+ description: CINDY_LEARN_SOURCE_DESCRIPTION,source: 'skill',})).toBe(false);});diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.tsindex 1bf84faa19..3651ba1a17 100644--- a/apps/desktop/src/renderer/vite-env.d.ts+++ b/apps/desktop/src/renderer/vite-env.d.ts@@ -5511,6 +5511,7 @@ interface ElectronAPI {kind: 'agent-skill';name: string;description?: string;+ builtIn?: boolean;source: 'user' | 'skill';path?: string;scope?: string;diff --git a/apps/desktop/src/shared/cindyBuiltInSkills.ts b/apps/desktop/src/shared/cindyBuiltInSkills.tsindex c0c1c07e32..1dadcf6b89 100644--- a/apps/desktop/src/shared/cindyBuiltInSkills.ts+++ b/apps/desktop/src/shared/cindyBuiltInSkills.ts@@ -1,24 +1,10 @@export const CINDY_SKILL_CREATOR_NAME = 'cindy-skill-creator';export const CINDY_LEARN_NAME = 'learn';-const CINDY_SKILL_CREATOR_SOURCE_DESCRIPTIONS = new Set([- 'Create or update a Cindy Skill',- 'Create or update a skill',- 'Create or update a Cindy Skill with appropriately scoped instructions and any needed supporting resources.',-]);-export const CINDY_LEARN_SOURCE_DESCRIPTION ="Distill a reusable Cindy Skill from the current task, a described workflow, or a SkillHub skill through Cindy's review flow when the user invokes /learn or explicitly asks to start Learn.";-const CINDY_LEARN_SOURCE_DESCRIPTIONS = new Set([- CINDY_LEARN_SOURCE_DESCRIPTION,- 'Distill a reusable Skill with Cindy',-]);--const CINDY_BUILT_IN_SOURCE_DESCRIPTIONS = new Map<string, ReadonlySet<string>>([- [CINDY_SKILL_CREATOR_NAME, CINDY_SKILL_CREATOR_SOURCE_DESCRIPTIONS],- [CINDY_LEARN_NAME, CINDY_LEARN_SOURCE_DESCRIPTIONS],-]);+const CINDY_BUILT_IN_NAMES = new Set([CINDY_SKILL_CREATOR_NAME, CINDY_LEARN_NAME]);/** Identify Cindy-owned metadata without treating another vendor's Skill Creator as official. */export function isCindyBuiltInSkillMetadata(skill: {@@ -27,11 +13,5 @@ export function isCindyBuiltInSkillMetadata(skill: {description?: string;scope?: string;}): boolean {- const sourceDescriptions = CINDY_BUILT_IN_SOURCE_DESCRIPTIONS.get(skill.name);- if (!sourceDescriptions) return false;- if (skill.builtIn === true || skill.scope === 'system') return true;- return Boolean(- skill.description- && sourceDescriptions.has(skill.description.trim()),- );+ return skill.builtIn === true && CINDY_BUILT_IN_NAMES.has(skill.name);}diff --git a/docs/dev-rules/credentials-and-local-storage.md b/docs/dev-rules/credentials-and-local-storage.mdindex ede77dbe5e..4596195db8 100644--- a/docs/dev-rules/credentials-and-local-storage.md+++ b/docs/dev-rules/credentials-and-local-storage.md@@ -83,6 +83,7 @@| 可丢弃的临时数据 | `app.getPath('temp')` 或 `os.tmpdir()` 下的任务专属目录 || 测试生成物 | `os.tmpdir()` 下通过 `mkdtemp` 创建的独立目录,并在测试结束时清理 || Skill 卸载清理回执 | `app.getPath('userData')/skillhub/uninstall-cleanups/<token>.json`,记录操作 owner、旧文件/注册/偏好身份与完成阶段;跨窗口和重启保留,当前 owner 重试完成后删除,不作为授权凭据 |+| 跨 profile 的 Cindy 内置 Skill 副本 | `app.getPath('appData')/Cindy/shared-system-skills`,只保存随应用发布、可由 bundle 重建的官方 Skill;Global、China、dev 与 isolated profile 共用稳定物理路径,更新和共享发现链接必须持有下述互斥锁 || 跨 profile 的共享 Skill 文件互斥 | `app.getPath('appData')/Cindy/shared-skill-mutation-locks`,仅存文件锁及未完成操作的 token/名称哈希,保证正式版/dev/isolated 共用;短期锁复用既有崩溃回收,持久屏障必须等对应清理完成后删除,读取损坏只阻止相关名称 || 用户明确导出的文件 | 用户选择或任务明确指定的目标路径 |diff --git a/packages/maker-core/src/types/palette.ts b/packages/maker-core/src/types/palette.tsindex 7dcea84f9a..86e508d0a0 100644--- a/packages/maker-core/src/types/palette.ts+++ b/packages/maker-core/src/types/palette.ts@@ -60,6 +60,8 @@ export interface AgentSkillCommand {kind: 'agent-skill';name: string;description?: string;+ /** Main-attested Cindy bundle identity; never inferred from user-authored metadata. */+ builtIn?: boolean;/** Whether the skill came from a user-global or project-local directory. */source: SlashCommandSource;path?: string;