refs
Tracks the reference codes (F1, D2, A3) Claude defines: a /refs pane, and cited codes resolved for the model
何をするか
- 欄・トーストを描く
- /refs を足す
- prompt.edit・prompt.submit・session.end・session.start ほか 1 個にフックする
良いところ
- ネットワークに出ない
- プロセスを起こさない
- TypeScript で書かれている
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like refs by Rafe Symonds (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/rafesymonds-refs/
// 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: "Refs" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Input, Button, Text } = $.ui.resolve(e)
const key = '…'
const label = '…'
const length = '…'
const stagedCount = '…'
const sentCount = '…'
const searched = '…'
const name = '…'
const inUse = '…'
const code = '…'
const text = '…'
const marker = '…'
const word = '…'
const marker2 = '…'
const marker3 = '…'
const typed = '…'
const question = '…'
const text2 = '…'
const marker4 = '…'
const marker5 = '…'
const marker6 = '…'
const typed2 = '…'
const code2 = '…'
const question2 = '…'
const text3 = '…'
const marker7 = '…'
const marker8 = '…'
const marker9 = '…'
const typed3 = '…'
const code3 = '…'
const question3 = '…'
const name2 = '…'
const inUse2 = '…'
const text4 = '…'
const marker10 = '…'
const marker11 = '…'
const marker12 = '…'
const typed4 = '…'
const code4 = '…'
const question4 = '…'
const text5 = '…'
const marker13 = '…'
const marker14 = '…'
const marker15 = '…'
const typed5 = '…'
const code5 = '…'
const question5 = '…'
const text6 = '…'
const marker16 = '…'
const marker17 = '…'
const marker18 = '…'
const typed6 = '…'
const code6 = '…'
const question6 = '…'
const name3 = '…'
const inUse3 = '…'
const text7 = '…'
const marker19 = '…'
const marker20 = '…'
const marker21 = '…'
const typed7 = '…'
const code7 = '…'
const question7 = '…'
const text8 = '…'
const marker22 = '…'
const marker23 = '…'
const marker24 = '…'
const typed8 = '…'
const code8 = '…'
const question8 = '…'
const text9 = '…'
const marker25 = '…'
const marker26 = '…'
const marker27 = '…'
const typed9 = '…'
const code9 = '…'
const question9 = '…'
return (
<Box flexDirection="column" gap={1} paddingX={1} paddingY={1}>
<Input label="⌕ " placeholder="Search codes, text or a group (findings, actions)" submitLabel="first match" />
<Box flexDirection="row" flexWrap="wrap" columnGap={2}>
<Button hotkey={`${key}`} label={`${label}`} plain dimColor />
<Button hotkey={`${key}`} label={`${label}`} plain dimColor />
<Button hotkey={`${key}`} label={`${label}`} plain dimColor />
</Box>
<Box flexDirection="row" gap={1}>
<Text bold>
{`${length} codes`}
</Text>
<Text color="cyan">
{"· "}
{stagedCount}
{" in your draft"}
</Text>
<Text dimColor>
{"· "}
{sentCount}
{" answered"}
</Text>
</Box>
<Text dimColor>
No codes match "
{searched}
".
</Text>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box flexDirection="row" gap={1}>
<Button label="▸" plain />
<Text bold>
{name}
</Text>
<Text dimColor>
{inUse}
</Text>
<Text>
❮
</Text>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker2}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker3}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code}
{" · "}
<Text italic>
{question}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text2}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker4}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker5}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker6}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed2}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code2}
{" · "}
<Text italic>
{question2}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text3}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker7}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker8}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker9}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed3}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code3}
{" · "}
<Text italic>
{question3}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box flexDirection="row" gap={1}>
<Button label="▸" plain />
<Text bold>
{name2}
</Text>
<Text dimColor>
{inUse2}
</Text>
<Text>
❮
</Text>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text4}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker10}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker11}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker12}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed4}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code4}
{" · "}
<Text italic>
{question4}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text5}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker13}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker14}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker15}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed5}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code5}
{" · "}
<Text italic>
{question5}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text6}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker16}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker17}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker18}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed6}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code6}
{" · "}
<Text italic>
{question6}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box flexDirection="row" gap={1}>
<Button label="▸" plain />
<Text bold>
{name3}
</Text>
<Text dimColor>
{inUse3}
</Text>
<Text>
❮
</Text>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text7}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker19}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker20}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker21}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed7}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code7}
{" · "}
<Text italic>
{question7}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text8}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker22}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker23}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker24}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed8}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code8}
{" · "}
<Text italic>
{question8}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1} paddingY={0}>
<Box flexDirection="row" gap={1}>
<Text>
❯
</Text>
<Text>
•
</Text>
<Button label={`${code}`} plain />
<Box flexGrow={1} flexShrink={1}>
<Text wrap="wrap">
{text9}
</Text>
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Box flexDirection="row">
<Text>
{marker25}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker26}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text>
{marker27}
</Text>
<Button label={`${word}`} plain />
</Box>
<Box flexDirection="row">
<Text color="yellow" dimColor>
○
{" "}
</Text>
<Button label="defer" plain dimColor />
</Box>
<Box flexDirection="row">
<Text color="blue">
{"○ "}
</Text>
<Button label="type" plain />
</Box>
<Box flexDirection="row">
<Text color="magenta">
{"○ "}
</Text>
<Button label="btw" plain />
</Box>
</Box>
<Box flexDirection="row" gap={1} marginTop={1}>
<Text color="blue">
✎
</Text>
<Box flexShrink={1}>
<Text wrap="wrap" color="blue">
{typed9}
</Text>
</Box>
<Button label="edit" plain dimColor />
<Button label="remove" plain dimColor />
</Box>
<Box marginTop={1}>
<Input label="✎ " placeholder={`Your answer to ${code}; Enter adds it to your prompt`} value="" autoFocus submitLabel="add" />
</Box>
<Box marginTop={1}>
<Input autoFocus label="btw " placeholder={`Ask about ${code}; Enter on empty asks for more depth`} submitLabel="ask" />
</Box>
<Box flexDirection="column" marginTop={1} paddingX={1} borderStyle="round" borderColor="magenta">
<Text color="magenta" bold>
{"btw · "}
{code9}
{" · "}
<Text italic>
{question9}
</Text>
</Text>
<Text dimColor>
Asking…
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="column" borderStyle="round" borderColor="yellow" borderDimColor paddingX={1} />
</Box>
)
})
on('session.start', async ($, e, next) => {
const code = '…'
const reason = '…'
await $.ui.toast(`${code} deferred: Claude records it in the repo's docs when you send`)
await $.ui.toast(`Can't jump to ${code}: ${reason}`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
plugins/refs/hooks/register.tsx 488〜647 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const elements = $.ui.resolve(e)
const { Box, Button, Markdown, Text } = elements
// Mobile draws no Input: no search or typed answers there.
const Input = 'Input' in elements ? elements.Input : undefined
const list = await read($, codes)
const inDraft = await read($, staged)
const answered = await read($, sent)
const open = await read($, asides)
const searched = await read($, query)
const typingCode = await read($, typing)
const askingCode = await read($, asking)
if (list.length === 0) {
return <Text dimColor>No reference codes yet. They appear here as Claude defines them.</Text>
}
const away = await read($, parked)
const isDeferredOpen = await read($, showDeferred)
const turnNow = await read($, turn)
const matches = search(list, searched, prefix => nameOf(prefix, list))
const shownRefs = matches.filter(ref => !away.includes(ref.code))
const deferredRefs = matches.filter(ref => away.includes(ref.code))
const foldedNow = await read($, folded)
const order = walkOrder(group(shownRefs), foldedNow)
const selectedNow = await read($, selected)
const selectedRef = order.find(ref => ref.code === selectedNow) ?? order[0]
const selectedCode = selectedRef?.code
const stagedCount = Object.keys(inDraft).length
const sentCount = Object.keys(answered).length
const setQuery = (value: string) => update($, query, () => value)
// The keyboard: each key is a plain Button whose hotkey works while the pane
// holds the keys. Drawn as `j: down`, so the row is its own legend.
const onSelected = (act: (code: string) => Promise<void>) => async () => {
if (selectedCode !== undefined) await act(selectedCode)
}
const hasInput = Input !== undefined
const KEYS: { key: string; label: string; run: () => Promise<void> }[] = [
{ key: 'j', label: 'down', run: () => move($, 'next') },
{ key: 'k', label: 'up', run: () => move($, 'previous') },
{ key: 'g', label: 'top/end', run: () => move($, 'ends') },
...(['y', 'n'] as const).flatMap((key, at) => {
const verb = selectedRef === undefined ? undefined : verbsFor(selectedRef.prefix, kinds)[at]
if (verb === undefined) return []
const [slot, word] = verb
return [{ key, label: word, run: onSelected(async () => answerRef($, selectedRef as Ref, slot)) }]
}),
{ key: 'd', label: 'defer', run: onSelected(async () => park($, selectedRef as Ref)) },
...(hasInput ? [{ key: 'i', label: 'type', run: onSelected(code => typeAnswer($, code)) }] : []),
{ key: 'x', label: 'clear', run: onSelected(code => setAnswer($, code, '')) },
{
key: 'b',
label: 'btw',
run: onSelected(async code => {
const ref = order.find(one => one.code === code)
if (ref !== undefined) await toggleAside($, ref, hasInput)
}),
},
{ key: 'p', label: 'put code', run: onSelected(code => putCode($, code)) },
{
key: 'z',
label: 'fold',
run: onSelected(async code => {
const ref = order.find(one => one.code === code)
if (ref !== undefined) await toggleFold($, ref.prefix)
}),
},
{ key: 'o', label: 'open', run: onSelected(code => jumpTo($, code)) },
...(hasInput
? [{ key: 's', label: 'search', run: async () => void (await focusOn($, 'search')) }]
: []),
{ key: 'q', label: 'close', run: () => $.ui.close({ id: PANE }) },
]
return (
<Box flexDirection="column" gap={1} paddingX={1} paddingY={1}>
{Input !== undefined && (
<Input
key="search"
label="⌕ "
placeholder="Search codes, text or a group (findings, actions)"
submitLabel="first match"
onInput={setQuery}
onSubmit={async value => {
await setQuery(value)
const first = (await shownOrder($))[0]
if (first !== undefined) {
await update($, selected, () => first.code)
await focusOn($, `code:${first.code}`)
}
}}
/>
)}
{hasVimKeys && (
<Box flexDirection="row" flexWrap="wrap" columnGap={2}>
{KEYS.map(({ key, label, run }) => (
<Button key={`key:${key}`} hotkey={key} label={label} plain dimColor onPress={() => void run()} />
))}
</Box>
)}
<Box flexDirection="row" gap={1}>
<Text bold>
{searched.trim() === ''
? `${shownRefs.length} codes`
: `${shownRefs.length} of ${list.length - away.length} codes`}
</Text>
{stagedCount > 0 && <Text color="cyan">· {stagedCount} in your draft</Text>}
{sentCount > 0 && <Text dimColor>· {sentCount} answered</Text>}
</Box>
{shownRefs.length === 0 && <Text dimColor>No codes match "{searched}".</Text>}
{group(shownRefs).map(({ prefix, refs }) => {
const style = { name: nameOf(prefix, list), color: colorOf(prefix) }
const isFolded = foldedNow.includes(prefix)
const holdsSelection = refs.some(ref => ref.code === selectedCode)
const verbs = verbsFor(prefix, kinds)
return (
<Box
flexDirection="column"
borderStyle="round"
borderColor={style.color}
borderDimColor={!holdsSelection}
paddingX={1}
>
<Box key={`group:${prefix}`} flexDirection="row" gap={1}>
<Button
key={`fold:${prefix}`}
label={isFolded ? '▸' : '▾'}
plain
hover={{ color: style.color }}
onPress={() => toggleFold($, prefix)}
/>
<Text bold color={style.color}>
{style.name}
</Text>
<Text dimColor>{inUse(refs)}</Text>
{isFolded && holdsSelection && <Text color={style.color}>❮</Text>}
</Box>
{/* Each code: a pointer when selected, its mark (a draft answer bright,
a sent one dim, else a bullet), the code, and its text wrapping
under itself. Under the text: its answers, the typed answer with
edit and remove, any open field, and any btw answer. */}
{(isFolded ? [] : refs).map(ref => {
const draftAnswer = inDraft[ref.code]
const sentAnswer = answered[ref.code]
const shown = draftAnswer ?? sentAnswer
const mark = shown === undefined ? undefined : markFor(prefix, shown)
const isSelected = ref.code === selectedCode
const aside = open.find(one => one.code === ref.code)
const typed =
draftAnswer !== undefined && slotOf(prefix, draftAnswer, kinds) === undefined ? draftAnswer : undefined
const isFieldOpen = Input !== undefined && typingCode === ref.code
// Everything under a code lines up with its text.
const indent = ref.code.length + 5
const age = ref.turn === undefined ? AGE_BACKGROUND.length : turnNow - ref.turn
const background = AGE_BACKGROUND[age]ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Rafe Symonds 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 に読んだコミット efacb19a1582 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。plugins/refs/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 RafeSymonds/claude-mods/plugin install refs@claude-mods入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(efacb19a1582)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「rafesymonds-refs」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
Claude に頼む…Glossary BrowserGlossary openContextsContextsContexts▲ prevWrite1/Glossary▼ nextContexts
-
Claude に頼む…Desktop Markdown ReaderDesktop Markdown ReaderMarkdown file README.md applyChoose a Markdown file.No document loaded.Copy Markdown sourceRefresh
-
Claude に頼む…envbuildbuildbuild+ .env.localsrc/app.ts is not in .gitignoreWriteNo .env files in the project root yet.K = paste the value, Enter saves saveNew key: NAME, Enter to continuegenerate randomcancelMissing compared with Write:KKK
-
Claude に頼む…⏺ src/ WriteUpdated·0·0·0search: Edit nextUpdated1/3── Updated ────────› Edit› Edit› Edit⎿Updated> what to change in lines Warp-Edit sendenter to send to Claude ·cancel⎿ open the original⎿ open the original⎿ open the original✎> what to change in lines Warp-Edit sendenter to send to Claude ·cancel⎿ open the original⎿ open the original⎿ open the original✎> what to change in lines Warp-Edit sendenter to send to Claude ·cancel⎿ open the original⎿ open the original⎿ open the original✎⋯> what to change in lines Warp-Edit sendenter to send to Claude ·cancel⎿ open the original⎿ open the original⎿ open the original✎> what to change in lines Warp-Edit sendenter to send to Claude ·cancel⎿ open the original⎿ open the original⎿ open the original✎> what to change in lines Warp-Edit sendenter to send to Claude ·cancel⎿ open the original⎿ open the original⎿ open the original✎
-
Claude に頼む…Tasks for you● Open (3)● Completed (3)Auto: on---Let Claude use this pane on its own?Claude would post anything only you can do here, and check tasks off when you confirm them in chat.Nothing for you to do right now.Yes, automaticallyOnly when I ask---#a1b2c3d Fix login31. CopyCopy
npm test31. CopyCopynpm test31. CopyCopyExpect: Donenpm testDoneCopyCopyCopyCancel replyReply What happened? Paste output or describe it send---#a1b2c3d Fix login31. CopyCopynpm test31. CopyCopynpm test31. CopyCopyExpect: Donenpm testDoneCopyCopyCopyCancel replyReply What happened? Paste output or describe it send---#a1b2c3d Fix login31. CopyCopynpm test31. CopyCopynpm test31. CopyCopyExpect: Donenpm testDoneCopyCopyCopyCancel replyReply What happened? Paste output or describe it send