Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aravhawk
Copy link

@aravhawk aravhawk commented Jan 27, 2026

Context

Adds a /session export command to the Kilo Code CLI that allows users to export their conversation sessions to shareable file formats (Markdown, HTML, JSONL). This enables users to save sessions for documentation, PR descriptions, bug reports, and auditing purposes.

Implementation

  • Created cli/src/utils/export.ts with rendering functions for each format:
    • renderToMarkdown() - Generates README-friendly Markdown with metadata header
    • renderToHtml() - Produces a self-contained HTML file with dark theme styling
    • renderToJsonl() - Outputs one JSON object per line for programmatic processing
  • Extended CommandContext with getMessages() and getExtensionState() to provide access to unified messages and session metadata
  • Added export subcommand to the existing /session command, following the pattern of other subcommands (show, list, share, etc.)
  • Messages are filtered to exclude internal types (api_req_started, checkpoints) and empty content
  • Export files default to ./kilo-exports/ with auto-directory creation

Screenshots

before after
image image

Example Markdown output:

# Kilo Code Session

## Metadata
- **Session ID:** `abc123`
- **Mode:** code
- **Provider:** anthropic
- **Model:** claude-sonnet-4-5-20250929

## Conversation

### User
Hello, can you help me?

### Assistant
Of course! How can I assist you?

How to Test

  1. Build and start the CLI:
    pnpm cli:bundle
    cd cli && pnpm start
  2. Send a message to start a conversation (e.g., "Hello")
  3. Test the export commands:
    • /session export markdown - exports to ./kilo-exports/session-<id>.md
    • /session export html - exports to ./kilo-exports/session-<id>.html
    • /session export jsonl ./test.jsonl - exports to custom path
  4. Open the exported files to verify content and formatting

Get in Touch

Discord: aravhawk

…support

- Add /session export subcommand to export conversations to files
- Support three formats: markdown, html, jsonl
- Include session metadata (ID, mode, provider, model, workspace)
- Add comprehensive test suite for export utilities
- Update README with session export documentation

Amp-Thread-ID: https://ampcode.com/threads/T-019c00b1-3c52-708b-b894-08482b4cb31b
Co-authored-by: Amp <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

🦋 Changeset detected

Latest commit: 63e2743

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant