personal-bot 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +4 -1
  4. package/README.zh-CN.md +4 -1
  5. package/docs/README.md +2 -3
  6. package/docs/architecture/design.md +41 -2
  7. package/docs/architecture/model-context.md +4 -1
  8. package/docs/architecture/principles.md +2 -2
  9. package/docs/guides/cross-harness-workers.md +26 -1
  10. package/docs/guides/workspace-configuration.md +2 -0
  11. package/lib/antigravity-plugin/lib/extension/acp-worker.js +19 -3
  12. package/lib/antigravity-plugin/lib/extension/cli.js +136 -61
  13. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +2 -0
  14. package/lib/antigravity-plugin/lib/extension/mcp.js +96 -17
  15. package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +2 -0
  16. package/lib/antigravity-plugin/lib/integrations/agent-resources.js +20 -2
  17. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +2 -1
  18. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.js +12 -13
  19. package/lib/antigravity-plugin/lib/model/worker-template.d.ts +21 -0
  20. package/lib/antigravity-plugin/lib/model/worker-template.js +1 -0
  21. package/lib/antigravity-plugin/lib/services/workspace/worker-templates.d.ts +17 -0
  22. package/lib/antigravity-plugin/lib/services/workspace/worker-templates.js +88 -0
  23. package/lib/antigravity-plugin/package.json +1 -1
  24. package/lib/antigravity-plugin/plugin.json +1 -1
  25. package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +1 -1
  26. package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
  27. package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
  28. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +1 -1
  29. package/lib/extension/acp-worker.js +19 -3
  30. package/lib/extension/cli.js +136 -61
  31. package/lib/extension/hosts/dsh/workspace.js +2 -1
  32. package/lib/extension/hosts/plugin-runtime.js +2 -0
  33. package/lib/extension/mcp/tool-contract.d.ts +3 -3
  34. package/lib/extension/mcp/tool-contract.js +4 -4
  35. package/lib/extension/mcp/workers.d.ts +1 -1
  36. package/lib/extension/mcp/workers.js +15 -7
  37. package/lib/extension/mcp.js +96 -17
  38. package/lib/integrations/agent-resources.d.ts +2 -0
  39. package/lib/integrations/agent-resources.js +20 -2
  40. package/lib/integrations/hosts/dsh/resources.d.ts +2 -1
  41. package/lib/integrations/hosts/dsh/resources.js +12 -13
  42. package/lib/model/worker-template.d.ts +21 -0
  43. package/lib/model/worker-template.js +1 -0
  44. package/lib/qoder-plugin/.mcp.json +2 -2
  45. package/lib/qoder-plugin/.qoder-plugin/plugin.json +1 -1
  46. package/lib/qoder-plugin/hooks/hooks.json +3 -3
  47. package/lib/qoder-plugin/skills/pbot/SKILL.md +1 -1
  48. package/lib/services/workspace/worker-templates.d.ts +17 -0
  49. package/lib/services/workspace/worker-templates.js +88 -0
  50. package/package.json +1 -1
  51. package/src/extension/hosts/dsh/workspace.ts +2 -1
  52. package/src/extension/hosts/pi/events.ts +2 -0
  53. package/src/extension/hosts/plugin-runtime.ts +2 -0
  54. package/src/extension/mcp/tool-contract.ts +4 -5
  55. package/src/extension/mcp/workers.ts +17 -8
  56. package/src/integrations/agent-resources.ts +22 -2
  57. package/src/integrations/hosts/dsh/resources.ts +13 -12
  58. package/src/model/worker-template.ts +24 -0
  59. package/src/services/workspace/worker-templates.ts +80 -0
  60. package/docs/architecture/model-instruction-guidelines.md +0 -34
@@ -7,6 +7,7 @@ import type { PluginHostAdapter } from "../../model/plugin-host.js";
7
7
  import { recordHistoryCapture } from "../../services/history/history-capture.js";
8
8
  import { historyStartupNotices } from "../../services/history/summary-runner.js";
9
9
  import { readWorkspaceConfig, workspaceFeatures } from "../../services/workspace/workspace-config.js";
10
+ import { readWorkerTemplates } from "../../services/workspace/worker-templates.js";
10
11
  import { initializeWorkspace } from "../../services/workspace/workspace-preparation.js";
11
12
  import { discoverSkills, discoverWorkspaceSkills } from "../../services/workspace/workspace-skills.js";
12
13
 
@@ -82,6 +83,7 @@ export async function pluginHook(adapter: PluginHostAdapter, payload: unknown, r
82
83
  host: adapter.host,
83
84
  root,
84
85
  role: event.role,
86
+ readWorkerTemplates,
85
87
  coordinatorPrompt: adapter.coordinatorPrompt ?? (features.history ? "plugin-coordinator.md" : null),
86
88
  includePrompts,
87
89
  includeRootAgents: includePrompts && !adapter.nativeRootAgents,
@@ -6,7 +6,7 @@ import { acpElicitationActions, type AcpCommands } from "../../model/acp.js";
6
6
 
7
7
  export const defaultWaitMs = 50_000;
8
8
  export const maxWaitMs = 600_000;
9
- export const discoverTargets = ["overview", "workers", "backends", "models"] as const;
9
+ export const discoverTargets = ["overview", "workers", "backends", "models", "templates"] as const;
10
10
 
11
11
  function formatBackendItem(entry: ReturnType<typeof inspectAcpBackends>[number], defaultBackend?: string): string {
12
12
  const tags: string[] = [];
@@ -184,10 +184,9 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
184
184
  },
185
185
  {
186
186
  name: "worker_discover" as const,
187
- description:
188
- "查找可复用的会话、查看助手状态或核对模型选项。查询模型会临时启动目标助手。",
187
+ description: "查找可用助手、模板或已有会话。查询模型会临时启动所选助手。",
189
188
  annotations: {
190
- title: "Discover Workers, Backends & Models",
189
+ title: "Discover Workers, Templates, Backends & Models",
191
190
  readOnlyHint: true,
192
191
  destructiveHint: false,
193
192
  idempotentHint: true,
@@ -201,7 +200,7 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
201
200
  target: {
202
201
  type: "string",
203
202
  enum: [...discoverTargets],
204
- description: "overview(默认)列助手及当前会话拥有的 worker,workers 只查会话,backends 只查助手可用情况,models 查模型与思考深度。",
203
+ description: "overview(默认)列助手和本会话的 worker,workers 查会话状态,backends 查可用助手,models 查模型与思考深度。templates 列出工作区的助手模板,选中模板的 create 可直接传给 worker_create。",
205
204
  },
206
205
  workerId: {
207
206
  type: "string",
@@ -28,6 +28,7 @@ import type { AgentCycle, AgentOwner, AgentView } from "../../model/agent.js";
28
28
  import { AgentService } from "../../services/agents/agent-service.js";
29
29
  import { readWorkspaceHistory, searchWorkspaceHistory } from "../../services/history/history-query.js";
30
30
  import { readWorkspaceConfig, workspaceDisabledMessage, workspaceFeatures } from "../../services/workspace/workspace-config.js";
31
+ import { discoverWorkerTemplates } from "../../services/workspace/worker-templates.js";
31
32
  import { WorkspaceMcpBridge } from "./bridge.js";
32
33
 
33
34
  export { buildHistoryMcpTools, buildPbotWorkerTools, buildWorkspaceMcpTools, pbotWorkerTools } from "./tool-contract.js";
@@ -40,7 +41,7 @@ const progressIntervalMs = 5_000;
40
41
  export type ProgressReporter = (message: string) => void;
41
42
 
42
43
  const workerCapabilityInstruction =
43
- "用户或工作区分工指定其他助手或特定模型时,可在当前工作区委派任务。常规任务优先自行处理或使用宿主内置子代理。";
44
+ "可查询工作区的助手模板,也可按用户要求或工作区分工委派给指定助手或模型。常规任务优先自行处理或使用宿主内置子代理。";
44
45
 
45
46
  const workspaceMcpCapabilityInstruction =
46
47
  "可调用本工作区 .pbot/mcp.json 中登记的 MCP 工具。";
@@ -61,7 +62,7 @@ export const mcpInstructions = buildMcpInstructions({ workspaceMcp: true, histor
61
62
 
62
63
  export function defaultWorkerDirectory(workspaceRoot: string): string {
63
64
  if (process.env.PBOT_MCP_AGENT_DIR) return process.env.PBOT_MCP_AGENT_DIR;
64
- return join(workspaceRoot, ".pbot", "subagents");
65
+ return join(workspaceRoot, ".pbot", "worker", "runtime");
65
66
  }
66
67
 
67
68
  function workerCommandTool(name: string): McpWorkerToolName | undefined {
@@ -389,12 +390,15 @@ export class McpWorkerRuntime {
389
390
  const { name, args: rawArgs } = parseMcpToolCall(toolName, input);
390
391
  requireThat(!this.#closing, "Personal Bot MCP 服务已关闭。");
391
392
  const isWorkerScoped = name === "worker_close" || name === "worker_request" || name === "worker_response" || name === "worker_output";
393
+ const isTemplateQuery = name === "worker_discover" && rawArgs.target === "templates";
392
394
  const root = isWorkerScoped
393
395
  ? await this.resolveWorkerWorkspace(asString(rawArgs, "workerId", true)!, defaultWorkspace)
394
- : await this.resolveWorkspace(asString(rawArgs, "workspace") ?? defaultWorkspace);
396
+ : await this.resolveWorkspace(asString(rawArgs, "workspace", isTemplateQuery && rawArgs.workspace !== undefined) ?? defaultWorkspace);
395
397
  const configuration = await readWorkspaceConfig(root);
396
398
  requireThat(!this.#closing, "Personal Bot MCP 服务已关闭。");
397
- requireThat(configuration.enabled, workspaceDisabledMessage(configuration));
399
+ requireThat(configuration.enabled, isTemplateQuery
400
+ ? `无法在工作区 ${root} 查询助手模板。`
401
+ : workspaceDisabledMessage(configuration));
398
402
 
399
403
  switch (name) {
400
404
  case "workspace_mcp_discover":
@@ -445,6 +449,12 @@ export class McpWorkerRuntime {
445
449
  }
446
450
  }
447
451
 
452
+ if (isTemplateQuery) {
453
+ const extra = Object.keys(rawArgs).find(key => key !== "target" && key !== "workspace");
454
+ requireThat(extra === undefined, `查询模板只接受 target 和 workspace,收到参数 ${extra}。`);
455
+ return discoverWorkerTemplates(root);
456
+ }
457
+
448
458
  const { host, service, owner } = this.workerService(root, configuration.acp);
449
459
  switch (name) {
450
460
  case "worker_create": {
@@ -513,10 +523,9 @@ export class McpWorkerRuntime {
513
523
  return this.waitFor(service, owner, workerId, undefined, waitMs, offset, progress);
514
524
  }
515
525
  case "worker_discover": {
516
- const rawTarget = asString(rawArgs, "target") ?? "overview";
517
- requireThat(isOneOf(rawTarget, discoverTargets),
518
- `参数 target 无效:${rawTarget}(可用:${discoverTargets.join(", ")})。`);
519
- const target = rawTarget;
526
+ const target = asString(rawArgs, "target") ?? "overview";
527
+ requireThat(isOneOf(target, discoverTargets),
528
+ `参数 target 无效:${target}(可用:${discoverTargets.join(", ")})。`);
520
529
  const workerId = asString(rawArgs, "workerId");
521
530
  const backendRaw = asString(rawArgs, "backend");
522
531
  const model = asString(rawArgs, "model");
@@ -3,6 +3,7 @@ import { join } from "node:path";
3
3
  import { resourceRoot } from "../common/paths.js";
4
4
  import { requireThat } from "../common/validation.js";
5
5
  import type { HostId, WorkspaceContext, WorkspaceRole } from "../model/plugin-host.js";
6
+ import type { ReadWorkerTemplates, WorkerTemplate } from "../model/worker-template.js";
6
7
  import type { WorkspaceSkillMeta } from "../model/workspace-mcp.js";
7
8
 
8
9
  export async function readOptionalFile(path: string): Promise<string> {
@@ -40,6 +41,22 @@ export function formatWorkspaceSkills(skills: readonly WorkspaceSkillMeta[]): st
40
41
  return "## 按需读取的技能\n\n" + lines.join("\n");
41
42
  }
42
43
 
44
+ function formatWorkerTemplates(templates: readonly WorkerTemplate[]): string {
45
+ if (!templates.length) return "";
46
+ const lines = templates.map(({ id, name, description, create }) => {
47
+ const label = name === id ? id : `${name}(${id})`;
48
+ const settings = [
49
+ ["助手", create.backend],
50
+ ["执行工作区", create.workspace],
51
+ ["模型", create.model],
52
+ ["思考深度", create.thinking],
53
+ ].filter(([, value]) => value !== undefined)
54
+ .map(([field, value]) => `${field} ${JSON.stringify(value)}`).join(",");
55
+ return `- ${label} ${description}(${settings})`;
56
+ });
57
+ return "## 工作区助手模板\n\n选用模板时,用 worker_discover 查询最新设置(target=templates)。\n\n" + lines.join("\n");
58
+ }
59
+
43
60
  export async function loadWorkspaceContext(options: {
44
61
  host: HostId;
45
62
  root: string;
@@ -48,6 +65,7 @@ export async function loadWorkspaceContext(options: {
48
65
  includePrompts?: boolean;
49
66
  includeRootAgents?: boolean;
50
67
  localRoleOnly?: boolean;
68
+ readWorkerTemplates?: ReadWorkerTemplates;
51
69
  workspaceSkills?: readonly WorkspaceSkillMeta[];
52
70
  notices?: readonly string[];
53
71
  }): Promise<WorkspaceContext> {
@@ -62,13 +80,15 @@ export async function loadWorkspaceContext(options: {
62
80
  workspaceSkills = [],
63
81
  notices = [],
64
82
  } = options;
65
- const [workspace, roleText, rootAgents] = includePrompts
83
+ const [workspace, baseRole, rootAgents, catalog] = includePrompts
66
84
  ? await Promise.all([
67
85
  readFile(join(resourceRoot, "prompts/workspace.md"), "utf8"),
68
86
  localRoleOnly ? readLocalRole(role, root) : agentText(role, root, coordinatorPrompt),
69
87
  includeRootAgents ? readOptionalFile(join(root, "AGENTS.md")) : Promise.resolve(""),
88
+ role === "coordinator" ? options.readWorkerTemplates?.(root) : undefined,
70
89
  ])
71
- : ["", "", ""];
90
+ : ["", "", "", undefined];
91
+ const roleText = [baseRole, formatWorkerTemplates(catalog?.templates ?? [])].filter(Boolean).join("\n\n");
72
92
  const skillsSection = formatWorkspaceSkills(workspaceSkills);
73
93
  const noticesSection = notices.length
74
94
  ? "## 维护提醒\n\n告知用户,按用户要求执行。\n\n" + notices.map(item => `- ${item}`).join("\n")
@@ -1,15 +1,13 @@
1
- import { readFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
1
  import type { Context } from "@deepseek-ai/cordis";
4
2
  import type { Agent } from "@deepseek-ai/dsh-agent";
5
3
  import type {} from "@deepseek-ai/dsh-skill";
6
4
  import type {} from "@deepseek-ai/dsh-working-directory";
7
5
  import type {} from "@deepseek-ai/dsh-tools";
8
- import { agentText } from "../../agent-resources.js";
9
- import { resourceRoot } from "../../../common/paths.js";
6
+ import { loadWorkspaceContext } from "../../agent-resources.js";
10
7
  import { requireThat } from "../../../common/validation.js";
11
8
  import { isMcpWorkerTool } from "../../../model/acp.js";
12
9
  import type { AgentOptions } from "../../../model/agent.js";
10
+ import type { ReadWorkerTemplates } from "../../../model/worker-template.js";
13
11
 
14
12
  export async function dshResources(
15
13
  ctx: Context,
@@ -18,25 +16,28 @@ export async function dshResources(
18
16
  role: "coordinator" | "general-purpose",
19
17
  check: () => void,
20
18
  coordinatorPrompt: string | null = "history-coordinator.md",
19
+ readWorkerTemplates?: ReadWorkerTemplates,
21
20
  ) {
22
- const read = () => Promise.all([agentText(role, root, coordinatorPrompt), readFile(join(resourceRoot, "prompts/workspace.md"), "utf8")]);
23
- const [text, workspace] = await read();
21
+ const read = () => loadWorkspaceContext({
22
+ host: "dsh", root, role, coordinatorPrompt, ...(readWorkerTemplates ? { readWorkerTemplates } : {}),
23
+ });
24
+ const context = await read();
24
25
  check();
25
- ctx.systemPrompt.section({ name: "pbot:role", order: 1, text, interpolate: false });
26
- ctx.systemPrompt.section({ name: "pbot:workspace", order: 2, text: workspace, interpolate: false });
26
+ ctx.systemPrompt.section({ name: "pbot:role", order: 1, text: context.role, interpolate: false });
27
+ ctx.systemPrompt.section({ name: "pbot:workspace", order: 2, text: context.workspace, interpolate: false });
27
28
  ctx.systemPrompt.context({
28
29
  name: "pbot:environment", order: 300, required: true, interpolate: false,
29
- text: JSON.stringify({ host: "dsh", workspaceRoot: root, resourceRoot }),
30
+ text: JSON.stringify(context.environment),
30
31
  });
31
32
  ctx.on("system-prompt/assemble", async (_assembly, _context, next) => {
32
33
  check();
33
- const [roleText, workspaceText] = await read();
34
+ const current = await read();
34
35
  check();
35
36
  const assembly = await next();
36
37
  return {
37
38
  ...assembly,
38
- sections: assembly.sections.map(section => section.name === "pbot:role" ? { ...section, text: roleText }
39
- : section.name === "pbot:workspace" ? { ...section, text: workspaceText } : section),
39
+ sections: assembly.sections.map(section => section.name === "pbot:role" ? { ...section, text: current.role }
40
+ : section.name === "pbot:workspace" ? { ...section, text: current.workspace } : section),
40
41
  };
41
42
  });
42
43
  }
@@ -0,0 +1,24 @@
1
+ export interface WorkerTemplate {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ create: {
6
+ backend: string;
7
+ workspace: string;
8
+ model?: string;
9
+ thinking?: string;
10
+ };
11
+ }
12
+
13
+ export interface WorkerTemplateError {
14
+ id: string;
15
+ message: string;
16
+ }
17
+
18
+ export interface WorkerTemplateCatalog {
19
+ templates: WorkerTemplate[];
20
+ errors: WorkerTemplateError[];
21
+ error?: string;
22
+ }
23
+
24
+ export type ReadWorkerTemplates = (root: string) => Promise<WorkerTemplateCatalog>;
@@ -0,0 +1,80 @@
1
+ import { constants } from "node:fs";
2
+ import { open } from "node:fs/promises";
3
+ import { homedir } from "node:os";
4
+ import { join, resolve } from "node:path";
5
+ import { object } from "../../common/json.js";
6
+ import type { WorkerTemplate, WorkerTemplateCatalog, WorkerTemplateError } from "../../model/worker-template.js";
7
+
8
+ const templateIdPattern = /^[a-z0-9][a-z0-9-]{0,63}$/;
9
+ const templateFields = ["name", "description", "create"];
10
+ const createFields = ["backend", "workspace", "model", "thinking"];
11
+
12
+ function validString(value: unknown): value is string {
13
+ return typeof value === "string" && value.trim().length > 0 && !value.includes("\0");
14
+ }
15
+
16
+ function parseTemplate(id: string, entry: unknown): WorkerTemplate | WorkerTemplateError {
17
+ if (!templateIdPattern.test(id)) return { id, message: "模板标识无效。" };
18
+ if (!object(entry) || Object.keys(entry).some(key => !templateFields.includes(key))) {
19
+ return { id, message: "模板设置无效。" };
20
+ }
21
+ const { name = id, description, create } = entry;
22
+ if (!validString(name)) return { id, message: "模板名称无效。" };
23
+ if (!validString(description)) return { id, message: "模板缺少有效的职责说明。" };
24
+ if (!object(create) || Object.keys(create).some(key => !createFields.includes(key))) {
25
+ return { id, message: "助手的启动设置无效。" };
26
+ }
27
+ if (!validString(create.backend)) return { id, message: "模板缺少有效的助手标识。" };
28
+ const options: WorkerTemplate["create"] = { backend: create.backend, workspace: "." };
29
+ for (const key of ["workspace", "model", "thinking"] as const) {
30
+ const value = create[key];
31
+ if (value === undefined) continue;
32
+ if (!validString(value)) return { id, message: "助手的启动设置无效。" };
33
+ options[key] = value;
34
+ }
35
+ return { id, name, description, create: options };
36
+ }
37
+
38
+ export async function readWorkerTemplates(root: string): Promise<WorkerTemplateCatalog> {
39
+ const path = join(root, ".pbot", "worker", "templates.json");
40
+ const catalog: WorkerTemplateCatalog = { templates: [], errors: [] };
41
+ const unavailable = { ...catalog, error: "当前工作区的助手模板不可用。" };
42
+ let entries: unknown;
43
+ try {
44
+ const file = await open(path, constants.O_RDONLY | constants.O_NONBLOCK);
45
+ try {
46
+ if (!(await file.stat()).isFile()) return unavailable;
47
+ entries = JSON.parse(await file.readFile("utf8"));
48
+ } finally {
49
+ await file.close();
50
+ }
51
+ } catch (error) {
52
+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return catalog;
53
+ return unavailable;
54
+ }
55
+ if (!object(entries)) return unavailable;
56
+ for (const id of Object.keys(entries).sort()) {
57
+ const result = parseTemplate(id, entries[id]);
58
+ if ("message" in result) catalog.errors.push(result);
59
+ else catalog.templates.push(result);
60
+ }
61
+ return catalog;
62
+ }
63
+
64
+ function resolveTemplateWorkspace(root: string, workspace: string): string {
65
+ if (workspace === "~" || workspace.startsWith("~/")) return join(homedir(), workspace.slice(2));
66
+ return resolve(root, workspace);
67
+ }
68
+
69
+ export async function discoverWorkerTemplates(root: string) {
70
+ const { templates, errors, error } = await readWorkerTemplates(root);
71
+ if (error) throw new Error(error);
72
+ return {
73
+ target: "templates",
74
+ templates: templates.map(template => ({
75
+ ...template,
76
+ create: { ...template.create, workspace: resolveTemplateWorkspace(root, template.create.workspace) },
77
+ })),
78
+ ...(errors.length ? { errors } : {}),
79
+ };
80
+ }
@@ -1,34 +0,0 @@
1
- # 模型指令编写原则
2
-
3
- 修改 Agent 实际可见的内容及其加载方式时遵循本文。范围包括各宿主主会话与 ACP worker 的公共提示、角色、动态环境、工具说明、技能、参考资料、模板及历史摘要提示。本文方法论**仅面向运行时模型上下文**,与面向开发者的仓库技术文档(`AGENTS.md`、`docs/`)严格分开,不将仓库架构或构建实现写进 `resources/`。当前加载方式见[模型上下文](model-context.md)。
4
-
5
- ## 从实际上下文出发
6
-
7
- 以宿主实际组装的内容判断取舍,尤其检查新会话第一次任务。同时考虑宿主提示、用户资料、工具声明和技能目录,避免只看某个 Markdown 文件。
8
-
9
- 每段指令应有具体用途:帮助模型作什么决定、执行什么操作,或避免什么已知错误。根据用途保留、合并、删除、条件加载或按需读取,不以字数最少为目标,不加入没有明确需求的泛化约束。
10
-
11
- ## 直接说明要做什么
12
-
13
- 使用自然、直接的语言,写清职责、操作入口、参数含义和下一步。内部架构与执行机制只在改变实际操作时说明,其余留在开发文档。
14
-
15
- ## 不增加泛化流程
16
-
17
- 按用户请求和已有约定推进,不自行补入通用的证据收集、授权核对、审批、独立复核或业务验收流程。权限和确认机制沿用宿主、凭据、外部服务及用户约定;不通过提示掩盖或绕过实际执行限制,保留直接影响操作的事项(如配置作用域、凭据引用,以及结果未知时先查状态、避免重复执行)。
18
-
19
- ## 保留实用细节,按用途放置
20
-
21
- | 内容 | 放置要求 |
22
- | --- | --- |
23
- | 首次任务就需要的职责与资料位置 | 放在公共提示或对应角色中 |
24
- | 工作区目录用途与组织规范 | 保留首轮可见的目录说明和模板导航;已有用户布局与约定优先 |
25
- | 工具参数、分页、状态和结果入口 | 放在工具契约中,避免其他提示重复完整说明 |
26
- | 维护、接入、计算及调度方法 | 通过技能或参考资料按需读取,正文包含能实际执行的方法与关键口径 |
27
- | 动态环境与错误 | 提供当前操作需要的字段;详细诊断留在状态或日志入口 |
28
- | 历史摘要 | 使用专用提示与待总结资料,不混入普通工作角色和无关技能 |
29
-
30
- 优先使用宿主已有的资源发现、技能、工具、配置和上下文去重机制。加载缺失、时序错误或重复注入问题应修代码,不用提示词弥补。
31
-
32
- ## 验证要求
33
-
34
- 加载行为用真实宿主 SDK、本地文件和进程检查来源、首轮出现时机、后续更新、条件加载及去重;不编写断言提示词文案或全文快照的测试。