Skip to content

Commit 75b01da

Browse files
btuckerclaude
andcommitted
Treat skill expansions (isMeta) as continuations for prompt numbering
Skill expansion messages have isMeta=True in JSONL sessions. These are system-injected, not user-typed prompts. They should be treated as continuations of the previous conversation for prompt numbering purposes. This fixes the code viewer showing all blame as "prompt simonw#2" when a skill was invoked - now all operations are correctly attributed to prompt #1 (the original user request to invoke the skill). - Preserve isMeta field in JSONL parsing - Treat isMeta entries like isCompactSummary (continuations) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7ebad63 commit 75b01da

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/claude_code_transcripts/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,10 @@ def _parse_jsonl_file(filepath):
622622
if obj.get("isCompactSummary"):
623623
entry["isCompactSummary"] = True
624624

625+
# Preserve isMeta if present (skill expansions, not real user prompts)
626+
if obj.get("isMeta"):
627+
entry["isMeta"] = True
628+
625629
# Preserve toolUseResult if present (needed for originalFile content)
626630
if "toolUseResult" in obj:
627631
entry["toolUseResult"] = obj["toolUseResult"]
@@ -1199,6 +1203,7 @@ def generate_html(
11991203
log_type = entry.get("type")
12001204
timestamp = entry.get("timestamp", "")
12011205
is_compact_summary = entry.get("isCompactSummary", False)
1206+
is_meta = entry.get("isMeta", False)
12021207
message_data = entry.get("message", {})
12031208
if not message_data:
12041209
continue
@@ -1215,11 +1220,12 @@ def generate_html(
12151220
if is_user_prompt:
12161221
if current_conv:
12171222
conversations.append(current_conv)
1223+
# isMeta entries (skill expansions) are continuations, not new prompts
12181224
current_conv = {
12191225
"user_text": user_text,
12201226
"timestamp": timestamp,
12211227
"messages": [(log_type, message_json, timestamp)],
1222-
"is_continuation": bool(is_compact_summary),
1228+
"is_continuation": bool(is_compact_summary or is_meta),
12231229
}
12241230
elif current_conv:
12251231
current_conv["messages"].append((log_type, message_json, timestamp))
@@ -1706,6 +1712,7 @@ def generate_html_from_session_data(
17061712
log_type = entry.get("type")
17071713
timestamp = entry.get("timestamp", "")
17081714
is_compact_summary = entry.get("isCompactSummary", False)
1715+
is_meta = entry.get("isMeta", False)
17091716
message_data = entry.get("message", {})
17101717
if not message_data:
17111718
continue
@@ -1722,11 +1729,12 @@ def generate_html_from_session_data(
17221729
if is_user_prompt:
17231730
if current_conv:
17241731
conversations.append(current_conv)
1732+
# isMeta entries (skill expansions) are continuations, not new prompts
17251733
current_conv = {
17261734
"user_text": user_text,
17271735
"timestamp": timestamp,
17281736
"messages": [(log_type, message_json, timestamp)],
1729-
"is_continuation": bool(is_compact_summary),
1737+
"is_continuation": bool(is_compact_summary or is_meta),
17301738
}
17311739
elif current_conv:
17321740
current_conv["messages"].append((log_type, message_json, timestamp))

0 commit comments

Comments
 (0)