decision-log
Architecture decision records you and Claude can go back to: ADR markdown files in the repo (docs/decisions/NNNN-slug.md), a `decision` tool for Claude, /decide to record your own, and /decisions to browse them (pane on terminal and deskto…
何をするか
- 欄を描く
- /decide・/decisions を足す
- ツールの呼び出しを見張る(止めることがある)
- prompt.compose・session.startにフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- プロセスを起こさない
- TypeScript で書かれている
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like decision-log by mrjk05 (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/mrjk05-decision-log/
// 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: "Decisions" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const length = '…'
const id = '…'
const status = '…'
const title = '…'
const supersededNote = '…'
const title2 = '…'
const supersededNote2 = '…'
const title3 = '…'
const supersededNote3 = '…'
return (
<Box flexDirection="column">
<Text bold>
{length}
{" decision"}
</Text>
<Box flexDirection="row">
<Button plain label={`#${id}`} />
<Text>
{` ${status} `}
</Text>
<Text wrap="truncate-end">
{title}
{supersededNote}
</Text>
</Box>
<Box flexDirection="row">
<Button plain label={`#${id}`} />
<Text>
{` ${status} `}
</Text>
<Text wrap="truncate-end">
{title2}
{supersededNote2}
</Text>
</Box>
<Box flexDirection="row">
<Button plain label={`#${id}`} />
<Text>
{` ${status} `}
</Text>
<Text wrap="truncate-end">
{title3}
{supersededNote3}
</Text>
</Box>
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
mods/decision-log/hooks/register.tsx 461〜471 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Button, Text, Markdown } = $.ui.resolve(e)
const ui: Ui = { Box, Button, Text, Markdown }
const entries = await read($, records)
const view = memberOf(selected, e)
const choice = await read($, view)
const go = (id: number) => update($, view, () => id)
const entry = choice > 0 ? find(entries, choice) : undefined
if (entry !== undefined) return recordTree(ui, entry, go)
return listTree(ui, entries, e.props.bodyColumns, go)
})mods/decision-log/hooks/register.tsx 572〜586 行 · ペイン
function recordTree(ui: Ui, entry: DecisionEntry, go: (id: number) => unknown): RenderElement {
const { Box, Button, Markdown } = ui
const links = [...entry.supersedes, ...entry.supersededBy]
return (
<Box key={`record-${entry.id}`} flexDirection="column">
<Box flexDirection="row">
<Button key="back" label="← All decisions" onPress={() => go(-1)} />
{links.map(id => (
<Button key={`link-${id}`} label={`#${id}`} onPress={() => go(id)} />
))}
</Box>
<Markdown key={`md-${entry.id}`} text={recordMarkdown(entry)} />
</Box>
)
}mods/decision-log/hooks/register.tsx 531〜548 行 · ペイン
function listTree(ui: Ui, entries: readonly DecisionEntry[], columns: number | undefined, go: (id: number) => unknown): RenderElement {
const { Box, Text } = ui
if (entries.length === 0) {
return (
<Box key="decisions-empty" flexDirection="column">
<Text dimColor>{'No decisions recorded yet. Add one with /decide <title> — <why>, or ask Claude to record one.'}</Text>
</Box>
)
}
return (
<Box key="decisions-list" flexDirection="column">
<Text bold>
{entries.length} decision{entries.length === 1 ? '' : 's'}
</Text>
{newestFirst(entries).map(entry => row(ui, entry, columns, go))}
</Box>
)
}mods/decision-log/hooks/register.tsx 511〜528 行 · ペイン
function row(ui: Ui, entry: DecisionEntry, columns: number | undefined, go: (id: number) => unknown): RenderElement {
const { Box, Button, Text } = ui
const isDim = entry.status === 'superseded'
// Room for `#nnnn`, the status and spaces; a narrow phone gets a shorter line rather than a wrapped one.
const titleMax = columns === undefined ? 200 : Math.max(columns - 20, 10)
return (
<Box key={`row-${entry.id}`} flexDirection="row">
<Button key={`open-${entry.id}`} plain label={`#${entry.id}`} dimColor={isDim} onPress={() => go(entry.id)} />
<Text color={statusColor(entry.status)} dimColor={isDim}>
{` ${entry.status.padEnd(10)} `}
</Text>
<Text dimColor={isDim} wrap="truncate-end">
{clip(entry.title, titleMax)}
{supersededNote(entry)}
</Text>
</Box>
)
}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 modemon contributors 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.
コードが呼ぶもの
ファイル書き込みツール呼び出し保存
コードから読めること
2026-10-06 に読んだコミット c14f77ca2a38 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。mods/decision-log/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 mrjk05/modemon/plugin install decision-log@modemon入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(c14f77ca2a38)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「mrjk05-decision-log」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…#3#3 Fix loginEsc closes_No description._── alex · Oct 6Bash── alex · Oct 6Bash── alex · Oct 6Bashc copy URLEsc closes
-
Claude に頼む…intentic savingsRun /intentic-pane to fill this.Refresh r
-
Claude に頼む…HandoffHandoffHandoff… the rest of the step is in the handoff████████░░░░░░░░ /clear in 4spress 1 to clear now, or send a prompt to stay
-
Claude に頼む…self-relayrelay packet: 3 chars (view truncated, full packet kept)c x
-
Claude に頼む…packpack: 3 chars (view truncated, full pack kept)c x
-
Claude に頼む…Question guideAwaiting answer Questions from Claude (3)Freeform answer1/3p ◀ Previousn Next ▶l Latesta AI explanation: ONh Hide historyCloseAI tokens this session: 3$1.24▍Your recent instructions▍Claude's preceding explanationCancelledFreeform answerExplainf Full context✦ AI explanation (instructions, context, effects, recommendation)compact context42%Generating… (you can keep answering)Freeform answerCould not generate an explanation: Freeform answerOFF (enable for the next question with [a])────────Past questions and answers31/3 ▶ Selected[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer→ Freeform: Explain31/3 ▶ Selected[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer→ Freeform: Explain31/3 ▶ Selected[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer→ Freeform: Explain