modscode EN

modscode / 図鑑 / mess-ages

mess-ages

Dim 'time ago · short summary' labels under every message in Claude Code, and an /ages side panel

確かめやすいコードターミナル+デスクトップペインBoxButtonText

何をするか

  • 欄を描く
  • /ages を足す
  • ツールの呼び出しを見張る(止めることがある)
  • prompt.submit・session.start・turn.complete・turn.start ほか 2 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • エラーを扱う

作り始めるためのコード

2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。

雛形(register.tsx)

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

// Drawn like mess-ages by tejeshkinariwala (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/tejeshkinariwala-mess-ages/
// 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: "Ages" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const hidden = '…'
    const title = '…'
    const length = '…'
    const age = '…'
    const verb = '…'
    const detail = '…'
    const detail2 = '…'
    const detail3 = '…'
    const age2 = '…'
    const detail4 = '…'
    const detail5 = '…'
    const detail6 = '…'
    const age3 = '…'
    const detail7 = '…'
    const detail8 = '…'
    const detail9 = '…'
    const age4 = '…'
    const detail10 = '…'
    const detail11 = '…'
    const detail12 = '…'
    const age5 = '…'
    const detail13 = '…'
    const detail14 = '…'
    const detail15 = '…'
    const age6 = '…'
    const detail16 = '…'
    const detail17 = '…'
    const detail18 = '…'
    const age7 = '…'
    const detail19 = '…'
    const detail20 = '…'
    const detail21 = '…'
    const age8 = '…'
    const detail22 = '…'
    const detail23 = '…'
    const detail24 = '…'
    const age9 = '…'
    const detail25 = '…'
    const detail26 = '…'
    const detail27 = '…'
    return (
      <Box flexDirection="column">
        <Text dimColor>
          No messages yet.
        </Text>
        <Text dimColor>
          {`${hidden} earlier message (no summary)`}
        </Text>
        <Box flexDirection="column">
          <Button plain label={`▸ ${title} (${length})`} />
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail2}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail3}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age2}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail4}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail5}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail6}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age3}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail7}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail8}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail9}
                </Text>
              </Text>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Button plain label={`▸ ${title} (${length})`} />
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age4}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail10}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail11}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail12}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age5}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail13}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail14}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail15}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age6}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail16}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail17}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail18}
                </Text>
              </Text>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Button plain label={`▸ ${title} (${length})`} />
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age7}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail19}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail20}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail21}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age8}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail22}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail23}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail24}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box>
            <Box width={5} flexShrink={0}>
              <Text dimColor>
                {age9}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1}>
              <Text>
                <Text dimColor />
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail25}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail26}
                </Text>
                <Text dimColor>
                  {" | "}
                </Text>
                <Text>
                  {`${verb}: `}
                </Text>
                <Text dimColor>
                  {detail27}
                </Text>
              </Text>
            </Box>
          </Box>
        </Box>
        <Box>
          <Button label="Minimize" hotkey="m" />
          <Button label="Collapse all" hotkey="c" />
          <Button label="Expand all" hotkey="e" />
        </Box>
      </Box>
    )
  })
}

Mod 自身のコード

Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。

hooks/register.tsx 361〜420 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Button, Text } = $.ui.resolve(e)
    const all = await read($, labels)
    const list = rows(all, await read($, now))
    const shown = list.filter(row => row.label)
    const hidden = list.length - shown.length
    const parts = sections(await read($, groups), shown.map(row => row.id))
    const folded = await read($, folds)
    const byId = new Map(shown.map(row => [row.id, row]))

    const drawRow = (row: Row) => (
      <Box>
        {/* Fixed width, never shrunk: a long summary wraps in its own column. */}
        <Box width={AGE_WIDTH} flexShrink={0}>
          <Text dimColor>{row.age}</Text>
        </Box>
        <Box flexGrow={1} flexShrink={1}>
          {labelText(Text, row.label!, '')}
        </Box>
      </Box>
    )
    // Fold choices are written from the press, never while drawing.
    const setFolds = (fn: (m: Folds) => Folds) => update($, folds, fn)

    return (
      <Box flexDirection="column">
        {list.length === 0 && <Text dimColor>No messages yet.</Text>}
        {hidden > 0 && (
          <Text dimColor>{`${hidden} earlier message${hidden === 1 ? '' : 's'} (no summary)`}</Text>
        )}
        {parts
          ? parts.map(part => {
            const isFolded = isCollapsed(part, folded)
            return (
              <Box flexDirection="column">
                {/* The header: Enter on it (the focus ring is the cursor) folds or unfolds it. */}
                <Button
                  key={`group:${part.key}`} plain
                  label={`${isFolded ? '▸' : '▾'} ${part.title} (${part.ids.length})`}
                  onPress={() => setFolds(m => ({ ...m, [part.key]: !isCollapsed(part, m) }))}
                />
                {!isFolded && part.ids.map(id => drawRow(byId.get(id)!))}
              </Box>
            )
          })
          : shown.map(drawRow)}
        <Box>
          <Button key="minimize" label="Minimize" hotkey="m" onPress={() => $.ui.close({ id: PANE })} />
          {parts && (
            <Button key="collapse" label="Collapse all" hotkey="c"
              onPress={() => setFolds(m => ({ ...m, ...Object.fromEntries(parts.map(p => [p.key, true])) }))} />
          )}
          {parts && (
            <Button key="expand" label="Expand all" hotkey="e"
              onPress={() => setFolds(m => ({ ...m, ...Object.fromEntries(parts.map(p => [p.key, false])) }))} />
          )}
        </Box>
      </Box>
    )
  })
hooks/register.tsx 96〜110 行 · ペイン
function labelText(Text: any, label: Label, lead: string) {
  const segments = parseSegments(label.words)
  if (segments.length <= 1) return <Text {...colorOf(label.kind)}>{`${lead}${label.words}`}</Text>
  const verbColor = (verb: string) => colorOf(label.kind === 'input' ? 'input' : verbGroup(verb))
  return (
    <Text>
      {lead && <Text dimColor>{lead}</Text>}
      {segments.flatMap((s, i) => [
        ...(i ? [<Text dimColor>{' | '}</Text>] : []),
        ...(s.verb ? [<Text {...verbColor(s.verb)}>{`${s.verb}: `}</Text>] : []),
        <Text dimColor>{s.detail}</Text>,
      ])}
    </Text>
  )
}
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Tejesh Kinariwala

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.

コードが呼ぶもの

プログラム起動ファイル書き込み環境変数Claude を動かすツール呼び出し保存

コードから読み取ったデザイン

読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。

コードから読めること

2026-10-06 に読んだコミット 69f7e6e51380 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。8 ファイルを解析
コードが Mod の中で完結import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中
読める圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし
呼び出しが見える通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で
入れる前に自分で判断する材料
描く場所コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに同じように描く
入れる手順リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っておらず、入れる手順は出せない
Windows のプログラム$.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。hooks/register.tsx:233 rm(Windows にない)
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。rm
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件

入れる

入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。

リポジトリの .claude-plugin/marketplace.json にこの Mod が載っていないため、入れる手順は出せません。コードとして読むか、作者の README に従ってください。

Claude に聞く

modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:

modscode のデザイン「tejeshkinariwala-mess-ages」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン