modscode JA

modscode / Gallery / oxen-pet

oxen-pet

A pixel Luffy above the Claude Code prompt who acts out each tool call in five gears, an HP/MP/ST HUD for context, rate limits, and prompt cache, a shield that asks before destructive commands, a bug boss for failing tests, and a /pet stat…

Code you can checkTerminal + desktopPaneBandStatus lineToastBoxSvgText

What it does

  • Draws a pane, a band above the prompt, the status line, toasts
  • Watches Bash calls and can refuse them
  • Hooks session.start, turn.complete
  • Keeps its own state between turns

Good points

  • No network calls
  • Starts no processes
  • Written in TypeScript
  • Has a desktop-specific branch

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 oxen-pet by NhonNguyen (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/thanhnhoncntt-oxen-pet/
// 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: "oxen-pet" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Svg, Text } = $.ui.resolve(e)
    const encodeSvg = '…'
    const name = '…'
    const label = '…'
    const value = '…'
    const value2 = '…'
    const value3 = '…'
    return (
      <Box gap={2}>
        <Svg source={`${encodeSvg}`} alt={`${name}, happy`} />
        <Box flexDirection="column">
          <Box>
            <Text bold>
              {`${label}  `}
            </Text>
            <Text color="#8b93b8">
              {value}
            </Text>
          </Box>
          <Box>
            <Text bold>
              {`${label}  `}
            </Text>
            <Text color="#8b93b8">
              {value2}
            </Text>
          </Box>
          <Box>
            <Text bold>
              {`${label}  `}
            </Text>
            <Text color="#8b93b8">
              {value3}
            </Text>
          </Box>
        </Box>
      </Box>
    )
  })

  // the band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Svg, Text } = $.ui.resolve(e)
    const encodeSvg = '…'
    const name = '…'
    const mode = '…'
    const line = '…'
    const bossAlt = '…'
    const label = '…'
    const key = '…'
    const pct = '…'
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const label2 = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const label3 = '…'
    const text7 = '…'
    const text8 = '…'
    const text9 = '…'
    return (
      <Box flexDirection="column">
        <Box alignItems="flex-end">
          <Box>
            <Svg source={`${encodeSvg}`} alt={`${name}, ${mode}`} />
          </Box>
          <Text bold>
            {line}
          </Text>
          <Box flexGrow={1} />
          <Svg source={`${encodeSvg}`} alt={`${bossAlt}`} />
        </Box>
        <Box flexDirection="row" alignSelf="flex-start">
          <Box alignItems="center">
            <Text>
              {" │ "}
            </Text>
            <Text>
              {label}
              {" "}
            </Text>
            <Svg source={`${encodeSvg}`} alt={`${key} bar, ${pct}% left`} />
            <Text>
              {text}
            </Text>
            <Text>
              {text2}
            </Text>
            <Text>
              {text3}
            </Text>
          </Box>
          <Box alignItems="center">
            <Text>
              {" │ "}
            </Text>
            <Text>
              {label2}
              {" "}
            </Text>
            <Svg source={`${encodeSvg}`} alt={`${key} bar, ${pct}% left`} />
            <Text>
              {text4}
            </Text>
            <Text>
              {text5}
            </Text>
            <Text>
              {text6}
            </Text>
          </Box>
          <Box alignItems="center">
            <Text>
              {" │ "}
            </Text>
            <Text>
              {label3}
              {" "}
            </Text>
            <Svg source={`${encodeSvg}`} alt={`${key} bar, ${pct}% left`} />
            <Text>
              {text7}
            </Text>
            <Text>
              {text8}
            </Text>
            <Text>
              {text9}
            </Text>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const err = '…'
    const errors = '…'
    const DEFAULT_THEME = '…'
    const name = '…'
    const message = '…'
    await $.ui.status(`oxen-pet: ${err}`)
    await $.ui.toast(`oxen-pet: your theme no longer reads (${errors}). Showing ${DEFAULT_THEME}.`)
    await $.ui.toast(`oxen-pet: the ${name} theme does not read (${message}). Showing ${DEFAULT_THEME}.`)
    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/oxen-pet/hooks/register.tsx lines 483–527 · Pane
  on('ui.render', { component: 'Pane' }, async ($, e, next) => {
    if (e.requestId !== PANE_ID) {
      return next(e)
    }
    if (!body) {
      body = await keptBody($, settings.theme, settings.customDir)
    }
    const now = await $.clock.now()
    const rows = statsRows(stats, now, hud, settings.targets)
    const labelW = Math.max(...rows.map(r => r.label.length))
    const face = composeFace(body, stats.bosses > 0 ? 'star' : 'happy', now)
    const frame = frameColor(body.look.hud)
    if (e.surface === 'terminal') {
      const { Box, Raster, Text } = $.ui.resolve(e)

      return (
        <Box gap={2}>
          <Raster key="face" columns={BODY_W} rows={ROWS} cells={encodeCells(face)} />
          <Box flexDirection="column">
            {rows.map(r => (
              <Box key={r.label}>
                <Text color={frame} bold>{`${r.label.padEnd(labelW)}  `}</Text>
                <Text color={DETAIL_COLOR}>{r.value}</Text>
              </Box>
            ))}
          </Box>
        </Box>
      )
    }
    const { Box, Svg, Text } = $.ui.resolve(e)

    return (
      <Box gap={2}>
        <Svg key="face" source={encodeSvg(face)} alt={`${body.name}, happy`} width={BODY_W * SVG_PX} height={HEIGHT * SVG_PX} />
        <Box flexDirection="column">
          {rows.map(r => (
            <Box key={r.label}>
              <Text color={frame} bold>{`${r.label.padEnd(labelW)}  `}</Text>
              <Text color={DETAIL_COLOR}>{r.value}</Text>
            </Box>
          ))}
        </Box>
      </Box>
    )
  })
plugins/oxen-pet/hooks/register.tsx lines 632–788 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    try {
      if (e.props.hasSurvey) {
        return next(e)
      }
      isWorking = e.props.isWorking
      bodyColumns = e.props.bodyColumns

      if (!body) {
        body = await keptBody($, settings.theme, settings.customDir)
      }
      const a = await read($, anim)
      const now = await $.clock.now()
      const elapsed = now - a.since
      const views = minisOnScreen(minis, now)
      // A leap is the run mode playing the jump clip, slowed, while the pet travels.
      const drawn = a.leap ? { mode: 'jump' as const, ms: leapClipMs((now - a.leap.since) * settings.pace) } : { mode: a.mode, ms: elapsed * settings.pace }
      const picture = compose(body, drawn.mode, drawn.ms, a.dir, hud ? mood(hud) : 'ok', views)
      const extra = views.length > MAX_MINIS ? ` (+${views.length - MAX_MINIS} minis)` : ''
      const shielded = shield !== undefined && guarding === 0 && now < shield.until ? guardLine(shield.result) : undefined
      const noticed = notice !== undefined && now < notice.until ? notice.text : undefined
      const line = settings.statusLine ? (shielded ?? noticed ?? statusLine(a.mode, a.since, elapsed, a.target, body.look.lines[a.mode])) + extra : ''
      const tint = noticed && !shielded ? NOTICE_COLOR : lineColor(a.mode, body.look.lineColors)
      if (showsError) {
        showsError = false
        $.ui.status(undefined)
      }

      const scene = sceneLayout(body)
      const shownBoss = settings.boss ? bossOnScreen(boss, now) : undefined
      const bossArt = shownBoss && drawBoss(shownBoss, now)
      const bossW = bossArt ? BOSS_W + 1 : 0
      if (e.surface === 'terminal' && scene && body.scene) {
        const { Box, Raster, Text } = $.ui.resolve(e)
        const width = scene.width
        const textW = line ? lineWidth(line) + 3 : 0
        const left = Math.max(0, Math.min(Math.round(a.x), width - picture.w - textW - bossW))
        const band = drawBand(body, body.scene, scene, picture, left, now)
        if (bossArt) {
          overlay(band, bossArt, width - bossW)
        }
        const cells = (x: number, y: number, w: number, h: number) => encodeCells(crop(band, x, y, w, h))
        // The status line cuts a hole in the band; the band shows above, below, and right of it.
        const textAt = left + picture.w
        const shown = Math.min(textW, width - textAt)
        const rest = width - textAt - shown

        return (
          <Box flexDirection="column" height={ROWS + GROUND_ROWS}>
            <Box height={ROWS}>
              <Raster key="pet" columns={textAt} rows={ROWS} cells={cells(0, 0, textAt, HEIGHT)} />
              {shown > 0 && (
                <Box key="line" flexDirection="column" width={shown}>
                  <Raster key="above" columns={shown} rows={ROWS - 2} cells={cells(textAt, 0, shown, HEIGHT - 4)} />
                  <Text color={tint} bold wrap="truncate">
                    {` › ${line}`}
                  </Text>
                  <Raster key="below" columns={shown} rows={1} cells={cells(textAt, HEIGHT - 2, shown, 2)} />
                </Box>
              )}
              {rest > 0 && <Raster key="rest" columns={rest} rows={ROWS} cells={cells(textAt + shown, 0, rest, HEIGHT)} />}
            </Box>
            <Raster key="ground" columns={width} rows={GROUND_ROWS} cells={cells(0, HEIGHT, width, GROUND_H)} />
          </Box>
        )
      }
      if (e.surface === 'terminal') {
        const { Box, Raster, Text } = $.ui.resolve(e)
        const room = Math.max(0, bodyColumns - picture.w - line.length - 4 - bossW)

        return (
          <Box height={ROWS} width={bandWidth()}>
            <Box marginLeft={Math.min(Math.round(a.x), room)} alignItems="flex-end">
              <Raster key="pet" columns={picture.w} rows={ROWS} cells={encodeCells(picture)} />
              {line && (
                <Box marginBottom={1} marginLeft={1}>
                  <Text color={tint} bold>
                    › {line}
                  </Text>
                </Box>
              )}
            </Box>
            {bossArt && <Box flexGrow={1} />}
            {bossArt && <Raster key="boss" columns={BOSS_W} rows={ROWS} cells={encodeCells(bossArt)} />}
          </Box>
        )
      }
      if (e.surface === 'desktop') {
        // The desktop has no Raster: the pet, its scene and the HUD's bars draw as SVG, and the HUD sits in the band,
        // since the desktop's hint line under the prompt is its own.
        const { Box, Svg, Text } = $.ui.resolve(e)
        const rows = settings.hud && hud ? hudRows({ ...hud, cacheMin: cacheLeftMin(lastTurnEndAt, settings.cacheTtlMin, now) }, body.look.hud, settings.hudRow) : []
        const hudFrame = frameColor(body.look.hud)
        const hudBox = rows.length > 0 && (
          <Box key="hud" flexDirection={settings.hudRow ? 'row' : 'column'} alignSelf="flex-start" {...(settings.hudRow ? {} : { borderStyle: 'round', borderColor: hudFrame, paddingX: 1 })}>
            {rows.map((r, k) => (
              <Box key={r.key} alignItems="center">
                {settings.hudRow && k > 0 && <Text color={hudFrame}>{ROW_GAP}</Text>}
                <Text color={r.color}>{r.label} </Text>
                <Svg source={encodeSvg(r.bar)} alt={`${r.key.toUpperCase()} bar, ${r.pct}% left`} width={r.bar.w * HUD_SVG_PX} height={r.bar.h * HUD_SVG_PX} />
                {r.parts.map((p, i) => (
                  <Text key={String(i)} color={p.color} bold={p.bold}>
                    {p.text}
                  </Text>
                ))}
              </Box>
            ))}
          </Box>
        )
        if (scene && body.scene) {
          const width = Math.min(scene.width, DESKTOP_BAND_W)
          const left = Math.max(0, Math.min(Math.round(a.x), width - picture.w - bossW))
          const band = crop(drawBand(body, body.scene, scene, picture, left, now), 0, 0, width, HEIGHT + GROUND_H)
          if (bossArt) {
            overlay(band, bossArt, width - bossW)
          }

          return (
            <Box flexDirection="column">
              <Svg source={encodeSvg(band)} alt={`${body.name}, ${a.mode}, in its scene`} width={width * SVG_PX} height={band.h * SVG_PX} />
              {line && (
                <Text color={tint} bold>
                  › {line}
                </Text>
              )}
              {hudBox}
            </Box>
          )
        }

        return (
          <Box flexDirection="column">
            <Box alignItems="flex-end">
              <Box marginLeft={Math.round(a.x)}>
                <Svg source={encodeSvg(picture)} alt={`${body.name}, ${a.mode}`} width={picture.w * SVG_PX} height={HEIGHT * SVG_PX} />
              </Box>
              {line && (
                <Text color={tint} bold>
                  {line}
                </Text>
              )}
              {shownBoss && bossArt && <Box flexGrow={1} />}
              {shownBoss && bossArt && <Svg key="boss" source={encodeSvg(bossArt)} alt={bossAlt(shownBoss)} width={BOSS_W * SVG_PX} height={HEIGHT * SVG_PX} />}
            </Box>
            {hudBox}
          </Box>
        )
      }

      return next(e)
    } catch (err) {
      showsError = true
      $.ui.status(`oxen-pet: ${String(err)}`)

      return next(e)
    }
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 halluqinate
Copyright (c) 2026 NhonNguyen (oxen-pet fork)

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

writes filesdrives 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 014cf61e65ed 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.plugins/oxen-pet/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.15 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, with its own branch for the desktop
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).runs no program a Windows PC lacks
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.starts no programs
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no 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 thanhnhoncntt/oxen-pet
/plugin install oxen-pet@oxen-pet

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

Search them from Claude: the MCP connector

Similar designs