Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - byteowlz/hstry: a unified history for all your agents · GitHub
Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - byteowlz/hstry: a unified history for all your agents · GitHub
Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - byteowlz/hstry: a unified history for all your agents · GitHub
Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - byteowlz/hstry: a unified history for all your agents · GitHub
Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - byteowlz/hstry: a unified history for all your agents · GitHub
Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - byteowlz/hstry: a unified history for all your agents · GitHub
Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - byteowlz/hstry: a unified history for all your agents · GitHub
Skip to content

Repository files navigation

hstry

Universal AI chat history database. Aggregates conversations from multiple AI tools (ChatGPT, Claude, Gemini, Cursor, Claude Code, etc.) into a single searchable SQLite database.

Features

  • Import chat history from multiple sources via pluggable TypeScript adapters
  • One-off imports from files or directories with auto-detection
  • Full-text search with separate indexes for natural language and code
  • Filter by source, workspace, role, and local/remote scope
  • Remote sync and search over SSH
  • Background service for automatic syncing
  • Optional terminal UI (hstry-tui) for interactive browsing
  • Incremental adapter parsing with cursor-based batching
  • Export conversations to adapter formats (markdown/json, pi, opencode, codex, claude-code, etc.)
  • Resume past sessions in any coding agent with cross-format conversion
  • Deduplicate conversations and export memories to mmry
  • JSON output for scripting and MCP integration

Installation

Homebrew (macOS and Linux)

brew tap byteowlz/tap
brew install hstry

Arch Linux (AUR)

# Using yay (recommended)
yay -S hstry
# Using paru
paru -S hstry
# Using makepkg (manual)
git clone https://aur.archlinux.org/hstry.git
cd hstry
makepkg -si

Cargo

cargo install --path crates/hstry-cli

Pre-built Binaries

Download pre-built binaries from the GitHub Releases page.

Available platforms:

  • Linux x86_64 and ARM64
  • macOS Intel and Apple Silicon

Build from Source

git clone https://github.com/byteowlz/hstry.git
cd hstry
cargo build --release --workspace

To install all binaries (CLI, TUI, MCP):

cargo install --path .

Quick Start

# Quickstart: scan, add sources, and sync
hstry quickstart
# Install Playwright browsers (web automation)
hstry web install
# Login to a web provider (headful for first login)
hstry web login chatgpt
# Sync web providers (uses saved sessions)
hstry web sync --provider chatgpt
# Note: web sync currently supports ChatGPT (including multiple workspaces).# Claude and Gemini sync support is planned.# Scan for supported chat history sources
hstry scan
# Add a source (auto-detects adapter)
hstry source add ~/.codex/sessions
# Sync all sources
hstry sync
# Control sync concurrency
hstry sync --parallel 2
# Import a one-off export directory
hstry import ~/Downloads/chatgpt-export
# Search your history
hstry search "how to parse JSON"# List recent conversations
hstry list --limit 10
# View a specific conversation
hstry show <conversation-id># Export a conversation to markdown
hstry export --format markdown --conversations <conversation-id> --output ./conversation.md
# Resume a past session in your preferred coding agent
hstry resume --search "JSON parser" --agent pi
# Resume with time filter
hstry resume --after "yesterday" --workspace myproject
# Browse recent and pick interactively
hstry resume --limit 10

Commands

CommandDescription
quickstartScan known paths, add sources, and sync everything
web installInstall Playwright browsers for web automation
web loginLogin to a web provider and store session state
web syncSync web providers and import chats
web statusShow web login and sync status
scanDetect chat history sources on the system
syncImport conversations from all configured sources in parallel (resets cursor if source is empty)
import <path>One-off import with auto-detected adapter
search <query>Full-text search across all messages
indexBuild or refresh the search index
listList conversations with optional filters (workspace uses substring match)
show <id>Display a conversation with all messages
exportExport conversations to markdown/json or adapter format
resumeResume a past session in a coding agent (pi, claude-code, codex, etc.)
dedupDeduplicate conversations in the database
source add/list/removeManage import sources
adapters list/add/enable/disableManage adapters
adapters repo ...Manage adapter repositories (git/archive/local)
remote add/list/remove/test/fetch/sync/statusManage remote hosts and sync

Adapter installs are version-pinned to the hstry binary. Run hstry adapters update whenever you upgrade, and the CLI will refuse to sync if adapter manifests do not match the current hstry version. | service enable/disable/start/run/restart/stop/status | Control background sync service | | config show/path/edit | Manage configuration | | stats | Show database statistics | | mmry extract | Export memories to mmry |

Search Modes

The search command auto-detects query type:

  • Natural language: Uses porter stemming for English text
  • Code: Preserves underscores, dots, and path separators

Force a mode with --mode natural or --mode code.

Scope and filters:

  • --scope local|remote|all (default: local)
  • --remote <name> to target specific remotes
  • --source, --workspace, --role filters
  • --no-tools to exclude tool calls
  • --dedup to collapse similar results
  • --include-system to include system context (AGENTS.md, etc.)

Session Resume

The resume command opens a past session in your preferred coding agent. It handles cross-agent format conversion automatically -- a Codex session can be resumed in pi, a Claude Code session in Codex, etc.

# Direct resume by conversation ID
hstry resume <conversation-id># Search for a session
hstry resume --search "async runtime refactor"# Browse recent sessions and pick interactively
hstry resume --limit 10
# Filter by time
hstry resume --after "yesterday"
hstry resume --after "2 days ago" --before "today"
hstry resume --after "2026-02-01" --before "2026-03-01"# Filter by source or workspace
hstry resume --source codex-main --workspace myproject
# Target a specific agent (overrides default_agent from config)
hstry resume --search "refactor" --agent claude-code
# Dry run (show what would happen without writing or launching)
hstry resume --dry-run --search "query"# JSON output for automation
hstry resume --json --search "query"

How it works:

  1. If the session already belongs to the target agent and the original file exists on disk, it launches directly (zero conversion overhead).
  2. Otherwise, it exports the session via the target adapter, places the converted file in the agent's native session directory, and launches the agent.

Time filter formats: ISO dates (2026-03-01), relative dates (yesterday, today, last week, last month), duration expressions (2 days ago, 3 weeks ago, 1 month ago).

Configure the default agent and per-agent launch commands in config.toml:

[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"
[resume.agents.claude-code]
format = "claude-code"command = "claude --resume {session_id}"session_dir = "~/.claude/projects"

Command templates support these placeholders: {session_path}, {session_id}, {workspace}.

Configuration

hstry follows XDG Base Directory specifications:

DirectoryDefaultEnvironment Override
Config~/.config/hstry/$XDG_CONFIG_HOME/hstry/
Data~/.local/share/hstry/$XDG_DATA_HOME/hstry/
State~/.local/state/hstry/$XDG_STATE_HOME/hstry/

Default config: ~/.config/hstry/config.toml

"$schema" = "https://raw.githubusercontent.com/byteowlz/schemas/refs/heads/main/hstry/hstry.config.schema.json"database = "~/.local/share/hstry/hstry.db"adapter_paths = ["~/.config/hstry/adapters"]
js_runtime = "auto"# bun, deno, or node
[[adapters]]
name = "codex"enabled = true
[service]
enabled = falsepoll_interval_secs = 30search_api = true
[search]
index_batch_size = 500
[resume]
default_agent = "pi"
[resume.agents.pi]
format = "pi"command = "pi --session {session_path}"session_dir = "~/.pi/agent/sessions"

See examples/config.toml for all options. Use hstry config show/path/edit for config management.

Service + API

hstry service runs a local daemon that keeps the search index warm and exposes a local-only gRPC search endpoint. The CLI prefers the service when it is running. Use hstry service enable/disable/start/run/restart/stop/status to manage it.

The optional hstry-api binary serves a local HTTP API (default http://127.0.0.1:3000) for external integrations (e.g., Octo).

Override service usage with HSTRY_NO_SERVICE=1. Override the API URL with HSTRY_API_URL or disable API usage with HSTRY_NO_API=1.

Remote Sync

hstry can sync and search remote databases over SSH. Remotes require hstry to be installed on the host.

# Add a remote host
hstry remote add laptop user@laptop
# Verify connectivity
hstry remote test laptop
# Fetch the remote database into the local cache
hstry remote fetch --remote laptop
# Search only remote results
hstry search "auth error" --scope remote --remote laptop
# Sync (merge) remote history into the local database
hstry remote sync --remote laptop --direction pull

See Remote sync for device namespaces, hub safety checks, and concurrency guidance.

Terminal UI

Use the optional hstry-tui binary for an interactive, three-pane browser.

cargo install --path crates/hstry-tui
hstry-tui

Supported Sources

Local Agents & Apps (automatic local storage)

AdapterDefault PathDescription
claude-code~/.claude/projectsClaude Code CLI
codex~/.codex/sessionsOpenAI Codex CLI
cursorCursor workspaceStorage (platform-specific)Cursor (state.vscdb)
opencode~/.local/share/opencodeOpenCode
pi~/.pi/agent/sessionsPi coding agent
gemini-cli~/.gemini/tmpGemini CLI sessions
workbuddy~/.workbuddy/projectsWorkBuddy project sessions
aiderProject directoriesAider (finds .aider.chat.history.md)
goose~/.local/share/goose/sessionsGoose (SQLite/JSONL)
jan~/jan/threadsJan.ai
lmstudio~/.cache/lm-studio/conversationsLM Studio
openwebui~/.open-webui/data (or /app/backend/data)Open WebUI

Web Exports (manual download)

AdapterSourceExport Location
chatgptChatGPTSettings > Data controls > Export
claude-webClaude.aiSettings > Export data
geminiGeminigoogle.com/takeout > Gemini Apps

Point these adapters at the extracted export directory (e.g., ~/Downloads/chatgpt-export).

Adapters

Adapters are TypeScript modules that parse chat history from specific tools. Each adapter implements:

  • detect(path) - Check if a path contains valid data
  • parse(path, options) - Extract conversations and messages

Add custom adapters by placing them in adapter_paths, or manage repositories with:

hstry adapters repo add-git community https://example.com/adapters.git
hstry adapters update

Workspace Structure

crates/
hstry-core/ # Database, config, models
hstry-runtime/ # TypeScript adapter execution
hstry-cli/ # Command-line interface
hstry-tui/ # Terminal UI (ratatui)
hstry-mcp/ # MCP server
hstry-api/ # HTTP API (axum)

Development

just check-all # Format, lint, and test
just test# Run tests only
just clippy # Lint only
just update-adapters # Copy latest adapters to ~/.config/hstry/adapters

Contributing

Contributions are welcome! Please see docs/RELEASE.md for information about the release process.

Release Notes

See CHANGELOG.md for the full list of changes.

Release Process

The release process is fully automated via GitHub Actions:

  1. GitHub Releases: Automatic builds for Linux (x86_64/ARM64) and macOS (Intel/Apple Silicon)
  2. Homebrew: Automatic formula updates in byteowlz/homebrew-tap
  3. AUR: Automatic PKGBUILD updates

See docs/RELEASE.md for detailed release instructions.

Attribution

This project is inspired by and references ideas from cross-agent-session-search (cass) by Jeffrey Emanuel. Source: https://github.com/Dicklesworthstone/coding_agent_session_search (MIT License).

License

MIT

About

a unified history for all your agents

Resources

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages