repo-sessions
Pane listing the Claude Code and Codex sessions working in this repo or folder
確かめやすいコードターミナル+デスクトップペインバンドステータスラインBoxButtonSvgText
何をするか
- プロンプトの上の帯・欄を描く
- /sessions-here・/sessions-pane を足す
- session.startにフックする
- ターンをまたいで自分の状態を持つ
- プロセスを起こす
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
register.tsx
import type { Register } from 'claude-code'
// Drawn like repo-sessions by Gabriel Blacher (pane, band, status), as modscode read it from the mod's code:
// https://modscode.com/gallery/gblacher2-repo-sessions/
// 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 band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Svg, Button } = $.ui.resolve(e)
const source = '…'
const length = '…'
const agent = '…'
const status = '…'
const name = '…'
const text = '…'
const label = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" alignItems="center" justifyContent="space-between" gap={1}>
<Box flexDirection="row" alignItems="center" gap={2}>
<Svg source={`${source}`} alt={`${length} other sessions in this repo`} />
<Box flexDirection="row" alignItems="center" gap={1}>
<Svg source={`${source}`} alt={`${agent} ${status}`} />
<Button label={`${name}`} plain />
<Svg source={`${source}`} alt={`${text}`} />
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Svg source={`${source}`} alt={`${agent} ${status}`} />
<Button label={`${name}`} plain />
<Svg source={`${source}`} alt={`${text}`} />
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Svg source={`${source}`} alt={`${agent} ${status}`} />
<Button label={`${name}`} plain />
<Svg source={`${source}`} alt={`${text}`} />
</Box>
<Svg source={`${source}`} alt={`${text}`} />
</Box>
<Button label={`${label}`} dimColor />
</Box>
<Svg source={`${source}`} alt="Session activity, last 10 minutes" />
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Sessions here" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Text } = $.ui.resolve(e)
return (
<Text>
Scanning…
</Text>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 235〜343 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { value: snap } = await $.state.get(SNAPSHOT)
const { value: isExpanded = false } = await $.state.get(EXPANDED)
const others = (snap?.peers ?? []).filter(p => !p.isSelf)
if (!snap || e.props.hasSurvey) return next(e)
const toggle = () => $.state.set(EXPANDED, !isExpanded)
const label = isExpanded ? 'Collapse' : 'Timeline'
if (e.surface !== 'terminal') {
const { Box, Button, Svg } = $.ui.resolve(e)
const header = summarySvg(snap)
const timeline = isExpanded ? paneSvg(snap, 560, { withHeader: false, isFixed: true }) : null
// Chips that fit beside the header and the toggle; the rest fold into +N.
let room = Math.min(1100, Math.max(320, e.props.bodyColumns * 7.5)) - header.width - 110
const shown = others.filter(p => {
const w = chipWidth(p.name, ago(snap.checkedAt - p.since), p.openUrl !== undefined)
if (w > room) return false
room -= w
return true
})
const hidden = others.length - shown.length
const more = hidden > 0 ? pixelTextSvg(`+${hidden}`) : null
return (
<Box flexDirection="column">
<Box flexDirection="row" alignItems="center" justifyContent="space-between" gap={1}>
<Box flexDirection="row" alignItems="center" gap={2}>
<Svg source={header.source} width={header.width} height={header.height} alt={`${others.length} other sessions in this repo`} />
{shown.map(p => {
const isBusy = p.status === 'busy'
const sprite = spriteSvg(p.agent, isBusy)
const time = pixelTextSvg(ago(snap.checkedAt - p.since))
const url = p.openUrl
return (
<Box key={`chip-${p.agent}-${p.id}`} flexDirection="row" alignItems="center" gap={1}>
<Svg source={sprite.source} width={sprite.width} height={sprite.height} alt={`${p.agent} ${p.status}`} />
{url ? (
<Button
key={`open-${p.agent}-${p.id}`}
label={p.name}
plain
dimColor={!isBusy}
onPress={() => $.process.run(['open', url])}
/>
) : (
<Svg source={nameSvg(p.name, isBusy).source} width={nameSvg(p.name, isBusy).width} height={16} alt={p.name} />
)}
<Svg source={time.source} width={time.width} height={time.height} alt={time.text} />
</Box>
)
})}
{more && <Svg source={more.source} width={more.width} height={more.height} alt={more.text} />}
</Box>
<Button key="toggle" label={label} dimColor onPress={toggle} />
</Box>
{timeline && (
<Svg source={timeline.source} width={timeline.width} height={timeline.height} alt="Session activity, last 10 minutes" />
)}
</Box>
)
}
const { Box, Button, Text } = $.ui.resolve(e)
const busy = others.filter(p => p.status === 'busy').length
return (
<Box flexDirection="column">
<Box flexDirection="row" gap={2}>
<Text wrap="truncate-end">
<Text bold>{snap.root.split('/').pop()}</Text>
<Text dimColor> {busy} busy · {others.length - busy} idle</Text>
</Text>
{others.map(p => {
const url = p.openUrl
return (
<Box key={`chip-${p.agent}-${p.id}`} flexDirection="row">
<Text color={p.status === 'busy' ? '#0ca30c' : 'gray'}>{p.status === 'busy' ? '●' : '○'}</Text>
<Text color={p.agent === 'codex' ? '#3987e5' : '#d95926'}>■ </Text>
{url ? (
<Button
key={`open-${p.agent}-${p.id}`}
label={p.name}
plain
dimColor={p.status !== 'busy'}
onPress={() => $.process.run(['open', url])}
/>
) : (
<Text dimColor={p.status !== 'busy'} wrap="truncate-end">{p.name}</Text>
)}
</Box>
)
})}
<Button key="toggle" label={label} dimColor onPress={toggle} />
</Box>
{isExpanded &&
others.map(p => (
<Text key={`row-${p.agent}-${p.id}`} wrap="truncate-end">
<Text color={p.agent === 'codex' ? '#3987e5' : '#d95926'}>{stripText(p.history)}</Text>
<Text dimColor> {p.status} {ago(snap.checkedAt - p.since)} · </Text>
{p.name}
</Text>
))}
</Box>
)
})hooks/register.tsx 346〜380 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { value: snap } = await $.state.get(SNAPSHOT)
if (e.surface !== 'terminal') {
const { Svg, Text } = $.ui.resolve(e)
if (!snap) return <Text>Scanning…</Text>
const pane = paneSvg(snap)
return <Svg source={pane.source} alt={`${snap.peers.length} sessions in this repo`} />
}
const { Box, Text } = $.ui.resolve(e)
if (!snap) return <Text dimColor>Scanning…</Text>
return (
<Box flexDirection="column">
{snap.peers.map(p => (
<Box key={`${p.agent}-${p.id}`} flexDirection="column" marginTop={1}>
<Text wrap="truncate-end">
<Text color={p.status === 'busy' ? '#0ca30c' : 'gray'}>{p.status === 'busy' ? '●' : '○'} </Text>
<Text bold={p.status === 'busy'}>{p.name}</Text>
</Text>
<Text wrap="truncate-end">
{' '}<Text color={p.agent === 'codex' ? '#3987e5' : '#d95926'}>{stripText(p.history)}</Text>
<Text dimColor>
{' '}{p.isSelf ? 'You · ' : ''}{p.status} {ago(snap.checkedAt - p.since)}
{p.branch ? ` · ${p.branch}` : ''}
{relativeCwd(p.cwd, snap.root) ? ` · ${relativeCwd(p.cwd, snap.root)}` : ''}
</Text>
</Text>
</Box>
))}
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Gabriel Blacher 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 を動かす保存
コードから読めること
2026-10-06 に読んだコミット 5972143582d8 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。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/… などは無い)。hooks/register.tsx:280 open(Windows にない); hooks/register.tsx:323 open(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.tsx:58 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。読んだうえで通信する |
| ソースの鍵 | ソースに 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 のデザイン「gblacher2-repo-sessions」をコードごと読んで、同じようなペインを作って似たデザイン
-
spending-effort-with-jev: no TypeSafe API key, so effort tips are off. Set it in /plugin.⚠ effort: long run, fuzzy spec → have Claude interview you, then go maxClaude に頼む…
-
✦ explain as pick how Claude answers×3 ● build3 ● build3 ● build▸ VideoClaude に頼む…
-
Claude に頼む…superpowersϟ Arc tokens showing buildNot now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)d darkl lightz daltonizeda ansiu auto
-
何をするか
- ターミナルにプロンプトの上の帯・欄・ステータス行・トーストを描く
- /agentzero を足す
- Bash の呼び出しを見張る(止めることがある)
- command.register・env.get・fs.read・fs.stat ほか 13 個にフックする
-
Claude に頼む…Timer● MonAprNo timer runningStopResume last CollapseFri week./meter.tsxUnbilled Wed h$1.24 · expenses MarMayToday, Oct 6This week
-
Claude に頼む…Notes⚠ A team of Never uses your Claude usage much faster.Showing:buildbuildbuildHide completed:buildbuildbuildSet team size:DefaultDefaultDefaultSet model:NotesNotesNotesWorkflowYour next prompt can hand work to Never Notes helpers.● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m