link cleared sessions back to the conversation they continue
/clear starts a new claude session and the list showed it as an unrelated conversation. claude records no parent link anywhere — not in compactMetadata, logicalParentUuid, summary.leafUuid, the per-session slug, or the live process registry — so infer it: a cleared transcript opens with /clear, and /clear happens inside one process, so the parent is the conversation in the same group that was writing to disk at the instant this one began (4ms apart, measured). matching is on per-minute activity rather than updatedAt, because resuming a parent moves its end time past its child's birth and lost the link entirely for two of the three cleared sessions here. the window is symmetric because clearing makes claude summarise the conversation it is ending, so the parent's final record can land after the child's first. ambiguity fails closed — the wrong parent also renames the conversation. read-only: nothing is written back to claude's store, and an explicit title always wins. also: cleared sessions were titled "<command-name>/clear</command-name>" because claude does not set isMeta on slash commands; and the chat header was hardcoded to undefined, so it read "New chat" above every conversation you opened. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,9 @@ import { useAuth } from 'hooks/useAuth';
|
||||
|
||||
const SESSIONS_KEY = 'CLAUDE_SESSIONS';
|
||||
|
||||
/** The conversation a session continues. Server-inferred — see `applyLineage` in claude-sessions.ts. */
|
||||
export type ClaudeSessionOrigin = { id: string; title: string };
|
||||
|
||||
export type ClaudeSessionSummary = {
|
||||
id: string; // Claude session uuid (= transcript filename)
|
||||
title: string;
|
||||
@@ -13,6 +16,14 @@ export type ClaudeSessionSummary = {
|
||||
updatedAt: string;
|
||||
messageCount: number;
|
||||
harness?: 'claude' | 'opencode'; // which harness produced it (absent = claude)
|
||||
/** This conversation was opened by `/clear`ing another one. */
|
||||
bornFromClear?: boolean;
|
||||
/**
|
||||
* The conversation this one continues, when the server could identify it. Absent means either not a
|
||||
* continuation or a continuation whose parent could not be named with confidence — the two are
|
||||
* deliberately indistinguishable here, because a guess is worth nothing to the reader.
|
||||
*/
|
||||
continuedFrom?: ClaudeSessionOrigin | null;
|
||||
};
|
||||
|
||||
// Display-ready message, matching the frontend ChatMessage union (rebuilt from Claude's transcript).
|
||||
@@ -35,6 +46,10 @@ export type ClaudeSessionDetail = {
|
||||
messages: ClaudeSessionMessage[];
|
||||
total: number; // full transcript length (the loaded messages may be a tail window)
|
||||
offset: number; // absolute index of messages[0]; older messages remain above when > 0
|
||||
/** The title the list shows this session under, so the open conversation is labelled the same way. */
|
||||
title?: string | null;
|
||||
/** The conversation this one continues, if any — so an open chat can link back to what preceded it. */
|
||||
continuedFrom?: ClaudeSessionOrigin | null;
|
||||
};
|
||||
|
||||
export type ClaudePwd = { cwd: string; sessionCount: number; updatedAt: string; isDefault: boolean };
|
||||
|
||||
Reference in New Issue
Block a user