| lib | ||
| .editorconfig | ||
| .eslintrc.json | ||
| .gitignore | ||
| .htaccess | ||
| .prettierrc | ||
| .stylelintrc.json | ||
| AGENTS.md | ||
| index.html | ||
| index.js | ||
| make-stat.js | ||
| metrics.md | ||
| README.md | ||
| search.php | ||
| update-category.php | ||
| view-stat.html | ||
ChatGPT History Archiver
Offline archive and viewer for your ChatGPT conversation history.
Quick Start
1. Capture Conversations
- Navigate to chatgpt.com
- Open browser DevTools (F12 or right-click → Inspect)
- Switch to the Network tab
- Browse through your conversations in ChatGPT (click each one to load it)
- Click on Export HAR icon (resembles a download icon)
- Save the HAR file to the
data/directory in this project
Tip: Repeat this process for different conversation categories or time periods.
2. Extract Conversations
Run the extraction script:
node index.js
This will:
- Process all HAR files in
data/ - Extract conversation data (title, timestamps, messages)
- Generate
output/metadata.jsonwith conversation index - Save individual conversations to
output/conversations/{id}.json
3. View Your Archive
Option A: Static Hosting (Basic Features)
Open index.html directly or deploy to any static host (GitHub Pages, Netlify, etc.):
# Open directly in browser
open index.html
# Or serve locally
npx serve .
Available features:
- Tree navigation by category
- Title-based search
- Markdown rendering
- Conversation viewing
- Metadata display
Option B: PHP Server (Full Features)
Serve with PHP to enable advanced features:
# Using PHP built-in server
php -S localhost:8000
# Or deploy to any PHP-enabled host (Apache, nginx + PHP-FPM)
Additional features with PHP:
- Content Search: Full-text search through all message content
- Category Editing: Change conversation categories with automatic backups
Features
Core Features (Always Available)
- Tree Navigation: Conversations organized by category
- Title Search: Filter conversations by title, ID, or category
- Markdown Support: Properly rendered code blocks, lists, and formatting
- Role-Based Styling: Color-coded messages (user/assistant/system)
- Metadata Display: Timestamps, model info, and referenced URLs
- Deep Links: Click conversation IDs to open in ChatGPT
PHP-Only Features
- Content Search: Search through all message text across conversations
- Category Management: Edit conversation categories with dropdown selector
- Change existing categories
- Create new categories
- Automatic timestamped backups before changes
Requirements
- Node.js (for extraction script)
- Modern web browser (for viewer)
- PHP 7.0+ (optional, for advanced features)
File Structure
├── data/ # Place HAR files here
├── output/
│ ├── metadata.json # Conversation index
│ ├── metadata.backup.*.json # Automatic backups (PHP feature)
│ └── conversations/ # Individual conversation files
├── lib/
│ ├── parser.js # HAR parsing logic
│ └── metadata.js # Metadata management
├── index.js # Extraction script
├── index.html # Conversation viewer
├── make-stat.js # Statistics generation (optional)
├── view-stat.html # Statistics dashboard (optional)
├── search.php # Content search endpoint (requires PHP)
└── update-category.php # Category update endpoint (requires PHP)
Bonus: Statistics Dashboard
If you're curious about your ChatGPT usage patterns, there's an optional statistics viewer with visual charts.
Generate Statistics
node make-stat.js
This analyzes all conversations and generates output/stats.json with metrics including:
- Volume & activity (message counts, conversation distribution)
- Length metrics (character/word counts, longest/shortest conversations)
- Temporal patterns (activity over time, hourly/daily trends)
- Linguistic analysis (questions, code blocks, sentences)
- Interaction dynamics (prompt types, turn counts)
- Sentiment indicators (emojis, politeness, hedging language)
- Model usage breakdown
View Statistics
Open view-stat.html in your browser:
# Static (works without server)
open view-stat.html
# Or with server
php -S localhost:8000
# Then navigate to http://localhost:8000/view-stat.html
The dashboard includes interactive charts:
- Message distribution by role (doughnut chart)
- Conversation/message length histograms
- Activity timeline (messages over time)
- Hourly and weekly activity patterns
- Prompt type breakdown
- Sentiment indicators comparison
- Model usage distribution
All charts are powered by Chart.js and match the dark theme of the main viewer.
Notes
- HAR files contain full conversation data including messages and metadata
- The script handles both plain JSON and base64-encoded responses
- Duplicate conversations (across multiple HAR files) are deduplicated by most recent update time
- Only conversation endpoints (
/backend-api/conversation/{id}) are extracted - The viewer automatically detects PHP availability and enables/disables features accordingly
- Category updates create timestamped backups to prevent data loss