Files
wangdefa f782b612ec build: 内置 norma 模块,构建不再依赖上游仓库
把 github.com/Autumn-27/norma v0.4.3(commit 320ae32)的源码复制到
third_party/norma,并用 go.mod 的 replace 指向本地副本。上游删除仓库或
改写 tag 都不再影响本仓库构建。

- 已验证 GOPROXY=off 下可完整编译并打出发行包
- go.sum 中该模块的两条校验记录随之删除(本地 replace 不需要哈希)
- 升级方法与授权注意事项见 third_party/README.md
2026-10-20 21:10:41 -07:00

37 lines
2.0 KiB
Go

package llm
import "strings"
// Todo-reminder messages re-surface the current todo list as standing guidance
// when the model hasn't touched TodoWrite in a while. Like the skill-invocation
// message, it is a self-identifying <system-reminder> user message: the harness
// derives its throttle ("turns since last reminder") by scanning history for it,
// and it is regenerated from live state each eligible turn so it survives
// compaction. Mirrors claude-code's todo_reminder attachment.
// todoReminderLead is the fixed nag text — also the detection sentinel (a normal
// user message is exceedingly unlikely to contain this exact system phrasing).
const todoReminderLead = "The TodoWrite tool hasn't been used recently. If you're working on tasks that would benefit from tracking progress, consider using the TodoWrite tool to track progress. Also consider cleaning up the todo list if it has become stale and no longer matches what you are working on. Only use it if it's relevant to the current work. This is just a gentle reminder - ignore if not applicable. Make sure that you NEVER mention this reminder to the user."
// TodoReminderMessage builds the <system-reminder> user message carrying the
// current todo list. listText is the rendered list (see tool.RenderTodoReminder).
func TodoReminderMessage(listText string) Message {
var b strings.Builder
b.WriteString("<system-reminder>\n")
b.WriteString(todoReminderLead)
b.WriteString("\n\nHere are the existing contents of your todo list:\n\n")
b.WriteString(listText)
b.WriteString("\n</system-reminder>")
return Message{Role: RoleUser, Content: []ContentBlock{TextBlock(b.String())}}
}
// IsTodoReminder reports whether m is a todo-reminder message (used to derive the
// throttle "turns since last reminder").
func IsTodoReminder(m Message) bool {
if m.Role != RoleUser || len(m.Content) != 1 || m.Content[0].Type != BlockText {
return false
}
t := m.Content[0].Text
return strings.HasPrefix(t, "<system-reminder>") && strings.Contains(t, todoReminderLead)
}