A powerful CLI and TUI (Terminal User Interface) tool for exporting and archiving your conversation history from Claude and ChatGPT. It converts your JSON exports into organized Markdown files, suitable for personal knowledge management (PKM) systems like Obsidian or Logseq.
Includes optional AI Semantic Tagging using a local BERT model to automatically categorize your conversations.
- Multi-Provider Support: Parses
conversations.jsonfrom both Claude and ChatGPT exports. - Flexible Input: Supports directory inputs, direct JSON files, or ZIP archives.
- TUI & CLI:
- Interactive Terminal UI (Ink-based) for easy navigation.
- Conversation Browser: Preview and select specific conversations to export.
- Stats Dashboard: Visualize conversation metrics (count, volume, timeline) with ASCII charts.
- Headless CLI commands for scripting and automation.
- Structured Export:
- Converts conversations to clean Markdown.
- Preserves metadata (date, model, title) in YAML frontmatter.
- Organizes output in chronological folders:
{year}/{month}-{monthName}/.
- AI Tagging (Optional):
- Uses
@huggingface/transformersto run a local classification model. - Automatically generates tags based on conversation content.
- Privacy-first: The model runs entirely locally; no data leaves your machine.
- Uses
- Persistent Configuration: Saves your preferences (output path, tagging settings) to
~/.config/coherence/config.json(XDG compatible).
-
Clone the repository:
git clone https://github.com/your-repo/coherence-chat-exporter.git cd coherence-chat-exporter -
Install dependencies:
npm install
-
Build the project:
npm run build
-
(Optional) Build a standalone executable with Bun:
npm run build:binary
-
(Optional) Link globally:
npm link
npm run build:binary requires Bun to be installed.
Simply run the tool without arguments to launch the interactive interface:
npm start
# OR if linked
coherenceUse the arrow keys to navigate the menu:
- Select Export Source: Choose between Claude or ChatGPT.
- Browse & Export: Load data and browse/filter conversations before exporting.
- Configure Tagging: Enable/Disable AI tagging.
- Settings: View/Save configuration.
When selecting a source, you can browse your file system:
Up/Down(orj/k): Navigate list.Enter/Right Arrow: Enter folder or select file.Backspace/Left Arrow: Go up one folder level.Tab: Toggle manual path entry.
The browser allows you to selectively export conversations.
- Select Browse & Export.
- Select your export file/directory using the File Browser.
- Navigate:
Up/Down: Select Projects or Conversations.Left/Right: Change pages.Space: Toggle selection.Enter: Preview conversation.e: Export selected items.s: View Stats Dashboard.c: Change Data Source.
Analyze your export data before processing.
- Select Stats Dashboard from the Main Menu.
- Or press
swhile in the Conversation Browser. - View metrics like:
- Total Conversations/Messages
- Activity over Time
- Top Projects & Tags
Use the export command for automated or single-shot exports.
# Export Claude data from a directory
coherence export --provider claude --input ./claude_export/ --output ./journal
# Export ChatGPT data from a zip file with tagging enabled
coherence export --provider chatgpt --input ./chatgpt_export.zip --tag
# View help
coherence export --helpOptions:
-p, --provider <type>:claudeorchatgpt(Required)-i, --input <path>: Path to directory,.jsonfile, or.ziparchive (Required)-o, --output <path>: Output directory (Defaults to config setting)--tag: Force enable AI tagging--no-tag: Force disable AI tagging
Configuration is stored in ~/.config/coherence/config.json. You can edit this file manually or save settings via the TUI.
{
"outputPath": "./output",
"tagging": {
"enabled": false,
"model": "Xenova/mobilebert-uncased-mnli",
"threshold": 0.5,
"maxTags": 5,
"customCategories": [ ... ]
},
"formatting": {
"dateFormat": "YYYY-MM-DD",
"folderStructure": "{year}/{month}-{monthName}/",
"filenameTemplate": "{day}-{slug}.md"
}
}The tool features a clean, keyboard-navigable terminal interface.
Main Menu
Chat Archive Tool
❯ 📦 Select Export Source
📂 Browse & Export
🏷️ Configure Tagging
⚙️ Settings
🚪 Exit
AI Tagging Configuration
AI Tagging Configuration
Automatically generate semantic tags for your conversations using a local AI model.
Note: First run will download ~25MB model.
❯ Enable AI Tagging: [OFF]
🔙 Back
Conversations are exported to Markdown with YAML frontmatter containing metadata.
Input (samples/claude_mock_conversations.json)
{
"conversations": [
{
"uuid": "550e8400-...",
"name": "Designing the Chat Archive Tool",
"chat_messages": [...]
}
]
}Output (2025/10-october/27-designing-the-chat-archive-tool.md)
---
title: Designing the Chat Archive Tool
date: '2025-10-27'
updated: '2025-10-27'
uuid: 550e8400-e29b-41d4-a716-446655440000
tags: ["programming", "AI", "tooling"]
---
### HUMAN (2025-10-27T10:01:00.000Z)
I want to build a CLI tool to archive my Claude conversations. It should be a TUI using Ink.
---
### ASSISTANT (2025-10-27T10:02:00.000Z)
That sounds like a great project! Using Ink for the TUI...The tool uses the Xenova/mobilebert-uncased-mnli model (via @huggingface/transformers) for zero-shot classification. On the first run with tagging enabled, it will download the quantized model (~25MB) to your local cache.
- Build:
npm run build(Compiles TypeScript todist/) - Build Binary:
npm run build:binary(Compiles a standalone executable todist/coherence) - Test:
npm test(Runs Jest unit tests) - Lint:
npm run lint(if configured) - Format Check:
npm run format:check(Checks workflow and package-file formatting)
GitHub releases now publish:
- Bun standalone binaries for Linux, macOS, and Windows (with
.sha256checksums). - Existing Node-based artefacts (
dist/coherence.bundle.mjs, AppImages, and.tgzpackage tarballs).
MIT