Skip to content

Add Copilot CLI session logs as a mining source#5

Merged
ohad6k merged 3 commits into
ohad6k:mainfrom
rjmurillo:feat/copilot-source
Jul 9, 2026
Merged

Add Copilot CLI session logs as a mining source#5
ohad6k merged 3 commits into
ohad6k:mainfrom
rjmurillo:feat/copilot-source

Conversation

@rjmurillo

@rjmurillo rjmurillo commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

Adds Copilot CLI session logs as a mining source, alongside Codex and Claude.
Reads ~/.copilot/session-state/*/events.jsonl.

Related #3

How

Copilot events use type: "user.message" with the typed text in
data.content. System-injected steering messages (data.source == "system")
are skipped, so only prose the user actually typed is mined. The raw
data.content is read, not data.transformedContent, which carries datetime
and system-reminder wrappers.

Commits (atomic)

  1. Refactor user_messages to a guard-clause shape. No behavior change for
    Codex or Claude; it only reshapes control flow so a new format is a small diff.
  2. Add the Copilot source: SOURCES root, parser branch, --source copilot,
    auto-scan, docstring, README.
  3. Label session blocks by parent dir plus filename. Copilot logs are all named
    events.jsonl, so the bare basename collapsed every block header to the same
    string. This also gives Claude blocks their project slug.

Verification

  • Existing subprocess tests pass unchanged.
  • Ran against real logs: 3395 of 4007 user.message events are system
    injections, all correctly dropped; typed messages are kept.

Notes

Comprehensive in-process unit tests and 100% coverage follow in a stacked PR #6

rjmurillo and others added 3 commits July 8, 2026 18:14
Lift the text-emission loop out of the role-check block and use an early
continue. Behavior is unchanged for Codex and Claude logs; this only reshapes
the control flow so a new log format can be added with a small diff.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Read ~/.copilot/session-state/*/events.jsonl alongside Codex and Claude logs.
Copilot events use type 'user.message' with the typed text in data.content;
system-injected steering messages (data.source == 'system') are skipped so
only prose you actually typed is mined.

- SOURCES gains a 'copilot' root; --source accepts 'copilot'; auto scans it
- user_messages parses the Copilot event shape; Codex/Claude handling is
  unchanged (verified against a real log: 3395 of 4007 events are system
  injections, correctly dropped)
- docstring and README note the new source

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot logs are all named events.jsonl under a per-session directory, so
os.path.basename collapsed every block header to '===== events.jsonl ====='
and sessions became indistinguishable in the corpus. Prefix the parent
directory: the session id for Copilot, the project slug for Claude, the day
for Codex. Cosmetic change to the session separator only; extraction,
redaction, and chunk boundaries are unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rjmurillo
rjmurillo marked this pull request as ready for review July 8, 2026 23:29
@ohad6k
ohad6k merged commit f2d1dd2 into ohad6k:main Jul 9, 2026
@rjmurillo
rjmurillo deleted the feat/copilot-source branch July 10, 2026 13:40
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.

2 participants