Skip to content

Read Continue and Copilot CLI sessions from their real storage formats - #3

Merged
kv4u merged 1 commit into
mainfrom
fix/continue-copilot-formats
Oct 13, 2026
Merged

kv4u merged 1 commit into
mainfrom
fix/continue-copilot-formats

Conversation

@kv4u

@kv4u kv4u commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Summary

The Continue and Copilot CLI parsers were written against guessed formats and could never find sessions on a real install.

Tool Before Actual format (now supported)
Continue ~/.continue/sessions.db (SQLite), which Continue never creates ~/.continue/sessions/<id>.json with history[].message.{role, content}, plus a sessions.json index. Honours CONTINUE_GLOBAL_DIR.
Copilot CLI ~/.copilot/sessions/*.json ~/.copilot/session-state/<uuid>/events.jsonl (session.start, user.message / assistant.message with data.content) plus workspace.yaml
  • Continue: keeps user and assistant turns; skips system, thinking and tool messages. Untitled sessions are titled from their first message. The project name is decoded from file:// workspace URIs.
  • Copilot CLI parser: skips model.* side-channel events (utility-model calls) and tool-only assistant messages, tolerates half-written lines, and reads the title, creation date and cwd from workspace.yaml.
  • Copilot CLI writer: now writes the session-state layout. Non-UUID source ids map to a stable UUID, so re-imports overwrite instead of duplicating. The README tells users to run /chronicle reindex if imported sessions don't show up.
  • Cleanup: removed the now-unused SqliteParser.

Format references: Continue's core/util/paths.ts and core/index.d.ts; Copilot CLI's events.jsonl is undocumented upstream (github/copilot-cli#3551), so the parser follows community references and stays tolerant of variations.

Test plan

  • cd movez && php vendor/bin/pest: 97 passed, 1 skipped. New fixtures cover both real formats, a Copilot write/read round-trip, and encrypted import into Copilot CLI.
  • Not checked against real Continue or Copilot CLI installs; neither tool is installed on the dev machine.

🤖 Generated with Claude Code

Both parsers were written against guessed formats and found nothing on a
real install.

- Continue: read ~/.continue/sessions/<id>.json (history[].message with
  string or text-part content) plus the sessions.json index for creation
  dates; honours CONTINUE_GLOBAL_DIR. The old parser queried a
  sessions.db SQLite file Continue never creates.
- Copilot CLI: read ~/.copilot/session-state/<uuid>/events.jsonl
  (session.start, user.message, assistant.message → data.content) and
  workspace.yaml for the title/created date/cwd. model.* side-channel
  events and tool-only assistant messages are skipped.
- Copilot CLI writer now produces that layout (stable UUIDs for non-UUID
  ids so re-imports overwrite) instead of ~/.copilot/sessions/*.json,
  which Copilot never read. README notes `/chronicle reindex`.
- Remove the now-unused SqliteParser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kv4u
kv4u merged commit 91ecd8a into main Oct 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant