workface
Keeps a long-running agent's working notes through every compaction: briefs the summarizer, re-attaches the notes after the summary, and shows them in a panel you can steer.
何をするか
- 欄・ステータス行を描く
- ツールの呼び出しを見張る(止めることがある)
- classic.SessionStart・prompt.submit・session.compact・session.measure ほか 2 個にフックする
- ターンをまたいで自分の状態を持つ
- プロセスを起こす
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like workface by Scott Hodge (pane, status), as modscode read it from the mod's code:
// https://modscode.com/gallery/scodge-24-workface/
// 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: "Workface" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button, Input } = $.ui.resolve(e)
const tranche = '…'
const lines = '…'
const fresh = '…'
const age = '…'
const commits = '…'
const heading = '…'
const length = '…'
const bullet = '…'
const text = '…'
const text2 = '…'
const text3 = '…'
const bullet2 = '…'
const text4 = '…'
const text5 = '…'
const text6 = '…'
const bullet3 = '…'
const text7 = '…'
const text8 = '…'
const text9 = '…'
const length2 = '…'
const bullet4 = '…'
const text10 = '…'
const text11 = '…'
const text12 = '…'
const bullet5 = '…'
const text13 = '…'
const text14 = '…'
const text15 = '…'
const bullet6 = '…'
const text16 = '…'
const text17 = '…'
const text18 = '…'
const length3 = '…'
const bullet7 = '…'
const text19 = '…'
const text20 = '…'
const text21 = '…'
const bullet8 = '…'
const text22 = '…'
const text23 = '…'
const text24 = '…'
const bullet9 = '…'
const text25 = '…'
const text26 = '…'
const text27 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column" marginBottom={1}>
<Box flexDirection="row" justifyContent="space-between">
<Text bold wrap="truncate-end">
{tranche}
</Text>
<Box flexShrink={0}>
<Button plain role="dismiss" label="✕" />
</Box>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0}>
<Box paddingX={1} backgroundColor="userMessageBackground">
<Button plain label="Compact" />
</Box>
<Box paddingX={1} backgroundColor="userMessageBackground">
<Button plain label="Full" />
</Box>
<Box paddingX={1} backgroundColor="userMessageBackground">
<Button plain label="Browse" />
</Box>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
<Box flexShrink={0}>
<Text>
{`${lines}/120 lines`}
</Text>
</Box>
<Box flexShrink={0}>
<Text>
{`+${fresh} new`}
</Text>
</Box>
<Box flexShrink={0}>
<Text>
{`· ${age} old`}
</Text>
</Box>
<Box flexShrink={0}>
<Text>
{`· ${commits} commit since`}
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" backgroundColor="userMessageBackground">
<Box flexDirection="row" flexShrink={1}>
<Text>
▍
</Text>
<Button plain label={`▾ ${heading}`} />
<Text dimColor>
{" "}
{length}
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet}
</Text>
<Text>
<Text>
{text}
</Text>
<Text>
{text2}
</Text>
<Text>
{text3}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet2}
</Text>
<Text>
<Text>
{text4}
</Text>
<Text>
{text5}
</Text>
<Text>
{text6}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet3}
</Text>
<Text>
<Text>
{text7}
</Text>
<Text>
{text8}
</Text>
<Text>
{text9}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" backgroundColor="userMessageBackground">
<Box flexDirection="row" flexShrink={1}>
<Text>
▍
</Text>
<Button plain label={`▾ ${heading}`} />
<Text dimColor>
{" "}
{length2}
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet4}
</Text>
<Text>
<Text>
{text10}
</Text>
<Text>
{text11}
</Text>
<Text>
{text12}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet5}
</Text>
<Text>
<Text>
{text13}
</Text>
<Text>
{text14}
</Text>
<Text>
{text15}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet6}
</Text>
<Text>
<Text>
{text16}
</Text>
<Text>
{text17}
</Text>
<Text>
{text18}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" backgroundColor="userMessageBackground">
<Box flexDirection="row" flexShrink={1}>
<Text>
▍
</Text>
<Button plain label={`▾ ${heading}`} />
<Text dimColor>
{" "}
{length3}
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet7}
</Text>
<Text>
<Text>
{text19}
</Text>
<Text>
{text20}
</Text>
<Text>
{text21}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet8}
</Text>
<Text>
<Text>
{text22}
</Text>
<Text>
{text23}
</Text>
<Text>
{text24}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between" paddingLeft={1}>
<Box flexDirection="row" flexShrink={1}>
<Text>
◆
</Text>
<Text>
{" "}
{bullet9}
</Text>
<Text>
<Text>
{text25}
</Text>
<Text>
{text26}
</Text>
<Text>
{text27}
</Text>
</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} marginLeft={1} paddingRight={1}>
<Button plain label="✓" />
<Button plain dimColor label="↺" />
</Box>
</Box>
<Box marginTop={1}>
<Input label="◆ note" placeholder="owner note or decision" submitLabel="add" />
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
<Box flexShrink={0}>
<Text>
{`${length} omitted`}
</Text>
</Box>
<Box flexShrink={0}>
<Text>
from the re-attach
</Text>
</Box>
<Box flexShrink={0}>
<Button plain dimColor label="· restore all" />
</Box>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const tranche = '…'
const lines = '…'
const over = '…'
const age = '…'
const stale = '…'
await $.ui.status(`${tranche} · ${lines}${over}/120L · ${age} old${stale}`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 616〜775 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const elements = $.ui.resolve(e)
const { Box, Button, Markdown, Text } = elements
const Input = 'Input' in elements ? elements.Input : undefined
const wf = await attached($)
if (!wf) return <Text dimColor>No workface is attached to this session; `/workface start` or `attach`.</Text>
const shown = await read($, view)
const open = await read($, expanded)
const wrapped = await read($, openLines)
const pending = await read($, asked)
const commits = await read($, behind)
const skip = (await read($, omitted))[wf.path] ?? []
const owned = new Set(await storedList($, 'ownerNotes', wf.path))
const before = new Set(await storedList($, 'snapshot', wf.path))
// What a line gets beside its gutter, padding and its ask/omit icons; longer lines are cut and can be opened.
const room = e.props.bodyColumns - 11
const lines = wf.text.trimEnd().split('\n').length
const fresh = wf.text.split('\n').filter(line => isItem(line) && !before.has(line)).length
const { sections } = parse(wf.text)
const now = await $.clock.now()
const ageMs = now - wf.mtimeMs
// A second press takes the ask back, as a second omit press restores.
const ask = (key: string, heading: string, body: string) =>
void update($, asked, now =>
now?.key === key
? null
: { key, text: `The owner points at this part of the workface (${wf.path}, section "${heading.slice(3)}"):\n${body}` },
)
const askButton = (key: string, heading: string, body: string) => (
<Button
key={`a:${key}`}
plain
dimColor={pending?.key !== key}
label={pending?.key === key ? '✓' : '?'}
onPress={() => ask(key, heading, body)}
/>
)
// The selected tab sits on the band colour, as a section heading does; the others stay dim.
const tab = (name: 'workface' | 'preview' | 'tranches', label: string) => (
<Box key={`tb:${name}`} paddingX={1} backgroundColor={shown === name ? 'userMessageBackground' : undefined}>
<Button key={`t:${name}`} plain dimColor={shown !== name} label={label} onPress={() => void update($, view, () => name)} />
</Box>
)
// A piece of the stats row: never shrinks, so one that does not fit moves to the next line whole.
const stat = (key: string, color: string | undefined, text: string) => (
<Box key={`st:${key}`} flexShrink={0}>
<Text color={color} dimColor={color === undefined}>
{text}
</Text>
</Box>
)
// Three rows, so a narrow dock never splits a word: name and close, the tabs, then the stats.
const header = (
<Box key="header" flexDirection="column" marginBottom={1}>
<Box flexDirection="row" justifyContent="space-between">
<Text bold color={palette.accent} wrap="truncate-end">
{tranche(wf.path)}
</Text>
<Box flexShrink={0}>
<Button key="close" plain role="dismiss" label="✕" onPress={() => void closePanel($)} />
</Box>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0}>
{tab('workface', 'Compact')}
{tab('preview', 'Full')}
{tab('tranches', 'Browse')}
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
{stat('lines', budgetColor(lines, palette), `${lines}/${BUDGET_LINES} lines`)}
{fresh > 0 && stat('fresh', palette.good, `+${fresh} new`)}
{stat('age', ageColor(ageMs, palette), `· ${age(ageMs)} old`)}
{commits > 0 && stat('commits', palette.sha, `· ${commits} commit${commits === 1 ? '' : 's'} since`)}
</Box>
</Box>
)
if (shown === 'preview') {
const preview = [
'**Added to every compaction’s summarizer instructions**',
'',
summarizerBrief(wf.path, '(the workface text shown below)'),
'',
'**Inserted after the compaction summary**',
'',
workfaceMessage(wf, skip, [...owned], 'right after this compaction summary'),
].join('\n')
return (
<Box flexDirection="column">
{header}
<Markdown key="preview" text={preview.slice(0, 10_000)} />
</Box>
)
}
if (shown === 'tranches') {
const rows = await tranches($)
return (
<Box flexDirection="column">
{header}
{rows.map(row => (
<Box key={`tr:${row.name}`} flexDirection="row" gap={1}>
<Text color={row.path === wf.path ? 'claude' : undefined} bold={row.path === wf.path}>
{row.path === wf.path ? '▸' : ' '} {row.name}
</Text>
<Text color={budgetColor(row.lines, palette)}>{row.lines}L</Text>
<Text color={ageColor(now - row.mtimeMs, palette)}>{age(now - row.mtimeMs)}</Text>
{row.running.length > 0 && <Text color={palette.good}>● {row.running.join(', ')}</Text>}
{row.idle > 0 && (
<Text dimColor>
○ {row.idle} not running
</Text>
)}
</Box>
))}
</Box>
)
}
const rows = sections.flatMap((section, index) => {
const isOpen = open.includes(section.heading)
const isOmitted = skip.includes(section.heading)
const items = section.lines.filter(isItem)
const head = (
<Box
key={`s:${section.heading}`}
flexDirection="row"
justifyContent="space-between"
backgroundColor="userMessageBackground"
>
<Box flexDirection="row" flexShrink={1}>
<Text color={isOmitted ? undefined : sectionColor(section.heading, index)} dimColor={isOmitted}>
▍
</Text>
<Button
key={`x:${section.heading}`}
plain
label={`${isOpen ? '▾' : '▸'} ${section.heading.slice(3)}`}
dimColor={isOmitted}
onPress={() =>
void update($, expanded, now =>
now.includes(section.heading) ? now.filter(heading => heading !== section.heading) : [...now, section.heading],
)
}
/>
<Text dimColor> {items.length}</Text>
</Box>
<Box flexDirection="row" gap={1} flexShrink={0} paddingRight={1}>
{askButton(section.heading, section.heading, [section.heading, ...items].join('\n'))}
<Button
key={`o:${section.heading}`}
plain
dimColor
label={isOmitted ? '↺' : '✕'}
onPress={() => void toggleOmitted($, wf.path, section.heading)}
/>
</Box>
</Box>ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Scott Hodge 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.
コードが呼ぶもの
プログラム起動ファイル書き込み環境変数ツール呼び出し保存
コードから読み取ったデザイン
読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。
コードから読めること
2026-10-06 に読んだコミット 92ca065a790c のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | 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:209 date(Windows にない); hooks/register.tsx:260 rm(Windows にない); hooks/register.tsx:306 rm(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。date, rm, git(通信する) |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。reads environment variables and files and reaches the network |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add scodge-24/workface/plugin install workface@workface入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(92ca065a790c)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「scodge-24-workface」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…────────Clear doneClaude⋯└─ buildCancelCancelCancel└─ buildCancelCancelCancel└─ buildCancelCancelCancel
-
Claude に頼む…GitHub inboxGitHubloading…Refresh rbuildbuildbuildClose xStealth IssuesNo open issues in this view.#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopenPull requestsNo open pull requests.#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopenChecks for #3Plain
-
a1b2c3d's result did not fit in the promptClaude に頼む…
-
Claude に頼む…AskSide questions. Answers stay here, out of the chat.Nothing asked yet.────────Remove ask────────› Copythinking…No answer.(empty)Use promptUse promptUse promptCopyRetryRemove────────› Copythinking…No answer.(empty)Use promptUse promptUse promptCopyRetryRemove────────› Copythinking…No answer.(empty)Use promptUse promptUse promptCopyRetryRemoveSuggest next promptsClear answered
-
Claude に頼む…ask attached to your next messageaskask #a1b2c3d› No answer: thinking…› No answer: thinking…› No answer: thinking…/ask a1b2c3d <follow-up> to continueFollow up on #a1b2c3d…← All threads ✓ attached to your next message
-
Claude に頼む…⏳ 3 test steps waiting on youtestsacme/app · main● Fix login⎿ before: EditNeeds you⋯● Writeanswer in the dialog below▾ Bash42%✓ Clean upNote✓ Clean upNote✓ Clean upNoteor type an answer… Writeextra details (optional)…lessreply…dismiss▾ Bash42%✓ Clean upNote✓ Clean upNote✓ Clean upNoteor type an answer… Writeextra details (optional)…lessreply…dismiss▾ Bash42%✓ Clean upNote✓ Clean upNote✓ Clean upNoteor type an answer… Writeextra details (optional)…lessreply…dismissSend 3 answers