Skip to content

docs(cli): add conversation export to Markdown recipe for Obsidian and Notion (addresses #13700) - #13701

Merged
kodjima33 merged 4 commits into
BasedHardware:mainfrom
ElvinGts:docs/conversations-markdown-recipe
Sep 15, 2026
Merged

kodjima33 merged 4 commits into
BasedHardware:mainfrom
ElvinGts:docs/conversations-markdown-recipe

Conversation

@ElvinGts

@ElvinGts ElvinGts commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses #13700.

Adds a complete, zero-dependency recipe and Python CLI converter script that allows Omi users to export conversation histories and transcripts into structured Markdown files tailored for personal knowledge management tools like Obsidian, Notion, and Logseq.

Proposed Changes

  • sdks/python-cli/examples/conversations_to_markdown.py: Standalone converter script using pure Python standard library (json, argparse, pathlib, re, datetime).
    • Formats YAML frontmatter with tags (#omi, #conversation, #<category>), ISO timestamps, and conversation ID.
    • Formats summary and overview blocks.
    • Converts action items to interactive Markdown checkboxes (- [ ] and - [x]).
    • Converts audio transcript segments into timestamped blockquotes (> **[MM:SS] Speaker X:** ...).
    • Supports both direct Unix pipe input from omi --json conversation list via stdin and local JSON file input.
    • Handles UTF-8 BOM encoding safely on Windows/PowerShell environments.
  • sdks/python-cli/examples/conversations_markdown.md: Complete user documentation guide with pipeline examples and sample output.
  • sdks/python-cli/examples/README.md: Added link to the new recipe in the examples index.

Verification

Verified locally on Python 3.12:

  • Tested standard JSON array and single conversation dictionary parsing.
  • Tested pipeline mode via stdin (cat conversations.json | python conversations_to_markdown.py -).
  • Verified UTF-8 and UTF-8-sig (BOM) file handling.
  • Validated YAML frontmatter parsing and Obsidian compatibility.

Bounty

Requested reward under the Contribution Guide: US$20 as proposed in #13700.
Payment details: Wise tag @ellyboyj or PayPal.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread sdks/python-cli/examples/README.md Resolved
Comment thread sdks/python-cli/examples/README.md Resolved
@ElvinGts

Copy link
Copy Markdown
Contributor Author

Thank you @cubic-dev-ai[bot] for the thorough automated review! All 8 points have been addressed in the latest commit:

  1. Python 3.10/3.11 Compatibility: Replaced f-string backslash escaping with json.dumps() for safe YAML scalar serialization without syntax errors.
  2. Path Traversal Guard: Added strict regex validation (^\d{4}-\d{2}-\d{2}) for started_at prefixes.
  3. Overwrite Prevention: Appended a sanitized conversation ID suffix (_shortid) to ensure unique filenames.
  4. Timezone Normalization: Normalized aware timestamps to timezone.utc before formatting.
  5. YAML Safety: All frontmatter fields are serialized with json.dumps() to prevent broken YAML on multiline or quoted strings.
  6. Documentation Clarification: Updated timestamp documentation to specify [HH:MM:SS] for transcripts longer than an hour.
  7. README Index Alignment: Restored Turkish (quickstart.tr.md) and Russian (quickstart.ru.md) links and cleanly appended conversations_markdown.md.
  8. Line Endings & Encoding: Stripped UTF-8 BOM and normalized line endings to LF.

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Thank you @cubic-dev-ai[bot] for the thorough automated review! All 8 points have been addressed in the latest commit:

  1. Python 3.10/3.11 Compatibility: Replaced f-string backslash escaping with json.dumps() for safe YAML scalar serialization without syntax errors.
  2. Path Traversal Guard: Added strict regex validation (^\d{4}-\d{2}-\d{2}) for started_at prefixes.
  3. Overwrite Prevention: Appended a sanitized conversation ID suffix (_shortid) to ensure unique filenames.
    ...

@ElvinGts Nice, that all lines up with what I'm seeing in the latest diff. I checked each of the 8 points against the actual code:

  • json.dumps() for frontmatter scalars is in place, so no more backslash-escaping syntax errors on 3.10/3.11.
  • The ^\d{4}-\d{2}-\d{2} regex on date_prefix plus the filename build closes the path traversal angle.
  • The sanitized _shortid suffix handles the duplicate-title/date overwrite case.
  • Timestamps normalize to timezone.utc before strftime, and unaware inputs get UTC attached.
  • The README index cleanly re-adds the quickstart.tr.md / quickstart.ru.md lines and appends the new doc.
  • BOM handling is covered on both paths — lstrip("\ufeff") for stdin and encoding="utf-8-sig" for files.

One tiny note, not a blocker: the f-strings still normalize line endings via "\n".join(...), which is fine on LF but on Windows you may end up with mixed line endings if a source file carries CRLF inside its text values. Since Obsidian handles both fine and you're joined via \n anyway, this is cosmetic at most.

The recipe reads clean and is genuinely zero-dependency. Ship it.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

@ElvinGts

Copy link
Copy Markdown
Contributor Author

Thank you @cubic-dev-ai[bot] for the thorough automated review! All 8 points have been addressed in the latest commit:

  1. Python 3.10/3.11 Compatibility: Replaced f-string backslash escaping with json.dumps() for safe YAML scalar serialization without syntax errors.
  2. Path Traversal Guard: Added strict regex validation (^\d{4}-\d{2}-\d{2}) for started_at prefixes.
  3. Overwrite Prevention: Appended a sanitized conversation ID suffix (_shortid) to ensure unique filenames.
  4. Timezone Normalization: Normalized aware timestamps to timezone.utc before formatting.
  5. YAML Safety: All frontmatter fields are serialized with json.dumps() to prevent broken YAML on multiline or quoted strings.
  6. Documentation Clarification: Updated timestamp documentation to specify [HH:MM:SS] for transcripts longer than an hour.
  7. README Index Alignment: Restored Turkish (quickstart.tr.md) and Russian (quickstart.ru.md) links and cleanly appended conversations_markdown.md.
  8. Line Endings & Encoding: Stripped UTF-8 BOM and normalized line endings to LF.

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Thank you @cubic-dev-ai[bot] for the thorough automated review! All 8 points have been addressed in the latest commit:

  1. Python 3.10/3.11 Compatibility: Replaced f-string backslash escaping with json.dumps() for safe YAML scalar serialization without syntax errors.
  2. Path Traversal Guard: Added strict regex validation (^\d{4}-\d{2}-\d{2}) for started_at prefixes.
  3. Overwrite Prevention: Appended a sanitized conversation ID suffix (_shortid) to ensure unique filenames.
    ...

@ElvinGts Confirmed against the actual diff — all 8 points check out in the code:

  • json.dumps() now serializes every frontmatter scalar (id, title, category, date, source, category_tag), so no backslash-escaping syntax errors on 3.10/3.11 and no broken YAML on quoted/multiline values.
  • date_prefix is gated by ^\d{4}-\d{2}-\d{2} before the filename build, closing the path traversal angle.
  • The sanitized _shortid suffix on YYYY-MM-DD_slug_shortid.md prevents silent overwrites for duplicate title/date pairs.
  • Aware timestamps normalize to timezone.utc before strftime, and unaware inputs get UTC attached.
  • README index cleanly restores the quickstart.tr.md / quickstart.ru.md lines and appends the new doc.
  • BOM is stripped on both paths (lstrip("\ufeff") for stdin, encoding="utf-8-sig" for files).

One cosmetic note only: the markdown body is joined with "\n", so text values that carry embedded CRLF from the source would still contain those bytes, giving mixed line endings on Windows. Obsidian and Notion handle both fine, so it's not a blocker.

Recipe is clean and genuinely zero-dependency. Ship it.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs-only, verified: omi --json conversation list/get --include-transcript flag exists in omi_cli/commands/conversation.py, pure-stdlib script, no secrets. Merging.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @ElvinGts — nice first contribution, and credit for working through the earlier review feedback point by point.

Independent verification on this head:

  • conversations_to_markdown.py — exercised the converter on adversarial fixtures: YAML frontmatter scalars go through json.dumps (a crafted title like Evil "Title": pwned cannot break out of frontmatter), filenames are traversal-safe (strict ^(\d{4}-\d{2}-\d{2}) date prefix, slugify(), [\w-]-only short id — a malicious id of ../../etc/passwd lands as a flat safe filename), duplicate title/date pairs get unique short-id suffixes instead of silently overwriting, and UTF-8 BOM input works via both stdin and file. Timestamps render correctly as MM:SS / HH:MM:SS with UTC normalization.
  • conversations_markdown.md — every documented command checks out against omi_cli on main: --json, conversation list/get --include-transcript, and --limit 100 (within the CLI's 1–200 bound) all exist as documented.
  • examples/README.md — index entry matches the new file name.

Docs-only, pure standard library, no production code touched — good to go from my side.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution docs-tooling Layer: Documentation, examples, dev tools labels Sep 13, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Delta check since @kodjima33's approval (bd960fb): the branch picked up exactly two changes on its way to the current head.

  • b3c32e0 touches only sdks/python-cli/examples/README.md: it restores the conversations_markdown.md index entry that the merge had displaced and adds the upstream Thai/Danish/Bulgarian/Mongolian quickstart links. Single entry, no duplication, all links point at files present on the head.
  • 9ac6c16 is a merge of main into the branch — no PR-owned changes in it.

The two substantive files are unchanged from the approved commit (conversations_to_markdown.py @ 2ca6caf, conversations_markdown.md @ 6469e42), and the documented flags still hold against omi_cli/commands/conversation.py on the merged head: --include-transcript exists on both conversation list and conversation get, and --limit is bounded 1–200, so the doc's 50/100 examples are valid.

Net: the existing approval covers the current content; from the docs side this is ready to merge whenever a maintainer is. The US$20 bounty request from #13700 is a maintainer-side payout call, unchanged by anything in the diff.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@ElvinGts

Copy link
Copy Markdown
Contributor Author

Thank you @Git-on-my-level and @kodjima33 for the comprehensive review, delta verification, and approval! Looking forward to the merge.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standalone stdlib Python script + recipe doc verified correct: --include-transcript flag confirmed real on conversation list/get, safe path handling, no injection risk — approving; mergeStateStatus UNKNOWN (GitHub still computing) blocks merge per policy.

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

Labels

docs-tooling Layer: Documentation, examples, dev tools positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants