reminder

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package reminder 提供 Coordinator 的每轮 system-reminder 生成逻辑。

设计原则(对应 docs/refactor-v2.md 铁律二):

  • 纯函数:每个 Generator 只读 store 状态,不产生副作用
  • 原子语义:单条 reminder 只回答"一个问题",避免一条 reminder 承担多职责
  • 成本敏感:reminder 只在确有指引价值时生成,空字符串直接跳过

工具链:agentcore.ReminderGenerator 会在每 turn 调用 Generate; 最终 reminder 作为一次性 system 消息注入到 LLM 请求里。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggregate

func Aggregate(st *store.Store, gens ...Generator) agentcore.ReminderGenerator

Aggregate 把一组 Generator 组合成 agentcore.ReminderGenerator。 每 turn 先拉 store 快照,再按注册顺序逐个询问,相同 Source 后覆盖先。

func NewArchitectStopGuard

func NewArchitectStopGuard(st *store.Store) agentcore.StopGuard

NewArchitectStopGuard 要求 architect 本轮至少落盘一次 save_foundation。

func NewEditorStopGuard

func NewEditorStopGuard(st *store.Store) agentcore.StopGuard

NewEditorStopGuard 要求 editor 本轮至少落盘一次审阅或摘要。

func NewStopGuard

func NewStopGuard(st *store.Store, onBlock func(reason string, consecutive int32)) agentcore.StopGuard

NewStopGuard 构造 Coordinator 专用 StopGuard。 onBlock 可选,非 nil 时每次阻拦调一次,用于审计。

func NewWriterStopGuard

func NewWriterStopGuard(st *store.Store) agentcore.StopGuard

NewWriterStopGuard 要求 writer 本轮至少产生一次成功的 commit_chapter。

Types

type Generator

type Generator interface {
	Source() string
	Generate(ctx context.Context, state State) string
}

Generator 是每轮 reminder 生成函数的抽象。 返回空字符串表示本轮不注入该 reminder。

func Default

func Default() []Generator

Default 返回默认启用的全部 Generator,按注入优先级排列。 排在前面的 Generator 产出在最终消息里靠前。

type State

type State struct {
	Progress *domain.Progress
	// LatestGlobalCheckpoint 是最近一次全局级 checkpoint,用于感知弧/卷结束、重写完成等事件。
	LatestGlobalCheckpoint *domain.Checkpoint
	// ArcHandoffPending 为 true 表示当前弧已全部写完但 arc_summary 尚未归档,
	// 此时 Coordinator 必须先按 coordinator.md 的弧结束流程交接,再派写下一章。
	ArcHandoffPending bool
	// FoundationMissing 是基础设定中尚缺的项(premise/outline/characters/world_rules/compass)。
	FoundationMissing []string
	TurnIndex         int
}

State 是 Generator 在本轮可读的 store 快照。 快照在每 turn 开头一次性拉取,避免每个 Generator 都独立读 store。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL