anomalyco / anomalyco/opencode
[FEATURE]: Add "Copy ID", "Copy Name", and "Copy Link" to TUI session context menu
@kommander is already working on this.
Since Sep 7, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
To: OpenCode Maintainers <anomalyco/opencode>
Subject: [RFC/UX] Add Copy ID, Copy Name, and Copy Link to TUI Session Context Menu
Hey team,
In the current TUI, right-clicking a session item in the sidebar opens a minimal context menu with three entries: "New tab", "Rename", and "Close".
When working across multiple sessions, referencing a session outside the TUI is a frequent need:
- Grabbing the Session ID (
ses_...) to run CLI operations (opencode session <id>), inspect SQLite state, or pass to local automation scripts. - Grabbing the Session Title to include in commit messages, PR descriptions, or dev logs.
- Grabbing the Session Link (share URL or web session URL) to send to teammates or view in the browser.
Currently, copying any of these requires either selecting text directly with terminal mouse-mode bypass (which often breaks across lines or captures UI padding) or manually searching storage logs.
Adding direct clipboard actions to the context menu resolves this without introducing new UI surfaces.
UI / Interaction Mockup
Current Context Menu
Right-clicking a session entry in the vertical sidebar:
refactor authentication
workspace ┌──────────┐
│ New tab │
: fix connection timeout│ Rename │
workspace │ Close │
└──────────┘
: add logging middleware
workspace
+ New session
Proposed Context Menu
Group clipboard actions between navigation and destruction:
refactor authentication
workspace ┌───────────────┐
│ New tab │
: fix connection timeout│ Rename │
workspace │ ───────────── │
│ Copy ID │
: add logging middleware│ Copy Name │
workspace │ Copy Link │
│ ───────────── │
+ New session │ Close │
└───────────────┘
Interaction Flow
- Right-click any session item in the vertical tab list.
- Select "Copy ID", "Copy Name", or "Copy Link":
- Writes the target string to system clipboard via
clipboard.write(...)(supporting OSC 52 / host clipboard). - Closes the context menu.
- Shows a brief toast alert at the top corner:
┌───────────────────────────────┐ │ Session ID copied to clipboard│ └───────────────────────────────┘
- Writes the target string to system clipboard via
Implementation Sketch
In packages/tui/src/ (where the session tab context menu items are constructed), sessionID and title are already present in the menu state:
const clipboard = useClipboard()
const toast = useToast()
const menuItems = createMemo(() => {
const sessionID = state.sessionID
const title = state.title
const shareURL = state.shareURL // resolved via sync.session.get(sessionID)?.share?.url
return [
...(tabs.add ? [{ title: "New tab", run: () => tabs.add?.() }] : []),
...(sessionID ? [
...(tabs.promote && tabs.isPreview?.(sessionID)
? [{ title: "Keep open", run: () => tabs.promote?.(sessionID) }]
: []),
{ title: "Rename", run: () => DialogSessionRename.show(dialog, sessionID, title) },
{
title: "Copy ID",
run: async () => {
await clipboard.write(sessionID)
toast.show({ message: "Copied session ID", variant: "info" })
},
},
{
title: "Copy Name",
run: async () => {
await clipboard.write(title)
toast.show({ message: "Copied session title", variant: "info" })
},
},
...(shareURL ? [{
title: "Copy Link",
run: async () => {
await clipboard.write(shareURL)
toast.show({ message: "Copied session link", variant: "info" })
},
}] : []),
{ title: "Close", run: () => tabs.close(sessionID) },
] : []),
]
})
Edge Cases & Details
- Session Link availability: If the session has not been shared publicly yet, "Copy Link" can either copy the local web server URL (
http://localhost:<port>/session/<id>) or remain omitted when no link is active. - Clipboard integration: The existing TUI clipboard provider already wraps OSC 52 and host clipboard commands, so no additional dependencies are required.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.