Skip to main content
← All posts
A South Asian software engineer at a dark walnut desk reviewing an exported Sourcegraph Cody chat transcript rendered as clean markdown on a 14-inch laptop, warm coral desk lamp lighting, editorial photography style.
·7 min read

How to Read Sourcegraph Cody Chat History as Real Documents

Export Sourcegraph Cody chat history from VS Code, JetBrains, or the CLI, clean the markdown, and read long Cody threads as proper documents.

Sourcegraph Cody is one of the few AI coding assistants that understands large monorepos with any real depth. It reads across your whole codebase, pulls in the right context, and answers with references to concrete symbols instead of hallucinated function names. That superpower comes with a side effect: your chat history piles up fast. Reading it back inside the sidebar becomes painful the moment a session runs longer than a few turns. By the time you have twenty back and forth turns on a tricky refactor, the panel stops being a conversation and starts being a wall.

The sidebar was built for asking, not for rereading. When you want to revisit a Cody thread a week later, share the reasoning with a teammate, or feed the transcript into another tool, you need the conversation as a proper document. That means getting the content out of the IDE panel and into a reader that respects long-form technical writing. Below is how to do it without losing the code blocks, the file citations, or the thread of the reasoning. The workflow is short, it survives IDE reinstalls, and it plays nicely with git.

Why the Cody Sidebar Falls Apart on Long Threads

Cody's chat lives inside a narrow VS Code or JetBrains panel. That panel is optimized for the current turn, not the twentieth turn. Scrolling back through a long thread is jumpy, code blocks wrap awkwardly at the panel width, and the file references Cody inserts render as tiny inline chips that are easy to lose track of. When you are trying to follow a chain of reasoning across a dozen turns, the panel format works against you rather than with you. Reading in that layout for more than a few minutes is a fast route to eye strain.

There is also a memory problem worth naming. Cody's history is tied to your workspace, so switching branches or reopening the editor on a different machine can hide threads you swore existed. If you rely on the sidebar as your archive, you will eventually lose work to a reinstall or a machine swap. The safer pattern is to export chats to markdown as soon as they matter, then treat the sidebar as ephemeral. That way the transcripts live somewhere you control, indexed by whatever system you already trust.

Getting the Transcript Out of Cody

Cody exposes chat history through a few different surfaces depending on your client. In the VS Code extension you can right-click a chat in the History view and choose Export, which writes a JSON file with the full turn structure including code fences and file citations. The JetBrains plugin has a similar option in the Cody tool window, though the menu wording shifts between minor versions. Sourcegraph's Cody documentation lists the current export commands and any per-version quirks worth checking. It is worth skimming the release notes before you script anything around the export format, because the schema does move.

If you use Cody through the web app, the flow is even simpler. Open the chat, hit the share menu, and copy the markdown version straight to your clipboard. That markdown is already close to publishable, though it usually needs a light cleanup pass for the fenced language hints and the file link syntax that Cody uses internally. A quick pipe through a formatter like Prettier fixes most of the fenced code alignment issues in a single command. For anyone doing this daily, wiring a keyboard shortcut to the paste-and-format step pays for itself within a week.

For teams that live in the terminal, the Sourcegraph CLI is the right tool. Running src cody chat export dumps threads by ID in a scriptable format, and src cody chat list gives you the IDs. That is the path to use if you want a nightly cron that snapshots every Cody conversation to a git repo. Pair it with a simple naming scheme like YYYY-MM-DD-thread-title.md and you have a durable archive without any manual clicking. It also gives you the ability to grep across every conversation you have ever had with Cody, which becomes useful faster than you expect.

Turning the Export Into a Readable Document

Raw Cody exports are markdown, but they are markdown written for a machine. File citations look like @file:path/to/file.ts:42, the code blocks sometimes miss their language tag, and the role headers are inconsistent between versions. A five-minute cleanup pass makes the difference between a transcript you can skim and one you have to decode. The good news is that the cleanup is mechanical enough to script once and reuse forever. Three fixes cover the vast majority of cases, and they should be applied in the following order:

  • Normalize the role headers so every turn starts with a clear ## You or ## Cody line.
  • Add language hints to any fenced code block that is missing one, so syntax highlighting works.
  • Convert the internal @file: citations into plain markdown links pointing at your repo browser, GitHub, or Sourcegraph itself.

Once the transcript is clean, open it in a proper markdown reader. Prism MD renders Cody's code blocks with a real monospace stack, keeps file citations as tappable links, and lays out the turns with the vertical rhythm that makes long technical reading tolerable. If you are on the fence about which reader to use, the best markdown reader for AI-generated content walks through the tradeoffs against Notion, Obsidian, and Typora. The short version: general note tools optimize for your own writing, not for machine-generated transcripts, and it shows once the code blocks get long.

Reading Cody Threads on Mobile Without Losing the Code

A lot of Cody sessions end with a working patch and a short explanation of what changed and why. That explanation is exactly the kind of thing you want to reread on a train or during a coffee break, away from the editor. The problem is that most mobile markdown readers butcher long fenced code blocks. They either wrap them into unreadable soup, or hide them behind a horizontal scrollbar that eats half the screen. Neither behavior is friendly to the way engineers read code on a phone.

Prism MD handles long code blocks the way you would want. Fixed monospace, horizontal scroll that respects the touch target, and a tap-to-expand mode for the truly enormous diffs. If you want the deeper background on why this matters, the piece on handling extremely long code blocks in AI answers covers the specific failure modes to watch for. For engineers who read a lot of Cody chats on their phone, this alone is worth the switch away from a generic viewer. The reading experience compounds when the same chat is going to be revisited multiple times over a sprint.

There is also a workflow angle that becomes obvious once you start reading Cody threads off the laptop. Reading a chat on mobile is often step one before you turn it into an action item, a PR description, or a Slack summary for the team. The guide on extracting action items from AI conversations pairs neatly with the Cody export flow, and it works whether you export by hand or via cron. Together the two habits turn Cody from a one-shot autocomplete into something closer to a real engineering journal. That journal is where the compounding value lives.

FAQ

Does Cody store chat history in the cloud or locally?

It depends on your deployment tier. Cody Free and Cody Pro store history in Sourcegraph's cloud tied to your account, which means logging in on a new machine brings your history with you. Cody Enterprise on a self-hosted Sourcegraph instance keeps history on your infrastructure and honors whatever retention policy your team has set. Either way, exporting to markdown gives you a copy you control independently of the platform. That copy is what protects you when a tier change, an account move, or a policy update reshuffles what is visible in the sidebar.

Can I bulk export every Cody thread at once?

Yes, through the Sourcegraph CLI. src cody chat list returns thread IDs, and a short shell loop can pipe each one through src cody chat export into a dated folder. This is the standard pattern for teams that want a git-tracked archive of every conversation with the assistant. Running it on a nightly cron keeps the archive close to real-time without any manual steps, and the resulting folder plays nicely with grep, ripgrep, and any static site generator you might already use.

Will the exported markdown include file references from my repo?

The exports preserve the citations Cody used, though they render as internal syntax rather than clickable links out of the box. A quick regex pass turns them into normal markdown links pointing at your repo browser, and after that they work in any reader you throw at them. For teams on Sourcegraph Enterprise, pointing the links back at your Sourcegraph instance keeps the code navigation UX consistent across the transcript and the live codebase. It is a small polish step that pays off every time someone opens an old thread.

Does Prism MD handle Mermaid diagrams and math from Cody responses?

Yes, both are supported. Mermaid diagrams render inline, KaTeX math renders cleanly for the occasional response where Cody drops in a formula or a complexity bound, and the layout holds up even on smaller phone screens. The render math and mermaid in markdown post covers the specifics for anyone who wants the technical detail. If Mermaid or math is a core part of your Cody workflow, that piece is worth reading before you commit to any particular reader.

Read your Cody transcripts the way they deserve.

Free to start — no credit card.

Try Prism MD free

Related reading

Ready to read your own AI documents?

Open ChatGPT, Claude, Gemini, or any markdown file in the reader built for the way models write.

  • Renders code, math & Mermaid out of the box
  • Works offline once you've opened a doc
  • Free forever for personal reading