Skip to content

Session-state importer ΓÇö backfill from Copilot CLI session history #3

@vidhartbhatia

Description

@vidhartbhatia

Summary

Build a session-state scanner that reads ~/.copilot/session-state/ to backfill brag entries from past Copilot CLI sessions.

What to build

lib/session-state.mjs ΓÇö session-state importer

Scan ~/.copilot/session-state/{id}/ directories and extract:

  • workspace.yaml ΓåÆ summary, CWD, git root, repo, branch, created_at
  • events.jsonl ΓåÆ lifecycle timestamps (session.start, session.resume, session.shutdown), model, token usage, duration

Create session records from discovered data with deduplication.

New tool: backfill_copilot_sessions

Scan my copilot session history and create brag entries for the significant ones.

Enhanced orphan recovery

  • Use events.jsonl timestamps to identify crashed/orphaned sessions
  • Salvage useful metadata into brag entries
  • Generate summaries from session context

Key data sources

Source Path Fields
workspace.yaml ~/.copilot/session-state/{id}/ cwd, summary, git_root, repository, branch, created_at
events.jsonl ~/.copilot/session-state/{id}/ session.start, session.resume, session.shutdown, data.currentModel, data.totalPremiumRequests

Files to create/modify

  • New: lib/session-state.mjs, test/session-state.test.mjs
  • Modify: extension.mjs (new tool), docs/backfill-guide.md

Estimated effort

  • MVP scanner + tool: 2ΓÇô3 days
  • Tests + docs: 1 day

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew 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