Skip to content

Add /export — render session to Markdown #32

Description

@aakashrajput

Why

Users want to share or archive what the agent did. Sessions are stored as JSONL — unreadable for humans.

What

New slash command /export [path]:

  • Renders the current session to clean Markdown: user/assistant turns, collapsed tool calls (name + one-line summary, expandable details block), diffs as fenced ```diff blocks, timestamps, final token/cost stats footer
  • Default path ./klaatai-session-<id>.md; path argument overrides
  • Bonus (separate PR welcome): --html variant with inline styles

Where to start

  • Session message history is already in memory in src/screens/repl.ts; session JSONL format in the session-save/resume code
  • Markdown rendering knowledge lives in src/engine/widgets/markdown.ts (you're doing the reverse — model messages → md text)

Acceptance criteria

  • /export writes the file and prints the path in the transcript
  • Tool calls and diffs render legibly; no raw JSON dumps
  • In slash autocomplete; typecheck + tests green

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions