modscode / Gallery / decision-lens
decision-lens
See the decisions Claude made in each turn, why it made them, and steer future turns with keep and avoid rules.
What it does
- Draws a pane, the status line, toasts
- Adds /why
- Watches tool calls and can refuse them
- Hooks prompt.compose, session.start, turn.complete, turn.start and 1 more
- Keeps its own state between turns
Good points
- No network calls
- Starts no processes
- Written in TypeScript
- Handles errors
Code to start from
Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.
Starter (register.tsx)
import type { Register } from 'claude-code'
// Drawn like decision-lens by Atchyut (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/theonly1me-decision-lens/
// 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: "Decision Lens" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const position = '…'
const ruleCount = '…'
const hint = '…'
const prompt = '…'
const message = '…'
const number = '…'
const title = '…'
const confidenceGlyph = '…'
const label = '…'
const text = '…'
const text2 = '…'
const text3 = '…'
const alternative = '…'
const unquoted = '…'
const explanation = '…'
const confidenceGlyph2 = '…'
const text4 = '…'
const text5 = '…'
const text6 = '…'
const explanation2 = '…'
const confidenceGlyph3 = '…'
const text7 = '…'
const text8 = '…'
const text9 = '…'
const explanation3 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column" marginBottom={1}>
<Text>
<Text bold color="#a78bfa">
Decision Lens
</Text>
<Text dimColor>
{position}
</Text>
</Text>
<Box flexDirection="row" flexWrap="wrap" columnGap={2}>
<Button plain hotkey="p" label="◀ Earlier turn" />
<Button plain hotkey="n" label="Later turn ▶" />
<Button plain hotkey="d" label="Decisions" />
<Button plain hotkey="r" label={`Rules (${ruleCount})`} />
<Button plain hotkey="x" role="dismiss" label="Close" />
</Box>
<Text color="#8b93a1">
{hint}
</Text>
</Box>
<Text italic dimColor>
{`“${prompt}”`}
</Text>
<Text dimColor>
{message}
</Text>
<Box flexDirection="column" borderStyle="round" borderColor="#a78bfa" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between" columnGap={1}>
<Button plain hotkey={`${number}`} label={`◆ ${title}`} />
<Text color="#8b93a1">
{confidenceGlyph}
</Text>
</Box>
<Text>
<Text bold>
{`${label} `}
</Text>
{text}
</Text>
<Text>
<Text bold>
{`${label} `}
</Text>
{text2}
</Text>
<Text>
<Text bold>
{`${label} `}
</Text>
{text3}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text italic dimColor>
{`“${unquoted}”`}
</Text>
<Text color="#a78bfa">
Asking Claude…
</Text>
<Text>
{explanation}
</Text>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Text color="#34d399">
✓ keep rule saved
</Text>
<Text color="#fb7185">
✓ avoid rule saved
</Text>
<Button plain label="? Ask why" />
</Box>
</Box>
<Box flexDirection="column" borderStyle="round" borderColor="#a78bfa" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between" columnGap={1}>
<Button plain hotkey={`${number}`} label={`◆ ${title}`} />
<Text color="#8b93a1">
{confidenceGlyph2}
</Text>
</Box>
<Text>
<Text bold>
{`${label} `}
</Text>
{text4}
</Text>
<Text>
<Text bold>
{`${label} `}
</Text>
{text5}
</Text>
<Text>
<Text bold>
{`${label} `}
</Text>
{text6}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text italic dimColor>
{`“${unquoted}”`}
</Text>
<Text color="#a78bfa">
Asking Claude…
</Text>
<Text>
{explanation2}
</Text>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Text color="#34d399">
✓ keep rule saved
</Text>
<Text color="#fb7185">
✓ avoid rule saved
</Text>
<Button plain label="? Ask why" />
</Box>
</Box>
<Box flexDirection="column" borderStyle="round" borderColor="#a78bfa" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between" columnGap={1}>
<Button plain hotkey={`${number}`} label={`◆ ${title}`} />
<Text color="#8b93a1">
{confidenceGlyph3}
</Text>
</Box>
<Text>
<Text bold>
{`${label} `}
</Text>
{text7}
</Text>
<Text>
<Text bold>
{`${label} `}
</Text>
{text8}
</Text>
<Text>
<Text bold>
{`${label} `}
</Text>
{text9}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text dimColor>
{`◇ ${alternative}`}
</Text>
<Text italic dimColor>
{`“${unquoted}”`}
</Text>
<Text color="#a78bfa">
Asking Claude…
</Text>
<Text>
{explanation3}
</Text>
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
<Text color="#34d399">
✓ keep rule saved
</Text>
<Text color="#fb7185">
✓ avoid rule saved
</Text>
<Button plain label="? Ask why" />
</Box>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
await $.ui.status(`◆ reading the decisions in this turn`)
await $.ui.toast(`Keep rule saved. Claude reads it from the next request.`)
return next(e)
})
}
The mod's own code
Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.
plugins/decision-lens/hooks/pane.tsx lines 116–156 · Pane
on('ui.render', { component: 'Pane', requestId: PANE_ID }, async ($, e) => {
const elements = $.ui.resolve(e)
const { Box, Text } = elements
const view = lensView()
const turn = selectedTurn()
const act = (action: PaneAction) => {
perform($, { action }).catch(noop)
}
const hasCards = view.tab === 'decisions' && turn?.status === 'ready' && turn.decisions.length > 0
const position = view.tab === 'decisions' && turn ? ` turn ${view.turns.indexOf(turn) + 1} of ${view.turns.length}` : ''
const message = view.tab === 'decisions' ? turnMessage({ turn, isAnalysisOn: view.isAnalysisOn }) : undefined
const header = headerTree({
elements,
act,
tab: view.tab,
position,
ruleCount: view.rules.length,
hint: hintText({ isFocused: e.props.isFocused, tab: view.tab }),
})
if (view.tab === 'rules') {
return (
<Box flexDirection="column">
{header}
<Text dimColor>Claude reads these rules in every session: project rules here, global rules everywhere.</Text>
{view.rules.length === 0 && <Text dimColor>No rules yet. Press k or a on a decision card, or type /why keep 1.</Text>}
{view.rules.map((rule, index) => ruleTree({ elements, act, rule, number: index + 1 }))}
</Box>
)
}
return (
<Box flexDirection="column">
{header}
{turn && <Text italic dimColor>{`“${turn.prompt}”`}</Text>}
{message !== undefined && <Text dimColor>{message}</Text>}
{hasCards &&
turn.decisions.map((decision, index) =>
cardTree({ elements, act, turn, decision, number: index + 1, isSelected: index + 1 === view.selectedNumber, rules: view.rules }),
)}
</Box>
)
})plugins/decision-lens/hooks/lens/panel.tsx lines 30–56 · Pane
export function headerTree(options: {
elements: ElementTable
act: Act
tab: LensTab
position: string
ruleCount: number
hint: string
}): RenderElement {
const { Box, Text, Button } = options.elements
const { act, tab } = options
return (
<Box flexDirection="column" marginBottom={1}>
<Text>
<Text bold color={COLORS.accent}>Decision Lens</Text>
<Text dimColor>{options.position}</Text>
</Text>
<Box flexDirection="row" flexWrap="wrap" columnGap={2}>
<Button key="previous" plain hotkey="p" label="◀ Earlier turn" onPress={() => act({ kind: 'turn', step: -1 })} />
<Button key="next" plain hotkey="n" label="Later turn ▶" onPress={() => act({ kind: 'turn', step: 1 })} />
<Button key="tab-decisions" plain hotkey="d" label="Decisions" dimColor={tab !== 'decisions'} onPress={() => act({ kind: 'tab', tab: 'decisions' })} />
<Button key="tab-rules" plain hotkey="r" label={`Rules (${options.ruleCount})`} dimColor={tab !== 'rules'} onPress={() => act({ kind: 'tab', tab: 'rules' })} />
<Button key="close" plain hotkey="x" role="dismiss" label="Close" onPress={() => act({ kind: 'close' })} />
</Box>
<Text color={COLORS.muted}>{options.hint}</Text>
</Box>
)
}plugins/decision-lens/hooks/lens/panel.tsx lines 121–139 · Pane
export function ruleTree(options: { elements: ElementTable; act: Act; rule: Rule; number: number }): RenderElement {
const { Box, Text, Button } = options.elements
const { act, rule } = options
const isKeep = rule.kind === 'keep'
return (
<Box key={`rule-${rule.id}`} flexDirection="column" marginBottom={1}>
<Text>
<Text color={COLORS.muted}>{`${options.number}. `}</Text>
<Text color={isKeep ? COLORS.keep : COLORS.avoid}>{isKeep ? '▲ keep ' : '▼ avoid '}</Text>
{rule.text}
</Text>
<Box flexDirection="row" columnGap={2} paddingLeft={3}>
<Text dimColor>{rule.scope === 'project' ? 'this project' : 'every project'}</Text>
<Button key={`scope-${rule.id}`} label={rule.scope === 'project' ? 'Make global' : 'This project only'} onPress={() => act({ kind: 'scope', ruleId: rule.id })} />
<Button key={`remove-${rule.id}`} label="Remove" onPress={() => act({ kind: 'remove', ruleId: rule.id })} />
</Box>
</Box>
)
}plugins/decision-lens/hooks/lens/panel.tsx lines 87–119 · Pane
export function cardTree(options: {
elements: ElementTable
act: Act
turn: LensTurn
decision: Decision
number: number
isSelected: boolean
rules: readonly Rule[]
}): RenderElement {
const { Box, Text, Button } = options.elements
const { decision, number, isSelected } = options
return (
<Box key={`decision-${decision.id}`} flexDirection="column" borderStyle="round" borderColor={isSelected ? COLORS.accent : COLORS.frame} paddingX={1}>
<Box flexDirection="row" justifyContent="space-between" columnGap={1}>
<Button key={`card-${number}`} plain hotkey={String(number)} {...(number === 1 ? ({ autoFocus: true } as const) : {})} label={`◆ ${decision.title}`} onPress={() => options.act({ kind: 'select', number })} />
<Text color={COLORS.muted}>{confidenceGlyph(decision.confidence)}</Text>
</Box>
{decisionBody(decision).map(part => (
<Text>
<Text bold>{`${part.label} `}</Text>
{part.text}
</Text>
))}
{decision.alternatives.map(alternative => (
<Text dimColor>{`◇ ${alternative}`}</Text>
))}
{decision.evidence !== '' && <Text italic dimColor>{`“${unquoted(decision.evidence)}”`}</Text>}
{decision.isAsking && <Text color={COLORS.accent}>Asking Claude…</Text>}
{decision.explanation !== '' && <Text>{decision.explanation}</Text>}
{steerButtons(options)}
</Box>
)
}plugins/decision-lens/hooks/lens/panel.tsx lines 58–85 · Pane
function steerButtons(options: {
elements: ElementTable
act: Act
turn: LensTurn
decision: Decision
rules: readonly Rule[]
isSelected: boolean
}): RenderElement {
const { Box, Text, Button } = options.elements
const { act, decision, isSelected } = options
const ids = { turnId: options.turn.id, decisionId: decision.id }
const keyed = (key: string) => (isSelected ? { hotkey: key } : {})
return (
<Box flexDirection="row" flexWrap="wrap" columnGap={2} marginTop={1}>
{hasRule({ rules: options.rules, text: decision.keep }) ? (
<Text color={COLORS.keep}>✓ keep rule saved</Text>
) : (
<Button key={`keep-${decision.id}`} plain {...keyed('k')} dimColor={!isSelected} label="▲ Keep doing this" onPress={() => act({ kind: 'keep', ...ids })} />
)}
{hasRule({ rules: options.rules, text: decision.avoid }) ? (
<Text color={COLORS.avoid}>✓ avoid rule saved</Text>
) : (
<Button key={`avoid-${decision.id}`} plain {...keyed('a')} dimColor={!isSelected} label="▼ Don't do this" onPress={() => act({ kind: 'avoid', ...ids })} />
)}
<Button key={`why-${decision.id}`} plain {...keyed('w')} dimColor={!isSelected} label="? Ask why" onPress={() => act({ kind: 'ask', ...ids })} />
</Box>
)
}Licence text (MIT)
MIT License Copyright (c) 2026 Atchyut 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.
What its code calls
drives Claudetool callsremembers
The design, read from code
Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.
What its code shows
Read from the source at commit 6d69bf8871bb on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.
| Decides the listing: code you can check | |
|---|---|
| Entry read | Every module hooks/hooks.json names was read.plugins/decision-lens/hooks/register.ts |
| Parses | Every file parses as TypeScript or JavaScript.14 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs |
| Calls in the open | Network and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open |
| For you to weigh before installing | |
| Where it draws | The terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both |
| Install line | Whether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there |
| Programs on Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether every program it starts is named in the code and is not a shell, an interpreter or a network tool.starts no programs |
| Reads and sends | Whether it both reads files or environment variables and reaches the network.reaches no network |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT |
This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen
Install it
Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:
/plugin marketplace add theonly1me/claude-code-mods/plugin install decision-lens@claude-code-modsThis installs the marketplace's latest commit, which may not be the one read here (6d69bf8871bb). Compare them before you install.
Ask Claude about it
With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:
Read the modscode design "theonly1me-decision-lens" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…2h 10m · █████░░░✓ build ✓ build ✓ buildJavaKotlin3 Python■ ok 3 ■ ok 3 ■ ok 3 Razor proven 3 Razor proven 3 Razor proven 3Phases ──────── 3/3build Pythonbuild Pythonbuild Python… 3 more phasesLua ──────── 3/Kotlin■ the whole upgrade Ruby■ build build Ruby■ build build Ruby■ build build Ruby … 3 moreNext ──────── PythonRuby (by hand)Podsclick a button, or ctrl+x tab then Tab, EnterAttention ──────── 3! Scala ! Scala ! Scala … 3 moreSession ──────── okJava
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Ask Claude…
-
Ask Claude…TodayOct 63 left · Mar overdueRemCTL: Sep✓ All done for today.● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓Updated 14:32UndoRefresh
-
Ask Claude…TO graph› Fix login › Fix login › Fix loginScopeThis featureWhole projectHide done stepsReconnect
-
Ask Claude…Replay TheaterStep Prev1/3 write Next[31][31][31]Prev pNext nClose q────────● Prev● Prev● Prev
-
Ask Claude…great_cto: 3 gate waiting — /gatesGatesmy-app · 3 waiting · checked Gates UTCGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approveGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approveGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approve