modscode EN

modscode / 図鑑 / heavens-feel

heavens-feel

Heaven's Feel cast for your agents: Sakura watches over the main session, Servants answer every subagent

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

何をするか

  • 欄・プロンプトの上の帯・トーストを描く
  • /hf を足す
  • ツールの呼び出しを見張る(止めることがある)
  • agent.spawn・config.set・prompt.submit・session.append ほか 6 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • プロセスを起こさない
  • TypeScript で書かれている
  • デスクトップ専用の分岐がある

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like heavens-feel by Yedidya Kfir (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/yedidyakfir-heavens-feel/
// 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: "Sakura's room" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text, Markdown } = $.ui.resolve(e)
    const nameOf = '…'
    const statusOf = '…'
    const title = '…'
    const allegianceOf = '…'
    const activity = '…'
    const line = '…'
    const split = '…'
    const description = '…'
    const length = '…'
    const clipText = '…'
    const outcome = '…'
    const icon = '…'
    const text = '…'
    const outcome2 = '…'
    const icon2 = '…'
    const text2 = '…'
    const outcome3 = '…'
    const icon3 = '…'
    const text3 = '…'
    const outcome4 = '…'
    const icon4 = '…'
    const text4 = '…'
    const outcome5 = '…'
    const icon5 = '…'
    const text5 = '…'
    const outcome6 = '…'
    const icon6 = '…'
    const text6 = '…'
    const outcome7 = '…'
    const icon7 = '…'
    const text7 = '…'
    const outcome8 = '…'
    const icon8 = '…'
    const text8 = '…'
    const outcome9 = '…'
    const icon9 = '…'
    const text9 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" columnGap={2}>
          <Button label="◂ Sakura" hotkey="b" plain />
          <Box flexGrow={1} />
        </Box>
        <Box flexDirection="row" justifyContent="space-between" marginTop={1}>
          <Text bold>
            {"✦ "}
            {nameOf}
          </Text>
          <Text dimColor>
            {statusOf}
          </Text>
        </Box>
        <Text dimColor italic>
          {title}
          {" · "}
          {allegianceOf}
        </Text>
        <Box justifyContent="center" marginY={1}>
          <Text>
            ◆
          </Text>
        </Box>
        <Box flexDirection="row" columnGap={1}>
          finished
          <Box flexShrink={1} minWidth={0}>
            <Text wrap="truncate-end">
              {activity}
            </Text>
          </Box>
        </Box>
        <Box borderStyle="round" paddingX={1} marginTop={1}>
          <Text wrap="wrap" italic>
            「
            {line}
            」
          </Text>
        </Box>
        <Box marginTop={1}>
          <Text>
            {"── ✦ "}
            {split}
            's report ✦ ──
          </Text>
        </Box>
        <Text dimColor wrap="truncate-end">
          {description}
        </Text>
        <Text dimColor>
          Nothing to read yet. The summons has only begun.
        </Text>
        <Text dimColor>
          {"… "}
          {length}
          {" earlier rows"}
        </Text>
        <Box flexDirection="column">
          <Box flexDirection="row" columnGap={1}>
            <Text>
              ●
            </Text>
            <Box flexShrink={1} minWidth={0}>
              <Markdown text={`${clipText}`} />
            </Box>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon}
              {" "}
              {text}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon2}
              {" "}
              {text2}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome3}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon3}
              {" "}
              {text3}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row" columnGap={1}>
            <Text>
              ●
            </Text>
            <Box flexShrink={1} minWidth={0}>
              <Markdown text={`${clipText}`} />
            </Box>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome4}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon4}
              {" "}
              {text4}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome5}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon5}
              {" "}
              {text5}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome6}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon6}
              {" "}
              {text6}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row" columnGap={1}>
            <Text>
              ●
            </Text>
            <Box flexShrink={1} minWidth={0}>
              <Markdown text={`${clipText}`} />
            </Box>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome7}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon7}
              {" "}
              {text7}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome8}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon8}
              {" "}
              {text8}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text>
              {outcome9}
            </Text>
            <Text dimColor wrap="truncate-end">
              {icon9}
              {" "}
              {text9}
            </Text>
          </Box>
        </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, Button } = $.ui.resolve(e)
    const MOOD_LABEL = '…'
    const icon = '…'
    const text = '…'
    const text2 = '…'
    const nameOf = '…'
    const nameOf2 = '…'
    const nameOf3 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" columnGap={2}>
          <Box flexShrink={0} />
          <Box flexDirection="column" flexGrow={1} flexShrink={1} minWidth={0}>
            <Box flexDirection="row" columnGap={1}>
              <Box flexShrink={0} columnGap={1}>
                <Text>
                  ✸
                </Text>
                <Text bold>
                  Sakura
                </Text>
                <Text color="#1a1320" bold>
                  {` ${MOOD_LABEL} `}
                </Text>
              </Box>
              <Box flexGrow={1} />
              <Box flexShrink={0}>
                <Button label="open pane" plain />
              </Box>
            </Box>
            <Text wrap="truncate-end">
              {icon}
              {" "}
              {text}
            </Text>
            <Box borderStyle="round" paddingX={1}>
              <Text wrap="wrap" italic>
                「
                {text2}
                」
              </Text>
            </Box>
            <Box flexDirection="row" columnGap={1}>
              <Box flexDirection="column">
                <Text>
                  ◆
                </Text>
                <Text bold wrap="truncate-end">
                  {nameOf}
                </Text>
                <Text dimColor wrap="truncate-end">
                  done
                </Text>
              </Box>
              <Box flexDirection="column">
                <Text>
                  ◆
                </Text>
                <Text bold wrap="truncate-end">
                  {nameOf2}
                </Text>
                <Text dimColor wrap="truncate-end">
                  done
                </Text>
              </Box>
              <Box flexDirection="column">
                <Text>
                  ◆
                </Text>
                <Text bold wrap="truncate-end">
                  {nameOf3}
                </Text>
                <Text dimColor wrap="truncate-end">
                  done
                </Text>
              </Box>
            </Box>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const why = '…'
    await $.ui.toast(`Sakura is not herself (${why}). /compact helps, or /hf dark off.`)
    return next(e)
  })
}

Mod 自身のコード

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

hooks/register.tsx 449〜460 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const view = await readView($)
    const chosen = (await read($, viewing)) || e.props.view.agentId || ''
    const agent = chosen ? (view.agents[chosen] ?? rt.pastAgents.get(chosen)) : undefined
    const servant = agent ? { agent, messages: await agentMessages($, agent.id), canGoBack: !e.props.view.agentId } : undefined
    const controls = {
      view: (id: string) => void update($, viewing, () => id),
      back: () => void update($, viewing, () => ''),
      openTasks: () => void $.command.run({ command: 'tasks' }).catch(() => {}),
    }
    return drawPane($.ui.resolve(e), e, view, settings, bond, servant, controls)
  })
hooks/views.tsx 347〜406 行 · ペイン
export const drawPane = (
  ui: any,
  e: PaneEvent,
  view: View,
  settings: Settings,
  bond: Record<string, number>,
  servant: ServantView | undefined,
  controls: PaneControls,
) => {
  if (servant) return drawServantRoom(ui, e, view, servant, controls)
  const { Box, Text } = ui
  const { mood: currentMood, isDark, agents: all, bubble: line, now } = view
  const isTerminal = e.surface === 'terminal'
  const accent = isDark ? DARK_ACCENT : CAST.sakura.accent
  const size = portraitSize(e)
  const width = Math.max(10, e.props.bodyColumns - 2)
  const roster = sortedAgents(all)
  const running = roster.filter(agent => !agent.endedAt).length

  const portrait = (() => {
    if (isTerminal) return liveRaster(ui, PANE, 'portrait', 1, now, at => portraitFrame(size, sceneAt(at, false)))
    if ('Svg' in ui) return sakuraSvg(ui, size, scene => portraitFrame(size, scene), blinkFrame(size, isDark), SVG_PIXEL_HD, view)
    return <Text color={hex(accent)}>{isDark ? '(◣_◢)' : '(´• ᴗ •`)'}</Text>
  })()

  return (
    <Box flexDirection="column" width={width}>
      <Box flexDirection="row" justifyContent="space-between">
        <Text bold color={hex(accent)}>
          {isDark ? '✸' : '❀'} Sakura Matou
        </Text>
        <Text color={hex(accent)}>{hearts(bond.sakura ?? 0)}</Text>
      </Box>
      <Text dimColor italic>{isDark ? 'the shadow that waits at home' : `${CAST.sakura.title} · Master of Rider`}</Text>
      <Box justifyContent="center" marginY={1}>{portrait}</Box>
      <Box flexDirection="row" columnGap={1}>
        {moodPill(ui, currentMood, accent)}
        <Box flexShrink={1} minWidth={0}>
          <Text color={hex(accent)} wrap="truncate-end">{view.activity.icon} {view.activity.text}</Text>
        </Box>
      </Box>
      {line.text ? (
        <Box borderStyle="round" borderColor={hex(accent)} paddingX={1} marginTop={1}>
          <Text wrap="wrap" italic>「{line.text}」</Text>
        </Box>
      ) : null}
      <Box flexDirection="column" marginTop={1}>
        {shadowGauge(ui, view.ctx, settings.darkThreshold)}
        {clockLine(ui, now, settings, running)}
      </Box>
      {roster.length > 0 ? (
        <Box marginTop={1}>
          <Text color={hex(accent)}>── ✦ Servants ✦ ──</Text>
        </Box>
      ) : null}
      {roster.slice(0, ROSTER_LIMIT).map((agent, i) => servantCard(ui, e.surface, agent, view, width, i, () => controls.view(agent.id)))}
      {roster.length > ROSTER_LIMIT ? <Text dimColor>+{roster.length - ROSTER_LIMIT} more</Text> : null}
    </Box>
  )
}
hooks/views.tsx 305〜345 行 · ペイン
const drawServantRoom = (ui: any, e: PaneEvent, view: View, servant: ServantView, controls: PaneControls) => {
  const { Box, Text, Button } = ui
  const { agent, messages } = servant
  const entry = CAST[agent.character]
  const accent = agent.isError ? DARK_ACCENT : entry.accent
  const width = Math.max(10, e.props.bodyColumns - 2)
  const recent = messages.slice(-TRANSCRIPT_ROWS)
  return (
    <Box flexDirection="column" width={width}>
      <Box flexDirection="row" columnGap={2}>
        {servant.canGoBack ? <Button key="back" label="◂ Sakura" hotkey="b" plain onPress={controls.back} /> : null}
        <Box flexGrow={1} />
        {e.surface === 'terminal' ? <Button key="tasks" label="/tasks" hotkey="t" plain onPress={controls.openTasks} /> : null}
      </Box>
      <Box flexDirection="row" justifyContent="space-between" marginTop={1}>
        <Text bold color={hex(accent)}>✦ {nameOf(agent)}</Text>
        <Text dimColor>{statusOf(agent, view.now)}</Text>
      </Box>
      <Text dimColor italic>{entry.title} · {allegianceOf(agent.character)}</Text>
      <Box justifyContent="center" marginY={1}>{miniArt(ui, e.surface, PANE, `viewed:${agent.id}`, agent.id, 2, view)}</Box>
      <Box flexDirection="row" columnGap={1}>
        {moodPill(ui, agent.endedAt ? 'done' : agent.mood, accent)}
        <Box flexShrink={1} minWidth={0}>
          <Text color={hex(accent)} wrap="truncate-end">{agent.activity}</Text>
        </Box>
      </Box>
      {agent.line ? (
        <Box borderStyle="round" borderColor={hex(accent)} paddingX={1} marginTop={1}>
          <Text wrap="wrap" italic>「{agent.line}」</Text>
        </Box>
      ) : null}
      <Box marginTop={1}>
        <Text color={hex(accent)}>── ✦ {entry.name.split(' ')[0]}'s report ✦ ──</Text>
      </Box>
      <Text dimColor wrap="truncate-end">{agent.description}</Text>
      {recent.length === 0 ? <Text dimColor>Nothing to read yet. The summons has only begun.</Text> : null}
      {messages.length > recent.length ? <Text dimColor>… {messages.length - recent.length} earlier rows</Text> : null}
      {recent.map((message, i) => transcriptRow(ui, message, i, accent))}
    </Box>
  )
}
hooks/views.tsx 172〜184 行 · ペイン
const miniArt = (ui: any, surface: string, requestId: string, key: string, id: string, scale: 1 | 2, view: View) => {
  const frameAt = agentMiniAt(id)
  const character = rt.agents[id]?.character ?? 'sakura'
  const accent = CAST[character].accent
  if (surface === 'terminal') return liveRaster(ui, requestId, key, scale, view.now, frameAt)
  const current = frameAt(view.now)
  if ('Svg' in ui && current) {
    const pixel = SVG_PIXEL_MINI * scale
    const source = gridToSvg(current.grid, { pixel, backdrop: backdropFor(view.theme, accent) })
    return <ui.Svg source={source} alt={CAST[character].name} {...svgBox(current.grid, pixel)} />
  }
  return <ui.Text color={hex(accent)}>◆</ui.Text>
}
hooks/views.tsx 267〜300 行 · ペイン
const transcriptRow = (ui: any, message: ServantMessage, index: number, accent: number) => {
  const { Box, Text } = ui
  if (message.role === 'user') {
    if (!message.text) return null
    return (
      <Box key={`row-${index}`} flexDirection="row" columnGap={1}>
        <Text color={hex(CAST.sakura.accent)}>❀</Text>
        <Text dimColor italic wrap="wrap">{clipText(message.text, SUMMONS_CHARACTERS)}</Text>
      </Box>
    )
  }
  return (
    <Box key={`row-${index}`} flexDirection="column">
      {message.text ? (
        <Box flexDirection="row" columnGap={1}>
          <Text color={hex(accent)}>●</Text>
          <Box flexShrink={1} minWidth={0}>
            <ui.Markdown text={clipText(message.text, MESSAGE_CHARACTERS)} />
          </Box>
        </Box>
      ) : null}
      {message.toolUses.map((use, k) => {
        const doing = describeTool(use.tool, use.input)
        const outcome = use.isError ? '✗' : use.text !== undefined || use.result !== undefined ? '✓' : '…'
        return (
          <Box key={`use-${index}-${k}`} flexDirection="row" columnGap={1}>
            <Text color={hex(use.isError ? DARK_ACCENT : accent)}>{outcome}</Text>
            <Text dimColor wrap="truncate-end">{doing.icon} {doing.text}</Text>
          </Box>
        )
      })}
    </Box>
  )
}
hooks/views.tsx 214〜218 行 · ペイン
const moodPill = (ui: any, mood: HeavensFeelMood, accent: number) => (
  <ui.Text backgroundColor={hex(accent)} color={PILL_TEXT} bold>
    {` ${MOOD_LABEL[mood]} `}
  </ui.Text>
)
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Yedidya Kfir

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 に読んだコミット 7792e2110021 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。9 ファイルを解析
コードが 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/… などは無い)。Windows にないプログラムを使わない
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

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

入れる

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

リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。

/plugin marketplace add yedidyakfir/heavens-feel
/plugin install heavens-feel@heavens-feel

入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(7792e2110021)と違うことがあります。入れる前に見比べてください。

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン