modscode JA

modscode / Gallery / idlecrash

idlecrash

Crash with fake tokens against other people who are also waiting for Claude: in a pane on a terminal, in the browser elsewhere.

Code you can checkTerminal + desktopPaneStatus lineToastBoxButtonText

What it does

  • Draws a pane, the status line, toasts
  • Adds /idlecrash
  • Hooks session.start, turn.complete, turn.start, ui.close
  • Keeps its own state between turns
  • Calls the network

Good points

  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors
  • Writes no files

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 idlecrash by grozoww (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/grozoww-idlecrash/
// 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: "IdleCrash" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    return (
      <Box flexDirection="column">
        <Box>
          <Text bold>
            IDLECRASH
          </Text>
          <Text dimColor>
            {" fake tokens only"}
          </Text>
        </Box>
        <Text>
          The game opens in your browser.
        </Text>
        <Text dimColor>
          Claude is working: bets are open.
        </Text>
        <Button label="o · Open the game" hotkey="o" variant="primary" />
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const fmt = '…'
    const sign = '…'
    const url = '…'
    await $.ui.status(`IdleCrash: playing in your browser · balance ${fmt} (${sign})`)
    await $.ui.toast(`IdleCrash: open ${url}`)
    await $.ui.toast(`IdleCrash: the window is narrower than 144 columns, so the game opens in your browser`)
    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.

mod/hooks/register.tsx lines 643–802 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const f = await read($, feed)
    const wish = await read($, local)
    const st = await read($, status)
    const width = Math.max(30, (e.props.bodyColumns ?? 40) - 1)
    const snap = f.snap

    const title = (
      <Box>
        <Text bold>IDLECRASH</Text>
        <Text dimColor>  fake tokens only</Text>
      </Box>
    )

    if (e.surface !== 'terminal') {
      return (
        <Box flexDirection="column">
          {title}
          <Text>The game opens in your browser.</Text>
          <Text dimColor>{st.isWorking ? 'Claude is working: bets are open.' : 'Bets open when Claude starts working.'}</Text>
          <Button key="web" label="o · Open the game" hotkey="o" variant="primary" onPress={() => openFromPane($)} />
        </Box>
      )
    }

    if (!st.isWorking && !st.isWatching && st.summary) {
      return (
        <Box flexDirection="column">
          {title}
          <Text color="warning">{st.summary}</Text>
          <Text dimColor>Betting opens again when Claude starts the next turn.</Text>
          <Text dimColor>{snap && snap.history.length > 0 ? `last crashes: ${snap.history.slice(0, 8).map(point => point.toFixed(2)).join(' ')}` : ' '}</Text>
        </Box>
      )
    }
    if (!st.isWorking && !st.isWatching) {
      return (
        <Box flexDirection="column">
          {title}
          <Text>Waiting for Claude to start working.</Text>
          <Text dimColor>You can only play while Claude is busy.</Text>
          <Text dimColor>/idlecrash off  stops it opening by itself</Text>
        </Box>
      )
    }
    if (!snap || !st.isJoined) {
      return (
        <Box flexDirection="column">
          {title}
          {st.error ? <Text color="error">{st.error}</Text> : <Text dimColor>Taking a seat…</Text>}
        </Box>
      )
    }

    // Nothing below changes between two redraws unless the table changed: the moving parts
    // (plane, multiplier, countdown) live in the picture, which animates on its own.
    const phase = snap.table.phase
    const mine = snap.you.bet
    const isLive = !!mine && mine.cash === null && phase !== 'crashed'
    const delta = st.balanceAtStart === null ? 0 : snap.you.balance - st.balanceAtStart
    const seated = snap.table.humans + snap.table.bots
    const columns = Math.min(56, Math.max(28, width))
    const rowsOfPicture = 14
    const sceneProps: SceneProps = {
      phase,
      round: snap.table.round,
      columns,
      rows: rowsOfPicture,
      growth: snap.growth,
      runStartedAt: snap.table.runStartedAt,
      crashedAt: snap.table.crashedAt,
      crashPoint: snap.table.crashPoint,
      bettingEndsAt: snap.table.bettingEndsAt,
      serverNow: (await $.clock.now()) + f.offset,
      stake: isLive && phase === 'running' ? mine!.amount : 0,
    }

    const { Client } = $.ui.resolve(e)
    const picture = (
      <Client key="scene" module="./scene-client.tsx" props={sceneProps} width={columns} height={rowsOfPicture + 1} />
    )

    const rows = snap.players.map(p => {
      const name = pad(`${p.you ? '›' : ' '}${p.bot ? '⚙' : ' '}${p.name}`, 12)
      let result = ''
      let color: string | undefined
      if (p.bet > 0) {
        if (p.cash !== null) {
          result = `${times(p.cash)} → ${fmt(p.payout)}`
          color = 'success'
        } else if (phase === 'crashed') {
          result = 'lost'
          color = 'error'
        } else {
          result = phase === 'betting' ? 'in' : '…'
        }
      }
      return (
        <Box>
          <Text bold={p.you}>{name} {padStart(p.bet > 0 ? fmt(p.bet) : '-', 5)}  </Text>
          <Text color={color} dimColor={!color}>{result}</Text>
        </Box>
      )
    })

    const room = Math.max(3, Math.floor((width - 6) / 6))

    let action
    if (!st.isWorking) {
      action = <Text color="warning">Claude finished: betting is locked. Watching this round.</Text>
    } else if (phase === 'betting' && !mine) {
      action = <Button key="bet" label={`b · Bet ${fmt(wish.stake)}`} hotkey="b" variant="primary" onPress={() => placeBet($)} />
    } else if (isLive && phase === 'running') {
      action = <Button key="cash" label="c · CASH OUT" hotkey="c" variant="primary" onPress={() => cashOut($)} />
    } else if (mine && phase === 'betting') {
      action = <Text color="warning">bet placed: {fmt(mine.amount)}{mine.auto ? ` · auto ${times(mine.auto)}` : ''}</Text>
    } else if (mine && mine.cash !== null) {
      action = <Text color="success">cashed out {times(mine.cash)}: paid {fmt(mine.payout)}</Text>
    } else {
      action = <Text dimColor>next round soon</Text>
    }

    return (
      <Box flexDirection="column">
        {title}
        {picture}
        <Text dimColor>table {snap.table.id} · {seated} seated{snap.table.bots > 0 ? ` (${snap.table.bots} bots ⚙)` : ''}</Text>
        <Box>
          <Text>balance <Text bold>{fmt(snap.you.balance)}</Text></Text>
          <Text color={delta >= 0 ? 'success' : 'error'}>  {sign(delta)} this turn</Text>
        </Box>
        <Box flexDirection="column">{rows}</Box>
        <Box>
          <Text dimColor>last </Text>
          {snap.history.slice(0, room).map(point => (
            <Text color={point >= 2 ? 'success' : 'error'}>{point.toFixed(2)} </Text>
          ))}
        </Box>
        <Box>{action}</Box>
        <Box>
          <Text dimColor>{st.isWorking ? 'stake ' : ' '}</Text>
          {(st.isWorking ? STAKES : []).map((s, i) => (
            <Button
              key={`stake${i + 1}`}
              plain
              hotkey={String(i + 1)}
              label={fmt(s)}
              dimColor={wish.stake !== s}
              onPress={() => update($, local, w => ({ ...w, stake: s }))}
            />
          ))}
        </Box>
        <Box>
          {st.isWorking && (<Button
            key="auto"
            plain
            hotkey="x"
            label={`auto-out ${wish.auto ? times(wish.auto) : 'off'}`}
            onPress={() =>
Licence text (MIT)
MIT License

Copyright (c) 2026 grozoww

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

networkruns programsremembers

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 47ba72b7321a 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.mod/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.7 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.mod/hooks/register.tsx:96 fetch(`${base}${path}`); mod/hooks/register.tsx:595 fetch(`${base}/top`)
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.mod/hooks/register.tsx:350 a program named at run time
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches the network, but reads no files and no environment variables
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 grozoww/idlecrash
/plugin install idlecrash@grozoww-mods

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

Search them from Claude: the MCP connector

Similar designs