How to Export a Chat from OpenCode

OpenCode is a powerful open-source AI coding assistant. While OpenCode is great for interactive development sessions, it doesn’t have a built-in way to export chat history or share conversations. If you’ve ever wanted to export an OpenCode chat, save a session for later reference, or share an AI-assisted coding session with a teammate — this guide is for you.

Using Cooontext, you can export any OpenCode conversation in under 30 seconds and share it with coworkers, followers, or friends.


Why Export Your OpenCode Chat?

Before diving into the steps, here’s why developers commonly need to export OpenCode sessions:

  • Share OpenCode chats with teammates — pass along a useful debugging session or architecture discussion without copy-pasting walls of text.
  • Export OpenCode chat history for documentation or postmortems.
  • Save context from a long coding session to revisit later.
  • Publish OpenCode conversations to your blog or social media to show your workflow.
  • Export prompts you’ve refined over time to reuse or share with others.

OpenCode doesn’t natively support any built-in export command, which is why a dedicated tool like Cooontext fills the gap.


How to Export an OpenCode Conversation (Step-by-Step)

Step 1 — Install the Cooontext Export Tool

Install the ctx CLI by running the following command in your terminal:

curl -fsSL https://cooontext.com/install.sh | bash

Then run the export command and select the “Chat” option:

ctx export

Run ctx export and choose Chat

Step 2 — Choose “OpenCode” as the Source

From the list of supported AI tools, select OpenCode to export your conversation.

Select OpenCode as the source

Step 3 — Select the Chat Session to Export

ctx will automatically detect your local OpenCode session history. Pick the conversation you want to export.

Select which chat session to export

That’s it — your OpenCode chat export is complete!

Export complete

The exported conversation is now saved to your Cooontext account and available at any time.

Chat available in your Cooontext account


Bonus: Share Your OpenCode Chats

Once exported, you get a shareable link you can send to anyone — no account required on their end. Share your OpenCode session with coworkers for code review, post it to social media, or embed it in your documentation.

Whether you want to opencode share chat, opencode share prompt, or simply opencode download chat as a permanent record — Cooontext has you covered.

Share your exported Claude Code chat


Frequently Asked Questions

Does OpenCode have a built-in export command?

No. As of 2026, OpenCode does not include a native export command or any built-in way to export chat history. The ctx tool from Cooontext is the easiest way to export OpenCode conversations.

Can I export my full OpenCode chat history?

Yes. Cooontext’s ctx tool reads your local OpenCode session files and lets you select any conversation to export — including long multi-turn sessions.

How do I export an OpenCode conversation to share with a coworker?

Install ctx, run ctx export, choose OpenCode, select the session, and share the generated link. The whole process takes under 30 seconds.

How do I save an OpenCode chat for later?

Use ctx export to export the session to your Cooontext account, where it’s stored permanently and accessible via a shareable link.

Is the export tool free?

Cooontext offers a free tier that covers basic exports and sharing. Visit cooontext.com for details on plans.


Summary

Exporting a chat from OpenCode is straightforward with the right tool. Here’s a quick recap:

  1. Install ctx: curl -fsSL https://cooontext.com/install.sh | bash
  2. Run ctx export and choose Chat
  3. Select OpenCode as your source
  4. Pick the session you want to export
  5. Share the link with anyone

Whether you need to export an OpenCode session, save your OpenCode chat history, or share an AI coding conversation with your team, Cooontext makes it effortless.