claude-export-history
v1.0.1
Published
Auto export Claude Code conversations to Markdown files on /clear, /export-history, and session end
Maintainers
Readme
Claude Export History
Auto export Claude Code conversations to Markdown files.
Perfect for keeping records of your AI coding sessions, sharing solutions, or reviewing past conversations.
Features
| Feature | Description |
|---------|-------------|
| Three trigger ways | /clear, /export-history, and session end (terminal close) |
| Non-blocking | Async export for commands, sync for session end |
| Customizable output | Environment variable for custom directory |
| Language support | English/Chinese output via environment variable |
| Clean Markdown format | Structured, readable output files |
| Easy install | npm install or Claude Code plugin command |
Quick Start
Install via npm
npm install -g claude-export-historyThe plugin will auto-install hooks into your Claude Code settings.
Install via Claude Code Plugin Marketplace
Add the marketplace once:
claude plugin marketplace add https://github.com/xuanweiH/claude-export-historyThen install the plugin:
claude plugin install claude-export-history@claude-export-history-marketplaceManual Install from a Local Clone
git clone https://github.com/xuanweiH/claude-export-history.git
claude plugin marketplace add ./claude-export-history
claude plugin install claude-export-history@claude-export-history-marketplaceUsage
| Command | Action |
|---------|--------|
| /clear | Clear session + auto export conversation |
| /export-history | Export current session (no clear) |
| Close terminal | Auto export on session end |
Output Example
File: ~/Desktop/ai_history_md/2026-05-20-Fix-authentication-bug.md
English output (EXPORT_HISTORY_LANG="en"):
# Fix authentication bug in login flow
> Exported:2026-05-20 13:32:27
> Project:rn-weiliaoke
---
### User
Help me fix the authentication bug in login page
---
### Claude
Let me analyze and fix this issue...
---
*Export time: 2026-05-20 13:32:27*Chinese output (EXPORT_HISTORY_LANG="zh"):
# Fix authentication bug in login flow
> 导出时间:2026-05-20 13:32:27
> 项目:rn-weiliaoke
---
### 用户
Help me fix the authentication bug in login page
---
### Claude
Let me analyze and fix this issue...
---
*导出时间: 2026-05-20 13:32:27*Configuration
Custom Output Directory
# Set custom directory
export EXPORT_HISTORY_DIR="$HOME/Documents/chat-history"
# Or add to ~/.zshrc or ~/.bashrc
echo 'export EXPORT_HISTORY_DIR="$HOME/Documents/chat-history"' >> ~/.zshrcLanguage Setting (English/Chinese)
# English (default)
export EXPORT_HISTORY_LANG="en"
# Chinese
export EXPORT_HISTORY_LANG="zh"
# Permanent setting
echo 'export EXPORT_HISTORY_LANG="zh"' >> ~/.zshrcDisable Specific Hooks
Edit ~/.claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{
"matcher": "/clear",
"hooks": [],
"description": "Override: disable export on /clear"
}
]
}
}Project Structure
claude-export-history/
├── hooks/
│ └── hooks.json # Hook configuration
├── scripts/
│ ├── hooks/
│ │ ├── export.py # Core export script
│ │ ├── user-prompt-export.sh
│ │ └── auto-export.sh
│ ├── install.js # npm postinstall script
│ └── uninstall.js # npm postuninstall script
├── skills/export-history/
│ └── SKILL.md # Skill definition
├── package.json # npm package info
├── README.md # This file
├── INSTALL.md # Detailed install guide
└── LICENSE # MIT LicenseRequirements
- Node.js >= 16.0.0
- Python 3.x
- Claude Code CLI
Claude Plugin Marketplace
This repository includes:
.claude-plugin/plugin.json- Claude Code plugin manifest.claude-plugin/marketplace.json- marketplace catalog entry using the published npm package
Contributing
Contributions welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT License - see LICENSE file.
Links
Made with love for Claude Code users
