Skip to content

Universal CLI for managing AI chat sessions across providers

License

Notifications You must be signed in to change notification settings

nervosys/chasm-cli

Chasm

Chat Session Manager (Chasm): Bridging the divide between AI providers
Harvest, harmonize, and recover your AI chat and agent task histories

Crates.io Documentation CI Status License Release

Recover Sessions β€’ Harvest & Export β€’ Run & Record β€’ Cross-Provider β€’ Agency β€’ Merge β€’ Install


Chasm Demo



Chasm bridges the divide between AI providers by extracting and unifying chat sessions from AI coding assistants like GitHub Copilot, Cursor, and more. Never lose your AI conversations again.

✨ Features

  • πŸ”„ Recover - Restore lost or orphaned chat sessions to VS Code
  • πŸ” Harvest - Extract chat sessions from VS Code, Cursor, Windsurf, and other editors
  • πŸš€ Run & Record - Chat with Ollama, Claude, ChatGPT, Claude Code, or OpenCode β€” every message auto-saved
  • πŸ”€ No Lock-in - Universal session format that works across all providers
  • πŸ€– Agentic Coding - Run coding tasks with any LLM backend (like Claude Code, but provider-agnostic)
  • πŸ”— Merge - Combine sessions across workspaces and time periods
  • πŸ“‘ Real-time Recording - Live session recording to prevent data loss from editor crashes
  • πŸ”Œ API Server - REST + WebSocket API for building custom integrations
  • πŸ—ƒοΈ Universal Database - SQLite-based storage that normalizes all providers

πŸ”„ Recover Lost Chat Sessions

The #1 use case β€” recover chat sessions that disappeared from VS Code after an update, crash, or workspace change:

# Recover sessions for a specific project
chasm fetch path /path/to/your/project

# Example output:
# [<] Fetching Chat History for: my-project
# ======================================================================
# Found 3 historical workspace(s)
#
#    [OK] Fetched: Implementing authentication system... (abc12345-...)
#    [OK] Fetched: Debugging API endpoints... (def67890-...)
#
# ======================================================================
# Fetched: 2 sessions
#
# [i] Reload VS Code (Ctrl+R) and check Chat history dropdown

After running, reload VS Code (Ctrl+R or Cmd+R) and your sessions will appear in the Chat history dropdown.

Find orphaned sessions

# Scan for orphaned workspaces with recoverable sessions
chasm detect orphaned /path/to/your/project

# Automatically recover them
chasm detect orphaned --recover /path/to/your/project

# Register recovered sessions so VS Code sees them
chasm register all --force --path /path/to/your/project

Investigate a workspace

# See everything chasm knows about a workspace
chasm detect all /path/to/your/project --verbose

# Output shows:
# - Workspace ID and status
# - Available sessions
# - Detected providers
# - Recommendations

πŸ“Š Harvest & Search All History

Bulk-collect sessions from every provider on your machine into a single searchable database:

# Scan for all available providers and sessions
chasm harvest scan

# Harvest everything into a unified database
chasm harvest run

# Harvest only from specific providers
chasm harvest run --providers copilot

# Full-text search across ALL your AI conversations
chasm harvest search "authentication"
chasm harvest search "react component"

# Check database status
chasm harvest status

Browse and explore

# List all discovered workspaces
chasm list workspaces

# List sessions for a specific project
chasm list sessions --project-path /path/to/your/project

# Search by project name or content
chasm find session "my-project"

# View full session content
chasm show session <session-id>

Export and backup

# Export sessions from a project
chasm export path /backup/dir /path/to/your/project

# Batch export from multiple projects
chasm export batch /backup/dir /project1 /project2 /project3

# Sync between database and provider workspaces
chasm sync --pull     # provider β†’ database
chasm sync --push     # database β†’ provider
chasm sync --pull --push  # bidirectional

πŸš€ Chat with Any AI Provider

Launch any AI provider directly from the terminal β€” every message is automatically recorded to Chasm's database. No data loss, no manual exports, full history retention.

# Chat with a local Ollama model
chasm run ollama
chasm run ollama -m codellama
chasm run ollama -m mistral --endpoint http://remote-server:11434

# Chat with Claude (Anthropic API)
chasm run claude
chasm run claude -m claude-3-haiku

# Chat with ChatGPT (OpenAI API)
chasm run chatgpt
chasm run chatgpt -m gpt-4o-mini

# Launch Claude Code CLI with recording
chasm run claudecode --workspace /path/to/project

# Launch OpenCode CLI with recording
chasm run opencode --workspace /path/to/project

# Interactive TUI browser
chasm run tui

All sessions are automatically persisted to the database. Search them later:

chasm harvest search "the bug we fixed yesterday"
chasm list sessions

πŸ”€ No Vendor Lock-in

Your AI chat history is scattered across VS Code Copilot (SQLite + JSON), Cursor (proprietary format), ChatGPT (web-only), Claude (web-only), and local LLMs (various formats). Each uses different formats, storage locations, and APIs. If you switch providers, you lose context.

Chasm normalizes all sessions into a universal format so you can:

  1. Import from any provider into a unified database
  2. Export to any format (JSON, Markdown, CSV)
  3. Continue sessions with a different provider
  4. Search across all history regardless of source

Cross-provider workflow

# 1. Start a project with GitHub Copilot in VS Code
#    (sessions automatically tracked)

# 2. Later, recover and view your sessions
chasm fetch path /path/to/project
chasm list sessions --project-path /path/to/project

# 3. Export for portability
chasm export path ./backup /path/to/project

# 4. Continue with Claude, GPT-4, or local Ollama
chasm agency run -m claude-3 --context ./backup/session.json \
  "Review the code we wrote and suggest improvements"

# 5. Merge multiple sessions into one unified history
chasm merge path /path/to/project

# 6. Search across ALL your AI conversations
chasm harvest search "authentication implementation"

Universal session format

{
  "id": "uuid",
  "title": "Session title",
  "provider": "copilot|cursor|chatgpt|claude|ollama|...",
  "workspace": "/path/to/project",
  "created_at": "2026-01-08T12:00:00Z",
  "messages": [
    {
      "role": "user|assistant|system",
      "content": "Message text",
      "timestamp": "2026-01-08T12:00:00Z",
      "tool_calls": [],
      "references": []
    }
  ],
  "metadata": {
    "model": "gpt-4o",
    "total_tokens": 15000,
    "files_referenced": ["src/main.rs", "Cargo.toml"]
  }
}
Feature Vendor Lock-in With Chasm
Switch providers Lose all history Keep everything
Search old chats Per-provider only Search all at once
Backup conversations Manual exports Automatic harvesting
Continue sessions Start fresh Full context preserved
Compare providers Impossible Same task, different models

πŸ€– Agentic Coding

Chasm includes a full agentic coding toolkit similar to Claude Code, but provider-agnostic. Run coding tasks with any LLM backend.

# Simple coding task (single agent)
chasm agency run "Add error handling to main.rs"

# Specify a model
chasm agency run -m gpt-4o "Refactor this function to use async/await"

# Use local Ollama model
chasm agency run -m ollama/codellama "Write unit tests for lib.rs"

# Multi-agent swarm for complex tasks
chasm agency run --orchestration swarm "Build a REST API with authentication"

# Parallel agents for speed
chasm agency run --orchestration parallel "Analyze and fix all TODO comments"

Available tools

Tool Description
file_read Read file contents
file_write Write or modify files
terminal Execute shell commands
code_search Search codebase for symbols
web_search Search the web for information
http_request Make HTTP requests
calculator Perform calculations

Orchestration modes

Mode Description
single Traditional single-agent (like Claude Code)
sequential Agents execute one after another
parallel Multiple agents work simultaneously
swarm Coordinated multi-agent collaboration
hierarchical Lead agent delegates to specialists
debate Agents debate to find best solution

Agent roles

  • coordinator - Orchestrates multi-agent workflows
  • coder - Writes and refactors code
  • reviewer - Reviews code for issues
  • tester - Generates and runs tests
  • researcher - Gathers information
  • executor - Runs commands and tasks

πŸ”— Merge & Consolidate Long Histories

Over time, AI conversations scatter across workspaces, branches, and providers. Chasm's merge commands consolidate them into a coherent timeline:

# Merge all sessions for a project into a single session
chasm merge path /path/to/your/project

# Merge sessions from matching workspaces
chasm merge workspace "my-project*"

# Merge specific sessions by ID
chasm merge sessions <id1> <id2> <id3>

# Merge everything across all providers
chasm merge all

This is especially useful for:

  • Long-running projects with dozens of scattered sessions
  • Team handoffs where multiple developers chatted about the same codebase
  • Context consolidation before starting a new coding task with full history

πŸ”Œ API Server & Real-time Recording

Start the REST API server for integration with web/mobile apps:

chasm api serve --host 0.0.0.0 --port 8787

Endpoints

Method Endpoint Description
GET /api/health Health check
GET /api/workspaces List workspaces
GET /api/workspaces/:id Get workspace details
GET /api/sessions List sessions
GET /api/sessions/:id Get session with messages
GET /api/sessions/search?q= Search sessions
GET /api/stats Database statistics
GET /api/providers List supported providers
POST /api/recording/events Send real-time recording events
POST /api/recording/snapshot Store full session snapshot
GET /api/recording/sessions List active recording sessions
GET /api/recording/sessions/:id Get recorded session by ID
GET /api/recording/status Recording service status
WS /api/recording/ws WebSocket for live session recording

Real-time recording

Chasm's recording API prevents data loss from editor crashes by capturing sessions as they happen. Extensions send incremental events and Chasm persists them in real-time.

Recording modes: Live (WebSocket), Batch (REST), Hybrid (WebSocket + REST checkpoints)

Event Description
session_start Begin recording a new session
session_end End a recording session
message_add Add a new message (user, assistant, or system)
message_update Update message content (streaming responses)
message_append Append to message content (incremental chunks)
heartbeat Keep session alive during idle periods

πŸ—ƒοΈ Supported Providers

Editor-based

  • βœ… GitHub Copilot (VS Code)
  • βœ… Cursor
  • βœ… Windsurf
  • βœ… Continue.dev

Local LLMs

  • βœ… Ollama
  • βœ… LM Studio
  • βœ… GPT4All
  • βœ… LocalAI
  • βœ… Jan.ai
  • βœ… llama.cpp / llamafile
  • βœ… vLLM
  • βœ… Text Generation WebUI

Cloud APIs

  • βœ… OpenAI / ChatGPT
  • βœ… Anthropic / Claude
  • βœ… Google / Gemini
  • βœ… Azure AI Foundry
  • βœ… Perplexity
  • βœ… DeepSeek

πŸ“¦ Installation

From crates.io

cargo install chasm-cli

From source

git clone https://github.com/nervosys/chasm-cli.git
cd chasm-cli
cargo install --path .

Pre-built binaries

Download from GitHub Releases:

Platform Download
Windows x64 chasm-v1.0.0-x86_64-pc-windows-msvc.zip
Windows ARM chasm-v1.0.0-aarch64-pc-windows-msvc.zip
macOS x64 chasm-v1.0.0-x86_64-apple-darwin.tar.gz
macOS ARM chasm-v1.0.0-aarch64-apple-darwin.tar.gz
Linux x64 chasm-v1.0.0-x86_64-unknown-linux-gnu.tar.gz
Linux musl chasm-v1.0.0-x86_64-unknown-linux-musl.tar.gz

Database locations

Platform Location
Windows %LOCALAPPDATA%\csm\csm.db
macOS ~/Library/Application Support/csm/csm.db
Linux ~/.local/share/csm/csm.db

πŸ“– Complete CLI Reference

Click to expand full command reference

Session Recovery & Fetching

Command Description
chasm fetch path <project-path> Recover sessions - Fetches and registers sessions for a project
chasm fetch workspace <pattern> Fetch sessions from workspaces matching a pattern
chasm fetch session <id> Fetch a specific session by ID
chasm register all --path <path> Register all on-disk sessions into VS Code's database index

Listing & Discovery

Command Description
chasm list workspaces List all discovered workspaces
chasm list sessions List all sessions
chasm list sessions --project-path <path> List sessions for a specific project
chasm detect all <path> Auto-detect workspace, providers, and sessions
chasm detect workspace <path> Detect workspace info for a path
chasm detect providers List available LLM providers
chasm detect orphaned <path> Find orphaned workspaces with recoverable sessions
chasm detect orphaned --recover <path> Recover orphaned sessions to the active workspace

Viewing & Searching

Command Description
chasm show session <id> Display full session content
chasm find session <pattern> Search sessions by text pattern
chasm find workspace <pattern> Search workspaces by name

Export & Import

Command Description
chasm export path <dest> <project-path> Export sessions from a project
chasm export workspace <dest> <hash> Export sessions from a workspace
chasm export batch <dest> <paths...> Batch export from multiple projects
chasm import path <source> <project-path> Import sessions into a project workspace

Merging

Command Description
chasm merge path <project-path> Merge all sessions for a project into one
chasm merge workspace <pattern> Merge sessions from matching workspaces
chasm merge sessions <id1> <id2> ... Merge specific sessions by ID
chasm merge all Merge all sessions across all providers

Sync & Recovery

Command Description
chasm sync --pull Pull sessions from provider workspaces into database
chasm sync --push Push sessions from database back to provider workspaces
chasm sync --pull --push Bidirectional sync
chasm sync --pull --workspace <pattern> Sync only matching workspaces
chasm recover scan Scan for recoverable sessions from various sources
chasm recover extract <path> Extract sessions from a VS Code workspace by project path
chasm recover orphans List sessions that may be orphaned in workspaceStorage
chasm recover repair Repair corrupted session files in place
chasm recover convert Convert session files between JSON and JSONL formats
chasm recover status Show recovery status and recommendations

Harvesting (Bulk Collection)

Command Description
chasm harvest scan Scan for all available providers and sessions
chasm harvest run Harvest sessions from all providers into database
chasm harvest run --providers copilot Harvest only from specific providers
chasm harvest status Show harvest database status
chasm harvest search <query> Full-text search across all harvested sessions
chasm harvest sync --push Alias for chasm sync --push
chasm harvest sync --pull Alias for chasm sync --pull

Interactive Tools

Command Description
chasm run tui Launch interactive TUI browser
chasm run ollama Chat with Ollama (auto-records session)
chasm run ollama -m codellama Chat with a specific Ollama model
chasm run claudecode Launch Claude Code CLI with recording
chasm run opencode Launch OpenCode CLI with recording
chasm run claude Chat with Claude API (auto-records session)
chasm run claude -m claude-3-haiku Chat with a specific Claude model
chasm run chatgpt Chat with ChatGPT API (auto-records session)
chasm run chatgpt -m gpt-4o-mini Chat with a specific ChatGPT model

Git Integration

Command Description
chasm git init Initialize git versioning for chat sessions
chasm git add Stage and commit chat sessions
chasm git status Show git status of chat sessions
chasm git log Show history of chat session commits
chasm git snapshot Create a tagged snapshot

Provider Management

Command Description
chasm provider list List discovered LLM providers

Server & API

Command Description
chasm api serve Start the REST API server
chasm api serve --port 8787 Start on specific port

Telemetry

Command Description
chasm telemetry Show current telemetry status
chasm telemetry on Enable anonymous usage data collection
chasm telemetry off Disable telemetry (opt-in by default)

πŸ› οΈ Development

Prerequisites

  • Rust 1.85+
  • Git

Building

git clone https://github.com/nervosys/chasm-cli.git
cd chasm-cli
cargo build --release

Running tests

cargo test

πŸ“œ License

This project is dual-licensed:

🀝 Contributing

Contributions are welcome! By contributing, you agree that your contributions may be used under both licenses. Please read our Contributing Guide and Code of Conduct.

πŸ”’ Security

For security issues, please see our Security Policy.

Security Audit Summary (v1.2.9)

Chasm underwent a comprehensive security audit in January 2026 against industry frameworks:

Framework Status Notes
CVE/RustSec βœ… Pass No direct vulnerabilities
MITRE ATT&CK βœ… Mitigated Command execution requires auth
NIST FIPS βœ… Compliant Argon2id password hashing
CMMC 2.0 βœ… Compliant Authentication hardened

Key Security Features:

  • πŸ” Argon2id password hashing (OWASP recommended)
  • πŸ”‘ JWT authentication with required secrets (no dev fallbacks)
  • πŸ›‘οΈ Parameterized SQL queries (no injection vectors)
  • πŸ”’ DPAPI/Keychain integration for credential access

Dependencies: 2 transitive advisories from ratatui TUI framework (paste unmaintained, lru unsound iterator) - compile-time/TUI only, no runtime security risk.

πŸ“ž Support


Built with Rust πŸ¦€ by NERVOSYS

⭐ Star us on GitHub

About

Universal CLI for managing AI chat sessions across providers

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages