Skip to content

Commit e3ca9aa

Browse files
IM.codesclaude
andcommitted
fix: memory summary shows source events + default expanded content
buildSummary now always includes raw source event content under a "Source events" section, so users can see both the compressed summary AND the original pre-compression data. Previously only the summary was shown, and source events were lost after processing. MemoryRecordContent now defaults to expanded when content is short enough (not collapsible), so summaries are immediately visible without clicking. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ab27658 commit e3ca9aa

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/context/materialization-coordinator.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,15 @@ function buildSummary(events: LocalContextEvent[]): string {
223223
if (decisions.length > 0) {
224224
sections.push(`- Key decisions: ${decisions.join('; ')}`);
225225
}
226-
// Fallback: include raw event content when no structured pairs/decisions were extracted
227-
if (turnPairs.length === 0 && decisions.length === 0) {
228-
for (const event of events) {
229-
const content = event.content?.trim();
230-
if (content) {
231-
sections.push(`- [${event.eventType}] ${content.length > 500 ? content.slice(0, 500) + '…' : content}`);
232-
}
226+
// Always include raw source events so the user can see pre-compression content
227+
sections.push(`\n---\n**Source events (${events.length}):**`);
228+
for (const event of events) {
229+
const content = event.content?.trim();
230+
if (content) {
231+
const truncated = content.length > 800 ? content.slice(0, 800) + '…' : content;
232+
sections.push(`- \`${event.eventType}\`: ${truncated}`);
233233
}
234234
}
235-
sections.push(`\nCompressed from ${events.length} event${events.length === 1 ? '' : 's'}.`);
236235
return sections.join('\n');
237236
}
238237

web/src/components/SharedContextManagementPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,11 +1927,12 @@ function MemoryRecordContent({
19271927
t: (key: string) => string;
19281928
}) {
19291929
const collapsible = shouldCollapseMemoryContent(text);
1930+
const showExpanded = expanded || !collapsible;
19301931
return (
19311932
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
19321933
<div
19331934
data-testid={`memory-record-content-${id}`}
1934-
style={expanded ? memoryContentExpandedStyle : memoryContentCollapsedStyle}
1935+
style={showExpanded ? memoryContentExpandedStyle : memoryContentCollapsedStyle}
19351936
>
19361937
<ChatMarkdown text={text} />
19371938
</div>

0 commit comments

Comments
 (0)