This repository contains a parser for ChatGPT export bundles with keyword-based conversation selection and related-conversation expansion.
This tool is provided as-is, without warranty. Use it at your own discretion.
- Python 3.10 or newer
- A ChatGPT export bundle as input
- No third-party runtime dependencies
Using a virtual environment is recommended, but not required.
Recommended local layout:
chatgpt-export/
archive/
chatgpt-export-archive/
output/
src/
tests/
Keep the raw export in archive/chatgpt-export-archive/ if you want it inside the repo.
Generated extraction output goes in output/chatgpt_export_extract/. Both archive/
and output/ are ignored by git.
python3 -m pip install -e .
python3 -m unittest discover -s tests -vContributions are welcome. See CONTRIBUTING.md for the local workflow and review expectations.
If the chatgpt-export command is installed but import chatgpt_export fails inside your
virtual environment, recreate the venv and reinstall the package:
rm -rf .venv
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e .This usually fixes a stale editable-install hook.
python3 -m pip install -e .This makes the chatgpt-export command and python3 -m chatgpt_export
available in the repo environment.
chatgpt-export /path/to/chatgpt-exportPreview the selected conversations without writing files:
chatgpt-export preview /path/to/chatgpt-export --keyword criticalityExtract matches to an output directory:
chatgpt-export extract /path/to/chatgpt-export --keyword criticality --expand-relatedRun a safe preview through the extract command:
chatgpt-export extract /path/to/chatgpt-export --keyword criticality --dry-runIf you want a guided first run, use the wizard:
chatgpt-export wizard /path/to/chatgpt-exportSaved presets live in .chatgpt_export_presets.json by default. List them with:
chatgpt-export list-presetsLoad one with:
chatgpt-export extract /path/to/chatgpt-export --preset criticalityPreset files are JSON. The loader accepts either of these shapes:
{
"presets": {
"criticality": {
"keywords": ["criticality"]
}
}
}or a direct mapping without the outer presets key:
{
"criticality": {
"keywords": ["criticality"]
}
}The example file chatgpt_export_presets.example.json shows the full supported preset fields. A preset can include:
keywordsexclude_keywordsregex_patternsmatch_modescopeinclude_project_enabledinclude_shareddate_fromdate_toexpand_relatedrelated_window_daysmin_score
Put your working file next to the archive as .chatgpt_export_presets.json, or pass a custom
path with --presets-file.
List the built-in default keyword set:
chatgpt-export --list-default-keywordsYou can also run it as a module:
python3 -m chatgpt_export extract /path/to/chatgpt-exportThe extractor writes output to output/chatgpt_export_extract/ by default when
the archive lives under the repo-local archive/ folder. Use repeated
--keyword flags for broader searches, or --exclude-keyword, --scope,
--match-mode, and --expand-related to tune the selection. Each extraction
also writes a human-readable summary.md and a machine-readable summary.json,
plus attachments.md and attachments.json for a per-conversation attachment
inventory. Each selected conversation is exported as both JSON and a companion
HTML transcript under conversations/. The HTML view is a clean conversation
transcript with any Deep Research report appended as its own readable section,
and it includes a Print / Save as PDF button so the browser can produce a PDF
snapshot. The JSON keeps the full raw record for debugging.