modscode JA

modscode / Gallery / playpen

playpen

The sessions you are working in right now as small cards above the prompt: a status lamp, a short label, what just happened, and one press to answer or jump there.

Code you can checkTerminal + desktopBandToastBoxButtonText

What it does

  • Draws a band above the prompt, toasts
  • Adds /board
  • Watches AskUserQuestion calls and can refuse them
  • Hooks classic.Notification, classic.PermissionRequest, classic.PostModelSwitch, prompt.context and 8 more
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Has a desktop-specific branch
  • 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 playpen by Joel Rönnqvist (band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/kytioisacat-playpen/
// 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 label = '…'
    const title = '…'
    const text = '…'
    const n = '…'
    const label2 = '…'
    const label3 = '…'
    const suggestion = '…'
    const title2 = '…'
    const text2 = '…'
    const label4 = '…'
    const label5 = '…'
    const label6 = '…'
    const suggestion2 = '…'
    const title3 = '…'
    const text3 = '…'
    const label7 = '…'
    const label8 = '…'
    const label9 = '…'
    const suggestion3 = '…'
    const title4 = '…'
    const text4 = '…'
    const label10 = '…'
    const label11 = '…'
    const label12 = '…'
    const suggestion4 = '…'
    const title5 = '…'
    const text5 = '…'
    const label13 = '…'
    const label14 = '…'
    const label15 = '…'
    const suggestion5 = '…'
    const title6 = '…'
    const text6 = '…'
    const label16 = '…'
    const label17 = '…'
    const label18 = '…'
    const suggestion6 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
          <Box flexDirection="column" paddingX={1} borderStyle="round">
            <Box flexDirection="row" justifyContent="space-between">
              <Box flexDirection="row" gap={1} overflow="hidden">
                <Text>
                  ●
                </Text>
                <Button plain label={`${label}`} />
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="hand off" />
                <Button plain label="►" />
                <Button plain dimColor label="×" />
              </Box>
            </Box>
            <Text color="red" wrap="truncate-end">
              asks you
            </Text>
            <Box flexDirection="column">
              <Text bold wrap="wrap">
                {title}
              </Text>
              <Text color="red" wrap="wrap">
                {text}
              </Text>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label2}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label3}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="send" />
                <Box>
                  <Text wrap="wrap">
                    {suggestion}
                  </Text>
                </Box>
              </Box>
            </Box>
            <Box position="absolute" flexDirection="column" paddingX={1} borderStyle="round" borderColor="red" display="none">
              <Text bold wrap="wrap">
                {title2}
              </Text>
              <Text color="red" wrap="wrap">
                {text2}
              </Text>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label4}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label5}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label6}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="send" />
                <Box>
                  <Text wrap="wrap">
                    {suggestion2}
                  </Text>
                </Box>
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column" paddingX={1} borderStyle="round">
            <Box flexDirection="row" justifyContent="space-between">
              <Box flexDirection="row" gap={1} overflow="hidden">
                <Text>
                  ●
                </Text>
                <Button plain label={`${label}`} />
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="hand off" />
                <Button plain label="►" />
                <Button plain dimColor label="×" />
              </Box>
            </Box>
            <Text color="red" wrap="truncate-end">
              asks you
            </Text>
            <Box flexDirection="column">
              <Text bold wrap="wrap">
                {title3}
              </Text>
              <Text color="red" wrap="wrap">
                {text3}
              </Text>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label7}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label8}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label9}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="send" />
                <Box>
                  <Text wrap="wrap">
                    {suggestion3}
                  </Text>
                </Box>
              </Box>
            </Box>
            <Box position="absolute" flexDirection="column" paddingX={1} borderStyle="round" borderColor="red" display="none">
              <Text bold wrap="wrap">
                {title4}
              </Text>
              <Text color="red" wrap="wrap">
                {text4}
              </Text>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label10}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label11}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label12}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="send" />
                <Box>
                  <Text wrap="wrap">
                    {suggestion4}
                  </Text>
                </Box>
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column" paddingX={1} borderStyle="round">
            <Box flexDirection="row" justifyContent="space-between">
              <Box flexDirection="row" gap={1} overflow="hidden">
                <Text>
                  ●
                </Text>
                <Button plain label={`${label}`} />
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="hand off" />
                <Button plain label="►" />
                <Button plain dimColor label="×" />
              </Box>
            </Box>
            <Text color="red" wrap="truncate-end">
              asks you
            </Text>
            <Box flexDirection="column">
              <Text bold wrap="wrap">
                {title5}
              </Text>
              <Text color="red" wrap="wrap">
                {text5}
              </Text>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label13}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label14}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label15}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="send" />
                <Box>
                  <Text wrap="wrap">
                    {suggestion5}
                  </Text>
                </Box>
              </Box>
            </Box>
            <Box position="absolute" flexDirection="column" paddingX={1} borderStyle="round" borderColor="red" display="none">
              <Text bold wrap="wrap">
                {title6}
              </Text>
              <Text color="red" wrap="wrap">
                {text6}
              </Text>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label16}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label17}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button plain hotkey={`${n}`} label={`[${n}1]`} />
                <Box>
                  <Text wrap="wrap">
                    {label18}
                  </Text>
                </Box>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Button variant="primary" label="send" />
                <Box>
                  <Text wrap="wrap">
                    {suggestion6}
                  </Text>
                </Box>
              </Box>
            </Box>
          </Box>
        </Box>
        <Box height={0} />
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const label = '…'
    const text = '…'
    await $.ui.toast(`Could not open the session; its link is on the clipboard`)
    await $.ui.toast(`Sent to ${label}: ${text}`)
    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.

hooks/register.tsx lines 1213–1372 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey || isCollapsed || deck.length === 0) return next(e)
    const { Box, Text, Button } = $.ui.resolve(e)
    const columns = e.props.bodyColumns
    // three cards across; each is two rows inside a thin frame: the lamp,
    // label, hand-off, reply and ×, then the gist
    const cardWidth = Math.max(MIN_CARD, Math.min(MAX_CARD, Math.floor((columns - (PER_ROW - 1)) / PER_ROW)))
    const perRow = Math.max(1, Math.floor((columns + 1) / (cardWidth + 1)))
    const inner = cardWidth - 4 // less the frame and its padding
    const labelMax = Math.max(8, inner - 8) // room for ✦ ► ×

    // The popover: twice a card wide, drawn over the neighbours and never in
    // the flow, so no card moves when it shows. The band clips at its own
    // edge, so rows are reserved under the cards for the tallest popover
    // that may show, and none when no card has one.
    const wide = Math.min(columns, cardWidth * 2 + 1)
    const wideInner = wide - 4
    const rowsOf = (text: string, width: number) => Math.max(1, Math.ceil(text.length / Math.max(1, width)))
    const popoverRows = (card: Card) => {
      let rows = 2 // the frame
      if (trim(card.title, LABEL_MAX) !== card.label) rows += rowsOf(card.title, wideInner)
      if (card.permission) {
        rows += rowsOf(card.permission, wideInner) + 2
      } else if (card.question) {
        rows += rowsOf(card.question.text, wideInner)
        for (const option of card.question.options) rows += rowsOf(option, wideInner - 4)
      } else {
        rows += rowsOf(card.snippet || stateWord(card.state), wideInner)
        if (card.suggestion) rows += rowsOf(card.suggestion, wideInner - 9)
      }
      return rows
    }
    // A red card with a question shows the question and its options in the
    // card itself, so the band already has that height, and its popover under
    // the pointer is the same content wide. Any card shows the popover while
    // open with ►; rows are reserved under the cards only then.
    // The desktop app draws the popover over the transcript above the band
    // and clips nothing, so there the cards stay two rows and no space is
    // kept. The terminal clips at the band's edge: there a red card shows its
    // question in the card, and rows are reserved while a card is open.
    const isTerminal = e.surface === 'terminal'
    const asks = (card: Card) => card.state === 'waiting' && (card.question !== null || !!card.permission)
    // The popover is revealed by the pointer alone, which is the one way the
    // desktop app draws it whole. A red question has one; ► gives any card
    // one for a while, and since the pointer is on the card at the press, it
    // shows at once. In a terminal, which clips the popover, the same content
    // expands the card in the flow instead.
    const hasPopover = (card: Card) => asks(card) || openId === card.id
    const expandsInCard = (card: Card) => isTerminal && (asks(card) || openId === card.id)
    const cardRowCount = Math.ceil(deck.length / perRow)
    // rows kept free under the cards for a terminal's hover popover, which
    // hangs below the card and would otherwise be cut at the band's edge
    let reserve = 0
    if (isTerminal) {
      deck.forEach((card, i) => {
        if (!hasPopover(card)) return
        const rowsBelow = cardRowCount - 1 - Math.floor(i / perRow)
        reserve = Math.max(reserve, popoverRows(card) - 1 - rowsBelow * 4)
      })
      reserve = Math.max(0, Math.min(reserve, e.props.maxRows - cardRowCount * 4))
    }

    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
          {deck.map((card, i) => {
            const isMe = me !== null && card.id === me.id
            const isOpen = openId === card.id
            const options = card.question?.options ?? []
            // a popover that would run past the band's right edge hangs from
            // the card's right edge instead
            const column = (i % perRow) * (cardWidth + 1)
            const anchorRight = column + wide > columns
            return (
              // a thin frame around the whole card: dim, full strength on this
              // session, and the surface brightens it under the pointer by itself
              <Box
                key={`card:${card.id}`}
                flexDirection="column"
                width={cardWidth}
                paddingX={1}
                borderStyle="round"
                borderDimColor={!isMe}
                hover={{ borderDimColor: false }}
              >
                <Box flexDirection="row" justifyContent="space-between">
                  <Box flexDirection="row" gap={1} overflow="hidden">
                    <Text color={lampColor(card.state)}>●</Text>
                    <Button
                      key={`jump:${card.id}`}
                      plain
                      label={trim(card.label, labelMax)}
                      onPress={() => void (isMe ? Promise.resolve() : jump($, card))}
                    />
                  </Box>
                  <Box flexDirection="row" gap={1}>
                    {armedId === card.id ? (
                      <Button
                        key={`handoff:${card.id}`}
                        variant="primary"
                        label="hand off"
                        onPress={() => pressHandoff($, card, isMe)}
                      />
                    ) : (
                      <Button
                        key={`handoff:${card.id}`}
                        plain
                        dimColor
                        label="✦"
                        onPress={() => pressHandoff($, card, isMe)}
                      />
                    )}
                    <Button
                      key={`reply:${card.id}`}
                      plain
                      dimColor={!isOpen}
                      label="►"
                      onPress={() => pressAnswer($, card)}
                    />
                    <Button key={`hide:${card.id}`} plain dimColor label="×" onPress={() => void hide($, card)} />
                  </Box>
                </Box>
                {/* Row two is the short form: the gist, red while the session
                    needs you. A card that asks a question goes on below it with
                    the question and one row per option, in the card's own
                    width; the popover shows the same thing wide. */}
                <Text
                  color={card.state === 'waiting' ? 'red' : undefined}
                  dimColor={card.state !== 'waiting'}
                  wrap="truncate-end"
                >
                  {card.gist ||
                    (card.state === 'waiting' ? (card.question ? 'asks you' : card.permission ? 'asks permission' : 'needs you') : stateWord(card.state))}
                </Text>
                {/* A terminal only: the card expanded in the flow, taller and
                    never wider. The full title where it adds to the label, then
                    the question with one row per option, or the latest reply in
                    full with the suggestion and a send button. */}
                {expandsInCard(card) && (
                  <Box flexDirection="column">
                    {isOpen && trim(card.title, LABEL_MAX) !== card.label && (
                      <Text bold wrap="wrap">
                        {card.title}
                      </Text>
                    )}
                    {card.question && !card.permission && (
                      <Text color="red" wrap="wrap">
                        {card.question.text}
                      </Text>
                    )}
                    {card.permission ? (
                      <Box flexDirection="column">
                        <Text color="red" wrap="wrap">
                          {`Asks to run ${card.permission}`}
                        </Text>
                        <Text dimColor wrap="wrap">
                          {isMe
                            ? 'Approve or deny it in the dialog above.'
                            : 'A permission is answered in its own session; a mod cannot give it.'}
                        </Text>
Licence text (MIT)
MIT License

Copyright (c) 2026 Joel Rönnqvist

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 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 d4309b75feb6 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.tsx
ParsesEvery file parses as TypeScript or JavaScript.1 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.tsx:488 open (not on Windows); hooks/register.tsx:917 open (not on Windows); hooks/register.tsx:964 open (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.open (reaches the network)
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 KytioisaCat/playpen
/plugin install playpen@kytioisacat

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

Search them from Claude: the MCP connector

Similar designs