cs
cs's in-session mod: the rotate band above the prompt, forced rotation past CS_ROTATE_FORCE_CTX, and the wrap key
What it does
- Draws a band above the prompt, a pane, toasts
- Adds /queue, /clear
- Hooks prompt.submit, session.start, skill.prompt, turn.complete and 1 more
- Starts processes
Good points
- No network calls
- Written in TypeScript
- 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)
import type { Register } from 'claude-code'
// Drawn like cs by cs (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/hex-cs/
// 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 cutTask = '…'
const gateElapsed = '…'
const left = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column">
<Box marginTop={1}>
<Box paddingX={1}>
<Text>
{`finishing ${cutTask} · gate ${gateElapsed}`}
</Text>
</Box>
</Box>
</Box>
<Box marginTop={1}>
<Box paddingX={1}>
<Button hotkey="1" plain label="/clear and continue from the handoff" />
<Text dimColor>
{" · "}
</Text>
<Button hotkey="2" plain label="wrap up this session" />
<Text dimColor>
{" · "}
</Text>
<Text bold>
{`/clear in ${left}s`}
</Text>
</Box>
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Handoff" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Markdown } = $.ui.resolve(e)
const text = '…'
const left = '…'
return (
<Box flexDirection="column" paddingX={1}>
<Text bold>
Handoff
</Text>
<Box flexDirection="column" marginTop={1}>
<Markdown text={`${text}`} />
<Text dimColor>
… the rest of the step is in the handoff
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box>
<Text>
████████░░░░░░░░
</Text>
<Text>
{" "}
</Text>
<Text bold>
{`/clear in ${left}s`}
</Text>
</Box>
<Text dimColor>
press 1 to clear now, or send a prompt to stay
</Text>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const cutTask = '…'
const force = '…'
const startPercent = '…'
await $.ui.toast(`cs: queued: ${cutTask}`)
await $.ui.toast(`cs: CS_ROTATE_FORCE_CTX=${force} is below this conversation's starting context (${startPercent}%); not forcing a rotation`)
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.
mods/cs/hooks/register.tsx lines 323–369 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const drawn = await withGateBand($, e, await next(e))
// The band draws in a new conversation before any of its turns end, so
// the birth is settled here: a later /resume is not mistaken for it.
noteConversation(await $.session.id())
// A survey owns the band; a running turn cannot be rotated out of.
turnRunning = e.props.isWorking
bandIdle = !e.props.hasSurvey && !e.props.isWorking
if (!bandIdle) return drawn
const armed = await handoffArmed($)
const { context } = await $.session.usage()
const percent = context.percent
if (!armed && (percent === undefined || percent < (await threshold($)))) return drawn
if (!(await ownsRotation($))) return drawn
const wrapped = !armed && (await wrapFinished($))
const fill = surfaceColor(await $.env.get("CS_TERM_BG_RGB"))
const { Box, Text, Button } = await $.ui.resolve(e)
// One capsule in the status bar's idiom: the keys on the bar's own fill,
// a blank line above them so the band reads apart from the transcript.
// The context percentage is the bar's to carry; the band does not repeat
// it. The keyed box lights coral under the pointer; the engine restyles it
// without running the hook.
return (
<Box flexDirection="column">
{drawn}
<Box marginTop={1}>
<Box key="cs-rotate-band" paddingX={1} backgroundColor={fill}>
{/* The engine draws a plain button as "1: label", and it draws
that prefix whether or not the label is empty (measured live:
a hand-drawn digit beside an empty-label button prints the
hotkey twice), so the label stays on the button. */}
{armed
? <Button key="cs-rotate" hotkey="1" plain label="/clear and continue from the handoff"
onPress={() => clearAndContinue($)} />
: <Button key="cs-rotate" hotkey="1" plain label="rotate this conversation"
onPress={() => rotate($)} />}
{/* a Button is a block: nested in a Text the engine refuses the whole tree (measured), so the separator stands beside it */}
{!armed && !wrapped && <Text dimColor>{' \u00b7 '}</Text>}
{!armed && !wrapped && <Button key="cs-wrap" hotkey="2" plain label="wrap up this session" onPress={() => askToWrap($)} />}
{/* the forced rotation's grace: the seconds left before the mod runs the /clear itself */}
{armed && left !== undefined && <Text dimColor>{' \u00b7 '}</Text>}
{armed && left !== undefined && <Text bold color={await rampColor($, left)}>{`/clear in ${left}s`}</Text>}
</Box>
</Box>
</Box>
)
})mods/cs/hooks/register.tsx lines 915–930 · Band
async function withGateBand($: EngineInterface, e: Parameters<EngineInterface['ui']['resolve']>[0], drawn: unknown) {
if (finishGate === undefined) return drawn
const { Box, Text } = await $.ui.resolve(e)
const fill = surfaceColor(await $.env.get("CS_TERM_BG_RGB"))
const secs = Math.max(0, Math.floor((await $.clock.now()) / 1000) - finishGate.since)
return (
<Box flexDirection="column">
{drawn}
<Box marginTop={1}>
<Box paddingX={1} backgroundColor={fill}>
<Text>{`finishing ${cutTask(finishGate.task)} · gate ${gateElapsed(secs)}`}</Text>
</Box>
</Box>
</Box>
)
}mods/cs/hooks/register.tsx lines 373–399 · Pane
on('ui.render', { component: 'Pane' }, async ($, e, next) => {
if (e.requestId !== PREVIEW_PANE || preview === undefined) return next(e)
const { Box, Text, Markdown } = await $.ui.resolve(e)
// With one pane open the engine draws no title, so the pane carries its
// own, in the session's colour; the step is drawn as a reply's markdown is.
const own = paletteColor(await sessionColor($))
const color = left === undefined ? undefined : await rampColor($, left)
return (
<Box flexDirection="column" paddingX={1}>
<Text key="header" bold color={own}>Handoff</Text>
<Box flexDirection="column" marginTop={1}>
<Markdown key="step" text={preview.text} />
{preview.cut && <Text key="cut" dimColor>… the rest of the step is in the handoff</Text>}
</Box>
{left !== undefined && (
<Box flexDirection="column" marginTop={1}>
<Box>
<Text key="bar" color={color}>{countdownBar(left)}</Text>
<Text>{' '}</Text>
<Text key="count" bold color={color}>{`/clear in ${left}s`}</Text>
</Box>
<Text dimColor>press 1 to clear now, or send a prompt to stay</Text>
</Box>
)}
</Box>
)
})Licence text (MIT)
MIT License Copyright (c) 2025 cs-tool contributors 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 Claude
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 0d28619de59b 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.mods/cs/hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.1 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.its repository's .claude-plugin/marketplace.json does not list it: no install line to give |
| Programs on Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).mods/cs/hooks/register.tsx:893 kill (not on Windows) |
| 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.mods/cs/hooks/register.tsx:255 a program named at run time; mods/cs/hooks/register.tsx:763 a program named at run time |
| 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's .claude-plugin/marketplace.json does not list it, so there is no install line to give. Read it as code, or follow its author's README.
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 "hex-cs" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
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
-
Ask Claude…────────Clear doneClaude⋯└─ buildCancelCancelCancel└─ buildCancelCancelCancel└─ buildCancelCancelCancel