Versions in this module Expand all Collapse all v0 v0.3.0 May 26, 2026 v0.2.1 May 26, 2026 Changes in this version + func CollapseRepeatedMessages(msgs []types.EyrieMessage) []types.EyrieMessage + func EstimateTokensFromContent(content string) int + func FormatContextItems(items []ContextItem) string + func PackingReport(result *PackingResult, strategy PackingStrategy, totalMessages int, ...) string + func SuggestFiles(projectDir string) []string + func SummarizeDropped(dropped []ScoredMessage) string + func TokenEstimate(content string) int + type ContextAllocation struct + Conversation int + Memory int + OutputReserve int + PreloadedFiles int + Remaining int + RepoMap int + SafetyMargin int + SystemPrompt int + ToolDefs int + Workspace int + type ContextBudget struct + Conversation int + Memory int + OutputReserve int + PreloadedFiles int + RepoMap int + SafetyMargin int + SystemPrompt int + ToolDefs int + Total int + Workspace int + func NewContextBudget(contextSize int) *ContextBudget + func (b *ContextBudget) Allocate(conversationTokens int) *ContextAllocation + func (b *ContextBudget) FilesBudget(conversationTokens int) int + func (b *ContextBudget) ShouldCompact(conversationTokens int) bool + func (b *ContextBudget) UsageReport(conversationTokens int) string + type ContextDecay struct + Entries []DecayEntry + HalfLife time.Duration + MinWeight float64 + func NewContextDecay(halfLife time.Duration) *ContextDecay + func (cd *ContextDecay) Access(id string) + func (cd *ContextDecay) Add(content, category string, tokens int) string + func (cd *ContextDecay) ApplyDecay() + func (cd *ContextDecay) BuildContext(maxTokens int) string + func (cd *ContextDecay) FormatEntries(entries []DecayEntry) string + func (cd *ContextDecay) Get(id string) (*DecayEntry, float64) + func (cd *ContextDecay) GetByBudget(maxTokens int) []DecayEntry + func (cd *ContextDecay) GetTopN(n int) []DecayEntry + func (cd *ContextDecay) Pin(id string) + func (cd *ContextDecay) Prune(minWeight float64) int + func (cd *ContextDecay) Stats() DecayStats + func (cd *ContextDecay) Unpin(id string) + type ContextFile struct + AddedAt time.Time + AutoRefresh bool + Content string + LastRefreshed time.Time + Path string + Pinned bool + TokenCount int + type ContextFileOption func(*ContextFile) + func WithAutoRefresh() ContextFileOption + func WithPinned() ContextFileOption + type ContextItem struct + Content string + Relevance float64 + Source string + Title string + TokenCount int + func PrioritizeItems(items []ContextItem, budget int) []ContextItem + type ContextManager struct + Providers []ContextProvider + TotalBudget int + func NewContextManager(totalBudget int) *ContextManager + func (cm *ContextManager) GatherAll(ctx context.Context, query string) ([]ContextItem, error) + func (cm *ContextManager) Register(provider ContextProvider) + type ContextPacker struct + MaxTokens int + ReservedForOutput int + Strategy PackingStrategy + SystemPromptTokens int + func NewContextPacker(maxTokens int) *ContextPacker + func (cp *ContextPacker) OptimalSelection(messages []ScoredMessage, budget int) []int + func (cp *ContextPacker) Pack(messages []ScoredMessage, currentTask string) *PackingResult + func (cp *ContextPacker) ScoreMessage(msg ScoredMessage, currentTask string, position int, total int) float64 + type ContextProvider interface + Description func() string + Gather func(ctx context.Context, query string) ([]ContextItem, error) + Name func() string + TokenBudget func() int + type ContextSection struct + Color string + Compressible bool + Items []VizContextItem + Name string + Percentage float64 + Tokens int + type ContextSnapshot struct + Compacted bool + Percentage float64 + TotalTokens int + Turn int + type ContextStats struct + BudgetUsed float64 + PinnedCount int + TotalFiles int + TotalTokens int + type ContextVisualizer struct + MaxTokens int + Sections []ContextSection + func NewContextVisualizer(maxTokens int) *ContextVisualizer + func (cv *ContextVisualizer) HistoryChart(snapshots []ContextSnapshot, width int) string + func (cv *ContextVisualizer) Recommend() []string + func (cv *ContextVisualizer) RenderBar(width int) string + func (cv *ContextVisualizer) RenderCompact() string + func (cv *ContextVisualizer) RenderDetailed() string + func (cv *ContextVisualizer) TakeSnapshot(turn int) ContextSnapshot + func (cv *ContextVisualizer) Update(sections []ContextSection) + func (cv *ContextVisualizer) WarnIfCritical() string + type DecayEntry struct + AccessCount int + Category string + Content string + CreatedAt time.Time + ID string + LastAccessed time.Time + Pinned bool + Tokens int + Weight float64 + type DecayStats struct + AvgWeight float64 + Newest time.Time + Oldest time.Time + PinnedCount int + TotalEntries int + TotalTokens int + type DependencyContextProvider struct + ProjectDir string + func (d *DependencyContextProvider) Description() string + func (d *DependencyContextProvider) Gather(ctx context.Context, query string) ([]ContextItem, error) + func (d *DependencyContextProvider) Name() string + func (d *DependencyContextProvider) TokenBudget() int + type EnvironmentContextProvider struct + func (e *EnvironmentContextProvider) Description() string + func (e *EnvironmentContextProvider) Gather(ctx context.Context, query string) ([]ContextItem, error) + func (e *EnvironmentContextProvider) Name() string + func (e *EnvironmentContextProvider) TokenBudget() int + type ErrorContextProvider struct + LogDir string + func (e *ErrorContextProvider) Description() string + func (e *ErrorContextProvider) Gather(ctx context.Context, query string) ([]ContextItem, error) + func (e *ErrorContextProvider) Name() string + func (e *ErrorContextProvider) TokenBudget() int + type FileContextProvider struct + MaxFiles int + RepoDir string + func (f *FileContextProvider) Description() string + func (f *FileContextProvider) Gather(ctx context.Context, query string) ([]ContextItem, error) + func (f *FileContextProvider) Name() string + func (f *FileContextProvider) TokenBudget() int + type GitContextProvider struct + MaxCommits int + RepoDir string + func (g *GitContextProvider) Description() string + func (g *GitContextProvider) Gather(ctx context.Context, query string) ([]ContextItem, error) + func (g *GitContextProvider) Name() string + func (g *GitContextProvider) TokenBudget() int + type PackingResult struct + DroppedMessages []int + KeptMessages []int + Summary string + TotalTokens int + Utilization float64 + type PackingStrategy string + const StrategyCompression + const StrategyHybrid + const StrategyRecent + const StrategyRelevance + type ReadOnlyContext struct + Files map[string]*ContextFile + MaxTokenBudget int + Patterns []string + func NewReadOnlyContext(maxBudget int) *ReadOnlyContext + func (rc *ReadOnlyContext) AddFile(path string, opts ...ContextFileOption) error + func (rc *ReadOnlyContext) AddPattern(pattern string) error + func (rc *ReadOnlyContext) BuildContextBlock() string + func (rc *ReadOnlyContext) Evict() []string + func (rc *ReadOnlyContext) IsReadOnly(path string) bool + func (rc *ReadOnlyContext) RefreshStale() error + func (rc *ReadOnlyContext) RemoveFile(path string) + func (rc *ReadOnlyContext) Stats() ContextStats + type ScoredMessage struct + Content string + Index int + MustKeep bool + Role string + Score float64 + Tokens int + type VizContextItem struct + Label string + Role string + Tokens int + Truncated bool