modscode JA

modscode / Gallery / csr-lens

csr-lens

Painel ao lado da conversa com agentes, diffs como no VS Code, contexto, turnos com os comandos, árvore de arquivos ao vivo e inventário de plugins, e uma linha de resumo colorida acima do prompt. Só observa.

Code you can checkTerminal + desktopPaneBandToastBoxButtonSvgText

What it does

  • Draws a pane, a band above the prompt, toasts
  • Adds /lens, /inventario
  • Watches tool calls
  • Hooks agent.spawn, session.end, session.measure, session.send and 7 more
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

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

// Drawn like csr-lens by Cesar Schutz (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/cesarschutz-csr-lens/
// 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: "Lens" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const resumo = '…'
    const texto = '…'
    return (
      <Box flexDirection="column" paddingRight={0}>
        <Box flexDirection="column">
          <Box flexDirection="row" columnGap={2} marginBottom={1}>
            <Box flexShrink={0}>
              <Text backgroundColor="#0d80bf" color="#ffffff" bold>
                {" ✦ CSR "}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} minWidth={0}>
              <Text dimColor wrap="truncate-end">
                {resumo}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
            <Box flexShrink={0}>
              <Text backgroundColor="#0d80bf" color="#ffffff" bold>
                {" ✦ CSR "}
              </Text>
            </Box>
            <Box flexShrink={0}>
              <Text>
                {` ${texto} `}
              </Text>
            </Box>
            <Box flexShrink={0}>
              <Text>
                {` ${texto} `}
              </Text>
            </Box>
            <Box flexShrink={0}>
              <Text>
                {` ${texto} `}
              </Text>
            </Box>
            <Button label="Fechar" role="dismiss" plain dimColor />
          </Box>
          <Text color="claude">
            ────────
          </Text>
        </Box>
      </Box>
    )
  })

  // the band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Text } = $.ui.resolve(e)
    const rotulo = '…'
    const valor = '…'
    const complemento = '…'
    const extra = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
          <Box flexShrink={0}>
            <Text backgroundColor="#0d80bf" color="#ffffff" bold>
              {" ✦ CSR "}
            </Text>
          </Box>
          <Text>
            <Text backgroundColor="#30363d" color="#e6edf3">
              {` ${rotulo} `}
            </Text>
            <Text bold>
              {` ${valor}`}
            </Text>
            <Text>
              {" ━━━━━━━━"}
            </Text>
            <Text dimColor>
              ━━━━━━━━
            </Text>
            <Text>
              {` ${complemento}`}
            </Text>
            <Text>
              {` (${extra})`}
            </Text>
            <Text>
              {" "}
            </Text>
          </Text>
          <Text>
            <Text backgroundColor="#30363d" color="#e6edf3">
              {` ${rotulo} `}
            </Text>
            <Text bold>
              {` ${valor}`}
            </Text>
            <Text>
              {" ━━━━━━━━"}
            </Text>
            <Text dimColor>
              ━━━━━━━━
            </Text>
            <Text>
              {` ${complemento}`}
            </Text>
            <Text>
              {` (${extra})`}
            </Text>
            <Text>
              {" "}
            </Text>
          </Text>
          <Text>
            <Text backgroundColor="#30363d" color="#e6edf3">
              {` ${rotulo} `}
            </Text>
            <Text bold>
              {` ${valor}`}
            </Text>
            <Text>
              {" ━━━━━━━━"}
            </Text>
            <Text dimColor>
              ━━━━━━━━
            </Text>
            <Text>
              {` ${complemento}`}
            </Text>
            <Text>
              {` (${extra})`}
            </Text>
            <Text>
              {" "}
            </Text>
          </Text>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    await $.ui.toast(`csr-lens: a sessão não devolveu o detalhamento do contexto`)
    return next(e)
  })
}

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/csr-lens/hooks/register.tsx lines 2701–2772 · Pane
  on('ui.render', { component: 'Pane', requestId: PAINEL }, async ($, e) => {
    if (diagnostico !== undefined) {
      await anotar($, 'diagnóstico', () => registrar($, `desenho do painel (foco: ${e.props.isFocused ? 'sim' : 'não'})`))
    }

    const tabela = $.ui.resolve(e)
    const el: Elementos = {
      Box: tabela.Box,
      Text: tabela.Text,
      Button: tabela.Button,
      Input: 'Input' in tabela ? tabela.Input : null,
      Markdown: tabela.Markdown,
      Code: tabela.Code,
      // O terminal também tem um Svg na tabela (desenha só o alt): para as
      // telas, desenho em SVG é coisa do app; no terminal, nenhum.
      Svg: 'Svg' in tabela && e.surface !== 'terminal' ? tabela.Svg : null,
    }
    // A versão é o único valor que o painel lê: ele é redesenhado quando o
    // instantâneo muda (veja refrescarPainel e vigiarPainel), e não a cada
    // valor gravado.
    await read($, versao)
    // Desenhado, o painel está aberto (o vigia passa a acompanhá-lo).
    isPainelAberto = true

    // Um erro ao desenhar não deixa o painel em branco: ele aparece no painel
    // e vai para ~/.claude/csr-lens-erros.log, para ser corrigido.
    try {
      const partida = performance.now()
      // Sem instantâneo (o mod acabou de recarregar), lê direto desta vez.
      const visto = instantaneo ?? { dados: await lerDados($), agora: await $.clock.now() }
      const dados = visto.dados
      const quadro: Quadro = {
        largura: e.props.bodyColumns,
        linhas: e.props.scroll.bodyRows,
        agora: visto.agora,
        cotacao,
        raiz,
        // Sentado acima do prompt, e não ao lado: a versão compacta.
        isCompacto: e.props.placement === 'inline',
        isTerminal: e.surface === 'terminal',
        isFaixa: false,
        fechadas: dados.ui.secoesFechadas ?? [],
      }
      const arvore = desenhar(el, dados, quadro, acoes($))
      const gasto = Math.round(performance.now() - partida)

      // Um desenho lento passa do orçamento do hook e o painel fica sem
      // desenho: fica registrado, com a aba, para ser corrigido.
      if (gasto > DESENHO_LENTO_MS) {
        await anotar($, 'registro do desenho lento', () =>
          registrarErro($, `desenho lento: aba ${dados.ui.aba}, ${gasto} ms (${e.surface}, ${quadro.largura} colunas)`),
        )
      }

      return arvore
    } catch (erro) {
      const texto = erro instanceof Error ? `${erro.message}\n${erro.stack ?? ''}` : String(erro)
      await anotar($, 'registro do erro', () => registrarErro($, texto))
      const { Box, Text, Button } = el

      return (
        <Box flexDirection="column" rowGap={1}>
          <Text bold color={COR.vermelho}>O Lens falhou ao desenhar esta aba.</Text>
          <Text dimColor wrap="wrap">{texto.split('\n').slice(0, 8).join('\n')}</Text>
          <Text dimColor wrap="wrap">O erro foi gravado em ~/.claude/csr-lens-erros.log.</Text>
          <Box flexDirection="row">
            <Button key="erro-voltar" label="Ir para Agentes" onPress={() => acoes($).aba(1)} />
          </Box>
        </Box>
      )
    }
  })
plugins/csr-lens/hooks/telas.tsx lines 2604–2635 · Pane
export const desenhar = (
  el: Elementos,
  dados: Dados,
  quadro: Quadro,
  acoes: Acoes,
): RenderElement => {
  const { Box, Text } = el
  const resumo = dados.resumo
  // Os títulos de todas as seções na cor da aba aberta.
  const tomDaAba = ABAS.find(aba => aba.n === dados.ui.aba)?.tom
  const quadroDaAba: Quadro = tomDaAba === undefined ? quadro : { ...quadro, tomDaAba }

  // Uma coluna de margem à direita: a moldura dos cartões não encosta na borda do painel.
  return (
    <Box flexDirection="column" rowGap={respiro(quadro)} paddingRight={quadro.isCompacto ? 0 : 1}>
      <Box flexDirection="column">
        {!quadro.isCompacto && (
          <Box flexDirection="row" columnGap={2} marginBottom={1}>
            {seloDaMarca(el)}
            <Box flexGrow={1} flexShrink={1} minWidth={0}>
              <Text dimColor wrap="truncate-end">{resumo}</Text>
            </Box>
          </Box>
        )}
        {abas(el, dados, quadroDaAba, acoes)}
        {/* No Desktop o ─ é mais largo que uma coluna e a régua quebrava em duas linhas. */}
        {!quadro.isCompacto && quadro.isTerminal && regua(el, limitar(quadro.largura - 1, 10, 200), corDaAba(dados.ui.aba))}
      </Box>
      {corpo(el, dados, quadroDaAba, acoes)}
    </Box>
  )
}
plugins/csr-lens/hooks/telas.tsx lines 307–318 · Pane
export const seloDaMarca = (el: Pick<Elementos, 'Box' | 'Text'>, isCurto = false): RenderElement => {
  const { Box, Text } = el

  // Num Box que não encolhe: o selo nunca quebra em duas linhas.
  return (
    <Box flexShrink={0}>
      <Text backgroundColor={TONS.marca.fundo} color={TONS.marca.tinta} bold>
        {isCurto ? ' ✦ CSR ' : ' ✦ CSR Lens '}
      </Text>
    </Box>
  )
}
plugins/csr-lens/hooks/telas.tsx lines 320–351 · Pane
const abas = (el: Elementos, dados: Dados, quadro: Quadro, acoes: Acoes): RenderElement => {
  const { Box, Button } = el
  const isInteiras = quadro.largura >= LARGURA_DAS_ABAS_INTEIRAS

  // No terminal, o botão sem moldura já escreve a tecla antes do rótulo ("2: ± Diffs").
  return (
    <Box flexDirection="row" flexWrap="wrap" columnGap={quadro.isTerminal ? 2 : 1}>
      {quadro.isCompacto && seloDaMarca(el, true)}
      {ABAS.map(aba =>
        aba.n === dados.ui.aba ? (
          <Box key={`guia-${aba.n}`} flexShrink={0}>
            {selo(el, `${aba.icone} ${aba.nome}`, aba.tom, true, quadro.isTerminal ? undefined : 26)}
          </Box>
        ) : (
          <Box key={`guia-${aba.n}`} flexShrink={0}>
            <Button
              key={`aba-${aba.n}`}
              label={isInteiras ? `${aba.icone} ${aba.nome}` : aba.icone}
              hotkey={teclaDaAba(aba.n)}
              {...comMoldura(quadro)}
              hover={{ color: COR[aba.tom], bold: true }}
              onPress={() => acoes.aba(aba.n)}
            />
          </Box>
        ),
      )}
      {quadro.isFaixa && (
        <Button key="fechar" label="Fechar" role="dismiss" plain dimColor onPress={acoes.fechar} />
      )}
    </Box>
  )
}
plugins/csr-lens/hooks/pecas.tsx lines 20–41 · Pane
export const selo = (
  el: Pick<Elementos, 'Text'> & ComSvg,
  texto: string,
  tom: Tom | NomeDoTom,
  isNegrito = true,
  altura?: number,
): RenderElement => {
  const { Text } = el
  const cor = typeof tom === 'string' ? TONS[tom] : tom

  if (el.Svg !== undefined && el.Svg !== null) {
    const desenho = pilulasSoltas([{ texto, fundo: cor.fundo, tinta: cor.tinta, isNegrito }], altura === undefined ? {} : { altura, corpo: 13.5 })

    return <el.Svg source={desenho.source} alt={texto} width={desenho.width} height={desenho.height} />
  }

  return (
    <Text backgroundColor={cor.fundo} color={cor.tinta} bold={isNegrito}>
      {` ${texto} `}
    </Text>
  )
}
plugins/csr-lens/hooks/pecas.tsx lines 318–322 · Pane
export const regua = (el: Pick<Elementos, 'Text'>, largura: number, cor: string): RenderElement => {
  const { Text } = el

  return <Text color={cor}>{'─'.repeat(Math.max(4, largura))}</Text>
}
Licence text (MIT)
MIT License

Copyright (c) 2026 Cesar Schutz

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.

What its code calls

runs programswrites filesenv varsdrives Claudetool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit 42bf47e4e4a4 on 2026-10-06. 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/csr-lens/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.22 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, with its own branch for the desktop
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.plugins/csr-lens/hooks/register.tsx:502 a program named at run time; plugins/csr-lens/hooks/register.tsx:545 a program named at run time; plugins/csr-lens/hooks/register.tsx:1001 a program named at run time
Reads and sendsWhether it both reads files or environment variables and reaches the network.reads environment variables and files and reaches the network
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

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 the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

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 cesarschutz/claude-code-kit
/plugin install csr-lens@cesarschutz

This installs the marketplace's latest commit, which may not be the one read here (42bf47e4e4a4). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "cesarschutz-csr-lens" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs