[FEATURE]: opencode session export to markdown or json #6780

Open
opened 2026-02-16 18:05:15 -05:00 by yindo · 8 comments
Owner

Originally created by @paralin on GitHub (Jan 19, 2026).

Originally assigned to: @thdxr on GitHub.

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

We need a way to export opencode sessions to Markdown or Json format with a TUI flag.

 % opencode session export -h
opencode session export [sessionID]

export session transcript to file

Positionals:
  sessionID  session id to export                                                           [string]

Options:
  -h, --help        show help                                                              [boolean]
  -v, --version     show version number                                                    [boolean]
      --print-logs  print logs to stderr                                                   [boolean]
      --log-level   log level                   [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
      --dir         directory to run in                                                     [string]
  -o, --output      output file path                                                        [string]
  -f, --format      output format       [string] [choices: "markdown", "json"] [default: "markdown"]
Originally created by @paralin on GitHub (Jan 19, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request We need a way to export opencode sessions to Markdown or Json format with a TUI flag. ``` % opencode session export -h opencode session export [sessionID] export session transcript to file Positionals: sessionID session id to export [string] Options: -h, --help show help [boolean] -v, --version show version number [boolean] --print-logs print logs to stderr [boolean] --log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"] --dir directory to run in [string] -o, --output output file path [string] -f, --format output format [string] [choices: "markdown", "json"] [default: "markdown"] ```
yindo added the discussion label 2026-02-16 18:05:15 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 19, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6089: [FEATURE]: /export /copy missing most agent activity - Related to export functionality and transcript features
  • #3748: (referenced in #6089) - Original /copy and /export commands
  • #7535: [FEATURE]: Session logging as OpenAI messages - Feature to preserve request-response pairs and log sessions
  • #7426: opencode export outputs messages in wrong order for long sessions - Bug report on the export functionality
  • #4524: How do I get output? - User issue about exporting session transcripts to file
  • #4867: [FEATURE]: Making sessions first-class unlocks cheap ChatGPT Projects - Related feature request about session management and export

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 19, 2026): This issue might be a duplicate of existing issues. Please check: - #6089: [FEATURE]: /export /copy missing most agent activity - Related to export functionality and transcript features - #3748: (referenced in #6089) - Original /copy and /export commands - #7535: [FEATURE]: Session logging as OpenAI messages - Feature to preserve request-response pairs and log sessions - #7426: opencode export outputs messages in wrong order for long sessions - Bug report on the export functionality - #4524: How do I get output? - User issue about exporting session transcripts to file - #4867: [FEATURE]: Making sessions first-class unlocks cheap ChatGPT Projects - Related feature request about session management and export Feel free to ignore if none of these address your specific case.
Author
Owner

@tetipong2542 commented on GitHub (Jan 20, 2026):

I Needed

@tetipong2542 commented on GitHub (Jan 20, 2026): I Needed
Author
Owner

@paralin commented on GitHub (Jan 20, 2026):

Implemented; #5426

@paralin commented on GitHub (Jan 20, 2026): Implemented; #5426
Author
Owner

@dhruvkej9 commented on GitHub (Jan 28, 2026):

@rekram1-node please merge this export is very difficult currently, also there is no way to export to JSON

@dhruvkej9 commented on GitHub (Jan 28, 2026): @rekram1-node please merge this export is very difficult currently, also there is no way to export to JSON
Author
Owner

@Nindaleth commented on GitHub (Feb 12, 2026):

@paralin hey I was wondering, is the current session export to JSON somehow insufficient? I totally welcome Markdown exports for human consumption, just the JSON is already available and your PR seems to duplicate it.

If no sessionID given, a small and simple selection TUI opens.

$ opencode export --help
opencode export [sessionID]

export session data as JSON

Positionals:
  sessionID  session id to export                                                           [string]

Options:
  -h, --help        show help                                                              [boolean]
  -v, --version     show version number                                                    [boolean]
      --print-logs  print logs to stderr                                                   [boolean]
      --log-level   log level                   [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
@Nindaleth commented on GitHub (Feb 12, 2026): @paralin hey I was wondering, is the current session export to JSON somehow insufficient? I totally welcome Markdown exports for human consumption, just the JSON is already available and your PR seems to duplicate it. If no sessionID given, a small and simple selection TUI opens. ``` $ opencode export --help opencode export [sessionID] export session data as JSON Positionals: sessionID session id to export [string] Options: -h, --help show help [boolean] -v, --version show version number [boolean] --print-logs print logs to stderr [boolean] --log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"] ```
Author
Owner

@mrw commented on GitHub (Feb 12, 2026):

I'm not the original creator of this, but I am also looking forward to this. For us, the markdown export is definitely more useful than the JSON because we want to make it readable for humans without going through a whole additional level of JSON->Markdown transformation.

@mrw commented on GitHub (Feb 12, 2026): I'm not the original creator of this, but I am also looking forward to this. For us, the markdown export is definitely more useful than the JSON because we want to make it readable for humans without going through a whole additional level of JSON->Markdown transformation.
Author
Owner

@Nindaleth commented on GitHub (Feb 12, 2026):

@mrw if you need something right now, OpenCode already supports /export which does exactly the MD export of the active session - product of an earlier PR of @paralin (just found out and used today, thx!)

@Nindaleth commented on GitHub (Feb 12, 2026): @mrw if you need something right now, OpenCode already supports /export which does exactly the MD export of the active session - product of an earlier PR of @paralin (just found out and used today, thx!)
Author
Owner

@mrw commented on GitHub (Feb 12, 2026):

Thanks! We've been using that but are hoping to get this in a CLI flag so we can automate it better as part of an internal conversation sharing flow/system we're building. (I'm just sharing this to help contextualize the feedback/use case).

@mrw commented on GitHub (Feb 12, 2026): Thanks! We've been using that but are hoping to get this in a CLI flag so we can automate it better as part of an internal conversation sharing flow/system we're building. (I'm just sharing this to help contextualize the feedback/use case).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6780