modscode JA

modscode / Gallery / hamster

hamster

A pixel hamster above the prompt in the Claude desktop app: it lives on your context window and tells you when to compact or clear. 110 tips on saving tokens, skills, plugins and MCP servers.

Code you can checkTerminal + desktopBandStatus lineToastBoxButtonLinkSvgText

What it does

  • Draws a band above the prompt, toasts
  • Watches tool calls
  • Hooks prompt.submit, session.start, turn.complete, ui.press
  • 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 hamster by nickpotet (band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/nickpotet-hamster/
// 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, Button, Svg, Text, Link } = $.ui.resolve(e)
    const flag = '…'
    const name = '…'
    const hamsterSvg = '…'
    const moods = '…'
    const level = '…'
    const title = '…'
    const bar = '…'
    const alt = '…'
    const xpText = '…'
    const percent = '…'
    const fun = '…'
    const tag = '…'
    const text = '…'
    const href = '…'
    return (
      <Box flexDirection="column" rowGap={1} paddingX={2} paddingY={1} position="relative">
        <Box position="absolute" top={1} right={2} flexDirection="column" alignItems="flex-end">
          <Button plain>
            en
          </Button>
          <Box borderStyle="round" flexDirection="column" paddingX={1}>
            <Button plain>
              {`✓ ${flag} ${name}`}
            </Button>
            <Button plain>
              {`✓ ${flag} ${name}`}
            </Button>
            <Button plain>
              {`✓ ${flag} ${name}`}
            </Button>
            <Button plain>
              ✓ 🌐 Same as Claude
            </Button>
          </Box>
        </Box>
        <Box flexDirection="row" flexWrap="wrap" alignItems="center" columnGap={4}>
          <Svg source={`${hamsterSvg}`} alt={`Hamster, ${moods}`} width={144} height={102} />
          <Box flexDirection="column" flexGrow={1} minWidth={34} rowGap={1}>
            <Box flexDirection="column">
              <Box columnGap={1}>
                <Text dimColor>
                  {`LV. ${level} / 10`}
                </Text>
                <Text dimColor>
                  ·
                </Text>
                <Text dimColor>
                  {moods}
                </Text>
                <Text color="#e0b04a">
                  · Claude is working
                </Text>
              </Box>
              <Text bold>
                {title}
              </Text>
            </Box>
            <Box flexDirection="column">
              <Box columnGap={2} alignItems="center">
                <Box width={10}>
                  <Text dimColor>
                    XP
                  </Text>
                </Box>
                <Svg source={`${bar}`} alt={`${alt}`} height={8} />
                <Text dimColor>
                  {xpText}
                </Text>
              </Box>
              <Box columnGap={2} alignItems="center">
                <Box width={10}>
                  <Text dimColor>
                    Fullness
                  </Text>
                </Box>
                <Svg source={`${bar}`} alt={`${alt}`} height={8} />
                <Text dimColor>
                  {`context ${percent}%`}
                </Text>
              </Box>
              <Box columnGap={2} alignItems="center">
                <Box width={10}>
                  <Text dimColor>
                    Joy
                  </Text>
                </Box>
                <Svg source={`${bar}`} alt={`${alt}`} height={8} />
                <Text dimColor>
                  {`${fun}% (/clear or /compact will bring joy)`}
                </Text>
              </Box>
            </Box>
          </Box>
        </Box>
        <Box borderStyle="round" paddingX={2} columnGap={1} alignItems="flex-start">
          <Box width={17}>
            <Text bold>
              {tag}
            </Text>
          </Box>
          <Box flexGrow={1} flexShrink={1} flexDirection="column">
            <Text wrap="wrap">
              {text}
            </Text>
            <Text wrap="wrap">
              {"→ "}
              <Link href={`${href}`}>
                {href}
              </Link>
            </Text>
          </Box>
          <Box columnGap={2} alignItems="flex-start">
            <Button plain>
              ←
            </Button>
            <Button plain>
              →
            </Button>
            <Button plain>
              Got it
            </Button>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const levelUp = '…'
    await $.ui.toast(`Context cleared: the hamster gained XP and joy.`)
    await $.ui.toast(`${levelUp}`)
    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.

hamster/hooks/register.tsx lines 432–582 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey) return next(e)

    const { Box, Text, Svg, Link, Button } = $.ui.resolve(e)
    const open = await read($, menu)
    const p = await read($, pet)
    const tick = await read($, frame)
    const stored = await read($, tip)
    const clockNow = await $.clock.now()
    // Until the first reading, the calm tip stands in so the card is never empty.
    const advice =
      stored.text !== ''
        ? stored
        : asTip(
            advise(
              { percent: p.food, fun: 100, ageMs: 0, idleMs: 0, limits: [], now: await $.clock.now() },
              lang,
              dismissed,
            ),
          )
    const tone = LOOK[advice.level]
    const { level, next: nextAt, share } = progressOf(p.xp)
    const mood = moodOf(p)
    const percent = Math.round(p.food)
    const ui = UI[lang]
    const title = titleOf(level, lang)

    // Without the room or the vector element, one plain line.
    if (e.surface !== 'desktop' || e.props.maxRows < 8) {
      return <Text dimColor>{ui.compact(title, level, percent, Math.round(p.fun))}</Text>
    }

    const xpText =
      nextAt === null ? `${Math.floor(p.xp)}` : `${Math.floor(p.xp)} / ${nextAt}`

    // One label column, so the three bars start and end on the same line.
    const row = (label: string, bar: string, alt: string, value: string) => (
      <Box columnGap={2} alignItems="center">
        <Box width={LABEL}>
          <Text dimColor>{label}</Text>
        </Box>
        <Svg source={bar} alt={alt} width={barWidth(SEGMENTS)} height={BAR_HEIGHT} />
        <Text dimColor>{value}</Text>
      </Box>
    )

    // No plate of its own: the hamster and its numbers sit straight on the
    // window. The same margin all round; one blank row between the blocks.
    return (
      <Box flexDirection="column" rowGap={1} paddingX={2} paddingY={1} position="relative">
        <Box position="absolute" top={1} right={2} flexDirection="column" alignItems="flex-end">
          <Button key="lang" plain onPress={noop}>
            {flagOf(lang)}
          </Button>
          {open && (
            <Box borderStyle="round" borderColor={tone.frame} flexDirection="column" paddingX={1}>
              {LANGS.map(l => (
                <Button key={`lang-${l.code}`} plain onPress={noop}>
                  {`${pref === l.code ? '✓' : ' '} ${l.flag} ${l.name}`}
                </Button>
              ))}
              <Button key="lang-auto" plain onPress={noop}>
                {`${pref === 'auto' ? '✓' : ' '} 🌐 ${ui.auto}`}
              </Button>
            </Box>
          )}
        </Box>
        <Box flexDirection="row" flexWrap="wrap" alignItems="center" columnGap={4}>
          <Svg
            source={hamsterSvg(p, tick, undefined, advice.level === 'info' ? null : advice.level)}
            alt={`${ui.hamster}, ${ui.moods[mood]}`}
            width={BAND.width}
            height={BAND.height}
          />
          <Box flexDirection="column" flexGrow={1} minWidth={34} rowGap={1}>
            <Box flexDirection="column">
              <Box columnGap={1}>
                <Text dimColor>{`${ui.level} ${level} / 10`}</Text>
                <Text dimColor>·</Text>
                <Text dimColor>{ui.moods[mood]}</Text>
                {e.props.isWorking && <Text color={GOLD}>{ui.working}</Text>}
              </Box>
              <Text bold>{title}</Text>
            </Box>
            <Box flexDirection="column">
              {row(
                ui.xp,
                barSvg(share, GOLD, SEGMENTS),
                ui.xpAlt(Math.round(share)),
                xpText,
              )}
              {row(
                ui.fed,
                barSvg(p.food, contextColor(p.food), SEGMENTS),
                ui.fedAlt(percent),
                `${ui.context} ${percent}%`,
              )}
              {row(
                ui.joy,
                barSvg(p.fun, JOY, SEGMENTS),
                ui.joyAlt(Math.round(p.fun)),
                `${Math.round(p.fun)}% ${ui.joyNote}`,
              )}
            </Box>
          </Box>
        </Box>
        {advice.text !== '' && (
          <Box
            borderStyle="round"
            borderColor={tone.frame}
            backgroundColor={tone.fill}
            paddingX={2}
            columnGap={1}
            alignItems="flex-start"
          >
            <Box width={TAG}>
              <Text bold color={tone.color}>{advice.tag}</Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} flexDirection="column">
              <Text bold={advice.level !== 'info'} wrap="wrap">{advice.text}</Text>
              {advice.href ? (
                <Text wrap="wrap">
                  {'→ '}
                  <Link href={advice.href}>{advice.link ?? advice.href}</Link>
                </Text>
              ) : (
                advice.link && <Text dimColor wrap="wrap">{`→ ${advice.link}`}</Text>
              )}
            </Box>
            <Box columnGap={2} alignItems="flex-start">
              {advice.level === 'info' && !advice.id && (
                <Button key="back" plain onPress={noop}>
                  ←
                </Button>
              )}
              {advice.level === 'info' && !advice.id && held !== null && browsing(clockNow) && (
                <Button key="forward" plain onPress={noop}>
                  →
                </Button>
              )}
              {advice.id && (
                <Button key="dismiss" plain onPress={noop}>
                  {ui.gotIt}
                </Button>
              )}
            </Box>
          </Box>
        )}
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 nickpotet

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

env varstool 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 76dc77641e97 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.hamster/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.11 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).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 nickpotet/claude-hamster
/plugin install hamster@claude-hamster

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

Search them from Claude: the MCP connector

Similar designs