utils/analyze/analyze_context library
Context analysis for conversations.
Ported from neomage/src/utils/analyzeContext.ts (1382 LOC).
Classes
- AgentInfo
- Information about a custom agent.
- ApiUsage
- API usage from last response.
- AttachmentsByType
- Breakdown of attachment tokens by type.
- ContextAnalyzer
- Analyzes context window usage and provides visualization data.
- ContextCategory
- A category of context usage.
- ContextData
- Complete context analysis data.
- DeferredBuiltinTool
- Information about a deferred builtin tool.
- GridSquare
- A single square in the context grid visualization.
- McpTool
- Information about an MCP tool in context.
- MemoryFile
- Information about a memory file in context.
- MessageBreakdown
- Message breakdown detail.
- SkillFrontmatter
- Individual skill detail for context display.
- SkillInfo
- Information about skills included in the context window.
- SlashCommandInfo
- Slash command info for context display.
- SystemPromptSectionDetail
- Information about a system prompt section.
- SystemToolDetail
- Information about a system tool.
- ToolCallsByType
- Breakdown of token usage by tool type.
Constants
- autocompactBufferTokens → const int
- Default autocompact buffer tokens.
- manualCompactBufferTokens → const int
- Default manual compact buffer tokens.
- toolTokenCountOverhead → const int
- Fixed token overhead added by the API when tools are present.