Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(desktop): 插件制作流程增设「设计对齐」提问卡片(FORGE_GUIDE §0)
Lizic0309fc2318a
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/forge.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/forge.test.tsindex 2a82f84fb6..d754e6f5d0 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/forge.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/forge.test.ts@@ -546,6 +546,16 @@ describe('FORGE_GUIDE', () => {'视频画面参数(四项全可选','videoParams','各型号支持集不同',+ // 2026-07-31 设计对齐章(§0):动手前用带选项的提问卡片摆出"隐藏"设计+ // 选项(界面形态/点名词/启动模式/联网等),用户确认设计小结后才动手;+ // 小结须告知源码目录位置(知情即可,不需要用户选)。+ '设计对齐',+ '提问卡片',+ '推荐项',+ '"隐藏"设计选项',+ '设计小结',+ '源码会放在工作目录的哪个文件夹',+ '让用户知情即可',]) {expect(FORGE_GUIDE).toContain(marker);}diff --git a/apps/desktop/src/main/cindy-brain/forge.ts b/apps/desktop/src/main/cindy-brain/forge.tsindex fae18fa555..bdb8155019 100644--- a/apps/desktop/src/main/cindy-brain/forge.ts+++ b/apps/desktop/src/main/cindy-brain/forge.ts@@ -710,14 +710,45 @@ export const FORGE_GUIDE = `# 意识(Ghost)编写手册意识是 Cindy 的第三方能力包,文件形态是 \`.cindy\`(zip 包)。装入后可给主机叠加:AI 可调用的工具、常驻界面面板、模型代办能力。本手册教你(agent)替用户-写一个意识。**流程:先取手册目录,按需用 section 读透相关章(动手前至少读完-"沙箱红线"与"打包与测试"两章) → 在工作目录写源码文件 → ghost_forge_pack 打包 →-用户在弹窗上确认装入。**+写一个意识。**流程:先取手册目录 → 按 §0 用提问卡片和用户对齐设计 → 按需用 section+读透相关章(动手前至少读完"沙箱红线"与"打包与测试"两章) → 在工作目录写源码文件 →+ghost_forge_pack 打包 → 用户在弹窗上确认装入。**从零开始时优先调用 \`ghost_forge_scaffold\` 生成一份不会覆盖现有文件的骨架,再在骨架上修改。可选模板:\`plain\`(普通沙箱工具)、\`agent-action\`(卡片点击后让 Agent继续工作)、\`node-json-rpc\`(普通随包 Node 服务)、\`node-mcp\`(随包 stdio MCP)。+## 0. 设计对齐:动手前用提问卡片确认关键决策++用户通常不知道意识能做成哪些形态——你不主动摆出来,他就只会得到一个"默认样子"的+插件。所以写任何代码之前,先用**带选项的提问**和用户对齐设计:宿主支持带选项的+提问卡片(用户点选项即可回答)就优先用卡片;没有就一次只问一个问题、正文里给出+编号选项。规则:++- 一张卡片聚焦一个决策,给 2–4 个具体选项并标注你的**推荐项**,不问开放式的"你想要什么"。+- 选项用用户听得懂的话描述效果与代价(如"常驻会一直占一份后台资源")。+- 只问需求推不出来的;能从用户描述直接推断的不要问,一般 3–6 个决策问完。++值得主动摆出来让用户选的"隐藏"设计选项(详见对应章节):++- **界面形态**:无界面(纯工具)/ 聊天卡片(card 槽,§4.5)/ 停靠面板(panel.position+ left,§5)/ 右侧栏页签(position "tab",§5)。+- **唤起方式**:只靠 AI 按 whenToUse 自动想起,还是同时声明 \`command\` 点名词让用户+ 显式点名(推荐,§2)。+- **启动模式**:on-demand 按需拉起(缺省,推荐)/ resident 常驻(仅订阅型、要秒响应+ 的场景,§2)。+- **后台能力**:要不要旁听事件(subscribe 槽,§4.6)、发系统提示(notify 槽,§4.9)。+- **联网与凭证**:要不要 network 槽白名单联网(§4.7);要用户填 key 就需要 setup+ 就绪声明与 settingsHtml 设置区(§4.7、§4.8)。+- **运行形态**:纯沙箱 main.js 够用,还是要随包 Node 进程装依赖跑重活(node 槽,§4.12)。+- **媒体代办**:要不要让主机代生成/改图/视频(cindy 槽,§2、§4.0.1)。++问完后把选择复述成一份简短设计小结(要解决的问题/目标用户/交互流程/所选形态/+权限边界/验收标准),并顺带说明源码会放在工作目录的哪个文件夹——位置不需要用户选+(骨架只能建在会话工作目录内,装入后归主机统一管理),让用户知情即可。用户确认+小结后再动手。**修改现有意识同样适用**:先读现有 ghost.json 与源码,列出改动会+影响哪些已选形态,再让用户确认。+## 1. 目录结构(最小可用)\`\`\`diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.ts b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.tsindex 68f0186f5e..0117eacc9f 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.ts+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.ts@@ -26,4 +26,16 @@ describe('Ghost Plugin creation prompt', () => {expect(prompt.indexOf('ghost_forge_guide')).toBeLessThan(prompt.indexOf('ghost_forge_pack'));expect(prompt).toContain('打包并安装插件');});++ it('asks with option cards and surfaces hidden design choices (guide §0)', () => {+ const prompt = zhCommon.settings.ghosts.page.createPrompt;++ // 与 FORGE_GUIDE §0「设计对齐」呼应:先读该章,再用带选项的提问卡片把+ // 用户想不到的设计选项(面板形态等)摆出来选,而不是开放式追问。+ expect(prompt).toContain('设计对齐');+ expect(prompt).toContain('提问卡片');+ expect(prompt).toContain('推荐项');+ expect(prompt).toContain('停靠面板');+ expect(prompt).toContain('右侧栏页签');+ });});diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 4a654074cc..55d28e600a 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -2731,7 +2731,7 @@"addPlugin": "Add plugin","addPluginAria": "Plugin add options","createWithCindy": "Create with Cindy",- "createPrompt": "I want to create a Cindy plugin. First call ghost_forge_guide to get the handbook's table of contents, then read the relevant chapters via the section parameter (at minimum the sandbox red-lines and packaging chapters) before writing any code; do not start implementing yet. Begin by asking questions, focusing on one key decision at a time, and work with me to define the problem, target users, interaction flow, required tools and connections, permission boundaries, and acceptance criteria. After I confirm the design, implement and validate it according to the specification, then call ghost_forge_pack to package and install the plugin.",+ "createPrompt": "I want to create a Cindy plugin. First call ghost_forge_guide to get the handbook's table of contents, read chapter 0 (design alignment) first, then read the relevant chapters via the section parameter (at minimum the sandbox red-lines and packaging chapters) before writing any code; do not start implementing yet. Begin by asking questions: prefer option-based question cards, one key decision per card with your recommended choice marked, and proactively surface design options I may not know about — such as the UI form (docked panel, right-sidebar tab, chat card, or no UI), a $ command word, launch mode, network access, and whether a settings page is needed. Step by step, confirm the problem to solve, target users, interaction flow, required tools and connections, permission boundaries, and acceptance criteria. After I confirm the design, implement and validate it according to the specification, then call ghost_forge_pack to package and install the plugin.","installedTitle": "Installed Plugins","installedExpand": "Show {{count}} more installed plugins","installedCollapse": "Hide additional installed plugins",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 5e6dda695d..ee48322951 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -2730,7 +2730,7 @@"addPlugin": "プラグインを追加","addPluginAria": "プラグイン追加オプション","createWithCindy": "Cindy で作成",- "createPrompt": "Cindy プラグインを作成したいです。まず ghost_forge_guide を呼び出してハンドブックの目次を取得し、section パラメータで関連する章(少なくともサンドボックスの禁止事項とパッケージ化の章)を読み込んでから着手してください。すぐに実装を始めないでください。質問から始め、毎回一つの重要な判断に集中しながら、解決する課題、対象ユーザー、操作フロー、必要なツールと接続、権限の境界、受け入れ条件を段階的に確認してください。設計を確認した後、仕様に沿って実装と検証を行い、最後に ghost_forge_pack を呼び出してプラグインをパッケージ化し、インストールしてください。",+ "createPrompt": "Cindy プラグインを作成したいです。まず ghost_forge_guide を呼び出してハンドブックの目次を取得し、最初に第 0 章「設計のすり合わせ」を読み、その後 section パラメータで関連する章(少なくともサンドボックスの禁止事項とパッケージ化の章)を読み込んでから着手してください。すぐに実装を始めないでください。質問から始めてください:選択肢付きの質問カードを優先し、1 枚のカードでは 1 つの重要な判断に絞り、あなたのおすすめを明示した上で、私が気づきにくい設計オプション(UI 形態:ドッキングパネル / 右サイドバーのタブ / チャットカード / UI なし、$ 呼び出しコマンド、起動モード、ネットワーク接続の要否、設定ページの要否など)を積極的に提示して選ばせてください。解決する課題、対象ユーザー、操作フロー、必要なツールと接続、権限の境界、受け入れ条件を段階的に確認してください。設計を確認した後、仕様に沿って実装と検証を行い、最後に ghost_forge_pack を呼び出してプラグインをパッケージ化し、インストールしてください。","installedTitle": "インストール済みプラグイン","installedExpand": "インストール済みプラグインをさらに {{count}} 件表示","installedCollapse": "追加のインストール済みプラグインを隠す",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 7aea1bf0f9..55fda0801d 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -2730,7 +2730,7 @@"addPlugin": "플러그인 추가","addPluginAria": "플러그인 추가 옵션","createWithCindy": "Cindy로 만들기",- "createPrompt": "Cindy 플러그인을 만들고 싶습니다. 먼저 ghost_forge_guide를 호출해 핸드북 목차를 받은 뒤 section 매개변수로 관련 장(최소한 샌드박스 금지선과 패키징 장)을 읽고 나서 작업을 시작하세요. 바로 구현을 시작하지 마세요. 질문부터 시작해 한 번에 하나의 핵심 결정에 집중하면서 해결할 문제, 대상 사용자, 상호작용 흐름, 필요한 도구와 연결, 권한 경계, 완료 기준을 단계적으로 확인해 주세요. 설계를 확인한 뒤 규격에 따라 구현하고 검증한 다음, 마지막으로 ghost_forge_pack을 호출해 플러그인을 패키징하고 설치해 주세요.",+ "createPrompt": "Cindy 플러그인을 만들고 싶습니다. 먼저 ghost_forge_guide를 호출해 핸드북 목차를 받고, 우선 0장 「설계 맞추기」를 읽은 뒤 section 매개변수로 관련 장(최소한 샌드박스 금지선과 패키징 장)을 읽고 나서 작업을 시작하세요. 바로 구현을 시작하지 마세요. 질문부터 시작하세요: 선택지가 있는 질문 카드를 우선 사용하고, 카드 한 장에는 핵심 결정 하나만 담아 추천안을 표시하며, 제가 모를 수 있는 설계 옵션(UI 형태: 도킹 패널 / 오른쪽 사이드바 탭 / 채팅 카드 / UI 없음, $ 호출 명령어, 시작 모드, 네트워크 사용 여부, 설정 페이지 필요 여부 등)을 먼저 보여 주고 고르게 해 주세요. 해결할 문제, 대상 사용자, 상호작용 흐름, 필요한 도구와 연결, 권한 경계, 완료 기준을 단계적으로 확인해 주세요. 설계를 확인한 뒤 규격에 따라 구현하고 검증한 다음, 마지막으로 ghost_forge_pack을 호출해 플러그인을 패키징하고 설치해 주세요.","installedTitle": "설치된 플러그인","installedExpand": "설치된 플러그인 {{count}}개 더 보기","installedCollapse": "추가 설치 플러그인 숨기기",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 3600881900..3c310b8cf3 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -2730,7 +2730,7 @@"addPlugin": "添加插件","addPluginAria": "插件添加选项","createWithCindy": "使用 Cindy 创建",- "createPrompt": "我要创建一个 Cindy 插件。请先调用 ghost_forge_guide 获取手册目录,再用 section 参数读透相关章节(动手前至少读完沙箱红线与打包流程两章),不要直接开始实现。先从提问开始,每次聚焦一个关键决策,与我逐步确认插件要解决的问题、目标用户、交互流程、所需工具与连接、权限边界和验收标准。设计确认后,再按规范实现并自检;最后调用 ghost_forge_pack 打包并安装插件。",+ "createPrompt": "我要创建一个 Cindy 插件。请先调用 ghost_forge_guide 获取手册目录,先读第 0 章「设计对齐」,再用 section 参数读透相关章节(动手前至少读完沙箱红线与打包流程两章),不要直接开始实现。先从提问开始:优先用带选项的提问卡片,每张卡片聚焦一个关键决策并标注你的推荐项,把我可能不知道的设计选项主动摆出来让我选——比如界面形态(停靠面板、右侧栏页签、对话卡片还是无界面)、$ 点名词、启动模式、是否联网、是否需要设置页;并逐步确认插件要解决的问题、目标用户、交互流程、所需工具与连接、权限边界和验收标准。设计确认后,再按规范实现并自检;最后调用 ghost_forge_pack 打包并安装插件。","installedTitle": "已安装的插件","installedExpand": "展开另外 {{count}} 个已安装插件","installedCollapse": "收起其他已安装插件",diff --git a/packages/cindy-tools/src/ghost/mcpServer.ts b/packages/cindy-tools/src/ghost/mcpServer.tsindex 0ab1f3d68d..de5ae48401 100644--- a/packages/cindy-tools/src/ghost/mcpServer.ts+++ b/packages/cindy-tools/src/ghost/mcpServer.ts@@ -67,11 +67,13 @@ const D_GHOST_CALL = [const D_GHOST_FORGE_GUIDE = ["获取《插件(Ghost)编写手册》——为用户制作/修改插件(.cindy 能力包)前必读。",- "手册随主机版本走,包含:ghost.json 身份卡全字段、十个卡槽、管子 API(cindy.send)、",- "面板与主题、沙箱红线、打包与测试流程。整本超出单次工具结果上限,分章取用:",- '不传参数返回目录,传 section(章号如 "4.7" 或章标题关键词如 "network")返回单章正文。',- '用户说"帮我做一个 XX 插件 / 改一下某插件"时,先取目录、按需读相关章,',- "新插件可用 ghost_forge_scaffold 生成骨架,修改完成后再用 ghost_forge_pack 打包装入。",+ "手册随主机版本走,包含:设计对齐提问清单、ghost.json 身份卡全字段、全部卡槽、",+ "管子 API(cindy.send)、面板与主题、沙箱红线、打包与测试流程。整本超出单次工具",+ '结果上限,分章取用:不传参数返回目录,传 section(章号如 "4.7" 或章标题关键词如',+ '"network")返回单章正文。用户说"帮我做一个 XX 插件 / 改一下某插件"时,先取目录、',+ "先按第 0 章「设计对齐」用带选项的提问卡片和用户确认界面形态(停靠面板/右侧栏页签/",+ "纯工具)等关键决策,再按需读相关章;新插件可用 ghost_forge_scaffold 生成骨架,",+ "修改完成后再用 ghost_forge_pack 打包装入。",].join("\n");const D_GHOST_FORGE_SCAFFOLD = [