ModsCode / Claude Code Mods / Ranking / ctx-relay
ctx-relay
提示框上方顯示每輪花費與距交接線的剩餘空間;越過自動交接線時倒數 60 秒,用 fork 產生交接檔後 /clear 並在新對話接續;新對話開場列出還沒人接手的交接檔,按 1 接續
What it does
- Draws a pane, toasts
- Adds /ctx-relay-status, /ctx-relay-now
- Hooks classic.Stop, prompt.submit, session.compact, session.end and 4 more
- Keeps its own state between turns
- Starts processes
Good points
- No network calls
- Written in TypeScript
- Has a desktop-specific branch
- Handles errors
Code to start from
A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.
Starter (register.tsx)
import type { Register } from 'claude-code'
// Drawn like ctx-relay by Mango (pane, band, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/mangow314-ctx-relay/
// 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: "ctx-relay notes" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const name = '…'
const ago = '…'
const meta = '…'
return (
<Box flexDirection="column" backgroundColor="#181818" paddingX={1} paddingY={1}>
<Box flexDirection="row" backgroundColor="#262626" paddingX={1}>
<Text color="#f5f7fa" bold wrap="truncate-end">
{name}
</Text>
<Box flexGrow={1} />
<Text color="#b1b8bf">
{` ${ago}`}
</Text>
</Box>
<Box paddingX={1}>
<Text color="#b1b8bf" wrap="truncate-end">
{meta}
</Text>
</Box>
<Box flexDirection="row" marginTop={1}>
<Box backgroundColor="#262626" paddingX={1}>
<Button plain hotkey="s" label="status" />
</Box>
<Box backgroundColor="#262626" paddingX={1}>
<Button plain hotkey="v" label="evidence" />
</Box>
<Box flexGrow={1} />
<Button plain hotkey="q" label="close" />
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
await $.ui.toast(`[ctx-relay] handed off to a new conversation; the notes pane shows the handoff (q closes)`)
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.
ctx-relay/hooks/register.tsx lines 359–362 · Pane
on('ui.render', { component: 'Pane' }, async ($, e, next) => {
if (e.requestId !== NOTES) return next(e)
return drawNotes($, e)
})ctx-relay/hooks/register.tsx lines 1013–1110 · Pane
async function drawNotes($: EngineInterface, e: RenderInput<'Pane'>): Promise<RenderElement> {
const { Box, Button, Text } = $.ui.resolve(e)
const n = notes
const close = <Button key="close" plain hotkey="q" label="close" onPress={() => $.ui.close({ id: NOTES })} />
if (n === null || n.kind === 'none') {
return (
<Box flexDirection="column" backgroundColor={N.PANE} paddingX={1} paddingY={1}>
<Text color={N.TEXT}>{n?.reason ?? 'Not loaded.'}</Text>
<Box marginTop={1}>{close}</Box>
</Box>
)
}
const now = await $.clock.now()
// 區塊標題:符號染語意色、標籤亮白、數字前置,細線吃剩下的寬(扣 pane 左右 padding;不夠 3 格就不畫)
const head = (key: string, sym: string, symColor: string, label: string, count?: number) => {
const title = `${sym} ${count === undefined ? '' : `${count} `}${label} `
const fill = e.props.bodyColumns - 2 - title.length
return (
<Box key={key} flexDirection="row" marginTop={1}>
<Text color={symColor} bold>{`${sym} `}</Text>
<Text color={N.TITLE} bold>{`${count === undefined ? '' : `${count} `}${label}`}</Text>
{fill >= 3 ? <Text color={N.RULE}>{` ${'─'.repeat(fill)}`}</Text> : <Text>{''}</Text>}
</Box>
)
}
const para = (key: string, text: string, color = N.TEXT) => (
<Box key={key} paddingLeft={2}><Text color={color} wrap="wrap">{text}</Text></Box>
)
const field = (key: string, label: string, text: string) => (
<Box key={key} flexDirection="row">
<Box width={9} flexShrink={0}><Text color={N.MUTED}>{label}</Text></Box>
<Box flexGrow={1} flexShrink={1}><Text color={N.TEXT} wrap="wrap">{text}</Text></Box>
</Box>
)
const tab = (view: NotesView, hotkey: string, label: string) => (
<Box key={`tab-${view}`} backgroundColor={notesView === view ? N.CARD : undefined} paddingX={1}>
<Button key={`view-${view}`} plain hotkey={hotkey} label={label} dimColor={notesView !== view} onPress={() => showNotes($, view)} />
</Box>
)
const meta = [n.from === '' ? '' : `from ${n.from}`, n.how, n.thin === '' ? '' : `thin: ${n.thin}`].filter(x => x !== '').join(' · ')
const body: RenderElement[] = [
<Box key="title" flexDirection="row" backgroundColor={N.CARD} paddingX={1}>
<Text color={N.TITLE} bold wrap="truncate-end">{n.branch === '' ? n.name : n.branch}</Text>
<Box flexGrow={1} />
<Text color={N.MUTED}>{` ${ago(now - n.mtimeMs)}`}</Text>
</Box>,
<Box key="meta" paddingX={1}><Text color={N.MUTED} wrap="truncate-end">{meta}</Text></Box>,
<Box key="tabs" flexDirection="row" marginTop={1}>
{tab('resume', 's', 'status')}
{tab('evidence', 'v', 'evidence')}
<Box flexGrow={1} />
{close}
</Box>,
]
if (notesView === 'resume') {
body.push(head('next-h', '▶', N.ACCENT, 'NEXT', n.next.length + n.moreNext))
if (n.next.length === 0) body.push(para('next-none', 'No next step written; read the gaps and goal first.', N.MUTED))
n.next.forEach((t, i) => body.push(
<Box key={`next-${i}`} flexDirection="row">
<Box width={2} flexShrink={0}><Text color={N.ACCENT}>{'▌'}</Text></Box>
<Box width={3} flexShrink={0}><Text color={N.ACCENT} bold>{`${i + 1}.`}</Text></Box>
<Box flexGrow={1} flexShrink={1}><Text color={i === 0 ? N.TITLE : N.TEXT} bold={i === 0} wrap="wrap">{t}</Text></Box>
</Box>,
))
if (n.moreNext > 0) body.push(<Box key="next-more" paddingLeft={5}><Text color={N.MUTED} wrap="wrap">{`+${n.moreNext} more in the handoff file (path on evidence)`}</Text></Box>)
if (n.dont.length > 0) {
body.push(head('dont-h', '✗', N.DANGER, "DON'T", n.dont.length))
body.push(
<Box key="dont" paddingLeft={2}>
<Text wrap="wrap">{n.dont.flatMap((d, i) => [
...(i > 0 ? [<Text key={`ds-${i}`} color={N.MUTED}>{' · '}</Text>] : []),
<Text key={`d-${i}`} color={N.TEXT}>{d}</Text>,
])}</Text>
</Box>,
)
}
body.push(head('gap-h', '▲', N.WARNING, 'GAPS'))
body.push(n.gaps === '' ? para('gap', 'None recorded.', N.MUTED) : para('gap', n.gaps))
body.push(<Box key="ctx-gap" marginTop={1} />)
if (n.goal !== '') body.push(field('goal', 'goal', n.goal))
if (n.task !== '' || n.phase !== '') body.push(field('phase', 'phase', [n.phase, n.task === '' ? '' : `(${n.task})`].filter(x => x !== '').join(' ')))
body.push(field('files', 'files', `${n.files} listed in the handoff${n.dirty === '' ? '' : ` · dirty: ${n.dirty}`}`))
} else {
body.push(head('ok-h', '✓', N.SUCCESS, 'VERIFIED'))
if (n.verified !== '') body.push(para('ok', n.verified))
else if (n.raw.length > 0) {
body.push(para('raw-h', 'Check notes (not classified):', N.MUTED))
n.raw.forEach((t, i) => body.push(para(`raw-${i}`, t)))
} else body.push(para('ok', 'No verified items recorded.', N.MUTED))
body.push(head('src-h', '·', N.MUTED, 'SOURCE'))
body.push(field('src-file', 'file', `${n.name}.md`))
body.push(field('src-path', 'path', n.path))
if (n.from !== '') body.push(field('src-from', 'session', n.from))
body.push(field('src-how', 'how', n.how))
if (n.dirty !== '') body.push(field('src-dirty', 'dirty', n.dirty))
}
return <Box flexDirection="column" backgroundColor={N.PANE} paddingX={1} paddingY={1}>{body}</Box>
}Licence text (MIT)
MIT License Copyright (c) 2026 Mango 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.
How to build this: Pane (panel), Rewrite the prompt
What its code calls
runs programswrites filesenv varsdrives Clauderememberscalls tools
What its code shows
Read from the source at commit 0ae0a54a8283 on 2026-10-11. 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.ctx-relay/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.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).ctx-relay/hooks/register.tsx:814 mkdir (not on Windows); ctx-relay/hooks/register.tsx:913 mkdir (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.ctx-relay/hooks/register.tsx:1375 bash (a shell or interpreter) |
| Reads and sends | Whether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads environment variables, files, the transcript, settings.json and reaches the 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 |
| Settings hooks | Hooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone |
| Servers it ships | MCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/ |
| Skills, commands, agents | What its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows |
| Tools and MCP | Whether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).command.run: /clear |
| Asks of the model | Completions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command ?, model.fork (sends its own transcript), prompt.submit (as the person) |
| Events it hooks | By what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: classic.Stop, prompt.submit, command.run (ctx-relay-status, ctx-relay-now) · shapes: skill.prompt · also: session.end, session.start, turn.complete, turn.start (+2) · timers: clock.after, clock.every |
| Reads, by name | The environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.env: FORCE_PROMPT_CACHING_5M, CLAUDE_CODE_PROMPT_CACHE_TTL, ENABLE_PROMPT_CACHING_1H; files: a path computed at run time, …/…; the transcript; settings.json |
| Writes, by name | The files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.files: a path computed at run time, …/…/… |
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 its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
From its marketplace
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 mangow314/mango-mods/plugin install ctx-relay@mango-mods/reload-pluginsThis installs the marketplace's latest commit, which may not be the one read here (0ae0a54a8283). Compare them before you install. /reload-plugins loads it into a session that is already open.
Try the commit ModsCode read
No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:
git clone https://github.com/mangow314/mango-modsgit -C mango-mods checkout 0ae0a54a828335de41abc37e5553ce8546a8a1abclaude plugin validate mango-mods/ctx-relayclaude --plugin-dir mango-mods/ctx-relayThe validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.
Ask Claude about it
With the ModsCode connector added, Claude can read this mod's code and what it reaches, and build on them. Ask it like this:
Read the ModsCode mod "mangow314-ctx-relay" with its code and make me one like itSearch them from Claude: the MCP connector
Similar mods
- code-modernizationAnthropic★ 37,653
- crit-tuiTomasz Tomczyk★ 1,196
- ai-maestro-secrets23blocks-OS★ 817
- remctlFederico Viticci★ 595
- task-orchestrator-modJeff Picklyk★ 208
- agent-radarHamza Zafar★ 184
More from this repository
Badge for your README
If this is your mod, paste this into your README. It links to this page.
[](https://modscode.com/claude-mods/mods/mangow314-ctx-relay/)