@jfrz38/opencode-copy-lastCopy recent agent, user, or user-agent messages from the current OpenCode session.
0
77
7 in 7 days
31.6
Multi-signal model
1 day ago
2026-08-18
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@jfrz38/opencode-copy-last@0.1.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@jfrz38/opencode-copy-last@0.1.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D @jfrz38/opencode-copy-lastopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
Copy the latest agent, user, or user-agent exchange from your current OpenCode session directly to the clipboard.

Why?
@jfrz38/opencode-copy-last is a small OpenCode plugin for quickly reusing recent conversation context without selecting text manually.
It helps when you want to:
- Paste the last agent answer into an issue, PR, note, or chat.
- Copy your latest prompt exactly as you wrote it.
- Export recent user-agent exchanges as clean Markdown.
- Keep useful context before restarting OpenCode, switching branches, or moving to another tool.
Install
Install via CLI:
opencode plugin @jfrz38/opencode-copy-last@latest --global
Or add the plugin to your OpenCode configuration:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@jfrz38/opencode-copy-last"]
}
Restart OpenCode after changing plugin configuration.
Usage
/copy-last [agent|user|pair] [count|all]
By default, it copies the latest agent message:
/copy-last
Examples
Copy the latest agent response:
/copy-last
Copy the latest two agent responses:
/copy-last agent 2
Copy your latest prompt:
/copy-last user
Copy the latest three user-agent exchanges:
/copy-last pair 3
Copy all complete user-agent exchanges:
/copy-last pair all
Use shorter aliases when you prefer:
/copy-last me
/copy-last us 2
Targets
agent: copies the latest assistant/agent messages.user: copies the latest user messages.pair: copies complete user-agent exchanges.me: alias foruser.us: alias forpair.
you is intentionally unsupported because it is ambiguous.
Count
count: copies the latest matching messages or pairs, from1to20.all: copies every matching message or complete pair for the selected target.
Output Format
Single messages are copied as trimmed Markdown content.
Pairs are copied like this:
## User
Your prompt here
## Agent
The agent response here
Multiple copied items are separated with a Markdown horizontal rule:
---
How It Works
The plugin registers the /copy-last command with OpenCode and intercepts it before it reaches the LLM. It reads the current session, selects the requested messages, formats them as Markdown, copies the result to the clipboard, and shows a toast.
Because the command is handled locally by the plugin, running /copy-last does not send a new prompt to the model.