Skip to content

feat: add import support for more AI tool session formats (Cursor, Copilot, Codex, Windsurf, Aider, etc.) #59

@adv3nt3

Description

@adv3nt3

Summary

MemPalace normalizes 6 chat export formats in normalize.py:

PR #155 (in review) adds Gemini CLI JSON. PR #169 (in review) adds Pi agent JSONL. PR #172 (in review) adds Aider markdown. PR #23 adds OpenCode SQLite (in review). There's no support yet for several other widely-used AI coding tools.

Candidate formats

Tool Export format Status
Codex (OpenAI CLI) JSONL sessions (~/.codex/sessions/) ✅ PR #61 merged
Gemini CLI JSON sessions (~/.gemini/tmp/{hash}/chats/session-*.json) 🔄 PR #155 in review
Pi agent JSONL sessions (~/.config/pi/agent/sessions/) 🔄 PR #169 in review
Aider Markdown chat logs (.aider.chat.history.md) 🔄 PR #172 in review (by @mvanhorn)
OpenCode SQLite session DB 🔄 PR #23 in review
Cursor SQLite (~/.cursor/) or workspace state
GitHub Copilot Chat VS Code extension state (JSON/SQLite)
Windsurf (Codeium) Local session files
Continue.dev JSON session logs (~/.continue/sessions/)
Cline (prev. Claude Dev) VS Code extension state

Pi session format (from @tunnckoCore)

  • Path: ~/.config/pi/agent/sessions/{encoded-cwd}/{timestamp}_{uuid}.jsonl
  • Folder naming: CWD path with / replaced by -, wrapped in --, e.g. --home-arcka-openclaude--
  • File naming: {ISO-timestamp}_{uuid}.jsonl
  • JSONL types: session (header), model_change, thinking_level_change, message, toolCall, compaction, branch_summary, label, custom
  • Messages: {"type":"message", "message":{"role":"user"|"assistant"|"toolResult", "content":[{"type":"text","text":"..."}]}}
  • Docs: session.md

Gemini CLI session format

  • Path: ~/.gemini/tmp/{project_hash}/chats/session-{timestamp}-{id}.json
  • Single JSON file (not JSONL) with sessionId, projectHash, messages array
  • User messages: type: "user", content as list of {"text": "..."} blocks (no "type" key)
  • Assistant messages: type: "gemini", content as plain string
  • Project-scoped: sessions stored under a hash of the working directory

Why this matters

Users who switch between AI tools (or use multiple) lose cross-tool context. Mining sessions from all tools into the same palace would let MemPalace serve as a unified memory layer across the entire AI-assisted development workflow.

Implementation notes

  • Each format would be a new _try_* parser in normalize.py, following the existing pattern
  • The normalize() function already auto-detects format — new parsers slot in naturally
  • SQLite-based formats (Cursor, Copilot) would need a light read layer similar to PR feat: add OpenCode SQLite session database support #23's OpenCode approach

Prior art in this repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/miningFile and conversation miningenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions