Skip to content

feat(subagent): show [1m] context-variant suffix on subagent model labels#102

Draft
tmck-code wants to merge 3 commits into
mainfrom
feat/subagent-1m-context-suffix
Draft

feat(subagent): show [1m] context-variant suffix on subagent model labels#102
tmck-code wants to merge 3 commits into
mainfrom
feat/subagent-1m-context-suffix

Conversation

@tmck-code

Copy link
Copy Markdown
Owner

Context

Subagents can run on the 1M-token context-window variant of their model (raw
model id carries a literal [1m] substring, e.g. claude-opus-4-8[1m]), but
the subagent cohort rows had no way to show this — every row displayed just
the model bucket name (opus, sonnet, …), so a 1m-variant subagent looked
identical to a plain one. This PR adds a [1m] suffix to the model label when
the raw model id carries the marker, and threads a cohort-wide shared field
width through subagent_row so mixed cohorts (some [1m], some not) still
line up on a common left edge instead of drifting apart. Ships as v0.4.6.

Changes

New [1m] variant marker

  • claude/yas/constants.py: added MODEL_VARIANT_1M = '[1m]', the literal
    substring a subagent's raw model id carries when running the 1M-token
    context variant.
  • claude/yas/renderer.py: added subagent_model_label(model), which appends
    MODEL_VARIANT_1M after the model bucket name (model_key) when present —
    the colour bucket itself (model_key/model_colour) is unchanged, only the
    displayed text widens.

Shared cohort-wide model field width

  • Renderer.subagent_row gained a model_field_w: int = 6 parameter (default
    matches the historical fixed .rjust(6)), used to right-justify the model
    label in both the one-line and two-line row layouts.
  • claude/yas/layout.py: added _cohort_model_field_w(subs), which computes
    the max visible width of every subagent's label in a cohort (floored at 6)
    and threads it into every subagent_row(...) call for that cohort — narrow,
    medium, wide, side-by-side, two-column subagent grid, and two-column
    workflow-agent rows all now share one column edge per cohort instead of each
    row justifying independently.

Tests

  • test/test_subagent_rows.py: new test asserting the [1m] suffix renders
    in the two-line row layout.
  • test/test_layout_subagent_rows.py: new tests asserting the suffix surfaces
    through build_wide, and that a mixed cohort (opus[1m] beside plain
    sonnet) shares one model-field left edge and width across rows.

Checklist

  • Tests added or updated for new/changed behaviour
  • (bug fixes) a regression test now covers the situation so it can't come back
  • N/A — no behaviour change, because:

Screenshots / recording

before after
kitchen-sink before kitchen-sink after
subagents before subagents after
workflows before workflows after

Note: the demo fixtures (ops/demo.py) have no way to force a [1m]-variant
model id onto a synthetic subagent, so these renders exercise the shared
column-width mechanics but not the [1m] suffix text itself — that's
covered by the unit tests above instead.

  • N/A — no visible change

Benchmark

Command Mean [ms] Min [ms] Max [ms] Relative
main 45.7 ± 7.6 40.5 80.3 1.00 ± 0.18
PR 45.5 ± 3.2 40.6 58.1 1.00
  • N/A — no performance-relevant change

System info

Key Value
OS Linux archlinux 7.1.2-arch3-1 #1 SMP PREEMPT_DYNAMIC Fri, 03 Jul 2026 23:25:36 +0000 x86_64 GNU/Linux
Claude Code 2.1.207 (Claude Code)
Terminal TERM=tmux-256color TERM_PROGRAM=tmux SHELL=/bin/bash COLORTERM=truecolor
Locale LANG=en_AU.UTF-8 LC_ALL=
Python Python 3.13.13
uv uv 0.11.26 (396ef7ce4 2026-06-30 x86_64-unknown-linux-gnu)

Test and others added 3 commits July 13, 2026 02:44
…bels

Subagent rows now render a `[1m]` suffix when the subagent runs the
1M-token context variant of its model (e.g. `opus[1m]` instead of `opus`),
mirroring the main-session pill's `1M` display. The colour bucket lookup
still uses the plain model key, so theming is unaffected.

To keep columns aligned, every subagent row in a cohort now right-justifies
its model label to a shared field width (max label width in the cohort,
min 6), threaded through all build_* layout paths. This fixes the
mixed-cohort left-edge misalignment a per-row rjust(6) would otherwise cause.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K6uTGQtDHSdjzb89x4HxBS
# Conflicts:
#	claude/yas/layout.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant