modscode EN

modscode / 図鑑 / vome-health

vome-health

A side pane for your Home Assistant's health: Vome's score out of 100 and what its check found, by severity with what to do, marked as Claude works on each, then a re-check rolls the score to the new one. Needs @vortitron/home-assistant-mc…

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

何をするか

  • デスクトップアプリに欄を描く
  • /health を足す
  • ツールの呼び出しを見張る(止めることがある)
  • session.startにフックする
  • ターンをまたいで自分の状態を持つ

良いところ

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

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like vome-health by Vortitron (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/vortitron-vome-health/
// 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: "Health" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Markdown, Code, Link } = $.ui.resolve(e)
    const ago = '…'
    const summary = '…'
    const label = '…'
    const label2 = '…'
    const label3 = '…'
    const since = '…'
    const length = '…'
    const title = '…'
    const title2 = '…'
    const title3 = '…'
    const label4 = '…'
    const title4 = '…'
    const recommendation = '…'
    const evidence = '…'
    const title5 = '…'
    const recommendation2 = '…'
    const evidence2 = '…'
    const title6 = '…'
    const recommendation3 = '…'
    const evidence3 = '…'
    const label5 = '…'
    const title7 = '…'
    const recommendation4 = '…'
    const evidence4 = '…'
    const title8 = '…'
    const recommendation5 = '…'
    const evidence5 = '…'
    const title9 = '…'
    const recommendation6 = '…'
    const evidence6 = '…'
    const label6 = '…'
    const title10 = '…'
    const recommendation7 = '…'
    const evidence7 = '…'
    const title11 = '…'
    const recommendation8 = '…'
    const evidence8 = '…'
    const title12 = '…'
    const recommendation9 = '…'
    const evidence9 = '…'
    const message = '…'
    const server = '…'
    const tool = '…'
    const healthUrl = '…'
    return (
      <Box flexDirection="column">
        <Text bold wrap="truncate-end">
          Home
          <Text>
            {"  "}
            ?
            /100
          </Text>
          <Text dimColor color="warning">
            {"  "}
            {"checked "}
            {ago}
            {" (re-check for today's)"}
          </Text>
        </Text>
        <Text dimColor wrap="wrap">
          {summary}
        </Text>
        <Text wrap="truncate-end">
          <Text>
            ⚠
            {" "}
            {label}
            {"   "}
          </Text>
          <Text>
            ⚠
            {" "}
            {label2}
            {"   "}
          </Text>
          <Text>
            ⚠
            {" "}
            {label3}
            {"   "}
          </Text>
        </Text>
        <Text color="suggestion" wrap="wrap">
          Checking… the new score lands here in a couple of minutes (
          {since}
          {" so far)."}
        </Text>
        <Box flexDirection="column" marginTop={1}>
          <Text color="warning">
            ?
            {" → "}
            ?
            {`: ${length} finding gone`}
            {`, ${length} new`}
          </Text>
          <Text color="success" strikethrough wrap="truncate-end">
            {"✓ "}
            {title}
          </Text>
          <Text color="success" strikethrough wrap="truncate-end">
            {"✓ "}
            {title2}
          </Text>
          <Text color="success" strikethrough wrap="truncate-end">
            {"✓ "}
            {title3}
          </Text>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text color="subtle">
            {label4}
          </Text>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title4}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title5}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation2}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence2}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title6}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation3}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence3}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text color="subtle">
            {label5}
          </Text>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title7}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation4}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence4}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title8}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation5}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence5}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title9}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation6}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence6}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text color="subtle">
            {label6}
          </Text>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title10}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation7}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence7}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title11}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation8}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence8}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between">
              <Text wrap="truncate-end" color="suggestion">
                <Text>
                  ✎
                </Text>
                {" "}
                {"+ "}
                {title12}
                <Text dimColor>
                  {" changed; re-check to confirm"}
                </Text>
              </Text>
              <Button>
                Ask again
              </Button>
            </Box>
            <Text dimColor wrap="wrap">
              {"   "}
              {recommendation9}
            </Text>
            <Text dimColor wrap="wrap">
              {"   "}
              {evidence9}
            </Text>
          </Box>
        </Box>
        <Text color="warning" wrap="wrap">
          {message}
        </Text>
        <Box flexDirection="column" borderStyle="round" borderColor="warning" paddingX={1} marginTop={1}>
          <Text color="warning" wrap="wrap">
            {"Auto mode refused the pane's "}
            re-check
            {". Add this to permissions.allow in "}
            ~/.claude/settings.json
            {", or ask Claude to "}
            re-check the health score
            :
          </Text>
          <Markdown text="[~/.claude/settings.json](file://~/.claude/settings.json)" />
          <Code source={`"mcp__${server}__${tool}"`} />
          <Box flexDirection="row" gap={2}>
            <Button hotkey="c">
              Copy the line
            </Button>
            <Button hotkey="t">
              Retry
            </Button>
          </Box>
        </Box>
        <Box flexDirection="row" gap={2} marginTop={1}>
          <Button hotkey="f">
            Fix what you can
          </Button>
          <Button hotkey="r">
            Checking…
          </Button>
          <Button hotkey="d" dimColor>
            Less
          </Button>
          <Button hotkey="b" dimColor>
            Animation off
          </Button>
          <Link href={`${healthUrl}`}>
            Full report
          </Link>
        </Box>
      </Box>
    )
  })
}

Mod 自身のコード

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

claude-plugin/vome-health/hooks/register.tsx 113〜272 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button, Code, Link, Markdown } = $.ui.resolve(e)
    const current = (await $.state.get(report)).value ?? null
    const latest = (await $.state.get(change)).value ?? null
    const running = (await $.state.get(checking)).value ?? null
    const worked = (await $.state.get(touched)).value ?? {}
    const handed = (await $.state.get(asked)).value ?? {}
    /** Hand findings to Claude: it fixes them with its own tools, which the person approves as usual. */
    const fix = async (findings: Finding[]) => {
      if (findings.length === 0) return
      await $.prompt.submit({ text: fixPrompt(findings, current ? homeName(current) : 'the home') })
      await $.state.set(asked, { ...handed, ...Object.fromEntries(findings.map(f => [f.id, Date.now()])) })
    }
    const isDetailed = (await $.state.get(details)).value ?? false
    const isFxEnabled = (await $.state.get(fxOn)).value ?? true
    const refusal = (await $.state.get(blocked)).value ?? null
    const message = (await $.state.get(note)).value ?? null
    const width = Math.max(20, e.props.bodyColumns)
    const isChangeShown = latest !== null && Date.now() - latest.at < CHANGE_SHOWN_MS

    let stage = null
    if (e.surface === 'terminal' && isFxEnabled) {
      const { Raster } = $.ui.resolve(e)
      const columns = Math.min(512, width)
      const home = current ? homeName(current) : ''
      const words = running
        ? `checking ${home || 'the home'}…`
        : current
          ? isChangeShown && latest.from !== null && latest.to !== null && latest.from !== latest.to
            ? `${home} · ${latest.from} → ${latest.to}`
            : `${home} · ${current.findings.length} finding${current.findings.length === 1 ? '' : 's'}`
          : 'no health score yet'
      strip = {
        columns,
        state: {
          score: current?.score ?? null,
          from: isChangeShown ? latest.from : null,
          changedAt: isChangeShown ? latest.at : null,
          isChecking: running !== null,
          words,
        },
      }
      stage = <Raster key="stage" columns={columns} rows={STRIP_ROWS} cells={stageFrame(Date.now(), strip.state, columns)} />
    } else {
      strip = null
    }

    const help = refusal ? (
      <Box flexDirection="column" borderStyle="round" borderColor="warning" paddingX={1} marginTop={1}>
        <Text color="warning" wrap="wrap">
          Auto mode refused the pane's {refusal.tool === 'vome_health_check' ? 're-check' : 'read of the report'}. Add this to
          permissions.allow in {settingsFile}, or ask Claude to {refusal.tool === 'vome_health_check' ? 're-check the health score' : 'read the health report'}:
        </Text>
        <Markdown text={`[${settingsFile}](file://${settingsFile})`} />
        <Code source={`"mcp__${refusal.server}__${refusal.tool}"`} />
        <Box flexDirection="row" gap={2}>
          <Button key="copy-rule" hotkey="c" onPress={press => $.ui.copy({ text: `"mcp__${refusal.server}__${refusal.tool}"`, surface: press.surface })}>
            Copy the line
          </Button>
          <Button
            key="retry"
            hotkey="t"
            onPress={async () => {
              await $.state.set(blocked, null)
              if (refusal.tool === 'vome_health_check') await requestCheck($, refusal.server)
              else await fetchReport($, refusal.server)
            }}
          >
            Retry
          </Button>
        </Box>
      </Box>
    ) : null

    if (!current) {
      return (
        <Box flexDirection="column">
          {stage}
          <Text dimColor wrap="wrap">
            No health score yet. Ask Claude "how healthy is my Home Assistant?", or press /health. Vome's check scores the home
            out of 100 and lists what to fix.
          </Text>
          {running ? <Text color="suggestion">Checking… the score lands here in a couple of minutes.</Text> : null}
          {message ? <Text color="warning" wrap="wrap">{message}</Text> : null}
          {help}
          {!running ? (
            <Box marginTop={1}>
              <Button
                key="first-check"
                hotkey="r"
                onPress={async () => {
                  const server = lastServer ?? (await healthServers($))[0]
                  if (server) await requestCheck($, server)
                  else await $.state.set(note, 'No connected MCP server has vome_health_check: connect Home Assistant through Vome first.')
                }}
              >
                Run the first check
              </Button>
            </Box>
          ) : null}
        </Box>
      )
    }

    const groups = groupFindings(current.findings)
    const ago = current.generatedAt ? since(Date.parse(current.generatedAt)) : 'unknown'
    const isStale = current.generatedAt !== null && Date.now() - Date.parse(current.generatedAt) > 7 * 24 * 3600_000

    return (
      <Box flexDirection="column">
        {stage}
        <Text bold wrap="truncate-end">
          {homeName(current)}
          <Text color={scoreColour(current.score)}>
            {'  '}
            {current.score ?? '?'}/100
          </Text>
          <Text dimColor color={isStale ? 'warning' : undefined}>
            {'  '}checked {ago}
            {isStale ? ' (re-check for today\'s)' : ''}
          </Text>
        </Text>
        {current.summary ? (
          <Text dimColor wrap="wrap">
            {current.summary}
          </Text>
        ) : null}
        <Text wrap="truncate-end">
          {current.categories.map((category: Category) => (
            <Text color={severityColour(category.severity)}>
              {severityIcon(category.severity)} {category.label}
              {'   '}
            </Text>
          ))}
        </Text>
        {running ? (
          <Text color="suggestion" wrap="wrap">
            Checking… the new score lands here in a couple of minutes ({since(running.startedAt).replace(' ago', '')} so far).
          </Text>
        ) : null}
        {isChangeShown ? (
          <Box flexDirection="column" marginTop={1}>
            <Text color={latest.to !== null && latest.from !== null && latest.to < latest.from ? 'warning' : 'success'}>
              {latest.from ?? '?'} → {latest.to ?? '?'}
              {latest.resolved.length > 0 ? `: ${latest.resolved.length} finding${latest.resolved.length === 1 ? '' : 's'} gone` : ''}
              {latest.added.length > 0 ? `, ${latest.added.length} new` : ''}
            </Text>
            {latest.resolved.map((finding: Finding) => (
              <Text color="success" strikethrough wrap="truncate-end">
                ✓ {finding.title}
              </Text>
            ))}
          </Box>
        ) : null}
        {groups.map(group => (
          <Box flexDirection="column" marginTop={1}>
            <Text color="subtle">{group.label}</Text>
            {group.findings.map((finding: Finding) => {
              const isWorked = worked[finding.id] !== undefined
              const isNew = isChangeShown && latest.added.includes(finding.id)
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Andrew Lyeklint Hancock (Vortitron)

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。claude-plugin/vome-health/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。2 ファイルを解析
コードが 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 Vortitron/home-assistant-mcp
/plugin install vome-health@vome

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン