By emasoft
Exports current session segment (since last compaction) with system-reminder stripping -- main conversation, subagent transcripts, sidechains, and debug logs in structured markdown
npx claudepluginhub emasoft/emasoft-plugins --plugin emasoft-chat-historyAutomatically exports the full chat transcript before every compaction event, preserving conversation history that would otherwise be summarized and lost.
The export captures four layers of conversation data:
~/.claude/debug/<session_id>.txt (if debug mode was active), interleaved into the main conversation by timestamp.A PreCompact hook fires before every compaction (manual via /compact or automatic when the context window fills). The hook runs a Python script that:
<session_id>/subagents/<details> sectionsThe export is saved to .claude/chat_history/export-YYYYMMDD-HHMMSS.md in the current working directory.
The hook is defined in hooks/hooks.json:
{
"hooks": {
"PreCompact": [
{
"matcher": "auto|manual",
"hooks": [
{
"type": "command",
"command": "python3 ${CLAUDE_PLUGIN_ROOT}/scripts/pre_compact_export.py"
}
]
}
]
}
}
The script receives hook input via stdin (JSON with session_id, transcript_path, etc.) and writes the export file.
Files are saved as:
.claude/chat_history/export-20260212-193045.md
.claude/chat_history/export-20260213-104512.md
Each export contains:
## USER / ## ASSISTANT headings and timestamps<details> sections (subagent Tasks are expanded by default)Install from the Emasoft marketplace. Use --scope user to install for all Claude Code instances, or --scope global for all projects.
# Add Emasoft marketplace (first time only)
claude plugin marketplace add emasoft-plugins --url https://github.com/Emasoft/emasoft-plugins
# Install plugin (--scope user = all Claude Code instances, recommended for utility plugins)
claude plugin install emasoft-chat-history@emasoft-plugins --scope user
# RESTART Claude Code after installing (required!)
Utility plugins are installed once with --scope user and become available to all Claude Code instances.
This is a utility plugin — it provides pre-compaction chat export hooks. No --agent flag needed; just start Claude Code normally and chat history will be automatically exported before context compaction.
--plugin-dir loads a plugin directly from a local directory without marketplace installation. Use only during plugin development.
claude --plugin-dir ./OUTPUT_SKILLS/emasoft-chat-history
match-free syntax, compatible with 3.10+)emasoft-chat-history/
.claude-plugin/
plugin.json # Plugin manifest
hooks/
hooks.json # PreCompact hook configuration
scripts/
pre_compact_export.py # Main export script (674 lines)
LICENSE
README.md
Automatic conversation saving plugin built on the conversation-logger skill. Adds Stop hook for real-time saving and slash commands for searching conversation history.
Session log archiver: saves conversations as Markdown or JSON for easy review
Lossless context management — DAG-based summarization that preserves every message
Memory compression system for Claude Code - persist context across sessions
Ultra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Share bugs, ideas, or general feedback.
Intelligent prompt optimization using skill-based architecture. Enriches vague prompts with research-based clarifying questions before Claude Code executes them
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claim