MCPcopy Create free account
hub / github.com/codeaashu/claude-code / analyzeSectionSizes

Function analyzeSectionSizes

src/services/SessionMemory/prompts.ts:134–159  ·  view source on GitHub ↗

* Parse the session memory file and analyze section sizes

(content: string)

Source from the content-addressed store, hash-verified

132 * Parse the session memory file and analyze section sizes
133 */
134function analyzeSectionSizes(content: string): Record<string, number> {
135 const sections: Record<string, number> = {}
136 const lines = content.split('\n')
137 let currentSection = ''
138 let currentContent: string[] = []
139
140 for (const line of lines) {
141 if (line.startsWith('# ')) {
142 if (currentSection && currentContent.length > 0) {
143 const sectionContent = currentContent.join('\n').trim()
144 sections[currentSection] = roughTokenCountEstimation(sectionContent)
145 }
146 currentSection = line
147 currentContent = []
148 } else {
149 currentContent.push(line)
150 }
151 }
152
153 if (currentSection && currentContent.length > 0) {
154 const sectionContent = currentContent.join('\n').trim()
155 sections[currentSection] = roughTokenCountEstimation(sectionContent)
156 }
157
158 return sections
159}
160
161/**
162 * Generate reminders for sections that are too long

Callers 1

Calls 2

pushMethod · 0.45

Tested by

no test coverage detected