Skip to content

feat: add Copilot Chat session parser for recall#29

Closed
bilersan wants to merge 1 commit intoActiveMemory:mainfrom
bilersan:feat/copilot-chat-parser
Closed

feat: add Copilot Chat session parser for recall#29
bilersan wants to merge 1 commit intoActiveMemory:mainfrom
bilersan:feat/copilot-chat-parser

Conversation

@bilersan
Copy link
Contributor

@bilersan bilersan commented Mar 7, 2026

Summary

Add a JSONL parser that discovers and parses VS Code Copilot Chat session files, enabling ctx recall to surface conversations from GitHub Copilot alongside existing Claude Code sessions.

Closes #28

Merge Order

Merge first — this PR is standalone with no dependencies on other open PRs.
Suggested order: #29#31#36

Changes

New files

  • internal/recall/parser/copilot.go (522 lines) - CopilotParser implementing the Parser interface with Matches(), ParseFile(), and CopilotSessionDirs() for platform-aware directory discovery
  • internal/recall/parser/copilot_raw.go (95 lines) - Typed Go structs for Copilot Chat JSONL format

Modified files

  • internal/config/file.go (+2 lines) - Added ToolCopilot = "copilot" constant
  • internal/recall/parser/parser.go (+1 line) - Registered NewCopilotParser() in registeredParsers
  • internal/recall/parser/query.go (+5 lines) - Added CopilotSessionDirs() to the directory scan loop

How it works

Copilot Chat stores conversations as JSONL files using a snapshot+patch model:

  • Kind 0: Full conversation snapshot
  • Kind 1: Incremental patch (add message)
  • Kind 2: Incremental patch (modify message)

The parser reads the JSONL file, applies patches in order to reconstruct the final conversation state, then builds Session objects with proper metadata (tool, model, timestamp, token counts).

Testing

  • All existing parser tests continue to pass
  • Copilot-specific tests pass (TestCopilot*, TestScanDir*, TestSession*, TestParse*)
  • go build ./... passes
  • Compliance tests pass

Notes

  • This is a purely additive change — no existing behavior is modified
  • The pre-existing TestGetPathRelativeToHome failure on Windows (hardcoded / separator) is NOT introduced by this PR; it exists on upstream/main already

@josealekhine
Copy link
Member

@bilersan can you please resolve conflicts?

Add a JSONL parser that discovers and parses VS Code Copilot Chat
session files, enabling ctx recall to surface conversations from
GitHub Copilot alongside existing Claude Code sessions.

Implementation:
- CopilotParser with Matches/ParseFile conforming to Parser interface
- copilot_raw.go: typed structs for Copilot Chat JSONL format
- CopilotSessionDirs() discovers platform-specific session paths
- Parser registered in registeredParsers and query scan loop
- ToolCopilot constant added to config

The parser handles Copilot's snapshot+patch model (kind 0/1/2),
reconstructs conversation turns, and builds Session objects with
proper metadata (tool, model, timestamp, token counts).

Signed-off-by: ersan bilik <ersanbilik@gmail.com>
@bilersan bilersan force-pushed the feat/copilot-chat-parser branch from f0a15aa to 8aaed8e Compare March 15, 2026 18:54
bilersan added a commit to bilersan/ctx that referenced this pull request Mar 17, 2026
- CopilotParser implementing SessionParser interface with Matches() and ParseFile()
- Platform-aware directory discovery for Code and Code Insiders
- Typed Go structs for Copilot Chat JSONL format (snapshot+patch model)
- Registration in parser.go and query scanning in query.go
- ToolCopilot constant in config/session

Closes ActiveMemory#28
Supersedes ActiveMemory#29
@bilersan
Copy link
Contributor Author

Superseded by #45 which consolidates this work with the governance engine and VS Code extension.

@bilersan bilersan closed this Mar 17, 2026
bilersan added a commit to bilersan/ctx that referenced this pull request Mar 17, 2026
- CopilotParser implementing SessionParser interface with Matches() and ParseFile()
- Platform-aware directory discovery for Code and Code Insiders
- Typed Go structs for Copilot Chat JSONL format (snapshot+patch model)
- Registration in parser.go and query scanning in query.go
- ToolCopilot constant in config/session

Closes ActiveMemory#28
Supersedes ActiveMemory#29

Signed-off-by: ersan bilik <ersanbilik@gmail.com>
bilersan added a commit to bilersan/ctx that referenced this pull request Mar 18, 2026
- CopilotParser implementing SessionParser interface with Matches() and ParseFile()
- Platform-aware directory discovery for Code and Code Insiders
- Typed Go structs for Copilot Chat JSONL format (snapshot+patch model)
- Registration in parser.go and query scanning in query.go
- ToolCopilot constant in config/session

Closes ActiveMemory#28
Supersedes ActiveMemory#29

Signed-off-by: ersan bilik <ersanbilik@gmail.com>
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.

feat: Add Copilot Chat session parser for recall

2 participants