Ranking|Claude Code Mods

ModsCode / Claude Code Mods / Ranking / context-window

context-window

A pane listing everything that entered the context window since the session started, by turn and by category

Code you can checkTerminal + desktopPaneToastBoxButtonMarkdownText
drives Claude, draws

What it does

  • Draws a pane
  • Adds /context-window
  • Hooks prompt.compose, prompt.context, session.append, session.compact and 5 more

Good points

  • No network calls
  • Starts no processes
  • Written in TypeScript
  • Handles errors

Code to start from

A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.

Starter (register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like context-window by Chris Han (pane, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/chrishan17-context-window/
// Written by ModsCode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Context" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Markdown } = $.ui.resolve(e)
    const t = '…'
    const hotkey = '…'
    const t2 = '…'
    const title = '…'
    const note = '…'
    const label = '…'
    const detail = '…'
    const fileLink = '…'
    const badge = '…'
    const label2 = '…'
    const detail2 = '…'
    const badge2 = '…'
    const label3 = '…'
    const detail3 = '…'
    const badge3 = '…'
    const label4 = '…'
    const detail4 = '…'
    const badge4 = '…'
    const label5 = '…'
    const detail5 = '…'
    const badge5 = '…'
    const label6 = '…'
    const detail6 = '…'
    const badge6 = '…'
    const label7 = '…'
    const detail7 = '…'
    const badge7 = '…'
    const label8 = '…'
    const detail8 = '…'
    const badge8 = '…'
    const label9 = '…'
    const detail9 = '…'
    const badge9 = '…'
    const label10 = '…'
    const detail10 = '…'
    const badge10 = '…'
    const label11 = '…'
    const detail11 = '…'
    const badge11 = '…'
    const label12 = '…'
    const detail12 = '…'
    const badge12 = '…'
    const title2 = '…'
    const label13 = '…'
    const detail13 = '…'
    const badge13 = '…'
    const label14 = '…'
    const detail14 = '…'
    const badge14 = '…'
    const label15 = '…'
    const detail15 = '…'
    const badge15 = '…'
    const label16 = '…'
    const detail16 = '…'
    const badge16 = '…'
    return (
      <Box flexDirection="column" paddingTop={1}>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Box flexShrink={0}>
              <Text>
                <Text bold>
                  {t}
                </Text>
                <Text bold>
                  {"  —"}
                </Text>
                <Text dimColor>
                  {`  ${t}`}
                </Text>
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} minWidth={0} justifyContent="flex-end" marginLeft={2} marginRight={3}>
              <Text dimColor wrap="truncate-start" />
            </Box>
          </Box>
          <Text>
            <Text>
              ━━━━━━━━
            </Text>
            <Text dimColor>
              ────────
            </Text>
          </Text>
          <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
            <Button plain label={`${t}◂`} hotkey={`${hotkey}`} />
            <Button plain label={`${t}◂`} hotkey={`${hotkey}`} />
            <Button plain label={`${t}◂`} hotkey={`${hotkey}`} />
            <Button plain label={`${t}`} hotkey="r" dimColor />
          </Box>
          <Text dimColor wrap="wrap">
            {t2}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="column">
            <Box flexDirection="row" marginTop={1}>
              <Box flexShrink={0}>
                <Text bold>
                  {title}
                </Text>
                <Text dimColor>
                  {`  ${note}`}
                </Text>
              </Box>
              <Box flexGrow={1} flexShrink={1} minWidth={0} paddingLeft={1}>
                <Text dimColor wrap="truncate">
                  ────────
                </Text>
              </Box>
              <Box flexShrink={0} width={5} />
              <Box flexShrink={0} width={7} justifyContent="flex-end">
                <Text bold />
              </Box>
            </Box>
            <Text dimColor>
              {`  ${t}`}
            </Text>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box flexShrink={0} width={2}>
                  <Text dimColor>
                    │
                  </Text>
                </Box>
                <Box flexShrink={0} width={2}>
                  <Button plain dimColor label="▾" />
                </Box>
                <Box flexShrink={0} width={2}>
                  <Text>
                    {"✗ "}
                  </Text>
                </Box>
                <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                  <Box flexShrink={1} minWidth={0}>
                    <Text wrap="truncate-end">
                      {label}
                    </Text>
                  </Box>
                  <Box flexShrink={100} minWidth={0} marginLeft={2}>
                    <Text dimColor wrap="truncate-end">
                      {detail}
                    </Text>
                  </Box>
                  <Box flexShrink={0} marginLeft={2}>
                    <Markdown text={`${fileLink}`} dimColor />
                  </Box>
                </Box>
                <Box flexShrink={0} marginLeft={1}>
                  <Text>
                    {badge}
                  </Text>
                </Box>
                <Box flexShrink={0} width={5} justifyContent="flex-end">
                  <Text dimColor />
                </Box>
                <Box flexShrink={0} width={7} justifyContent="flex-end">
                  <Text />
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label2}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail2}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge2}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label3}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail3}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge3}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label4}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail4}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge4}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} />
                  <Button plain dimColor label={`${t}`} />
                </Box>
              </Box>
            </Box>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box flexShrink={0} width={2}>
                  <Text dimColor>
                    │
                  </Text>
                </Box>
                <Box flexShrink={0} width={2}>
                  <Button plain dimColor label="▾" />
                </Box>
                <Box flexShrink={0} width={2}>
                  <Text>
                    {"✗ "}
                  </Text>
                </Box>
                <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                  <Box flexShrink={1} minWidth={0}>
                    <Text wrap="truncate-end">
                      {label5}
                    </Text>
                  </Box>
                  <Box flexShrink={100} minWidth={0} marginLeft={2}>
                    <Text dimColor wrap="truncate-end">
                      {detail5}
                    </Text>
                  </Box>
                  <Box flexShrink={0} marginLeft={2}>
                    <Markdown text={`${fileLink}`} dimColor />
                  </Box>
                </Box>
                <Box flexShrink={0} marginLeft={1}>
                  <Text>
                    {badge5}
                  </Text>
                </Box>
                <Box flexShrink={0} width={5} justifyContent="flex-end">
                  <Text dimColor />
                </Box>
                <Box flexShrink={0} width={7} justifyContent="flex-end">
                  <Text />
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label6}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail6}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge6}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label7}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail7}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge7}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label8}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail8}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge8}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} />
                  <Button plain dimColor label={`${t}`} />
                </Box>
              </Box>
            </Box>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box flexShrink={0} width={2}>
                  <Text dimColor>
                    │
                  </Text>
                </Box>
                <Box flexShrink={0} width={2}>
                  <Button plain dimColor label="▾" />
                </Box>
                <Box flexShrink={0} width={2}>
                  <Text>
                    {"✗ "}
                  </Text>
                </Box>
                <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                  <Box flexShrink={1} minWidth={0}>
                    <Text wrap="truncate-end">
                      {label9}
                    </Text>
                  </Box>
                  <Box flexShrink={100} minWidth={0} marginLeft={2}>
                    <Text dimColor wrap="truncate-end">
                      {detail9}
                    </Text>
                  </Box>
                  <Box flexShrink={0} marginLeft={2}>
                    <Markdown text={`${fileLink}`} dimColor />
                  </Box>
                </Box>
                <Box flexShrink={0} marginLeft={1}>
                  <Text>
                    {badge9}
                  </Text>
                </Box>
                <Box flexShrink={0} width={5} justifyContent="flex-end">
                  <Text dimColor />
                </Box>
                <Box flexShrink={0} width={7} justifyContent="flex-end">
                  <Text />
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label10}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail10}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge10}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label11}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail11}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge11}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label12}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail12}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge12}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} />
                  <Button plain dimColor label={`${t}`} />
                </Box>
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" marginTop={1}>
              <Box flexShrink={0}>
                <Text bold>
                  {title2}
                </Text>
                <Text dimColor>
                  {`  ${note}`}
                </Text>
              </Box>
              <Box flexGrow={1} flexShrink={1} minWidth={0} paddingLeft={1}>
                <Text dimColor wrap="truncate">
                  ────────
                </Text>
              </Box>
              <Box flexShrink={0} width={5} />
              <Box flexShrink={0} width={7} justifyContent="flex-end">
                <Text bold />
              </Box>
            </Box>
            <Text dimColor>
              {`  ${t}`}
            </Text>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box flexShrink={0} width={2}>
                  <Text dimColor>
                    │
                  </Text>
                </Box>
                <Box flexShrink={0} width={2}>
                  <Button plain dimColor label="▾" />
                </Box>
                <Box flexShrink={0} width={2}>
                  <Text>
                    {"✗ "}
                  </Text>
                </Box>
                <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                  <Box flexShrink={1} minWidth={0}>
                    <Text wrap="truncate-end">
                      {label13}
                    </Text>
                  </Box>
                  <Box flexShrink={100} minWidth={0} marginLeft={2}>
                    <Text dimColor wrap="truncate-end">
                      {detail13}
                    </Text>
                  </Box>
                  <Box flexShrink={0} marginLeft={2}>
                    <Markdown text={`${fileLink}`} dimColor />
                  </Box>
                </Box>
                <Box flexShrink={0} marginLeft={1}>
                  <Text>
                    {badge13}
                  </Text>
                </Box>
                <Box flexShrink={0} width={5} justifyContent="flex-end">
                  <Text dimColor />
                </Box>
                <Box flexShrink={0} width={7} justifyContent="flex-end">
                  <Text />
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label14}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail14}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge14}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label15}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail15}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge15}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Button plain dimColor label="▾" />
                  </Box>
                  <Box flexShrink={0} width={2}>
                    <Text>
                      {"✗ "}
                    </Text>
                  </Box>
                  <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
                    <Box flexShrink={1} minWidth={0}>
                      <Text wrap="truncate-end">
                        {label16}
                      </Text>
                    </Box>
                    <Box flexShrink={100} minWidth={0} marginLeft={2}>
                      <Text dimColor wrap="truncate-end">
                        {detail16}
                      </Text>
                    </Box>
                    <Box flexShrink={0} marginLeft={2}>
                      <Markdown text={`${fileLink}`} dimColor />
                    </Box>
                  </Box>
                  <Box flexShrink={0} marginLeft={1}>
                    <Text>
                      {badge16}
                    </Text>
                  </Box>
                  <Box flexShrink={0} width={5} justifyContent="flex-end">
                    <Text dimColor />
                  </Box>
                  <Box flexShrink={0} width={7} justifyContent="flex-end">
                    <Text />
                  </Box>
                </Box>
                <Box flexDirection="row">
                  <Box flexShrink={0} width={2}>
                    <Text dimColor>
                      │
                    </Text>
                  </Box>
                  <Box flexShrink={0} />
                  <Button plain dimColor label={`${t}`} />
                </Box>
              </Box>
            </Box>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box flexShrink={0} width={2}>
                  <Text dimColor>
                    │
                  </Text>
                </Box>
                <Box flexShrink={0} width={2}>
                  <Button plain dimColor label="▾" />
                </Box>
                <Box flexShrink={0} width={2}>
                  <Text>
                    {"✗ "}
                  </Text>
                </Box>
                <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row" />
              </Box>
            </Box>
          </Box>
        </Box>
      </Box>
    )
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

plugins/context-window/hooks/register.tsx lines 257–287 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const isInline = e.props.placement === 'inline'
    if (isInline && !(await read($, asked))) {
      // Opened at session start on a layout with no sidebar: step aside.
      void $.clock.after(0, () => void $.ui.close({ id: PANE }))
      const { Text } = $.ui.resolve(e)

      return <Text dimColor>context-window: /context-window to open</Text>
    }
    const current = normalizeLog(await read($, log))

    return drawPane(
      $.ui.resolve(e),
      {
        fill: await read($, fill),
        startup: await read($, startup),
        entries: current.entries,
        epoch: current.epoch,
        view: await read($, view),
        toggled: await read($, toggled),
        lang: await read($, lang),
        columns: Math.max(24, e.props.bodyColumns),
        isInline,
      },
      {
        toggle: key => void toggle($, key),
        setView: next => void update($, view, () => next),
        refresh: () => void refresh($),
      },
    )
  })
plugins/context-window/hooks/view.tsx lines 146–305 · Pane
export function drawPane(ui: Ui, data: PaneData, act: PaneActions) {
  const { Box, Text, Button, Markdown } = ui
  const { lang } = data
  const tr = (text: string | undefined, arg?: string | number) =>
    text === undefined ? undefined : hasKey(text) ? t(lang, text, arg ?? '') : text
  const isOpen = (key: string, byDefault: boolean) => byDefault !== data.toggled.includes(key)

  /** The indent guides for a row `depth` levels down, one fixed cell each. */
  const indent = (depth = 0) =>
    Array.from({ length: depth }, () => (
      <Box flexShrink={0} width={INDENT_WIDTH}>
        <Text dimColor>│</Text>
      </Box>
    ))
  const live = data.entries.filter(entry => entry.epoch === data.epoch)
  const inWindow = live.filter(entry => !entry.isOutside)
  const groups = data.startup?.groups ?? []
  const startupTokens = sum(groups)
  const hasShare = data.view === 'top' || data.view === 'category' || data.view === 'origin'

  /**
   * One row on a fixed grid: guides, toggle, glyph | name, detail or file link
   * (each truncated on its own, the detail first) | badge | share | tokens,
   * the last two right-aligned columns.
   */
  const row = (props: RowProps) => {
    const color = props.isError ? 'error' : props.color
    // A detail that only restates the name ("Environment  Environment") is dropped.
    const detail = props.detail && props.detail.toLowerCase() !== props.label.toLowerCase() ? props.detail : undefined
    const tokenColor = props.tokens === undefined || props.isQuiet ? undefined : sizeColor(props.tokens)

    return (
      <Box flexDirection="row">
        {indent(props.depth)}
        <Box flexShrink={0} width={TOGGLE_WIDTH}>
          {props.toggleKey ? (
            <Button
              key={props.toggleKey}
              plain
              dimColor
              label={props.isOpenNow ? '▾' : '▸'}
              onPress={() => act.toggle(props.toggleKey as string)}
            />
          ) : null}
        </Box>
        <Box flexShrink={0} width={GLYPH_WIDTH}>
          <Text color={color}>{`${props.isError ? '✗' : props.glyph} `}</Text>
        </Box>
        <Box flexGrow={1} flexShrink={1} minWidth={0} flexDirection="row">
          <Box flexShrink={1} minWidth={0}>
            <Text bold={props.isBold} dimColor={props.isQuiet} wrap="truncate-end">
              {props.label}
            </Text>
          </Box>
          {detail && !props.path ? (
            <Box flexShrink={100} minWidth={0} marginLeft={2}>
              <Text dimColor wrap="truncate-end">
                {detail}
              </Text>
            </Box>
          ) : null}
          {props.path ? (
            <Box flexShrink={0} marginLeft={2}>
              <Markdown text={fileLink(props.path)} dimColor />
            </Box>
          ) : null}
        </Box>
        {props.badge ? (
          <Box flexShrink={0} marginLeft={1}>
            <Text color={props.badgeColor} dimColor={!props.badgeColor}>
              {props.badge}
            </Text>
          </Box>
        ) : null}
        {hasShare ? (
          <Box flexShrink={0} width={SHARE_WIDTH} justifyContent="flex-end">
            <Text dimColor>{props.share ?? ''}</Text>
          </Box>
        ) : null}
        <Box flexShrink={0} width={TOKENS_WIDTH} justifyContent="flex-end">
          <Text color={tokenColor} dimColor={!tokenColor}>
            {props.tokens === undefined || (props.tokens === 0 && props.isQuiet) ? '' : formatTokens(props.tokens)}
          </Text>
        </Box>
      </Box>
    )
  }

  /** A section heading: title, dim note, a rule to the edge, its total. */
  const heading = (title: string, tokens?: number, note?: string) => {
    // Longer than any room it gets: the Box's edge cuts it, on any font.
    const rule = Math.max(2, data.columns)

    return (
      <Box flexDirection="row" marginTop={1}>
        <Box flexShrink={0}>
          <Text bold>{title}</Text>
          {note ? <Text dimColor>{`  ${note}`}</Text> : null}
        </Box>
        <Box flexGrow={1} flexShrink={1} minWidth={0} paddingLeft={1}>
          <Text dimColor wrap="truncate">
            {'─'.repeat(rule)}
          </Text>
        </Box>
        {hasShare ? <Box flexShrink={0} width={SHARE_WIDTH} /> : null}
        <Box flexShrink={0} width={TOKENS_WIDTH} justifyContent="flex-end">
          <Text bold>{tokens === undefined ? '' : formatTokens(tokens)}</Text>
        </Box>
      </Box>
    )
  }

  /** Items under an open group, each on a branch, the first few then "N more". */
  const itemRows = (items: readonly StartupItem[], depth: number, key: string, total?: number) => {
    const shown = isOpen(`${key}:all`, false) ? items : items.slice(0, TOP_ITEMS)
    const more = items.length - shown.length

    return (
      <Box flexDirection="column">
        {shown.map(item =>
          row({
            depth,
            glyph: '·',
            color: 'inactive',
            label: tr(item.label) ?? '',
            detail: tr(item.detail, item.detailArg),
            path: item.path,
            share: total ? `${Math.round((item.tokens / total) * 100)}%` : undefined,
            tokens: item.tokens > 0 ? item.tokens : undefined,
          }),
        )}
        {more > 0 && (
          <Box flexDirection="row">
            {indent(depth)}
            <Box flexShrink={0} width={TOGGLE_WIDTH + GLYPH_WIDTH} />
            <Button key={`${key}:all`} plain dimColor label={t(lang, 'more', more)} onPress={() => act.toggle(`${key}:all`)} />
          </Box>
        )}
      </Box>
    )
  }

  // ── Timeline ──────────────────────────────────────────────────────────────

  /** The entries under each parent, in the order they came. */
  const children = new Map<string, Entry[]>()
  const ids = new Set(live.map(entry => entry.id))
  for (const entry of live) {
    if (!entry.parent || !ids.has(entry.parent)) continue
    children.set(entry.parent, [...(children.get(entry.parent) ?? []), entry])
  }
  const subtree = (entry: Entry): Entry[] => [entry, ...(children.get(entry.id) ?? []).flatMap(subtree)]

  /** One entry on its branch and, while open, its children and preview. */
  const node = (entry: Entry, depth: number) => {
    const style = KINDS[entry.kind]
    const kids = children.get(entry.id) ?? []
    const key = `node:${entry.id}`
    // An Agent's own steps live in its window, a preview is long: shut until asked.
    const open = isOpen(key, entry.kind !== 'agent' && kids.length > 0)
Licence text (MIT)
MIT License

Copyright (c) 2026 Chris Han

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

How to build this: Pane (panel), Add a slash command

What its code calls

env varsdrives Claude

What its code shows

Read from the source at commit 041fa4383b8f on 2026-10-11. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.plugins/context-window/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.4 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.starts no programs
Reads and sendsWhether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads environment variables, the system prompt, the transcript, but reaches nothing outside
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets ModsCode show its code; otherwise the code is linked.MIT
Settings hooksHooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone
Servers it shipsMCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/
Skills, commands, agentsWhat its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows
Tools and MCPWhether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).calls no tool, MCP server or command
Asks of the modelCompletions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command context-window
Events it hooksBy what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: command.run (context-window), session.append · shapes: prompt.compose, prompt.context, turn.step · also: session.start, ui.close, turn.complete, session.compact (+2) · timers: clock.after
Reads, by nameThe environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.env: LC_ALL, LC_MESSAGES, LANG; the system prompt; the transcript
Writes, by nameThe files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.writes no files, environment variables, settings or conversation rows

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and ModsCode does not vouch for what this code does. Read its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

From its marketplace

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add chrishan17/claude-mod-context-window
/plugin install context-window@claude-mod-context-window
/reload-plugins

This installs the marketplace's latest commit, which may not be the one read here (041fa4383b8f). Compare them before you install. /reload-plugins loads it into a session that is already open.

Try the commit ModsCode read

No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:

git clone https://github.com/chrishan17/claude-mod-context-window
git -C claude-mod-context-window checkout 041fa4383b8fbd85d13ab718b39722af22fd2fcf
claude plugin validate claude-mod-context-window/plugins/context-window
claude --plugin-dir claude-mod-context-window/plugins/context-window

The validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.

Ask Claude about it

With the ModsCode connector added, Claude can read this mod's code and what it reaches, and build on them. Ask it like this:

Read the ModsCode mod "chrishan17-context-window" with its code and make me one like it

Search them from Claude: the MCP connector

Similar mods

Badge for your README

If this is your mod, paste this into your README. It links to this page.

README.md
[![ModsCode](https://modscode.com/badge/chrishan17-context-window.svg)](https://modscode.com/claude-mods/mods/chrishan17-context-window/)