{% extends "base.html" %} {% block title %}Sessions{% endblock %} {% block content %}

Sessions

Recent Claude Code sessions for this project — summarized starter prompts to help you resume work.

{# Sessions S3b — reads Claude Code's per-project JSONL logs, surfaces last-3-days sessions, and replaces the heuristic starter prompt with a Haiku-summarized version when ATTUNE_OPS_SESSIONS_LLM is on and the budget allows. The `source` chip per row tells the user which lane produced the text (heuristic, haiku, cached). `?compare=1` renders both heuristic + haiku columns side-by-side (dev tool). S4 lifts the most-recent session into a prominent resume card; S5 marks the live session. #}
{% if compare_mode and compare_columns %} {# Compare mode — renders heuristic + haiku starter prompts side-by-side on the same row, indexed by session id. No UI affordance points here; discoverable only by URL. #}

Compare mode: heuristic vs Haiku starter prompts. {% if not llm_enabled %}(Haiku disabled — second column will be empty){% endif %}

{# Iterate the heuristic column by index; pull the matching haiku row from the second column. Lengths are identical because both columns are built from the same path list. #} {% for h in compare_columns[0].sessions %} {% set hk = compare_columns[1].sessions[loop.index0] %} {% endfor %}
Session Last activity Heuristic Haiku
{{ h.id[:8] }} {{ h.last_activity[:19] }} {{ h.source }} {{ h.starter_prompt }} {{ hk.source }} {{ hk.starter_prompt }}
{% elif sessions %} {% for s in sessions %} {% endfor %}
Session Last activity Duration Prompts Starter prompt Source
{{ s.id[:8] }} {{ s.last_activity[:19] }} {% if s.duration_seconds > 0 %}{{ '%.0fs'|format(s.duration_seconds) if s.duration_seconds < 60 else '%.0fm'|format(s.duration_seconds / 60) }}{% else %}—{% endif %} {{ s.message_count }} {{ s.starter_prompt }} {# Per-source tooltip copy explains where the text came from. 'haiku' = fresh LLM call this load; 'cached' = a prior Haiku call's persisted summary; 'heuristic' = fallback (LLM disabled, budget exhausted, or any failure path). #} {{ s.source }}
{% if over_budget %} {# Per-page-load budget breach. Trailing sessions render with their heuristic prompt rather than a fresh Haiku call. Cache hits still happen post-breach (free). #}

Per-page Haiku budget exceeded. Some rows above show heuristic prompts. Configure with ATTUNE_OPS_SESSIONS_BUDGET_USD.

{% endif %}

Older sessions (beyond 3 days) stay on disk at {{ sessions_dir }} but aren't surfaced here.

{% else %}

No sessions in the last 3 days for {{ project_name | default(project_root.split('/')[-1]) }}. Older sessions are at {{ sessions_dir }}.

{% endif %}
{% endblock %}