modscode / Gallery / terminal-gym
terminal-gym
A daily bodyweight rep goal inside Claude Code: log with /fit, quick-log band, long-turn nudges, streaks and a score grid, optional strict mode.
What it does
- Draws a band above the prompt, a pane
- Adds /fit
- Hooks classic.SessionStart, prompt.submit, session.start, turn.complete and 1 more
- 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)
import type { Register } from 'claude-code'
// Drawn like terminal-gym by Naitik Mehta (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/drumandcode-terminal-gym/
// 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)
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Box flexDirection="row">
<Box>
<Text dimColor>
❚
</Text>
<Text color="#d7af5f">
█═
</Text>
<Text bold>
TERMINAL-GYM
</Text>
<Text color="#d7af5f">
═█
</Text>
<Text dimColor>
❚
</Text>
<Text>
{" "}
</Text>
</Box>
<Text dimColor wrap="truncate-end">
Your agent put in the reps. You next.
</Text>
</Box>
<Text>
{" "}
</Text>
<Box flexDirection="row">
<Button label="Pick your training" variant="primary" />
<Text>
{" "}
</Text>
<Button label="House rules" />
<Text>
{" "}
</Text>
<Button label="Just train" />
</Box>
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "TERMINAL GYM" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const step = '…'
const dots = '…'
const name = '…'
const size = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column">
<Text dimColor>
{"Step "}
{`${step}1`}
{" of 3 "}
{dots}
</Text>
<Text bold>
Pick your program
</Text>
<Text>
{" "}
</Text>
</Box>
<Button label={`● ${name}`} plain />
<Button label={`● ${name}`} plain />
<Button label={`● ${name}`} plain />
<Box flexDirection="column">
<Text>
{" "}
</Text>
<Text dimColor>
Goal size
</Text>
<Box>
<Box>
<Button label={`● ${size}`} plain />
<Text>
{" "}
</Text>
</Box>
<Box>
<Button label={`● ${size}`} plain />
<Text>
{" "}
</Text>
</Box>
<Box>
<Button label={`● ${size}`} plain />
<Text>
{" "}
</Text>
</Box>
</Box>
</Box>
<Text>
{" "}
</Text>
<Text dimColor>
Your routine stays as it is.
</Text>
<Text>
{" "}
</Text>
<Box>
<Button label="Back" />
<Text>
{" "}
</Text>
<Button label="Next" variant="primary" />
</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/register.tsx lines 506–600 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const t = await read($, today)
if (options.band === false || e.props.hasSurvey || t === null) return next(e)
const { Box, Button, Text } = $.ui.resolve(e)
// Lay the band out in rows that fit, widest first: one line, then the
// header over the buttons, then every piece on its own line.
const cols = e.props.bodyColumns
const WORDMARK = MINI_BARBELL.small + MINI_BARBELL.plate + MINI_BARBELL.name + MINI_BARBELL.plateRight + MINI_BARBELL.small
const TAGLINE = 'Your agent put in the reps. You next.'
const BUTTONS_WIDTH = buttonsWidth(['Pick your training', 'House rules', 'Just train'])
const HEADER_WIDTH = cells(WORDMARK) + 2 + cells(TAGLINE)
if (!(await read($, isIntroduced))) {
const buttons = (
<Box key="buttons" flexDirection={cols >= BUTTONS_WIDTH ? 'row' : 'column'}>
<Button key="setup" label="Pick your training" variant="primary" onPress={() => openOnboarding($)} />
{cols >= BUTTONS_WIDTH && <Text> </Text>}
<Button key="help" label="House rules" onPress={() => $.ui.open({ id: HELP_PANE, title: 'HOUSE RULES' })} />
{cols >= BUTTONS_WIDTH && <Text> </Text>}
<Button key="dismiss" label="Just train" onPress={() => markIntroduced($)} />
</Box>
)
const header = (
<Box key="header" flexDirection={cols >= HEADER_WIDTH ? 'row' : 'column'}>
{cols >= cells(WORDMARK) ? (
<Box>
<Text dimColor>{MINI_BARBELL.small}</Text>
<Text color="#d7af5f">{MINI_BARBELL.plate}</Text>
<Text bold>{MINI_BARBELL.name}</Text>
<Text color="#d7af5f">{MINI_BARBELL.plateRight}</Text>
<Text dimColor>{MINI_BARBELL.small}</Text>
{cols >= HEADER_WIDTH && <Text> </Text>}
</Box>
) : (
<Text bold wrap="truncate-end">
{MINI_BARBELL.name}
</Text>
)}
<Text dimColor wrap="truncate-end">{TAGLINE}</Text>
</Box>
)
const isOneLine = cols >= HEADER_WIDTH + 1 + BUTTONS_WIDTH
return (
<Box key="band" flexDirection={isOneLine ? 'row' : 'column'}>
{header}
{isOneLine && <Text> </Text>}
{buttons}
</Box>
)
}
// A rest day is deliberate, not a miss: no rep buttons, just a way back.
if (t.isRest) {
const REST = `😴 Rest day · ${t.exercise} back tomorrow`
const TRAIN = 'Train today'
return (
<Box key="rest" flexDirection={cols >= cells(REST) + 2 + buttonsWidth([TRAIN]) ? 'row' : 'column'}>
<Text dimColor wrap="truncate-end">
{REST}
{' '}
</Text>
<Button key="train" label={TRAIN} onPress={() => endRest($)} />
</Box>
)
}
const days = await read($, history)
const color = progressColor(t.count, t.goal)
const add = (n: number) => () => void logReps($, count => count + n)
const progress = `${line(t)}${paceText(await read($, pace), isStrict)}`
const run = fullStreak(days, await read($, olderStreak))
const streakText = run > 0 ? ` 🔥${run}d` : ''
const LOG_LABEL = 'log reps: '
const logWidth = cells(LOG_LABEL) + buttonsWidth(['+5', '+10', '+25']) + cells(streakText)
return (
<Box key="tracker" flexDirection={cols >= cells(progress) + 2 + logWidth ? 'row' : 'column'}>
<Text color={color} dimColor={color === undefined} wrap="truncate-end">
{progress}
{' '}
</Text>
<Box>
<Text dimColor>{LOG_LABEL}</Text>
<Button key="add5" label="+5" onPress={add(5)} />
<Text> </Text>
<Button key="add10" label="+10" onPress={add(10)} />
<Text> </Text>
<Button key="add25" label="+25" onPress={add(25)} />
{streakText !== '' && <Text>{streakText}</Text>}
</Box>
</Box>
)
})hooks/register.tsx lines 687–809 · Pane
on('ui.render', { component: 'Pane', requestId: ONBOARD_PANE }, async ($, e) => {
const { Box, Button, Text } = $.ui.resolve(e)
const step = await read($, onboardStep)
const p = await read($, onboardPick)
const go = (to: number) => () => void update($, onboardStep, () => to)
const choose = (patch: Partial<OnboardPick>) => () => void update($, onboardPick, now => ({ ...now, ...patch }))
const dots = [0, 1, 2].map(i => (i === step ? '●' : '○')).join(' ')
const header = (title: string) => (
<Box flexDirection="column">
<Text dimColor>
Step {step + 1} of 3 {dots}
</Text>
<Text bold>{title}</Text>
<Text> </Text>
</Box>
)
const nav = (
<Box>
{step > 0 && <Button key="back" label="Back" onPress={go(step - 1)} />}
{step > 0 && <Text> </Text>}
{step < 2 ? (
<Button key="next" label="Next" variant="primary" onPress={go(step + 1)} />
) : (
<Button key="finish" label="Let's go" variant="primary" onPress={() => finishOnboarding($)} />
)}
</Box>
)
if (step === 0) {
return (
<Box flexDirection="column">
{header('Your agent works the code. You work the reps.')}
<Text>Every day has a rep goal.</Text>
<Text>When Claude runs a long turn, that's your cue for a set.</Text>
<Text> </Text>
<Text>Log reps two ways:</Text>
<Text dimColor> type /fit 20</Text>
<Text dimColor> or press +5 +10 +25 above your prompt</Text>
<Text> </Text>
{nav}
</Box>
)
}
if (step === 1) {
const programs = [...(p.hasRoutine ? [KEEP] : []), ...Object.keys(ROUTINES)]
const routine = pickedRoutine(p)
return (
<Box flexDirection="column">
{header('Pick your program')}
{programs.map((name, i) => (
<Button
key={`program-${i}`}
label={`${name === p.program ? '●' : '○'} ${name}`}
plain
onPress={choose({ program: name })}
/>
))}
{routine !== undefined && (
<Box flexDirection="column">
<Text> </Text>
<Text dimColor>Goal size</Text>
<Box>
{Object.keys(SIZES).map(size => (
<Box>
<Button
key={`size-${size}`}
label={`${size === p.size ? '●' : '○'} ${size}`}
plain
onPress={choose({ size })}
/>
<Text> </Text>
</Box>
))}
</Box>
</Box>
)}
<Text> </Text>
<Text dimColor>{routine === undefined ? 'Your routine stays as it is.' : describeRoutine(routine)}</Text>
<Text> </Text>
{nav}
</Box>
)
}
const routine = pickedRoutine(p)
const exercise = routine?.mon?.exercise ?? (await read($, today))?.exercise ?? 'pushups'
const sample = withStreak(
{ date: '', exercise, goal: 100, unit: '', count: 60, isRest: false },
// three finished days, today still in progress: 🔥3d
[
...Array.from({ length: 3 }, (_, i) => ({ date: `d${i}`, count: 100, goal: 100, exercise, isSkipped: false })),
{ date: 'today', count: 60, goal: 100, exercise, isSkipped: false },
],
)
const preview =
e.surface === 'terminal' ? (
(() => {
const { Raster } = $.ui.resolve(e)
return <Raster key="sample-grid" {...heatCells(SAMPLE_DAYS)} />
})()
) : (
<Text dimColor>■ ■ ■ ■ ■ □ ■</Text>
)
return (
<Box flexDirection="column">
{header('Keep the streak alive')}
<Text>Hit your goal and the streak grows.</Text>
<Text>It sits at the end of your tracker:</Text>
<Text color="#d7af5f"> {sample}</Text>
<Text dimColor>Miss a day and it resets to zero.</Text>
<Text> </Text>
<Text>See every day as a grid:</Text>
<Text dimColor> type /fit score</Text>
{preview}
<Text> </Text>
{nav}
</Box>
)
})Licence text (MIT)
MIT License Copyright (c) 2026 Naitik Mehta 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 filesenv varsremembers
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 0df9a375d879 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 read | Every module hooks/hooks.json names was read.hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.2 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No 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 open | Network 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 draws | The 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 line | Whether 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 Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether 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 sends | Whether it both reads files or environment variables and reaches the network.reaches no network |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An 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 DrumAndCode/terminal-gym/plugin install terminal-gym@terminal-gymThis installs the marketplace's latest commit, which may not be the one read here (0df9a375d879). 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 "drumandcode-terminal-gym" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…HandoffHandoffHandoff… the rest of the step is in the handoff████████░░░░░░░░ /clear in 4spress 1 to clear now, or send a prompt to stay
-
Ask Claude…Question guideAwaiting answer Questions from Claude (3)Freeform answer1/3p ◀ Previousn Next ▶l Latesta AI explanation: ONh Hide historyCloseAI tokens this session: 3$1.24▍Your recent instructions▍Claude's preceding explanationCancelledFreeform answerExplainf Full context✦ AI explanation (instructions, context, effects, recommendation)compact context42%Generating… (you can keep answering)Freeform answerCould not generate an explanation: Freeform answerOFF (enable for the next question with [a])────────Past questions and answers31/3 ▶ Selected[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer→ Freeform: Explain31/3 ▶ Selected[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer→ Freeform: Explain31/3 ▶ Selected[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer[Freeform answer] Question guide → Awaiting answer→ Freeform: Explain
-
Ask Claude…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
Ask Claude…Glossary BrowserGlossary openContextsContextsContexts▲ prevWrite1/Glossary▼ nextContexts
-
Ask Claude…envbuildbuildbuild+ .env.localsrc/app.ts is not in .gitignoreWriteNo .env files in the project root yet.K = paste the value, Enter saves saveNew key: NAME, Enter to continuegenerate randomcancelMissing compared with Write:KKK
-
What it does
- Draws a pane, a band above the prompt
- Watches Bash calls and can refuse them
- Hooks classic.CwdChanged, classic.SessionStart, classic.SubagentStart, classic.UserPromptSubmit and 5 more
- Keeps its own state between turns