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

Function formatTranscriptWithSummarization

src/commands/insights.ts:906–939  ·  view source on GitHub ↗
(
  log: LogOption,
)

Source from the content-addressed store, hash-verified

904}
905
906async function formatTranscriptWithSummarization(
907 log: LogOption,
908): Promise<string> {
909 const fullTranscript = formatTranscriptForFacets(log)
910
911 // If under 30k chars, use as-is
912 if (fullTranscript.length <= 30000) {
913 return fullTranscript
914 }
915
916 // For long transcripts, split into chunks and summarize in parallel
917 const CHUNK_SIZE = 25000
918 const chunks: string[] = []
919
920 for (let i = 0; i < fullTranscript.length; i += CHUNK_SIZE) {
921 chunks.push(fullTranscript.slice(i, i + CHUNK_SIZE))
922 }
923
924 // Summarize all chunks in parallel
925 const summaries = await Promise.all(chunks.map(summarizeTranscriptChunk))
926
927 // Combine summaries with session header
928 const meta = logToSessionMeta(log)
929 const header = [
930 `Session: ${meta.session_id.slice(0, 8)}`,
931 `Date: ${meta.start_time}`,
932 `Project: ${meta.project_path}`,
933 `Duration: ${meta.duration_minutes} min`,
934 `[Long session - ${chunks.length} parts summarized]`,
935 '',
936 ].join('\n')
937
938 return header + summaries.join('\n\n---\n\n')
939}
940
941async function loadCachedFacets(
942 sessionId: string,

Callers 1

extractFacetsFromAPIFunction · 0.85

Calls 3

logToSessionMetaFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected