Skip to content

feat: add experimental Chat Export lab - #20

Merged
runesleo merged 2 commits into
mainfrom
labs/chat-export
Oct 17, 2026
Merged

runesleo merged 2 commits into
mainfrom
labs/chat-export

Conversation

@runesleo

Copy link
Copy Markdown
Owner

What

Adds labs/chat-export, an experimental lab that exports local Claude Code, Codex, Cursor and Grok Bot (macOS app) chat history to one Markdown file per conversation, so any agent can search past conversations with rg or a full-text index.

  • Python 3 stdlib only, read-only, no network, never touches app state
  • Incremental: a watermark keyed on mtime+size skips unchanged sessions
  • Drops system reminders, injected AGENTS.md / environment context, thinking, tool calls and subagent sidechains
  • Best-effort credential redaction before anything is written; exports are owner-only (umask 077, dirs 0700)
  • Codex: prefers the thread-history SQLite (prompt + final answer per turn) and keeps every assistant reply in rollouts, so conclusions after progress notes are not lost

Main README (zh/en) gets one entry line each; CI runs the new synthetic-fixture tests.

Verification

  • python3 labs/chat-export/tests/run.py → CHAT_EXPORT_TEST_OK (synthetic fixtures only)
  • ./scripts/verify.sh → VERIFY_OK
  • Real-data parity against the exporter it was extracted from: Codex thread exports identical turn content, Cursor counts equal

Chat logs stay retrieval hints; files remain the source of truth.

🤖 Generated with Claude Code

runesleo and others added 2 commits October 17, 2026 12:45
Export local Claude Code, Codex, Cursor and Grok Bot chat history to
one Markdown file per conversation so any agent can search it.
Stdlib-only, read-only, incremental, with best-effort credential
redaction. Synthetic-fixture tests run in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exported chats are private: set umask 077 and tighten export
directories to 0700 so other local users cannot read them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runesleo
runesleo marked this pull request as ready for review October 17, 2026 05:40
@runesleo
runesleo merged commit de075f5 into main Oct 17, 2026
1 check passed
@runesleo
runesleo deleted the labs/chat-export branch October 17, 2026 05:40

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1f3213ecf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +22 to +23
- name: Verify Chat Export fixtures
run: python3 labs/chat-export/tests/run.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Trigger the workflow for Chat Export changes

When a later PR changes only labs/chat-export/**, this fixture step will never run because this workflow's pull_request.paths filter includes labs/opc-company/** and the READMEs, but not the new lab. Add the Chat Export path to the filter so changes to these exporters are actually covered by their CI test.

Useful? React with 👍 / 👎.


# Credentials are redacted before anything touches disk. Most specific patterns first.
REDACTIONS = [
(re.compile(r"0x[a-fA-F0-9]{64}\b"), "<REDACTED_PRIVKEY>"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Redact PEM private keys before writing exports

When a chat contains a conventional PEM private key, it is written verbatim: this rule only covers 64-hex-character blockchain keys, while the generic base64 rule does not match PEM bodies because they are normally wrapped into short lines. This contradicts the documented promise that private keys are replaced before export, so add a multiline PEM-key rule (and a fixture) rather than relying on the contiguous-base64 pattern.

AGENTS.md reference: AGENTS.md:L10-L10

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T05:42:22.305016Z f1f3213 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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