ModsCode / Claude Code Mods / Ranking / session-links
session-links
Every URL mentioned in the session, floating in a compact band above the prompt: pin it, dismiss it, open it in the browser. Decisions survive exit and resume; nothing is ever fetched.
What it does
- Draws a band above the prompt, a pane, toasts
- Adds /links
- Hooks classic.SessionStart, prompt.submit, session.append, session.start
- 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 session-links by samaphp (pane, band, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/samaphp-session-links/
// 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 } = $.ui.resolve(e)
const bulk = '…'
const hidden = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column">
<Box flexDirection="row">
<Button plain dimColor label={`${bulk}`} />
<Button plain label={`${bulk}`} />
<Button plain label={`${bulk}`} />
<Button plain dimColor label={` +${hidden} more `} />
</Box>
<Box flexDirection="row">
<Button plain dimColor label={`${bulk}`} />
<Button plain label={`${bulk}`} />
<Button plain label={`${bulk}`} />
<Button plain dimColor label={` +${hidden} more `} />
</Box>
<Box flexDirection="row">
<Button plain dimColor label={`${bulk}`} />
<Button plain label={`${bulk}`} />
<Button plain label={`${bulk}`} />
<Button plain dimColor label={` +${hidden} more `} />
</Box>
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Links" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const length = '…'
const displayOf = '…'
const displayOf2 = '…'
const displayOf3 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Text bold>
Links
</Text>
<Text dimColor>
{` ${length} pinned · ${length} floating · ${length} dismissed`}
</Text>
</Box>
<Box marginBottom={1} />
<Text dimColor>
Every URL you or Claude mention lands here and floats above the prompt.
</Text>
<Text bold color="claude">
★ PINNED
</Text>
<Box flexDirection="row">
<Text bold color="suggestion">
☆ FLOATING
</Text>
<Button plain dimColor label=" dismiss all " />
<Button plain label={` dismiss ${length}? `} />
</Box>
<Text bold dimColor>
× DISMISSED
</Text>
<Box flexDirection="row">
<Text dimColor>
{" "}
</Text>
<Text dimColor strikethrough>
{displayOf}
</Text>
<Button plain label=" restore " />
</Box>
<Box flexDirection="row">
<Text dimColor>
{" "}
</Text>
<Text dimColor strikethrough>
{displayOf2}
</Text>
<Button plain label=" restore " />
</Box>
<Box flexDirection="row">
<Text dimColor>
{" "}
</Text>
<Text dimColor strikethrough>
{displayOf3}
</Text>
<Button plain label=" restore " />
</Box>
<Box marginTop={1}>
<Text dimColor>
★ locks a link in for the whole session · × hides it · both survive exit and resume
</Text>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const reasonOf = '…'
const named = '…'
await $.ui.toast(`Links were not saved, so a resume will not restore them: ${reasonOf}`)
await $.ui.toast(`Dismissed ${named} · /links brings it back`)
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.
hooks/register.tsx lines 799–918 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
// Asked first, and of every drawing: an empty band is exactly what a session just left looks like.
const isMine = await isCurrent($)
const all = await read($, links)
const shown = all.filter(link => link.status !== 'dismissed').length
if (e.props.hasSurvey || shown === 0 || !isMine) {
return next(e)
}
const since = await read($, freshSince)
const { Box, Button, Link, Text } = $.ui.resolve(e)
const asked = await read($, armed)
const floating = all.filter(link => link.status === 'floating').length
const bulk = bulkLabels(floating, asked === ALL)
const tail = bulk.reduce((cells, label) => cells + label.length, 0)
const { rows, hidden } = seat(all, e.props.bodyColumns, Math.max(1, Math.min(MAX_ROWS, e.props.maxRows)), asked, tail)
// A click reaches a Button only where the surface reports clicks: the
// fullscreen terminal. On the main screen only the terminal's own
// hyperlink answers a click, so the label is a Link there when one will
// be drawn as a hyperlink, and a Button the keyboard presses otherwise.
const hasClicks = e.surface === 'terminal' && e.viewport?.isFullscreen === true
const isPressed = hasClicks || !(await drawsHyperlinks($, e.surface))
const run = (what: string, work: () => Promise<unknown>) => () => quietly($, what, work)
const chip = ({ link, id, label }: Chip) => {
const isPinned = link.status === 'pinned'
const isAsked = link.url === asked
// The bar names what the standing question would take: this link, or every floating one.
const isMarked = isAsked || (asked === ALL && !isPinned)
return (
<Box key={`chip:${id}`} flexDirection="row" flexShrink={0} marginRight={1}>
<Text color={isMarked ? 'error' : barOf(link, since)}>▎</Text>
<Button
key={`pin:${id}`}
plain
dimColor={!isPinned}
label={isPinned ? ' ★ ' : ' ☆ '}
hover={{ color: 'warning' }}
onPress={press => quietly($, 'pin', () => togglePin($, link, `pin:${id}`, press.requestId))}
/>
{isPressed ? (
<Button
key={`open:${id}`}
plain
label={` ${label} `}
hover={{ underline: true }}
onPress={press => quietly($, 'open the browser', () => openInBrowser($, link.url, press.surface))}
/>
) : (
<Link href={link.url} label={` ${label} `} />
)}
{!isPinned && (
<Button
key={`drop:${id}`}
plain
dimColor={!isAsked}
label={isAsked ? ARMED_LABEL : DISMISS_LABEL}
hover={{ color: 'error' }}
onPress={run('dismiss', () => pressDismiss($, link.url))}
/>
)}
</Box>
)
}
const own = (
<Box flexDirection="column">
{rows.map((row, at) => (
<Box key={`row:${at}`} flexDirection="row">
{row.map(chip)}
{at === rows.length - 1 && bulk.length === 1 && (
<Button
key="bulk"
plain
dimColor
label={bulk[0]}
hover={{ color: 'error' }}
onPress={press => quietly($, 'ask about every link', () => askAll($, 'bulk', press.requestId))}
/>
)}
{at === rows.length - 1 && bulk.length === 2 && (
<Button key="bulk" plain label={bulk[0]} hover={{ color: 'error' }} onPress={run('dismiss every link', () => dismissAll($))} />
)}
{at === rows.length - 1 && bulk.length === 2 && (
<Button
key="bulk:list"
plain
label={bulk[1]}
hover={{ color: 'error' }}
onPress={run('dismiss every link and open the list', async () => {
await dismissAll($)
await openPane($)
})}
/>
)}
{at === rows.length - 1 && (
<Button
key="all"
plain
dimColor
label={hidden > 0 ? ` +${hidden} more ` : ' ≡ '}
onPress={run('open the list', () => openPane($))}
/>
)}
</Box>
))}
</Box>
)
// Other mods draw in this band too (status rows, confirmation controls):
// the links stack over whatever the rest of the chain drew instead of replacing it.
return (
<Box flexDirection="column">
{own}
{await next(e)}
</Box>
)
})hooks/register.tsx lines 920–932 · Pane
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const all = (await isCurrent($)) ? await read($, links) : []
const since = await read($, freshSince)
const kit = $.ui.resolve(e)
const columns = Math.max(24, e.props.bodyColumns)
const isLinked = await drawsHyperlinks($, e.surface)
const asked = await read($, armed)
const editing = await read($, renaming)
return listView($, kit, all, columns, since, isLinked, asked, editing)
})hooks/register.tsx lines 576–735 · Pane
function listView(
$: Engine,
kit: Kit,
all: readonly Link[],
columns: number,
since: number,
isLinked: boolean,
asked: string,
editing: string,
) {
const { Box, Button, Link, Text } = kit
const Field = kit.Input
const run = (what: string, work: () => Promise<unknown>) => () => quietly($, what, work)
// A row's keys carry its link's address: unique across the sections, and
// unmoved when a link changes section or the cap trims the list.
const pinned = all.filter(link => link.status === 'pinned').sort(byPriority)
const floating = all.filter(link => link.status === 'floating').sort(byPriority)
const dismissed = all.filter(link => link.status === 'dismissed')
const width = Math.max(8, columns - 4)
const row = (link: Link) => (
<Box key={`row:${link.url}`} flexDirection="column" marginBottom={1}>
<Box flexDirection="row">
<Text color={link.url === asked ? 'error' : barOf(link, since)}>▎</Text>
{link.name !== undefined && <Text bold>{` ${clip(link.name, width)}`}</Text>}
{link.name === undefined && isLinked && <Link href={link.url} label={` ${displayOf(link.url, width)} `} />}
{link.name === undefined && !isLinked && (
// Without hyperlinks the whole address is written once, as plain
// text: that is what such a terminal can open on a click.
<Text>{` ${link.url}`}</Text>
)}
</Box>
{link.name !== undefined && isLinked && <Link href={link.url} label={` ${displayOf(link.url, width - 1)} `} />}
{link.name !== undefined && !isLinked && <Text dimColor>{` ${link.url}`}</Text>}
{Field !== undefined && link.url === editing && (
<Box paddingLeft={1}>
<Field
key="rename"
label="name "
value={link.name ?? ''}
placeholder="a name for this link; leave empty to clear it"
submitLabel="save"
autoFocus
onSubmit={value => quietly($, 'name the link', () => rename($, link.url, value))}
/>
</Box>
)}
<Box flexDirection="row" paddingLeft={1}>
<Button
key={`open:${link.url}`}
plain
dimColor
label=" open "
onPress={press => quietly($, 'open the browser', () => openInBrowser($, link.url, press.surface))}
/>
<Button
key={`pin:${link.url}`}
plain
dimColor
label={link.status === 'pinned' ? ' unpin ' : ' pin '}
onPress={press => quietly($, 'pin', () => togglePin($, link, `pin:${link.url}`, press.requestId))}
/>
{link.status !== 'pinned' && (
<Button
key={`drop:${link.url}`}
plain
dimColor={link.url !== asked}
label={link.url === asked ? ' dismiss? ' : ' dismiss '}
onPress={run('dismiss', () => pressDismiss($, link.url))}
/>
)}
<Button
key={`copy:${link.url}`}
plain
dimColor
label=" copy "
onPress={press => quietly($, 'copy', () => copyLink($, link.url, press.surface))}
/>
{Field !== undefined && (
<Button
key={`rename:${link.url}`}
plain
dimColor={link.url !== editing}
label={link.url === editing ? ' cancel ' : ' rename '}
onPress={press => quietly($, 'rename', () => toggleRename($, link.url, press.requestId))}
/>
)}
{columns >= 60 && <Text dimColor>{` ${link.source === 'you' ? 'you' : 'Claude'} · ${link.mentions}×`}</Text>}
</Box>
</Box>
)
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Text bold>Links</Text>
<Text dimColor>{` ${pinned.length} pinned · ${floating.length} floating · ${dismissed.length} dismissed`}</Text>
</Box>
{Field !== undefined && (
<Box marginBottom={1}>
<Field
key="add"
label="add "
placeholder="type or paste an address"
submitLabel="pin it"
// Of several fields the first drawn takes the focus: while a name is being typed, this one yields.
{...(editing === '' ? { autoFocus: true as const } : {})}
onSubmit={value => quietly($, 'add the link', () => addByHand($, value))}
/>
</Box>
)}
{all.length === 0 && <Text dimColor>Every URL you or Claude mention lands here and floats above the prompt.</Text>}
{pinned.length > 0 && (
<Text bold color="claude">
★ PINNED
</Text>
)}
{pinned.map(row)}
{floating.length > 0 && (
<Box key="floating" flexDirection="row">
<Text bold color="suggestion">
☆ FLOATING
</Text>
{floating.length >= LIST_BULK_MIN && asked !== ALL && (
<Button
key="bulk"
plain
dimColor
label=" dismiss all "
hover={{ color: 'error' }}
onPress={press => quietly($, 'ask about every link', () => askAll($, 'bulk', press.requestId))}
/>
)}
{floating.length >= LIST_BULK_MIN && asked === ALL && (
<Button key="bulk" plain label={` dismiss ${floating.length}? `} hover={{ color: 'error' }} onPress={run('dismiss every link', () => dismissAll($))} />
)}
</Box>
)}
{floating.map(row)}
{dismissed.length > 0 && (
<Text bold dimColor>
× DISMISSED
</Text>
)}
{dismissed.map(link => (
<Box key={`row:${link.url}`} flexDirection="row">
<Text dimColor>{' '}</Text>
<Text dimColor strikethrough>
{displayOf(link.url, Math.max(8, width - 12))}
</Text>
<Button key={`restore:${link.url}`} plain label=" restore " onPress={run('restore', () => setStatus($, link.url, 'floating'))} />
</Box>
))}
{all.length > 0 && (
<Box marginTop={1}>
<Text dimColor>★ locks a link in for the whole session · × hides it · both survive exit and resume</Text>
</Box>
)}
</Box>
)Licence text (MIT)
MIT License Copyright (c) 2026 samaphp 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 programsenv varsremembers
What its code shows
Read from the source at commit 9404f3c6347d 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.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.hooks/register.tsx:424 a program named at run time |
| 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, the transcript, but reaches nothing outside |
| 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).calls no tool, MCP server or command |
| 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 links |
| 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: prompt.submit, session.append, command.run (links) · reads: classic.SessionStart · also: session.start, ui.render (AbovePrompt, Pane) · timers: clock.after |
| 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_HYPERLINK; the transcript |
| 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.the clipboard |
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 samaphp/session-links/plugin install session-links@session-links/reload-pluginsThis installs the marketplace's latest commit, which may not be the one read here (9404f3c6347d). 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/samaphp/session-linksgit -C session-links checkout 9404f3c6347d62cbafd7a60fe21c608f995408aaclaude plugin validate session-linksclaude --plugin-dir session-linksThe 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 "samaphp-session-links" 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 by samaphp
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/samaphp-session-links/)