Skip to main content

Import Past Conversations

Import your old CLI conversations into Audaxic Memory — so your coding agents remember everything you've ever discussed, not just what happens after you install a plugin.

← Back to MCP Setup


Why Import?​

Your coding agents accumulate months of valuable context in local conversation history. When you switch agents or start fresh, that context is lost. The import tool reads history from Codex CLI, Claude Code CLI, and OpenCode CLI and sends it to Audaxic Memory with the correct timestamps — making it searchable and available to any agent.


Installation​

npm install -g @audaxic/memory-import

Setup​

The tool uses your Audaxic API key in this order:

  1. AUDAXIC_API_KEY environment variable
  2. ~/.config/audaxic/config.json ({"apiKey": "ak_..."} — the shared config used by all Audaxic integrations)

Get your API key from: memory-dashboard.audaxic.com


Usage​

# Import from all supported CLIs
audaxic-memory-import

# Import from a specific CLI
audaxic-memory-import --tool codex
audaxic-memory-import --tool claude
audaxic-memory-import --tool opencode

# Multiple CLIs
audaxic-memory-import --tool claude --tool opencode

# Preview without sending anything (recommended first)
audaxic-memory-import --dry-run

# Date range (local timezone)
audaxic-memory-import --from 2026-01-01 --to 2026-07-31

# Cap the number of messages
audaxic-memory-import --limit 500

# Override the API key
audaxic-memory-import --api-key ak_...

# Clear import state (re-import everything)
audaxic-memory-import --reset-state

Run via npx without global install:

npx @audaxic/memory-import --dry-run

What Gets Imported​

CLISourceMessages
Codex~/.codex/sessions/**/rollout-*.jsonluser + assistant (response_item messages)
Claude Code~/.claude/projects/**/*.jsonl and ~/.claude/transcripts/*.jsonluser + assistant (native format), user (transcript format)
OpenCode~/.local/share/opencode/opencode.db (SQLite)user + assistant (text parts only)

Tool calls, reasoning blocks, and system prompts are skipped. Only actual conversation text is imported.


How It Works​

  1. Extract — reads each CLI's conversation history and extracts (role, text, timestamp) messages
  2. Group by day — messages are grouped by local-timezone YYYY-MM-DD (the /add API accepts one timestamp per batch)
  3. Batch — each day's messages are sent in chunks of ≤30 to POST /add with the correct day as the timestamp
  4. Idempotent — processed messages are tracked in ~/.config/audaxic/import-state.json; re-running skips everything already imported
  5. Retry — connection-level failures retry once (HTTP error responses never retry, preventing duplicate memories)

Dry Run​

Always start with a dry run to preview exactly what would be imported:

$ audaxic-memory-import --dry-run

Tool: codex
codex: 6 source(s), 47 messages (31 user, 16 assistant)
Day 2026-07-31: 47 messages → 2 batch(es) of ≤30
DRY RUN — would send 1 day request(s)

Tool: claude
claude: 15 source(s), 45 messages (45 user, 0 assistant)
Day 2026-02-05: 13 messages → 1 batch(es) of ≤30
...

Import State​

The state file ~/.config/audaxic/import-state.json records which messages have been imported (per source file + line). This means:

  • Re-running is safe — already-imported messages are skipped
  • New conversations since the last run are picked up automatically
  • Use --reset-state only if you want to re-import everything (will create duplicates)

Troubleshooting​

"No API key found" — set AUDAXIC_API_KEY or create ~/.config/audaxic/config.json manually.

OpenCode shows no messages — verify the database exists at ~/.local/share/opencode/opencode.db.

Claude Code shows only user messages — transcript files in ~/.claude/transcripts/ only contain user/tool entries; native ~/.claude/projects/**/*.jsonl transcripts contain both roles.


See Also​