Documentation
¶
Index ¶
- func BuildFullSystemPrompt(cfg SystemPromptConfig, tools []provider.ToolDef) string
- func BuildSystemContext(cfg SystemPromptConfig) string
- func BuildSystemPrompt(tools []provider.ToolDef, projectInstructions string) string
- func BuildUserContext(cfg SystemPromptConfig) string
- func FormatMemoryForPrompt(files []MemoryFileInfo, projectDir string) string
- func GetGitStatus(workDir string) string
- func IsGitRepo(workDir string) bool
- type MemoryFileInfo
- type MemoryType
- type SystemPromptConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFullSystemPrompt ¶
func BuildFullSystemPrompt(cfg SystemPromptConfig, tools []provider.ToolDef) string
BuildFullSystemPrompt 使用 SystemPromptConfig 构建完整系统提示词(新接口) 包含多层级 XINCODE.md 发现、完整环境信息
func BuildSystemContext ¶
func BuildSystemContext(cfg SystemPromptConfig) string
BuildSystemContext 构建系统上下文(git status 等) CC 参考:getSystemContext()
func BuildSystemPrompt ¶
BuildSystemPrompt 构建完整系统提示词(保持旧接口兼容) 结构对标 CC src/constants/prompts.ts 分层:Identity → System → Doing Tasks → Tools → Tone
func BuildUserContext ¶
func BuildUserContext(cfg SystemPromptConfig) string
BuildUserContext 构建用户上下文(注入为首条 user message 的 system-reminder) CC 参考:getUserContext() + prependUserContext()
func FormatMemoryForPrompt ¶
func FormatMemoryForPrompt(files []MemoryFileInfo, projectDir string) string
FormatMemoryForPrompt 将所有发现的文件格式化为系统提示词的一部分 CC 参考:getUserContext() 中 claudeMd 的格式
func GetGitStatus ¶
GetGitStatus 采集 git 状态,格式对标 CC context.ts 的 getGitStatus() 返回空字符串表示不在 git 仓库中
Types ¶
type MemoryFileInfo ¶
type MemoryFileInfo struct {
Path string // 绝对路径
Type MemoryType // 来源层级
Content string // 文件内容(含 @include 展开后)
}
MemoryFileInfo 表示一个已发现的配置/记忆文件
func DiscoverMemoryFiles ¶
func DiscoverMemoryFiles(projectDir, homeDir string) []MemoryFileInfo
DiscoverMemoryFiles 按优先级发现所有配置文件 加载顺序(低 → 高优先级):managed → user → project → rules → local CC 参考:src/utils/claudemd.ts — getClaudeMds()
type MemoryType ¶
type MemoryType string
MemoryType 配置文件来源层级 CC 参考:src/utils/claudemd.ts — MemoryType
const ( MemoryTypeManaged MemoryType = "managed" // /etc/xincode/XINCODE.md(系统级) MemoryTypeUser MemoryType = "user" // ~/.xincode/XINCODE.md(用户级) MemoryTypeProject MemoryType = "project" // ./XINCODE.md, .xincode/XINCODE.md, .xincode/rules/*.md MemoryTypeLocal MemoryType = "local" // ./XINCODE.local.md(不提交 git 的个人配置) MemoryTypeAutoMem MemoryType = "automem" // ~/.xincode/projects/{hash}/memory/ )