Skip to content

Commit 36fbc62

Browse files
authored
fix(client): Claude memory writes show as memory activity again (#927)
fix(client): show Claude memory writes as memory activity again The V2 orchestrator intake removed the memory group category and mobile's brain icon, and V2 file changes reach clients without a Write or Edit tool name, so memory writes rendered as plain file paths. An unnamed single-file change now counts as a write when classifying memory files. Web and mobile group, count, label, and icon memory writes again, including mobile's lone and live rows and group headers. Mobile keeps every path of a multi-file change, as web does. Tool calls that stopped without finishing are headed as stopped again; the check only recognized the V1 completion activity.
1 parent 70317fa commit 36fbc62

10 files changed

Lines changed: 236 additions & 65 deletions

File tree

‎.github/fork-features.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2268,19 +2268,24 @@ features:
22682268
- Claude, Codex, and OpenCode file edits retain structured paths, line statistics, lifecycle state, and provider-independent presentation without eagerly sending full diffs to clients.
22692269
- Folded completed turns summarize the categories of tools used with recognizable icons; web and desktop keep the activity counts and disclosure chevron aligned to the end of the row.
22702270
- Folded turn rows show no hover timestamp of their own, since the user message that starts the turn already reveals the same time.
2271-
- Claude project memory writes and index updates form a distinct work-log category on web and mobile; similarly named repository files remain ordinary edits.
2271+
- Claude project memory writes and index updates form a distinct work-log category on web and mobile, read as "Updated memory" rows, and count separately in group and folded-turn summaries, including projected file changes that name no tool; similarly named repository files remain ordinary edits.
22722272
- Page fetches read as "Fetched page" with their URL for Claude and ACP providers, and ACP workspace searches read and count as code searches rather than web lookups, including in historical threads.
22732273
rationale: Upstream V2 owns native item vocabulary, provider-attempt folds, read-path punctuation, and standalone compaction rows; the obsolete V1 aliases and activity inference are retired. The fork retains shared action labels, structured edit counts, findings cards, group summaries, approval details, and on-demand raw command output. Historical provider payloads remain frozen on V2 items so output lookup preserves imported details without reading the retired V1 activity projection.
22742274
implementation_paths:
22752275
- apps/mobile/src/features/threads/thread-work-log.tsx
22762276
- apps/server/src/orchestration-v2/CommandOutputQuery.ts
22772277
- apps/web/src/components/chat/MessagesTimeline.tsx
2278+
- packages/client-runtime/src/work-log/presentation.ts
2279+
- packages/shared/src/toolRowPresentation.ts
22782280
upstream_paths:
22792281
- apps/mobile/src/features/threads/thread-work-log.tsx
22802282
- apps/web/src/components/chat/MessagesTimeline.tsx
22812283
tests:
22822284
- apps/mobile/src/lib/threadActivity.test.ts
22832285
- apps/server/src/orchestration-v2/CommandOutputQuery.test.ts
2286+
- apps/web/src/components/chat/MessagesTimeline.logic.test.ts
2287+
- packages/client-runtime/src/work-log/presentation.test.ts
2288+
- packages/shared/src/toolRowPresentation.test.ts
22842289
upstream:
22852290
status: partial
22862291
tracking:

‎apps/mobile/src/features/threads/thread-work-log.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,9 +1599,9 @@ function toolGroupSummarySymbolName(kind: ToolGroupSummaryKind): AppSymbolName {
15991599
return { ios: "globe", android: "public" };
16001600
case "code-search":
16011601
return "magnifyingglass";
1602-
case "memory":
16031602
case "other":
16041603
return { ios: "wrench", android: "build" };
1604+
case "memory":
16051605
case "reasoning":
16061606
return { ios: "brain", android: "psychology" };
16071607
case "agent-tool":

‎apps/mobile/src/lib/threadActivity.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,40 @@ describe("buildThreadFeed", () => {
537537
expect(presented.some((entry) => entry.type === "run-fold")).toBe(false);
538538
});
539539

540+
it("labels Claude memory writes and keeps multi-file changes as edits", () => {
541+
const memoryPath = "/synthetic/.claude/projects/-demo/memory/first.md";
542+
const memoryWrite: OrchestrationV2TurnItem = {
543+
...base("memory-write", "2026-06-20T00:00:02.000Z", 1),
544+
type: "file_change",
545+
fileName: memoryPath,
546+
};
547+
const presented = deriveThreadFeedPresentation(
548+
buildThreadFeed([projected(userMessage(), 0), projected(memoryWrite, 1)]),
549+
{
550+
runId,
551+
status: "completed",
552+
startedAt: "2026-06-20T00:00:01.000Z",
553+
completedAt: "2026-06-20T00:00:05.000Z",
554+
},
555+
new Set([runId]),
556+
);
557+
expect(presented.find((entry) => entry.type === "work-toggle")).toMatchObject({
558+
summary: "Updated memory - first",
559+
});
560+
const multiFile: OrchestrationV2TurnItem = {
561+
...memoryWrite,
562+
...base("multi-file", "2026-06-20T00:00:03.000Z", 2),
563+
changes: [
564+
{ operation: "update", path: memoryPath },
565+
{ operation: "update", path: "/synthetic/repo/src/app.ts" },
566+
],
567+
} as OrchestrationV2TurnItem;
568+
const activities = buildThreadFeed([projected(memoryWrite, 0), projected(multiFile, 1)])
569+
.flatMap((entry) => (entry.type === "activity-group" ? entry.activities : []))
570+
.map((activity) => activity.icon);
571+
expect(activities).toEqual(["brain", "edit"]);
572+
});
573+
540574
it("presents a usage-limit stop as a warning while preserving its explanation", () => {
541575
const message = "Plan usage limit reached. Try again after reset.";
542576
const entries = buildThreadFeed([

‎apps/mobile/src/lib/threadActivity.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
resolveWorkEntryToolPresentation,
3333
summarizeToolGroup,
3434
toolGroupSummaryKind,
35+
memoryRowLabel,
36+
workEntryMemoryFileKind,
3537
type ToolGroupSummaryKind,
3638
type WorkLogPresentationEntry,
3739
type WorkLogToolLifecycleStatus,
@@ -326,6 +328,7 @@ export function workEntryRowLabel(entry: WorkLogPresentationEntry, expanded = fa
326328
if (presentation) return presentation.displayName;
327329
if (entry.command?.trim()) return compactWorkEntryText(commandDisplayText(entry.command));
328330
const action = toolGroupAction(entry);
331+
if (action === "memory") return memoryRowLabel(entry);
329332
const isToolRead = action === "read" && entry.itemType === "dynamic_tool";
330333
if (action === "code-search" || action === "search") {
331334
const toolData =
@@ -817,7 +820,7 @@ function toWorkLogEntry(
817820
case "file_change":
818821
return {
819822
...common,
820-
changedFiles: [item.fileName],
823+
changedFiles: item.changes?.map((change) => change.path) ?? [item.fileName],
821824
toolTitle: title ?? "File change",
822825
toolData: item,
823826
};
@@ -917,7 +920,7 @@ function toFeedActivity(
917920
fetchesDetail: turnItemNeedsDetailFetch(item),
918921
getFullDetail,
919922
getCopyText,
920-
icon: workEntry.toolSurface ?? itemIcon(item),
923+
icon: workEntry.toolSurface ?? (workEntryMemoryFileKind(workEntry) ? "brain" : itemIcon(item)),
921924
logo: toolPresentation?.logo ?? null,
922925
toolLike: itemIsToolLike(item),
923926
prominent: itemIsProminent(item) || (item.type === "error" && item.status === "failed"),
@@ -940,6 +943,7 @@ function singleToolCallLabel(activity: ThreadFeedActivity, expanded: boolean): s
940943
: compactWorkEntryText(activity.workEntry.detail ?? "") || "Thought";
941944
const presentation = resolveWorkEntryToolPresentation(activity.workEntry, "completed");
942945
if (presentation) return presentation.displayName;
946+
if (toolGroupAction(activity.workEntry) === "memory") return memoryRowLabel(activity.workEntry);
943947
const command = activity.workEntry.command?.trim();
944948
return command || activity.summary;
945949
}
@@ -1765,6 +1769,7 @@ function liveToolActivitySummary(activity: ThreadFeedActivity, presentTense: boo
17651769
toolLifecycleStatus: status,
17661770
});
17671771
if (presentation) return presentation.displayName;
1772+
if (toolGroupAction(activity.workEntry) === "memory") return memoryRowLabel(activity.workEntry);
17681773
const command = activity.workEntry.command?.trim();
17691774
if (command) {
17701775
const program = commandProgramName(command);

‎apps/web/src/components/chat/MessagesTimeline.logic.test.ts‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,76 @@ describe("deriveMessagesTimelineRows", () => {
15771577
expect(assistantRow?.assistantTurnDiffSummary).toBe(assistantTurnDiffSummary);
15781578
});
15791579

1580+
it("counts distinct agent memories separately from repo file edits in the turn fold", () => {
1581+
const memoryPath = "/synthetic/.claude/projects/-demo/memory/first.md";
1582+
const timelineEntries = [
1583+
{
1584+
id: "user-entry",
1585+
kind: "message" as const,
1586+
createdAt: "2026-01-01T00:00:00Z",
1587+
message: {
1588+
id: "user-memory" as never,
1589+
role: "user" as const,
1590+
text: "Remember this",
1591+
runId: null,
1592+
createdAt: "2026-01-01T00:00:00Z",
1593+
updatedAt: "2026-01-01T00:00:00Z",
1594+
streaming: false,
1595+
},
1596+
},
1597+
// Projected file changes name no tool, only the changed file.
1598+
...[
1599+
memoryPath,
1600+
memoryPath,
1601+
"/synthetic/.claude/projects/-demo/memory/second.md",
1602+
"/synthetic/.claude/projects/-demo/memory/MEMORY.md",
1603+
"/synthetic/docs/memory/design.md",
1604+
].map((path, index) => ({
1605+
id: `work-entry-${index}`,
1606+
kind: "work" as const,
1607+
createdAt: `2026-01-01T00:00:0${index + 1}Z`,
1608+
entry: {
1609+
id: `work-${index}`,
1610+
createdAt: `2026-01-01T00:00:0${index + 1}Z`,
1611+
runId: "turn-memory" as never,
1612+
label: `Changed ${path}`,
1613+
tone: "tool" as const,
1614+
itemType: "file_change" as const,
1615+
changedFiles: [path],
1616+
},
1617+
})),
1618+
{
1619+
id: "assistant-final-entry",
1620+
kind: "message" as const,
1621+
createdAt: "2026-01-01T00:00:06Z",
1622+
message: {
1623+
id: "assistant-memory" as never,
1624+
role: "assistant" as const,
1625+
text: "Remembered",
1626+
runId: "turn-memory" as never,
1627+
createdAt: "2026-01-01T00:00:06Z",
1628+
updatedAt: "2026-01-01T00:00:06Z",
1629+
streaming: false,
1630+
},
1631+
},
1632+
];
1633+
1634+
const rows = deriveMessagesTimelineRows({
1635+
timelineEntries,
1636+
isWorking: false,
1637+
activeTurnStartedAt: null,
1638+
turnDiffSummaries: [],
1639+
supportsConversationRollback: false,
1640+
});
1641+
1642+
expect(rows.find((row) => row.kind === "turn-fold")).toMatchObject({
1643+
activitySummary: [
1644+
{ kind: "file-change", count: 1 },
1645+
{ kind: "memory", count: 2 },
1646+
],
1647+
});
1648+
});
1649+
15801650
it("folds the first assistant message and settled work before the terminal response", () => {
15811651
const timelineEntries = [
15821652
{

‎apps/web/src/components/chat/MessagesTimeline.logic.ts‎

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import type { ReviewFindingsReport } from "@t3tools/shared/reviewFindings";
2-
import {
3-
isPreviewToolName,
4-
isWorkspaceSearchInput,
5-
memoryFileToolKind,
6-
memoryFileToolPath,
7-
} from "@t3tools/shared/toolRowPresentation";
2+
import { isPreviewToolName, isWorkspaceSearchInput } from "@t3tools/shared/toolRowPresentation";
83
import { worktreeSetupAgentStarted } from "@t3tools/client-runtime/worktree-setup";
94
export { worktreeSetupAgentStarted } from "@t3tools/client-runtime/worktree-setup";
105
import { isLiveSubagentTurnItem } from "@t3tools/client-runtime/state/subagentRuntime";
@@ -29,6 +24,9 @@ import {
2924
toolGroupSummaryKind,
3025
workEntryReviewFindings,
3126
workEntryIsStoppedToolCall,
27+
memoryRowLabel,
28+
workEntryMemoryFileKind,
29+
workEntryMemoryFilePath,
3230
type ToolGroupSummaryKind,
3331
} from "@t3tools/client-runtime/work-log/presentation";
3432
export {
@@ -148,6 +146,7 @@ export function workEntryDisplayLabel(entry: WorkLogEntry, workspaceRoot: string
148146
if (toolPresentation) return toolPresentation.displayName;
149147
if (entry.command?.trim()) return commandDisplayText(entry.command);
150148
const action = toolGroupAction(entry);
149+
if (action === "memory") return memoryRowLabel(entry);
151150
if (action === "code-search" || action === "search") {
152151
// Adapters title file searches with their target; the item keeps only the pattern.
153152
const searchLabel =
@@ -795,8 +794,7 @@ const TURN_FOLD_ACTIVITY_ORDER: ReadonlyArray<TurnFoldActivityKind> = [
795794
];
796795

797796
function turnFoldActivityKind(entry: WorkLogEntry): TurnFoldActivityKind | null {
798-
if (memoryFileToolKind(entry.toolName, workEntryToolInputRecord(entry), entry.changedFiles))
799-
return "memory";
797+
if (workEntryMemoryFileKind(entry)) return "memory";
800798
if (entry.requestKind === "command") return "terminal";
801799
if (entry.requestKind === "file-read") return "file-read";
802800
if (entry.requestKind === "file-change") return "file-change";
@@ -840,18 +838,8 @@ function summarizeTurnFoldActivity(entries: ReadonlyArray<TimelineEntry>) {
840838
if (entry.kind !== "work") continue;
841839
const kind = turnFoldActivityKind(entry.entry);
842840
if (kind === "memory") {
843-
const path = memoryFileToolPath(
844-
entry.entry.toolName,
845-
workEntryToolInputRecord(entry.entry),
846-
entry.entry.changedFiles,
847-
);
848-
if (
849-
memoryFileToolKind(
850-
entry.entry.toolName,
851-
workEntryToolInputRecord(entry.entry),
852-
entry.entry.changedFiles,
853-
) === "index"
854-
) {
841+
const path = workEntryMemoryFilePath(entry.entry);
842+
if (workEntryMemoryFileKind(entry.entry) === "index") {
855843
hasMemoryIndex = true;
856844
} else if (path) {
857845
memoryPaths.add(path);

‎packages/client-runtime/src/work-log/presentation.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
resolveViewedImageAsset,
1414
resolveWorkEntryToolPresentation,
1515
resolveWorkEntryToolRowPresentation,
16+
memoryRowLabel,
1617
summarizeToolGroup,
1718
toolGroupAction,
1819
toolGroupSummaryKind,
@@ -253,6 +254,29 @@ describe("summarizeToolGroup", () => {
253254
expect(toolGroupSummaryKind([thought])).toBe("reasoning");
254255
});
255256

257+
it("counts projected memory file changes as memory updates", () => {
258+
const fileChange = (id: string, path: string) =>
259+
entry(id, { label: `Changed ${path}`, itemType: "file_change", changedFiles: [path] });
260+
const memory = (name: string) =>
261+
fileChange(name, `/synthetic/.claude/projects/-demo/memory/${name}.md`);
262+
263+
expect(summarizeToolGroup([memory("first"), memory("first")]).summary).toBe("Updated 1 memory");
264+
expect(toolGroupSummaryKind([memory("first")])).toBe("memory");
265+
expect(
266+
summarizeToolGroup([
267+
memory("first"),
268+
memory("MEMORY"),
269+
fileChange("repo", "/synthetic/docs/memory/design.md"),
270+
]).summary,
271+
).toBe("Updated 1 memory and changed 1 file");
272+
expect(memoryRowLabel(memory("first"))).toBe("Updated memory - first");
273+
expect(memoryRowLabel(memory("MEMORY"))).toBe("Updated memory index");
274+
// A write the user interrupted never finished, so it must not claim an update.
275+
expect(memoryRowLabel({ ...memory("first"), toolLifecycleStatus: "stopped" })).toBe(
276+
"Edit stopped - first",
277+
);
278+
});
279+
256280
it("counts created threads alongside adjacent commands", () => {
257281
expect(
258282
summarizeToolGroup([

‎packages/client-runtime/src/work-log/presentation.ts‎

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ export function workEntryDisplayIndicatesToolFailure(entry: WorkLogPresentationE
548548
* killed. Clients show it as stopped rather than hiding it as still running.
549549
*/
550550
export function workEntryIsStoppedToolCall(entry: WorkLogPresentationEntry): boolean {
551-
return entry.sourceActivityKind === "tool.completed" && entry.toolLifecycleStatus === "stopped";
551+
return workLogEntryIsToolLike(entry) && entry.toolLifecycleStatus === "stopped";
552552
}
553553

554554
/** Decides whether the row can show a success marker. */
@@ -572,6 +572,32 @@ function workLogEntryIsLocalCodeSearch(entry: WorkLogPresentationEntry): boolean
572572
);
573573
}
574574

575+
/** The Claude memory file, or memory index, that the entry wrote. */
576+
export function workEntryMemoryFilePath(entry: WorkLogPresentationEntry) {
577+
return memoryFileToolPath(
578+
structuredWorkEntryToolName(entry),
579+
asRecord(workEntryToolInput(entry)) ?? undefined,
580+
entry.changedFiles,
581+
entry.itemType,
582+
);
583+
}
584+
585+
/** "Updated memory - <name>", or "Updated memory index" for MEMORY.md. */
586+
export function memoryRowLabel(entry: WorkLogPresentationEntry): string {
587+
const row = resolveWorkEntryToolRowPresentation(entry);
588+
if (!row) return entry.label;
589+
return row.argument ? `${row.heading} - ${row.argument.value}` : row.heading;
590+
}
591+
592+
export function workEntryMemoryFileKind(entry: WorkLogPresentationEntry) {
593+
return memoryFileToolKind(
594+
structuredWorkEntryToolName(entry),
595+
asRecord(workEntryToolInput(entry)) ?? undefined,
596+
entry.changedFiles,
597+
entry.itemType,
598+
);
599+
}
600+
575601
export function toolGroupAction(entry: WorkLogPresentationEntry): ToolGroupAction {
576602
if (entry.itemType === "thread_created") return "thread-create";
577603
const presentation = resolveWorkEntryToolPresentation(entry);
@@ -583,6 +609,7 @@ export function toolGroupAction(entry: WorkLogPresentationEntry): ToolGroupActio
583609
if (entry.itemType === "approval_request" || entry.itemType === "user_input_request") {
584610
return workLogEntryIsToolLike(entry) ? "other" : "update";
585611
}
612+
if (workEntryMemoryFileKind(entry)) return "memory";
586613
const data = asRecord(entry.toolData) ?? {};
587614
const toolName =
588615
entry.structuredPayload?.type === "dynamic_tool"
@@ -677,20 +704,8 @@ function toolGroupActionCount(
677704
if (action === "memory") {
678705
const memoryPaths = new Set<string>();
679706
for (const entry of entries) {
680-
if (
681-
memoryFileToolKind(
682-
workEntryToolName(entry),
683-
asRecord(workEntryToolInput(entry)) ?? undefined,
684-
entry.changedFiles,
685-
) !== "memory"
686-
) {
687-
continue;
688-
}
689-
const path = memoryFileToolPath(
690-
workEntryToolName(entry),
691-
asRecord(workEntryToolInput(entry)) ?? undefined,
692-
entry.changedFiles,
693-
);
707+
if (workEntryMemoryFileKind(entry) !== "memory") continue;
708+
const path = workEntryMemoryFilePath(entry);
694709
if (path) memoryPaths.add(path);
695710
}
696711
return memoryPaths.size;

0 commit comments

Comments
 (0)