CMDC.Agent.BasePrompt (cmdc v0.5.3)

Copy Markdown View Source

默认基座提示词。

提供所有 CMDC Agent 共享的基础行为指引,包括:

  • 核心行为准则(简洁直接,不啰嗦)
  • 任务执行指引(理解→执行→验证)
  • 工具使用指南
  • 错误处理策略
  • 进度汇报约定

使用

BasePrompt 作为系统提示词的底层基座,由 Agent 内部组装管线拼装:

BasePrompt + 用户 system_prompt + Skills + Memory  最终 system prompt

通常不直接调用,而是由 Agent 在每轮请求前自动注入。

Summary

Functions

构建带可用工具列表的基座提示词(等价 for_mode(tools, :full))。

prompt_mode 构建基座提示词。

返回精简 task 模式基座提示词文本。

返回默认基座提示词文本(:full 模式)。

Functions

build(tools \\ [])

@spec build([module()]) :: String.t()

构建带可用工具列表的基座提示词(等价 for_mode(tools, :full))。

当提供工具模块列表时,在基座提示词末尾追加工具清单。 空工具列表时仅返回基座提示词。

for_mode(tools, mode)

@spec for_mode([module()], CMDC.Options.prompt_mode()) :: String.t()

prompt_mode 构建基座提示词。

  • :full — 完整 BasePrompt + 工具清单(同 build/1
  • :task — 精简 task BasePrompt + 工具清单(含 description)
  • :minimal注入 BasePrompt,只有工具名称列表(无 description)
  • :none — 返回空串(完全由上层 system_prompt 接管)

task_text()

@spec task_text() :: String.t()

返回精简 task 模式基座提示词文本。

text()

@spec text() :: String.t()

返回默认基座提示词文本(:full 模式)。