Documentation
¶
Index ¶
- Constants
- func CancelAllBackgroundReviews()
- func CountUserTurns(messages []agentkit.ModelMessage) int
- func DecideMemoryNudge(interval int, messages []agentkit.ModelMessage, prior NudgeSessionState, ...) (MemoryNudgeDecision, NudgeSessionState)
- func DigestMessages(messages []agentkit.ModelMessage, limit int) string
- func FormatSkillsPolicyStatus(skillsMode string, fromFile bool) string
- func RegisterGlobalReviewRuns(r *ReviewRunRegistry)
- func TruncateEllipsis(s string, max int) string
- func TurnSegmentUsedMemoryTool(messages []agentkit.ModelMessage) bool
- type CaptureInput
- type CaptureOutput
- type MemoryNudgeDecision
- type NudgeFile
- type NudgeSessionState
- type NudgeStore
- type QuotaStore
- type ReviewConfig
- type ReviewQuota
- type ReviewResult
- type ReviewRunRegistry
- type SkillsPolicy
- type SkillsPolicyStore
Constants ¶
const DefaultMemoryNudgeInterval = 10
DefaultMemoryNudgeInterval is Hermes memory.nudge_interval (user turns between background memory reviews).
Variables ¶
This section is empty.
Functions ¶
func CancelAllBackgroundReviews ¶ added in v0.3.13
func CancelAllBackgroundReviews()
CancelAllBackgroundReviews stops every in-flight review (runner shutdown).
func CountUserTurns ¶ added in v0.3.14
func CountUserTurns(messages []agentkit.ModelMessage) int
CountUserTurns counts user-role messages with non-empty text (slash commands still count as turns).
func DecideMemoryNudge ¶ added in v0.3.14
func DecideMemoryNudge( interval int, messages []agentkit.ModelMessage, prior NudgeSessionState, hydrateFromHistory bool, ) (MemoryNudgeDecision, NudgeSessionState)
DecideMemoryNudge applies Hermes-style cadence: increment per completed user turn; reset when memory tool ran; run review when turnsSince >= interval. interval <= 0 disables automatic memory review.
func DigestMessages ¶ added in v0.3.13
func DigestMessages(messages []agentkit.ModelMessage, limit int) string
DigestMessages formats recent model-visible messages for the review prompt.
func FormatSkillsPolicyStatus ¶ added in v0.3.14
FormatSkillsPolicyStatus renders /learn policy output.
func RegisterGlobalReviewRuns ¶ added in v0.3.13
func RegisterGlobalReviewRuns(r *ReviewRunRegistry)
RegisterGlobalReviewRuns wires an alternate registry into process shutdown (tests only). Production code uses GlobalReviewRuns.
func TruncateEllipsis ¶ added in v0.3.14
TruncateEllipsis shortens s to at most max bytes and appends an ellipsis rune.
func TurnSegmentUsedMemoryTool ¶ added in v0.3.14
func TurnSegmentUsedMemoryTool(messages []agentkit.ModelMessage) bool
TurnSegmentUsedMemoryTool reports whether the current turn (since the last user message) invoked memory.
Types ¶
type CaptureInput ¶ added in v0.3.13
type CaptureInput = caplearning.CaptureInput
type CaptureOutput ¶ added in v0.3.13
type CaptureOutput = caplearning.CaptureOutput
func ApplyCapture ¶ added in v0.3.13
func ApplyCapture(ctx context.Context, mem capmemory.Capture, skills caplearning.SkillProposer, sessionID string, in CaptureInput) (CaptureOutput, error)
ApplyCapture applies one learn_capture action via memory capture + skill proposer.
type MemoryNudgeDecision ¶ added in v0.3.14
MemoryNudgeDecision is whether to spawn background memory review after this turn.
type NudgeFile ¶ added in v0.3.14
type NudgeFile struct {
Sessions map[string]NudgeSessionState `json:"sessions"`
}
NudgeFile maps session IDs to nudge counters (per tenant workspace file).
type NudgeSessionState ¶ added in v0.3.14
type NudgeSessionState = caplearning.NudgeSessionState
NudgeSessionState tracks background memory review cadence for one conversation.
type NudgeStore ¶ added in v0.3.14
type NudgeStore struct {
Path string
}
NudgeStore persists per-session memory review cadence.
func (*NudgeStore) LoadSession ¶ added in v0.3.14
func (s *NudgeStore) LoadSession(sessionID string) (NudgeSessionState, bool, error)
func (*NudgeStore) SaveSession ¶ added in v0.3.14
func (s *NudgeStore) SaveSession(sessionID string, st NudgeSessionState) error
type QuotaStore ¶ added in v0.3.13
type QuotaStore struct {
Path string
}
QuotaStore persists review_quota.json under memory/dreaming/.
func (*QuotaStore) TryConsume ¶ added in v0.3.13
type ReviewConfig ¶ added in v0.3.13
type ReviewConfig struct {
MaxSteps int
MaxDigestMessages int
// SessionRecall is optional FTS hits from prior sessions (appended to the digest).
SessionRecall string
// SignalCandidates is optional grounded dreaming signals for consolidation.
SignalCandidates string
}
ReviewConfig controls the background review LLM loop.
type ReviewQuota ¶ added in v0.3.13
ReviewQuota tracks per-day background review runs for throttling.
type ReviewResult ¶ added in v0.3.13
type ReviewResult struct {
Summary string
Steps int
InputTokens int
OutputTokens int
Cancelled bool
// Notices are user-visible lines from successful learn_capture memory/skill actions.
Notices []string
}
ReviewResult summarizes one background review run.
func RunReview ¶ added in v0.3.13
func RunReview( ctx context.Context, cfg ReviewConfig, llm agentkit.LLMProvider, tools agentkit.ToolRuntime, model string, transcript []agentkit.ModelMessage, ) (*ReviewResult, error)
RunReview executes a isolated tool loop against the conversation digest.
type ReviewRunRegistry ¶ added in v0.3.13
type ReviewRunRegistry struct {
// contains filtered or unexported fields
}
ReviewRunRegistry cancels in-flight background reviews (per session + global shutdown).
func GlobalReviewRuns ¶ added in v0.3.13
func GlobalReviewRuns() *ReviewRunRegistry
GlobalReviewRuns is the process-wide registry used by hook/background-review.
func (*ReviewRunRegistry) Begin ¶ added in v0.3.13
func (r *ReviewRunRegistry) Begin(parent context.Context, sessionKey string) (context.Context, context.CancelFunc)
func (*ReviewRunRegistry) CancelAll ¶ added in v0.3.13
func (r *ReviewRunRegistry) CancelAll()
func (*ReviewRunRegistry) End ¶ added in v0.3.13
func (r *ReviewRunRegistry) End(sessionKey string)
type SkillsPolicy ¶ added in v0.3.14
type SkillsPolicy struct {
SkillsMode string `json:"skillsMode,omitempty"` // off | propose | auto
}
SkillsPolicy is tenant-local skill workshop capture mode.
func (SkillsPolicy) Normalized ¶ added in v0.3.14
func (p SkillsPolicy) Normalized() SkillsPolicy
type SkillsPolicyStore ¶ added in v0.3.14
type SkillsPolicyStore struct {
Path string
}
SkillsPolicyStore persists learning/policy.json (relative to memory root).
func (*SkillsPolicyStore) Load ¶ added in v0.3.14
func (s *SkillsPolicyStore) Load() (SkillsPolicy, error)
func (*SkillsPolicyStore) Save ¶ added in v0.3.14
func (s *SkillsPolicyStore) Save(p SkillsPolicy) error