Skip to content

[Dashboard] Let the user choose a dashboard theme, stored per browser #218

Description

@LarsLaskowski

Summary

Add the mechanism and the control that let a user pick the visual theme of the dashboard. The choice is stored per browser, applied before the first paint, independent of the light/dark mode, and defaults to the theme "Clear" from #217. This issue delivers the infrastructure and the selector; the additional themes "Console" and "Berry" are separate issues in this milestone and plug into what is built here.

Problem

v1.5.0 brings three designs for the dashboard. All three should ship, and each user should be able to choose the one they prefer, with "Clear" as the default. Today the dashboard has exactly one look and only a light/dark switch; there is no place to register a second design, no storage for the choice and no control to make it.

Terminology

  • Mode — light or dark. Existing behaviour: pimonitor-theme in localStorage, data-theme on <html>, the header toggle, following prefers-color-scheme when nothing is stored. Unchanged by this issue.
  • Theme — the visual design. Ids and display names:
Id Display name Issue
clear Clear #217 (default)
console Console separate issue in this milestone
berry Berry separate issue in this milestone

Every theme exists in both modes, so the user has theme × mode = up to six appearances.

Because the existing storage key and attribute for the mode are already called "theme", the new key and attribute need a different name. Proposed: localStorage key pimonitor-style and attribute data-style on <html>. The existing key pimonitor-theme must keep its name and meaning, otherwise every user loses the stored mode on upgrade. If the spec picks other names, the reasons go into the decision record.

Specification

1. Theme registry

  • There is one list of known themes with id and display name, in display order, default first. It is the single source for the selector and for validating a stored value.
  • theme-init.js runs before app.js and before first paint and needs to validate the stored id too. If that means a second copy of the id list, a test must keep the two lists identical (the same approach as the fallback threshold keys, see thresholds_test.go).
  • Adding a theme must be possible by adding its registry entry and its style rules, without touching the selection logic.

2. Applying a theme

  • The active theme is expressed as data-style="<id>" on <html>. The default theme may be expressed either as data-style="clear" or as the absence of the attribute; the spec decides, the rules below hold either way.
  • A theme is implemented as CSS overrides of custom properties and rules scoped to its data-style value. The page has one DOM for all themes; index.html does not contain per-theme markup variants, and app.js has no per-theme rendering branches for HTML content.
  • Canvas widgets (chart.js, gauge.js) cannot be restyled by CSS. Where a theme needs a different drawing (line width, cap style, stepped vs straight line, arc vs ring, fill opacity), the renderer reads declared custom properties from the computed style of the document, the way drawSparkline already reads --accent and drawGauge reads the track and level colours. This issue establishes that pattern and documents the properties that exist after [Dashboard] Refresh the default look: theme "Clear" (light and dark) #217 (colours, line width, track); the Console and Berry issues add the properties they need. Unknown or missing values fall back to the Clear drawing.
  • Mode and theme are orthogonal. Each theme provides its light values, its dark values for [data-theme="dark"] and the same dark values for @media (prefers-color-scheme: dark) with :root:not([data-theme]). A test keeps the token key sets of all blocks of all themes identical, so a theme cannot forget a token and silently inherit a colour from another theme.
  • How the stylesheet is organised — one file, or one file per theme, all linked statically — is the plan's decision. Additional files are served like every other asset (internal/web/embed.go: no-cache, per-file ETag) and must be covered by the asset tests. Loading a theme's stylesheet on demand is not required and must not cause a flash.

3. Storage

  • The choice is stored in localStorage under pimonitor-style with the theme id as value.
  • On load, theme-init.js reads the key and applies the theme before the first paint, next to the stored mode, so the page never flashes the default theme first.
  • A missing key, an unknown id (for example after a downgrade, or a theme that was removed) or unreadable storage means the default theme clear. An unknown stored value is ignored, not deleted, and not treated as an error.
  • When storage is unavailable (private browsing, blocked storage) the selector still works for the current page; nothing is stored and no error is shown — the same rule the mode and the layout follow today.
  • After this issue the dashboard stores exactly four localStorage entries: pimonitor-api-key, pimonitor-theme, pimonitor-layout, pimonitor-style.
  • There is no server-side theme setting: no configuration option, no API field. The choice is per browser, like mode and layout.

4. The selector

  • The selector lives in the existing "Customize dashboard" dialog (#layout-modal), in a new section "Theme" above the card list. The dialog is already the place for per-browser appearance preferences, so no new header button is needed and the header stays as it is.
  • It is a group of radio inputs, one per registered theme, inside a <fieldset> with a <legend>; each option shows the display name. It is fully operable by keyboard and announced as a radio group by assistive technology.
  • Selecting an option applies the theme immediately, without a reload and without closing the dialog, and stores it. Charts and gauges are redrawn at once in the new theme, exactly as on a mode switch (applyTheme() already repaints the canvas widgets; reuse that path).
  • The selected option reflects the active theme whenever the dialog opens, including after a reload.
  • The header's light/dark button keeps working in every theme and is not affected by the selection.
  • While only one theme is registered, the "Theme" section is not shown. This lets this issue be merged on its own after [Dashboard] Refresh the default look: theme "Clear" (light and dark) #217; the section appears with the first additional theme. The tests for the selector use more than one registered theme regardless of what the shipped registry holds at that time. If the plan prefers to deliver this issue together with the Console theme in one pull request, that is fine as long as the acceptance criteria of both issues hold.
  • "Reset to default" in the dialog resets the card layout only, as its hint text says today. Whether it should also reset the theme is an open question (see below); the default answer is no.

5. Optional preview hint

Each option may show a small static swatch (for example the theme's background, card and accent colour) next to its name so the choice is not blind. This is a nice-to-have; if it is built, the swatch colours come from the theme's own tokens, not from a second hard-coded list.

Constraints

  • Content-Security-Policy: style-src 'self'; script-src 'self' — no inline styles or scripts; theme-init.js stays an external, synchronous script in <head>.
  • innerHTML: the selector is built from static markup or with document.createElement + textContent; app.js never assigns non-empty content to innerHTML (internal/web/xss_test.go).
  • No external resources, no build step, no web fonts.
  • No API or configuration change.
  • The stored mode (pimonitor-theme), the stored layout (pimonitor-layout) and the stored API key keep their keys, formats and behaviour.
  • Dialog behaviour (modal, focus moves in and back, Escape / outside click / close button) is unchanged (dialog_test.go).

Out of scope

  • The visual design of Console and Berry (their own issues).
  • A server-side default theme or a theme option in config.yaml.
  • A control to return the mode to "follow the operating system" (noted as missing in docs/areas/dashboard.md; can become its own issue).
  • Syncing the choice across open tabs.
  • User-defined themes or colour pickers.

Acceptance criteria

  • AC1 — With no stored choice the dashboard shows the theme clear.
  • AC2 — A stored, known theme id is applied before the first paint; the page does not render in the default theme first.
  • AC3 — A stored value that is not a registered theme id results in the theme clear, without an error and without removing the stored value.
  • AC4 — With more than one registered theme, the "Customize dashboard" dialog shows a "Theme" radio group with one option per registered theme in registry order, and the option of the active theme is checked whenever the dialog opens.
  • AC5 — Choosing an option applies the theme immediately without a reload, keeps the dialog open, stores the id under pimonitor-style, and redraws sparklines, gauges and an open detail chart in the new theme.
  • AC6 — With exactly one registered theme the "Theme" section is not rendered.
  • AC7 — Theme and mode are independent: switching the mode keeps the theme, choosing a theme keeps the mode, and with no stored mode the page keeps following prefers-color-scheme live in every theme.
  • AC8 — When localStorage is unavailable, choosing a theme works for the current page, nothing is stored and nothing throws.
  • AC9 — The id list used before first paint and the registry used by the selector are identical.
  • AC10 — Every registered theme defines the same set of palette tokens in its light block and in both of its dark blocks.
  • AC11 — The selector is a <fieldset> with a <legend> and native radio inputs, reachable and operable by keyboard alone.
  • AC12 — The dashboard stores no localStorage entry other than pimonitor-api-key, pimonitor-theme, pimonitor-layout and pimonitor-style.
  • AC13 — "Reset to default" restores the default card layout and leaves the chosen theme as it is.
  • AC14 — index.html still has no inline style or script, and app.js still assigns no non-empty innerHTML.

Testing notes

Follow the existing pattern of Go tests over the embedded assets in internal/web: registry/id-list equality (AC9), token key sets per theme and block (AC10), presence and structure of the selector markup or of the code that builds it (AC4, AC11), the storage key set (AC12), and the CSP/innerHTML guards (AC14). Where behaviour can only be shown by running the script (AC2, AC3, AC5–AC8, AC13), use whatever the repository's tests already do for script behaviour (polling_test.go, history_test.go); if a criterion cannot be covered that way, the plan says how it is verified.

Documentation

  • docs/areas/dashboard.md: split the Theme section into mode and theme, describe selection, storage, default and fallback; update Browser storage (four entries) and Card layout (the dialog now also holds the theme selection).
  • README.md: mention the selectable themes in the feature list.
  • Decision records: the name of the storage key and attribute; "a theme is CSS overrides plus declared canvas properties, one DOM"; "per browser, no server-side setting".

Open questions for the spec

  1. Should "Reset to default" also reset the theme? (Default answer: no — AC13.)
  2. Default theme as an explicit data-style="clear" or as the absence of the attribute?
  3. One stylesheet or one file per theme?
  4. Should the selector show swatches (section 5)?

Activity

  1. added this to the v1.5.0 milestone on Nov 13, 2026
  2. added
    enhancement
    on Nov 13, 2026
  3. LarsLaskowski commented on Nov 13, 2026

    @LarsLaskowski
    OwnerAuthor

    Design mockups

    The three themes the selection chooses between, each shown in light mode; the dark variants are in the repository at docs/design/v1.5.0/ on main. Sample data. The selector itself is not shown in the mockups; its specification is in the issue text.

    Clear (default)

    Theme Clear, light mode

    Console

    Theme Console, light mode

    Berry

    Theme Berry, light mode

  4. LarsLaskowski commented on Nov 28, 2026

    @LarsLaskowski
    OwnerAuthor

    Squad working record

    Verification matrix of feature-218-theme-selection on 7432d83

    Criterion Verification Tests or check Result
    AC1 unit TestThemeInit_DefaultLeavesNoAttribute_AC1 (sets dataset.style only for a registered id other than PIMONITOR_THEMES[0].id; <html> in index.html has no data-style); manual M1 pass on 7432d83: internal/web/theme_test.go
    AC2 unit TestThemeInit_AppliesStoredThemeBeforePaint_AC2 (reads pimonitor-style; theme-init.js stays sync in <head> before <body>; registry parser on a two-entry fixture); manual M2 pass on 7432d83: internal/web/theme_test.go
    AC3 unit TestThemeInit_UnknownValueIsKept_AC3 (exact === match, no toLowerCase/trim on the value, no removeItem of STYLE_KEY anywhere); manual M3 pass on 7432d83: internal/web/theme_test.go
    AC4 unit TestAppJS_StylePickerFromRegistry_AC4 (buildStylePicker iterates PIMONITOR_THEMES, checks the option whose id is activeStyle(), is called from openLayoutModal; #style-picker precedes .layout-hint); manual M4 pass on 7432d83: internal/web/theme_test.go
    AC5 unit TestAppJS_SelectStyleAppliesAndStores_AC5 (selectStyle stores via setItem(STYLE_KEY, then applyStyle; applyStyle calls repaintCanvases(); no .close() in the picker code); adapted checkApplyThemeRedraws; manual M5 pass on 7432d83: internal/web/theme_test.go
    AC6 unit TestStylePicker_HiddenWithOneTheme_AC6 (static class="style-picker hidden" on #style-picker; buildStylePicker toggles the hidden class from PIMONITOR_THEMES.length < 2); manual M6 pass on 7432d83: internal/web/theme_test.go
    AC7 unit TestAppJS_ModeAndThemeIndependent_AC7 (applyStyle never writes dataset.theme, applyTheme/toggleTheme never dataset.style); AC10's block test for the OS-dark selector of every theme; manual M7 pass on 7432d83: internal/web/theme_test.go
    AC8 unit TestAppJS_StyleStorageFailureIsCaught_AC8 (both storage calls in try; activeStyle reads the attribute, not storage); manual M8 pass on 7432d83: internal/web/theme_test.go
    AC9 unit TestThemeRegistry_SingleSource_AC9 (ids parsed from theme-init.js unique, default clear first; app.js holds no { id: '…', name: entry and no registered id as a literal; parser on a two-entry fixture) pass on 7432d83: internal/web/theme_test.go
    AC10 unit TestStyleCSS_ThemeTokenSets_AC10 (for each registered id its three blocks — Clear's unscoped — share one key set; each property passed to themeColor/themeNumber in chart.js, gauge.js, app.js is in it; checker run on a fixture with a probe theme missing a token reports it) pass on 7432d83: internal/web/theme_test.go
    AC11 unit TestIndexHTML_StylePickerIsRadioGroup_AC11 (<fieldset id="style-picker"> with <legend>Theme</legend>; buildStylePicker creates input with type = 'radio' and name = 'style-choice' inside a label); existing dialog_test.go unchanged; manual M10 pass on 7432d83: internal/web/theme_test.go
    AC12 unit TestAssets_StorageKeys_AC12 (every pimonitor-… string literal in the JS assets is one of the five keys, all five occur) pass on 7432d83: internal/web/theme_test.go
    AC13 unit TestAppJS_ResetLayoutKeepsTheme_AC13 (resetLayout body mentions no STYLE_KEY/applyStyle/selectStyle); manual M11 pass on 7432d83: internal/web/theme_test.go
    AC14 unit existing look_test.go (AC11 tests) and xss_test.go, unchanged; TestThemeInit_AppliesStoredThemeBeforePaint_AC2 for the sync script pass on 7432d83: internal/web/look_test.go, internal/web/xss_test.go
    AC15 unit adapted checkUpdateThemeToggle ('Switch to light mode' : 'Switch to dark mode'); TestIndexHTML_ModeButtonLabel_AC15 (static aria-label="Toggle mode"; no aria-label in index.html or app.js contains "theme") pass on 7432d83: internal/web/icons_test.go, internal/web/theme_test.go
    AC16 unit TestIndexHTML_ThemesLoadedStatically_AC16 (only style.css is linked, no <link> or stylesheet created by script: no createElement('link'), no insertRule); existing embed_test.go cache/ETag tests pass on 7432d83: internal/web/theme_test.go
    AC17 unit TestThemeInit_DrawingFallbacks_AC17 (keys of DRAWING_FALLBACKS equal the set of properties read; each value equals Clear's light block; themeNumber checks Number.isFinite and the range, no \|\| default; no getPropertyValue( left in chart.js/gauge.js/app.js); manual M9 pass on 7432d83: internal/web/theme_test.go
    log.md
    Date Step Member Result
    2026-11-28 13:06 1 Intake Orchestrator Issue #218 (feature, label enhancement, open, milestone v1.5.0): selectable dashboard theme stored per browser. Branch claude/busy-archimedes-cnsq6t off main d05bb19 (theme Clear, #296, merged). Reported environment: n/a.
    2026-11-28 13:08 2a Spec Lead RESULT: DONE. spec.md written (status Draft); answers the four open questions; adds AC15 (mode button name), AC12 lists five storage entries. (opus/medium · 61,327 tokens · 14 tool uses · 153 s · 28 in · 13,503 out · 549,756 cache read · 60,171 cache write · 340,489 weighted)
    2026-11-28 13:11 2a Spec challenge Devil's Advocate VERDICT: OBJECTIONS 2 major, 3 minor. Major: (1) AC10/N5 weaker than the issue: token key sets of all blocks of all themes, Clear's unscoped blocks included, must be identical; E7 vs AC10 contradiction. (2) Selector/AC2 branch must be verified against a registry of at least two themes, not the shipped one-entry registry. Minor: (3) AC15 misses index.html aria-label 'Toggle theme' and icons_test.go:356 assertion; (4) E7 must define 'unusable' (valid 0 honoured; chart.js:43 and gauge.js:44 fallbacks); (5) issue wrongly claims line width is a canvas property after #217; add to Corrections, list only real properties. (opus/medium · 62,072 tokens · 19 tool uses · 141 s · 38 in · 12,115 out · 702,151 cache read · 59,037 cache write · 339,034 weighted)
    2026-11-28 13:12 2a Spec revise (challenge) Lead RESULT: DONE. All five objections accepted and answered in the Challenge section; AC10/N5 strengthened, Verification paragraph (two-theme registry, manual browser check), AC15 extended, E7 defined with AC17, corrections added. (opus/medium · 12,119 tokens · 6 tool uses · 67 s · 14 in · 6,449 out · 390,427 cache read · 11,952 cache write · 133,441 weighted · continued)
    2026-11-28 13:18 2b Plan Lead RESULT: DONE. Tier standard, security areas none. spec.md Approved by Lead; plan.md, tasks.md, decisions 0041/0042 new, 0038 extended. One stylesheet; PIMONITOR_THEMES and canvas readers in theme-init.js; manual browser cases M1-M11. (opus/medium · 59,072 tokens · 29 tool uses · 330 s · 56 in · 31,985 out · 2,841,979 cache read · 58,587 cache write · 750,627 weighted · continued)
    2026-11-28 13:19 2b Plan challenge Devil's Advocate VERDICT: OBJECTIONS 0 major, 3 minor. (1) openhab_test.go:195 expects getComputedStyle, change to themeColor( and add to Test files. (2) AC10/AC17 extractor must also collect gaugeColorVar return values and the openHAB colors map values. (3) Hide picker via .hidden class (display:none !important), not the hidden attribute; AC6 test asserts it. (opus/medium · 56,813 tokens · 17 tool uses · 98 s · 30 in · 8,928 out · 576,490 cache read · 49,564 cache write · 270,899 weighted)
    2026-11-28 13:20 2b Challenge notes Orchestrator minor objections appended verbatim to plan.md; exact edits applied (hidden class, openhab_test.go, extractor)
    2026-11-28 13:20 4 Skeleton (G1) Dev RESULT: DONE. Skeleton in theme-init.js (registry, fallbacks, throwing stubs), app.js (STYLE_KEY, empty picker functions), index.html (picker fieldset, Toggle mode). Existing web tests pass. Deviation: stubs throw. (sonnet/medium · 87,995 tokens · 7 tool uses · 30 s · 12 in · 3,244 out · 450,692 cache read · 35,060 cache write · 105,126 weighted)
    2026-11-28 13:24 5 Tests first (G1) Tester RESULT: tests written; 13 tests fail on the skeleton as intended (confirmed by orchestrator), 5 hold already. Deferred: TestThemeRegistry_SingleSource_AC9, TestStyleCSS_ThemeTokenSets_AC10, TestAssets_StorageKeys_AC12, TestAppJS_ResetLayoutKeepsTheme_AC13, TestIndexHTML_ThemesLoadedStatically_AC16 (sonnet/medium · 132,968 tokens · 13 tool uses · 174 s · 24 in · 28,697 out · 1,211,118 cache read · 79,385 cache write · 363,852 weighted)
    2026-11-28 13:25 6 Implement (G1) Dev RESULT: green. All tests incl. deferred pass; coverage gate PASS (confirmed by orchestrator). Extra helper themeValue in theme-init.js; fact 12 (CSS.supports) left to manual M9. (sonnet/medium · 100,345 tokens · 7 tool uses · 72 s · 12 in · 4,906 out · 487,805 cache read · 44,714 cache write · 129,215 weighted)
    2026-11-28 13:27 6 Coverage (G1) Tester RESULT: PASS. Four of five deferred tests strengthened (AC9, AC12, AC13, AC16), AC10 unchanged; mutation runs fail as expected; analyzer and coverage gates pass. (sonnet/medium · 95,227 tokens · 17 tool uses · 92 s · 34 in · 9,522 out · 1,422,379 cache read · 38,844 cache write · 238,437 weighted)
    2026-11-28 13:27 6 Documentation Dev RESULT: green. dashboard.md (Theme section, Look, Card layout, Browser storage five entries), ARCHITECTURE.md, README.md written; figure-check hits are in decision records 0039/0042 and hold. (sonnet/medium · 6,965 tokens · 4 tool uses · 25 s · 10 in · 3,030 out · 405,609 cache read · 7,048 cache write · 64,531 weighted · continued)
    2026-11-28 13:28 7 Gate stamp Orchestrator PASS on ba393c3 (tier standard): Format check pass; Analyzer gate pass; Test with coverage pass; Coverage gate pass; decision-check.py pass; scope-check.py pass · figure-check.py 2 hit(s)
    2026-11-28 13:31 6 Manual check (G1) Tester RESULT: PASS. M1-M11 all pass in headless Chrome on a probe-theme scratch build; fact 12 confirmed (CSS.supports('color','notacolor') is false). One measurement script revision in M9 (script flaw, no production defect). (sonnet/medium · 107,702 tokens · 12 tool uses · 182 s · 22 in · 15,101 out · 973,677 cache read · 50,798 cache write · 236,392 weighted)
    2026-11-28 13:33 8 Review Reviewer VERDICT: BLOCKING 1 | NON-BLOCKING 2 on ba393c3. Blocking: dashboard.md Look must state that every palette block of every theme, Clear's three included, declares the same token keys. Non-blocking: Look first bullet fallback wording (empty/unparseable/out-of-range for any property); README bullet says theme is set in the Customize dialog although the picker is hidden with one theme. (opus/medium · 70,007 tokens · 15 tool uses · 98 s · 28 in · 9,088 out · 612,547 cache read · 67,807 cache write · 321,708 weighted)
    2026-11-28 13:33 8 Verbatim fix Orchestrator verbatim: [BLOCKING, verbatim] docs/areas/dashboard.md Look second bullet; [NON-BLOCKING, verbatim] docs/areas/dashboard.md Look first bullet; [NON-BLOCKING, verbatim] README.md:57-58
    2026-11-28 13:33 7 Gate stamp Orchestrator PASS on 4f76c0c (tier standard, verbatim): Format check pass; decision-check.py pass; scope-check.py pass
    2026-11-28 13:33 9 PR approval Orchestrator approved by checklist
    2026-11-28 13:33 7 Gate stamp Orchestrator PASS on 7432d83 (tier standard, verbatim): Format check pass; decision-check.py pass; scope-check.py pass
    2026-11-28 13:40 10 Pull request Orchestrator #297 (draft, label enhancement); working record posted on #218, folder removed
    2026-11-28 13:40 11 Sonar fix Code Officer RESULT: fixed. go:S8209 theme_test.go:190, parameters grouped; Sonar 0 new issues, all checks green on 8568635; PR marked ready (sonnet/medium · 72,298 tokens · 7 tool uses · 15 s · 10 in · 1,317 out · 333,217 cache read · 20,135 cache write · 65,085 weighted)
    2026-11-28 13:40 11 Review Reviewer VERDICT: APPROVE on 8568635. Delta round for the Sonar fix; nothing to report. (opus/medium · 21,478 tokens · 3 tool uses · 13 s · 6 in · 971 out · 43,284 cache read · 15,764 cache write · 53,460 weighted)
    2026-11-28 13:40 12 Lessons Orchestrator no lessons
    2026-11-28 13:40 11 Gate stamp Orchestrator PASS on 8568635 (tier standard): Format check pass; Analyzer gate pass; Test with coverage pass; Coverage gate pass; decision-check.py pass; scope-check.py --no-specs pass · figure-check.py 2 hit(s)

    Squad run metrics

    Template: LarsLaskowski/Squad-Spec-Repository-Template v2026.11.15 (commit 96342d9fa5f8)

    Member Model/effort Launches Tokens Tool uses Seconds
    Code Officer sonnet/medium 1 72,298 7 15
    Dev sonnet/medium 3 (1 continued) 195,305 18 127
    Devil's Advocate opus/medium 2 118,885 36 239
    Lead opus/medium 3 (2 continued) 132,518 49 550
    Reviewer opus/medium 2 91,485 18 111
    Tester sonnet/medium 3 335,897 42 448
    Total 14 (3 continued) 946,388 170 1490
    Member Wall time (s) Not covered by launches (s) Gate runs
    Orchestrator 2,040 678 3

    Tokens per kind and their weighted figure (every token at its list price, in tokens of Sonnet input: .squad/tools/session-usage.py):

    Member Model/effort Input Output Cache read Cache write Weighted Share
    Code Officer sonnet/medium 10 1,317 333,217 20,135 65,085 1%
    Dev sonnet/medium 34 11,180 1,344,106 86,822 298,872 5%
    Devil's Advocate opus/medium 68 21,043 1,278,641 108,601 609,933 11%
    Lead opus/medium 98 51,937 3,782,162 130,710 1,224,557 22%
    Reviewer opus/medium 34 10,059 655,831 83,571 375,168 7%
    Tester sonnet/medium 80 53,320 3,607,174 169,027 838,681 15%
    Orchestrator sonnet/medium 230 35,298 16,690,568 138,803 2,123,383 38%
    Total 554 184,154 27,691,699 737,669 5,535,679 100%

    Session usage

    Tokens per model (the session and all its subagents; Claude Code's own background calls are not in the transcripts, so this is a lower bound):

    Model Input Output Cache read Cache write Weighted
    claude-opus-5-5 200 83,039 5,716,634 322,882 2,209,658
    claude-sonnet-5-5 354 100,582 21,441,222 439,848 3,320,094
    Total 554 183,621 27,157,856 762,730 5,529,752

    Subagents:

    Subagent Launches Models Input Output Cache read Cache write Weighted
    squad-code-officer 1 claude-sonnet-5-5 10 1,317 333,217 20,135 65,085
    squad-dev 2 claude-sonnet-5-5 34 11,180 1,344,106 86,822 298,872
    squad-devils-advocate 2 claude-opus-5-5 68 21,043 1,278,641 108,601 609,933
    squad-lead 1 claude-opus-5-5 98 51,937 3,782,162 130,710 1,224,557
    squad-reviewer 2 claude-opus-5-5 34 10,059 655,831 83,571 375,169
    squad-tester 3 claude-sonnet-5-5 80 53,320 3,607,174 169,027 838,681
    Total 11 324 148,856 11,001,131 598,866 3,412,297

    Orchestrator (this session without its subagents): 2,117,456 weighted, 38 % of the total, on claude-sonnet-5-5.

    Weighted: every token at its list price, in tokens of Sonnet input (PRICES in .squad/tools/session-usage.py); a model of no listed family has none (–).


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions