modscode JA

modscode / Gallery / katharsis

katharsis

An output style that classifies each message by exchange type and shapes the reply to fit it: the answer first, a ceiling per type, reference codes that survive the session, and decisions handed back as questions

Code you can checkTerminal + desktopPaneBandBoxButtonInputText

What it does

  • Draws a band above the prompt, a pane
  • Hooks classic.Stop, prompt.submit, session.end, session.start and 3 more
  • Starts processes

Good points

  • No network calls
  • 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)

register.tsx
import type { Register } from 'claude-code'

// Drawn like katharsis by Holden Hewett (pane, band), as modscode read it from the mod's code:
// https://modscode.com/gallery/openscribbler-katharsis/
// 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, Text, Button } = $.ui.resolve(e)
    const groupName = '…'
    const length = '…'
    const value = '…'
    const hint = '…'
    const p = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="column">
          <Box display="none" flexDirection="column" overflow="hidden" borderStyle="round" paddingX={1}>
            <Box flexDirection="row" gap={2}>
              <Text bold>
                {`${groupName} · ${length}`}
              </Text>
              <Text dimColor>
                {`latest ${length}`}
              </Text>
              <Button label={`list all ${length} ▸`} plain />
            </Box>
            <Button label={`${value}`} plain />
            <Button label={`${value}`} plain />
            <Button label={`${value}`} plain />
          </Box>
          <Box display="none" flexDirection="column" overflow="hidden" borderStyle="round" paddingX={1}>
            <Box flexDirection="row" gap={2}>
              <Text bold>
                {`${groupName} · ${length}`}
              </Text>
              <Text dimColor>
                {`latest ${length}`}
              </Text>
              <Button label={`list all ${length} ▸`} plain />
            </Box>
            <Button label={`${value}`} plain />
            <Button label={`${value}`} plain />
            <Button label={`${value}`} plain />
          </Box>
          <Box display="none" flexDirection="column" overflow="hidden" borderStyle="round" paddingX={1}>
            <Box flexDirection="row" gap={2}>
              <Text bold>
                {`${groupName} · ${length}`}
              </Text>
              <Text dimColor>
                {`latest ${length}`}
              </Text>
              <Button label={`list all ${length} ▸`} plain />
            </Box>
            <Button label={`${value}`} plain />
            <Button label={`${value}`} plain />
            <Button label={`${value}`} plain />
          </Box>
          <Box flexDirection="row" gap={1} height={1} overflow="hidden">
            <Box flexDirection="row" gap={1} flexShrink={0}>
              <Text color="#14B8A6">
                ▸ Katharsis
              </Text>
              <Text dimColor>
                ·
              </Text>
              <Button label="open" plain />
              <Text dimColor>
                {hint}
              </Text>
            </Box>
            <Text dimColor>
              no codes yet
            </Text>
            <Box flexDirection="row">
              <Box flexDirection="row" flexShrink={0}>
                <Button label={`${p}:${length}`} plain dimColor />
                <Text dimColor>
                  |
                </Text>
              </Box>
              <Box flexDirection="row" flexShrink={0}>
                <Button label={`${p}:${length}`} plain dimColor />
                <Text dimColor>
                  |
                </Text>
              </Box>
              <Box flexDirection="row" flexShrink={0}>
                <Button label={`${p}:${length}`} plain dimColor />
                <Text dimColor>
                  |
                </Text>
              </Box>
            </Box>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Katharsis" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Input, Button, Text } = $.ui.resolve(e)
    const filterLabel = '…'
    const showLabel = '…'
    const viewLabel = '…'
    const length = '…'
    const heading = '…'
    const heading2 = '…'
    const heading3 = '…'
    const menuRow = '…'
    const g = '…'
    const text = '…'
    const g2 = '…'
    const text2 = '…'
    const g3 = '…'
    const text3 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row">
          <Box flexGrow={1} flexShrink={1}>
            <Input label="Search" placeholder="code, title, body, option" value="" submitLabel="" autoFocus />
          </Box>
        </Box>
        <Box flexDirection="row" flexWrap="wrap" columnGap={2} paddingRight={2}>
          <Button label={`${filterLabel}`} hotkey="f" />
          <Button label={`${showLabel}`} hotkey="s" />
          <Button label="Clear" />
          <Box flexGrow={1} flexDirection="row" justifyContent="flex-end">
            <Button label={`${viewLabel}`} hotkey="v" />
          </Box>
        </Box>
        <Text dimColor>
          {`${length} of ${length} items`}
        </Text>
        <Text dimColor>
          Nothing matches.
        </Text>
        <Box flexDirection="column" marginTop={1}>
          <Text bold color="cyan">
            {heading}
          </Text>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text bold color="cyan">
            {heading2}
          </Text>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text bold color="cyan">
            {heading3}
          </Text>
        </Box>
        <Box position="absolute" left={0} flexDirection="column" borderStyle="round" backgroundColor="userMessageBackground" paddingX={1}>
          <Button label={`${menuRow}`} plain />
          <Button label={`${menuRow}`} plain />
          <Button label={`${menuRow}`} plain />
        </Box>
        <Box position="absolute" flexDirection="column" borderStyle="round" backgroundColor="userMessageBackground" paddingX={1}>
          <Button label={`${menuRow}`} plain />
          <Button label={`${menuRow}`} plain />
          <Button label={`${menuRow}`} plain />
          <Box flexDirection="column" marginTop={1}>
            <Box flexDirection="row">
              <Box width={2} flexShrink={0}>
                <Text color="success">
                  {g}
                </Text>
              </Box>
              <Text dimColor>
                {text}
              </Text>
            </Box>
            <Box flexDirection="row">
              <Box width={2} flexShrink={0}>
                <Text color="success">
                  {g2}
                </Text>
              </Box>
              <Text dimColor>
                {text2}
              </Text>
            </Box>
            <Box flexDirection="row">
              <Box width={2} flexShrink={0}>
                <Text color="success">
                  {g3}
                </Text>
              </Box>
              <Text dimColor>
                {text3}
              </Text>
            </Box>
          </Box>
        </Box>
      </Box>
    )
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

hooks/drawer.tsx lines 586–678 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey) return next(e);
    if (!S.loaded) await refresh($);
    if (!S.active) return next(e);
    // Another plugin's band draws beneath this one rather than being replaced.
    const below = await next(e);
    const { Box, Text, Button } = $.ui.resolve(e);
    const present = byCode(prefixes());
    const most = Math.max(0, ...present.map((p) => ofPrefix(p).length));
    // Border 2, header 1, band row 1; what is left holds titles, at most 10.
    const listRows = Math.max(1, Math.min(REVEAL_MAX, most, e.props.maxRows - 4));
    const revealHeight = listRows + 3;
    const titleWidth = Math.max(10, e.props.bodyColumns - 4);
    // The hint goes when the row would not fit, as beside a docked pane: a row
    // too wide shrinks its Texts to nothing rather than cutting the tail.
    const labels = present.map((p) => `${p}:${ofPrefix(p).length}`).join('|');
    const hint = `▸ ${TITLE} · open | use /${PANE} · ${labels}`.length <= e.props.bodyColumns ? `| use /${PANE} ·` : '·';
    const openType = (p: string, code = '') => {
      S.query = code;
      S.selected = code;
      S.prefix = p;
      void openPane($).then(() => $.ui.invalidate('ui.render'));
    };
    const band = (
      <Box flexDirection="column">
        {(S.paneOpen ? [] : present).map((p) => {
          const items = ofPrefix(p);
          const shown = items.slice(-listRows);
          return (
            <Box
              key={`reveal-${p}`}
              display="none"
              hover={{ scope: `kband-${p}`, display: 'flex' }}
              flexDirection="column"
              height={revealHeight}
              overflow="hidden"
              borderStyle="round"
              paddingX={1}
            >
              <Box key={`reveal-head-${p}`} flexDirection="row" gap={2}>
                <Text bold>{`${groupName(p)} · ${items.length}`}</Text>
                {items.length > shown.length ? <Text dimColor>{`latest ${shown.length}`}</Text> : null}
                <Button key={`reveal-all-${p}`} label={`list all ${items.length} ▸`} plain onPress={() => openType(p)} />
              </Box>
              {shown.map((i) => (
                <Button
                  key={`reveal-${i.code}`}
                  label={clip(`${i.code}${mark(i)}  ${i.title}`, titleWidth)}
                  plain
                  onPress={() => openType(p, i.code)}
                />
              ))}
            </Box>
          );
        })}
        <Box key="band-row" flexDirection="row" gap={1} height={1} overflow="hidden">
          <Box key="band-head" flexDirection="row" gap={1} flexShrink={0}>
            <Text color={TEAL}>{`▸ ${TITLE}`}</Text>
            <Text dimColor>·</Text>
            <Button
              key="open"
              label="open"
              plain
              hover={{ scope: 'kband-open', underline: true }}
              // An empty query, as /kdrawer with no argument sends, so a code
              // the band opened last time does not stay listed past Status.
              onPress={() => {
                void openPane($, '').then(() => refresh($)).then(() => $.ui.invalidate('ui.render'));
              }}
            />
            <Text dimColor>{hint}</Text>
          </Box>
          {present.length === 0 ? <Text dimColor>no codes yet</Text> : null}
          <Box key="band-labels" flexDirection="row">
            {present.map((p, k) => (
              <Box key={`label-${p}`} flexDirection="row" flexShrink={0} hover={{ scope: `kband-${p}` }}>
                <Button
                  key={`band-${p}`}
                  label={`${p}:${ofPrefix(p).length}`}
                  plain
                  dimColor
                  hover={{ scope: `kband-${p}`, bold: true }}
                  onPress={() => openType(p)}
                />
                {k < present.length - 1 ? <Text dimColor>|</Text> : null}
              </Box>
            ))}
          </Box>
        </Box>
      </Box>
    );
    return below ? <Box flexDirection="column">{band}{below}</Box> : band;
  }).catch(($, e, next) => next(e));
hooks/drawer.tsx lines 680–839 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, ($, e, next) => {
    if (!S.active) return next(e);
    const T = $.ui.resolve(e);
    const { Box, Text, Button } = T;
    const redraw = () => $.ui.invalidate('ui.render');
    const rows = visible();
    const width = Math.max(20, e.props.bodyColumns);
    const present = byName(prefixes());
    const groups = byName([...new Set(rows.map((i) => i.prefix))]);
    // The pane losing focus, a click in the transcript or the prompt, closes the menu.
    if (!e.props.isFocused) S.filterOpen = S.statusOpen = false;
    // Row 2 names the filter by its code when the full name would push the
    // view toggle onto a line of its own, as in a docked pane. A Button draws
    // as `[ label ]`, the controls sit 2 apart, and the row keeps 2 of padding.
    // Past that the row wraps, and the menu drops below its last line.
    const viewLabel = S.full ? 'Show short view' : 'Show full view';
    // Status opens a menu of all, open, and resolved, with the key to the row
    // glyphs below them. Clear leaves it alone: Status is a standing
    // preference that outlives the pane, and Clear undoes one visit's search.
    const showLabel = `Status: ${S.show} ${S.statusOpen ? '▴' : '▾'}`;
    const named = S.only.length > 0 ? 'still open' : S.prefix === 'all' ? 'all types' : groupName(S.prefix);
    const controls = (filter: string) => [filter.length + 4, showLabel.length + 4, 'Clear'.length + 4, viewLabel.length + 4];
    const fits = lines(controls(`Filter: ${named} ▾`), width - 2, 2) === 1;
    const filterLabel = `Filter: ${fits ? named : S.only.length > 0 ? 'open' : S.prefix} ${S.filterOpen ? '▴' : '▾'}`;
    const menuTop = 1 + lines(controls(filterLabel), width - 2, 2);
    const menu = [
      { value: 'all', name: 'All types', n: S.items.length },
      ...present.map((p) => ({ value: p, name: groupName(p), n: ofPrefix(p).length })),
    ];
    // The menu reaches the Clear button's right edge, wider only for a long name.
    const reach = filterLabel.length + 4 + 2 + showLabel.length + 4 + 2 + 'Clear'.length + 4;
    const longest = Math.max(...menu.map((f) => `● ${f.name} ${f.n}`.length)) + 4;
    const menuWidth = Math.min(width, Math.max(reach, longest));
    // The Status menu drops below the Status button, or from the left edge
    // when the button wrapped onto a line of its own.
    const statusMenu = SHOWS.map((s) => ({
      value: s,
      n: S.items.filter((i) => (S.prefix === 'all' || i.prefix === S.prefix) && shows(i, s)).length,
    }));
    const legend = [
      { g: '○', text: 'open, or never closes' },
      { g: '✓', text: 'answered, settled, or done' },
      { g: '✗', text: 'dismissed, dropped, or withdrawn' },
      { g: '!', text: 'corrected, title not restated' },
    ];
    const statusWidth = Math.min(width, Math.max(...legend.map((l) => l.text.length + 2), ...statusMenu.map((f) => `● ${f.value} ${f.n}`.length)) + 4);
    // A menu wider than the room right of the button shifts left to stay inside the drawer.
    const statusLeft = Math.max(0, Math.min(width - statusWidth, lines([filterLabel.length + 4, showLabel.length + 4], width - 2, 2) === 1 ? filterLabel.length + 4 + 2 : 0));

    const body = (i: Item) => [
      closingLine(Text, i, `closed-${i.code}`),
      correctionLine(Text, i, `corrected-${i.code}`),
      backlinks(i) ? <Text key={`cited-${i.code}`} wrap="wrap" dimColor>{backlinks(i)}</Text> : null,
      i.summary ? <Text key={`sum-${i.code}`} wrap="wrap" dimColor={i.prefix === 'Q'}>{i.summary}</Text> : null,
      ...i.options.map((o) => <Text key={`opt-${i.code}-${o.key}`} wrap="wrap">{`  ${o.key}. ${o.text}`}</Text>),
      i.rec ? <Text key={`rec-${i.code}`} wrap="wrap"><Text bold>Recommended:</Text>{` ${i.rec}`}</Text> : null,
    ];

    // A row is a table line: the code, the status glyph, and the title, which
    // wraps in the cells left. Every row keeps the glyph cell, blank or not, so
    // every title starts in one column. The code cell fits the widest code
    // shown and its marker.
    const codeWidth = Math.max(0, ...rows.map((i) => i.code.length)) + 4;
    // A heading counts its type under the search and filters but not Status,
    // and for a type that closes, how many are open, so Status open never
    // reads "1 open of 1".
    const every = visible('all');
    const heading = (p: string) => {
      const of = every.filter((i) => i.prefix === p);
      const open = of.filter((i) => !isClosed(i)).length;
      return CLOSING.has(p) ? `${groupName(p)} · ${open} open of ${of.length}` : `${groupName(p)} · ${of.length}`;
    };
    // A check is green, a cross red, and a circle grey, in a row and in the key.
    const paint = (g: string) =>
      g === '✓' ? <Text color="success">{g}</Text> : g === '✗' ? <Text color="error">{g}</Text> : g === '!' ? <Text color="warning">{g}</Text> : <Text dimColor>{g}</Text>;

    // The code is a button: pressing it opens the item as a card beneath the
    // row, in a frame, and pressing it again closes the card.
    const entry = (i: Item) => {
      const open = S.selected === i.code;
      return (
        <Box key={`row-${i.code}`} flexDirection="column" marginTop={S.full ? 1 : 0}>
          <Box key={`line-${i.code}`} flexDirection="row" alignItems="flex-start">
            <Box key={`cell-code-${i.code}`} width={codeWidth} flexShrink={0}>
              <Button
                key={`pick-${i.code}`}
                label={`${open ? '▾' : '▸'} ${i.code}`}
                plain
                hover={{ scope: `kref-${i.code}`, inverse: true }}
                onPress={() => {
                  S.selected = open ? '' : i.code;
                  S.filterOpen = S.statusOpen = false;
                  redraw();
                }}
              />
            </Box>
            <Box key={`cell-status-${i.code}`} width={2} flexShrink={0}>
              {paint(glyph(i))}
            </Box>
            <Box key={`cell-title-${i.code}`} flexGrow={1} flexShrink={1} minWidth={0}>
              <Text wrap="wrap">{i.title}</Text>
            </Box>
          </Box>
          {open ? (
            <Box
              key={`card-${i.code}`}
              flexDirection="column"
              borderStyle="round"
              backgroundColor="userMessageBackground"
              paddingX={1}
            >
              <Text color="cyan">{`${i.code}${mark(i)} · ${nameOf(i)}`}</Text>
              {body(i)}
            </Box>
          ) : S.full ? (
            body(i)
          ) : null}
        </Box>
      );
    };

    return (
      <Box flexDirection="column" width={width}>
        <Box key="top" flexDirection="row">
          {'Input' in T ? (
            <Box key="q-box" flexGrow={1} flexShrink={1}>
              <T.Input
                key="q"
                label="Search"
                placeholder="code, title, body, option"
                value={S.query}
                submitLabel=""
                autoFocus
                onInput={(v) => {
                  S.query = v;
                  redraw();
                }}
                onSubmit={(v) => {
                  S.query = v;
                  redraw();
                }}
              />
            </Box>
          ) : null}
        </Box>
        <Box key="filters" flexDirection="row" flexWrap="wrap" columnGap={2} paddingRight={2}>
          <Button
            key="filter"
            label={filterLabel}
            hotkey="f"
            onPress={() => {
              S.filterOpen = !S.filterOpen;
              S.statusOpen = false;
              redraw();
            }}
          />
          <Button
            key="show"
            label={showLabel}
            hotkey="s"
Licence text (MIT)
MIT License

Copyright (c) 2026 Holden Hewett

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

runs programswrites filesenv varsdrives Claude

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 f53e560879cb 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 readEvery module hooks/hooks.json names was read.hooks/register.ts
ParsesEvery file parses as TypeScript or JavaScript.6 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo 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 openNetwork 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 drawsThe 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 lineWhether 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 WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).hooks/register.ts:138 rm (not on Windows)
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.git (reaches the network), rm
Reads and sendsWhether it both reads files or environment variables and reaches the network.reads environment variables and files and reaches the network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn 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 OpenScribbler/Katharsis
/plugin install katharsis@openscribbler

This installs the marketplace's latest commit, which may not be the one read here (f53e560879cb). 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 "openscribbler-katharsis" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs