Total Cost
{{ format_cost(session.total_cost) }}
{% if show_source_split and (session.bedrock_cost or session.api_cost) %}
{% if session.bedrock_cost %}Bedrock {{ format_cost(session.bedrock_cost) }}{% endif %}
{% if session.api_cost %}API {{ format_cost(session.api_cost) }}{% endif %}
{% endif %}
Turns
{{ session.message_count }}
Input
{{ format_tokens(session.total_input_tokens) }}
Output
{{ format_tokens(session.total_output_tokens) }}
Cache Write
{{ format_tokens(session.total_cache_write_tokens) }}
Cache Read
{{ format_tokens(session.total_cache_read_tokens) }}
{% for ex in exchanges %}
{% if ex.type == "compaction" %}
{% set ev = ex.event %}
{% set _pre_k = (ev.pre_tokens // 1000) %}
{% set _post_k = (ev.post_tokens // 1000) %}
{% set _dur_s = (ev.duration_ms // 1000) %}
{% set _dur_m = (_dur_s // 60) %}
{% set _dur_rem = (_dur_s % 60) %}
{% set _tip = "Context compacted (" ~ ev.trigger ~ "): " ~ _pre_k ~ "K → " ~ _post_k ~ "K tokens · " ~ (_dur_m ~ "m " ~ _dur_rem ~ "s" if _dur_m else _dur_s ~ "s") ~ ". Cost of this API call is not tracked." %}
compact ⓘ
{% elif ex.type == "away_summary" %}
{% set ev = ex.event %}
{{ ev.content }}
{% elif ex.type == "fork_point" %}
⑂ Fork Point · New turns in this session begin here (+{{ ex.new_turns }} turn{% if ex.new_turns != 1 %}s{% endif %} · +{{ format_cost(ex.inc_cost) }})
{% elif ex.type == "unlinked_subagent" %}
{% set sa = ex.subagent %}
⚡
Background Workflow: {{ sa.description or "Agent Run" }} ({{ sa.turns|length }} step{% if sa.turns|length > 1 %}s{% endif %})
{{ sa.timestamp[:19].replace("T", " ") }}
{{ format_cost(sa.total_cost) }}
{# Hoist all commentary (text blocks) into a collapsible section #}
{% set ns_sa = namespace(has_text=false) %}
{% for st in sa.turns %}{% if st.text_blocks %}{% set ns_sa.has_text = true %}{% endif %}{% endfor %}
{% if ns_sa.has_text %}
{% endif %}
{# Tool calls listed cleanly #}
{% for st in sa.turns %}
{% for tu in st.tool_uses %}
🔧
{{ tu.name }}
{% set sa_input = tu.get("input", {}) %}
{% if sa_input.get("url") %}{{ sa_input.get("url","")[:100] }}
{% elif sa_input.get("file_path") %}{{ sa_input.get("file_path","") }}
{% elif sa_input.get("query") %}{{ sa_input.get("query","")[:100] }}
{% elif sa_input.get("prompt") %}{{ sa_input.get("prompt","")[:100] }}{% endif %}
{{ sa_input | tojson(indent=2) }}
{% if tu.get("result") %}
Result
{% for item in tu.get("result", []) %}
{% if item.get("type") == "text" %}
{{ item.get("text","") }}{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
{% set ex_date = (ex.user_turn.timestamp[:10] if ex.user_turn and ex.user_turn.timestamp else (ex.final_turn.timestamp[:10] if ex.final_turn and ex.final_turn.timestamp else "")) %}
{# ── Vertical spine that runs through the whole exchange ── #}
{# ── User Bubble ── #}
{% if ex.user_turn and (ex.user_turn.user_prompt_full or ex.user_turn.user_prompt) %}
User
{{ ex.user_turn.timestamp[:19].replace("T", " ") }}
{{ (ex.user_turn.user_prompt_full or ex.user_turn.user_prompt) | markdown }}
{% endif %}
{# ── Agent Steps (vertical sub-timeline) ── #}
{% set all_steps = [] %}
{% if ex.user_turn %}{% set _ = all_steps.append(ex.user_turn) %}{% endif %}
{% for step in ex.intermediate_turns %}{% set _ = all_steps.append(step) %}{% endfor %}
{% if all_steps|length > 0 %}
{% set ns_agent = namespace(cost=0.0, duration=0.0, has_sub=false) %}
{% for step in all_steps %}
{% set ns_agent.cost = ns_agent.cost + step.cost_usd %}
{% set ns_agent.duration = ns_agent.duration + step.duration_seconds %}
{% if step.tool_calls or step.assistant_content %}
{% set ns_agent.has_sub = true %}
{% endif %}
{% endfor %}
{# Dot on the spine #}
{# Agent summary row — always visible, click to expand #}
🤖
Agent Workflow ({{ all_steps|length }} step{% if all_steps|length > 1 %}s{% endif %})
{{ format_cost(ns_agent.cost) }}
{% if ns_agent.duration > 0 %}{{ format_duration(ns_agent.duration) }}{% endif %}
{% if ns_agent.has_sub %}
{% for step in all_steps %}
{% set step_idx = loop.index0 %}
{# 1. Render incoming results for the very first step in the exchange (orphaned from previous exchange) #}
{% if loop.first %}
{% for tc in step.tool_calls %}
📥
Result: {{ tc.name }}
{% if tc.input and tc.input.get("file_path") %}{{ tc.input.get("file_path") }}{% endif %}
{% if tc.result_content %}
{% for item in tc.result_content %}
{% if item.get("type") == "text" %}
{{ item.get("text","") }}
{% elif item.get("type") == "tool_reference" %}
[tool_reference: {{ item.get("tool_name","") }}]
{% endif %}
{% endfor %}
{% else %}
No result content
{% endif %}
{% endfor %}
{% endif %}
{# 2. Assistant content IN ORIGINAL API ORDER, pulling Results to their Calls #}
{% set step_idx = loop.index0 %}
{% for block in step.assistant_content %}
{% if block.get("type") == "thinking" and block.get("thinking", "")|length > 0 %}
🧠
Thinking
{{ block.get("thinking","")|length }} chars
{{ block.get("thinking","") }}
{% elif block.get("type") == "text" and block.get("text", "").strip() %}
{{ block.get("text","").strip().split("\n")[0][:120] }}
{% elif block.get("type") == "tool_use" %}
{# 3. IMMEDIATELY find and render the matching result from the next step! #}
{% if step_idx + 1 < all_steps|length %}
{% for tc in all_steps[step_idx + 1].tool_calls %}
{% if tc.tool_use_id == block.get("id") %}
{% if tc.subagent %}
{# Subagent result: render full drill-down of subagent turns #}
🤖
{{ tc.subagent.description or tc.name }}
{{ tc.subagent.total_tool_uses }} tool calls · {{ tc.subagent.agent_type }}
{% if tc.subagent.total_cost %}·{{ format_cost(tc.subagent.total_cost) }}{% endif %}
{# Hoist all commentary (text blocks) into a single collapsible section #}
{% set ns_sa = namespace(has_text=false) %}
{% for st in tc.subagent.turns %}{% if st.text_blocks %}{% set ns_sa.has_text = true %}{% endif %}{% endfor %}
{% if ns_sa.has_text %}
{% endif %}
{# Tool calls listed cleanly without text interruptions #}
{% for st in tc.subagent.turns %}
{% for tu in st.tool_uses %}
🔧
{{ tu.name }}
{% set sa_input = tu.get("input", {}) %}
{% if sa_input.get("url") %}{{ sa_input.get("url","")[:100] }}
{% elif sa_input.get("file_path") %}{{ sa_input.get("file_path","") }}
{% elif sa_input.get("query") %}{{ sa_input.get("query","")[:100] }}
{% elif sa_input.get("prompt") %}{{ sa_input.get("prompt","")[:100] }}{% endif %}
{{ sa_input | tojson(indent=2) }}
{% if tu.get("result") %}
Result
{% for item in tu.get("result", []) %}
{% if item.get("type") == "text" %}
{{ item.get("text","") }}{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
📥
Result: {{ tc.name }}
{% if tc.input and tc.input.get("file_path") %}{{ tc.input.get("file_path") }}{% endif %}
{% if tc.result_content %}
{% for item in tc.result_content %}
{% if item.get("type") == "text" %}
{{ item.get("text","") }}
{% elif item.get("type") == "tool_reference" %}
[tool_reference: {{ item.get("tool_name","") }}]
{% endif %}
{% endfor %}
{% else %}
No result content
{% endif %}
{% endif %}
{# Render workflow subagents if any #}
{% if tc.subagents %}
{% for sa in tc.subagents %}
🤖
{{ sa.description or "Background Workflow" }}
{{ sa.total_tool_uses }} tool calls · {{ sa.agent_type }}
{% if sa.total_cost %}·{{ format_cost(sa.total_cost) }}{% endif %}
{# Hoist all commentary (text blocks) into a collapsible section #}
{% set ns_sa = namespace(has_text=false) %}
{% for st in sa.turns %}{% if st.text_blocks %}{% set ns_sa.has_text = true %}{% endif %}{% endfor %}
{% if ns_sa.has_text %}
{% endif %}
{# Tool calls listed cleanly without text interruptions #}
{% for st in sa.turns %}
{% for tu in st.tool_uses %}
🔧
{{ tu.name }}
{% set sa_input = tu.get("input", {}) %}
{% if sa_input.get("url") %}{{ sa_input.get("url","")[:100] }}
{% elif sa_input.get("file_path") %}{{ sa_input.get("file_path","") }}
{% elif sa_input.get("query") %}{{ sa_input.get("query","")[:100] }}
{% elif sa_input.get("prompt") %}{{ sa_input.get("prompt","")[:100] }}{% endif %}
{{ sa_input | tojson(indent=2) }}
{% if tu.get("result") %}
Result
{% for item in tu.get("result", []) %}
{% if item.get("type") == "text" %}
{{ item.get("text","") }}{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{# ── Final Response Bubble ── #}
{% set response_turn = ex.final_turn %}
{% if response_turn and response_turn.assistant_content %}
{% set text_blocks = response_turn.assistant_content | selectattr("type", "equalto", "text") | list %}
{% if text_blocks %}
Response
{{ format_cost(response_turn.cost_usd) }}
{{ response_turn.model.replace("claude-","") }}
{% for block in text_blocks %}{{ block.get("text", "") | markdown }}{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{# ═══ Hidden modal data blocks for each turn ═══ #}
{% for turn in session.turns %}
{% if turn.user_prompt_full or turn.user_prompt %}
👤 User
{{ (turn.user_prompt_full or turn.user_prompt) | markdown }}
{% endif %}
{% if turn.tool_calls %}
🔧 Tool Results
{% for tc in turn.tool_calls %}
{{ tc.name }}
{% if tc.input and tc.input.get("file_path") %}{{ tc.input.get("file_path") }}{% endif %}
{{ tc.tool_use_id[:12] }}…
{% if tc.input %}
Input
{{ tc.input | tojson(indent=2) }}
{% endif %}
{% if tc.result_content %}
Result
{% for item in tc.result_content %}
{% if item.get("type") == "text" %}
{{ item.get("text","") }}
{% elif item.get("type") == "tool_reference" %}
[tool_reference: {{ item.get("tool_name","") }}]
{% else %}
{{ item | tojson(indent=2) }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if turn.assistant_content %}
🤖 Assistant
{% for block in turn.assistant_content %}
{% if block.get("type") == "thinking" and block.get("thinking", "")|length > 0 %}
Thinking ({{ block.get("thinking","")|length|string }} chars)
{{ block.get("thinking","") }}
{% elif block.get("type") == "text" %}
{{ block.get("text","") | markdown }}
{% elif block.get("type") == "tool_use" %}
🔧 {{ block.get("name","tool") }}
→ {{ block.get("id","")[:12] }}…
{% endif %}
{% endfor %}
{% endif %}
💬 Commentary
{% endfor %} {% endfor %}