Skip to content

feat(cli): add Claude Code and Codex session parsing and --discover to ingest-transcript - #2099

Open
suryanshxharma wants to merge 8 commits into
ClickHouse:mainfrom
suryanshxharma:feat/ingest-transcript-discover
Open

suryanshxharma wants to merge 8 commits into
ClickHouse:mainfrom
suryanshxharma:feat/ingest-transcript-discover

Conversation

@suryanshxharma

@suryanshxharma suryanshxharma commented Dec 3, 2026 •

Copy link
Copy Markdown

Part 1 of #2078 (formats and read-only discovery).

  • Added server/cli/_transcripts.py to parse Claude Code (~/.claude/projects/*/*.jsonl) and Codex (~/.codex/sessions/**/*.jsonl) session transcripts without modifying the source files.
  • Added --discover to loom ingest-transcript to list local sessions grouped by project (sources, session count, date range, total size) without writing anything.
  • Extended loom ingest-transcript --file to accept .jsonl session files in addition to .json and .md.
  • Added unit tests for Claude Code parsing, Codex parsing, and --discover, and updated CLI snapshots and docs/reference/cli.md.

Follow-up PR 2 will add project-level batch import (--newest N), client-side secret redaction, retention/recording checks, source_class="imported" with session timestamps, and the SessionStart primer offer.


Note

Medium Risk
Ingests local chat transcripts into conversation storage with client-side redaction; mistakes in parsing or redaction could leak secrets or drop/duplicate turns, but scope is CLI-only with no server auth changes.

Overview
Extends loom ingest-transcript so local Claude Code and Codex session .jsonl files can be ingested alongside existing JSON and markdown transcripts, and adds --discover to list sessions under ~/.claude/projects and ~/.codex/sessions grouped by project (sources, counts, date span, size) without contacting the server.

A new server/cli/_transcripts.py module implements read-only parsing: format auto-detection, Claude active-branch/logicalParentUuid handling, filtering of meta/sidechain/tool-result noise, stripping of injected client XML wrappers on user turns, and redact_secrets on JSONL content before conversation.append. --namespace and --file are optional when --discover is used; CLI docs and help snapshots are updated, with unit tests covering parsers, discovery, branch logic, and redaction.

Reviewed by Cursor Bugbot for commit f752065. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 6, 2026 7:38am UTC
loom-telemetry Ready Ready Preview Dec 6, 2026 7:38am UTC

Request Review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread server/cli/_transcripts.py Resolved
Comment thread server/cli/shell.py Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread server/cli/_transcripts.py Resolved
@zlareb1 zlareb1 self-assigned this Dec 3, 2026

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSONL upload needs client-side redaction. The three commits on this head also need the required DCO sign-offs.

Comment thread server/cli/shell.py Resolved
Comment thread server/cli/_transcripts.py Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transcript command breaks the unit test for agent token refusal. The failure reproduces on the exact CI merge. Failed job

Comment thread server/cli/shell.py Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prepared-bot integration failure reproduces on clean main. General health can report ready while the web process still reads recording mode, so the bot identity endpoint refuses provisioning. The same test passes when the fixture waits for that process’s enforced heartbeat. Failed job · Repair #2106

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The streaming retirement test hits the same entry timeout on clean main when an event-loop turn pauses. The repair puts that test on the existing private clock. Failed job · Repair #2112

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread server/cli/_transcripts.py Resolved
…o ingest-transcript

Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
…SONL error

Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
…k token before args

Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
@suryanshxharma
suryanshxharma force-pushed the feat/ingest-transcript-discover branch from a620e69 to db04f2d Compare December 4, 2026 16:15

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new head redacts JSONL uploads, streams discovery by file, and checks the agent token before reading the file arguments. The Unicode redaction finding still applies on this head. Reuse the Python SDK redactor’s word-boundary behavior and cover it in the outgoing-request test.

Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread server/cli/_transcripts.py Resolved
Comment thread server/cli/_transcripts.py Resolved
s = _JWT_RE.sub("[redacted]", s)
s = _BEARER_RE.sub(r"\1 [redacted]", s)
s = _BASIC_AUTH_RE.sub(r"\1 [redacted]", s)
return _URL_CREDENTIALS_RE.sub(r"\1[redacted]@", s)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL redaction eats ordinary paths

Medium Severity

_URL_CREDENTIALS_RE is documented as matching the client redactor, but its userinfo class is [^\s/@\"'] and therefore allows /. A normal URL whose path contains : and a later @ is treated as credentials and rewritten to scheme://[redacted]@... before the turn is stored.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7084797. Configure here.

Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 0e67ef9. Configure here.

Comment thread server/cli/_transcripts.py Resolved
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ASCII word boundary fixes the previous Unicode-adjacency case. The same flag also disables Unicode whitespace matching and lets formatted credentials reach the outgoing import.

Comment thread server/cli/_transcripts.py Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python SDK adapter job fails during test collection with agent-framework-core 1.26.0 and opentelemetry-api 1.46.0. Clean main fails with the same versions and traceback. A separate PR constrains the incompatible dependency. PR job · Main job · Fix #2164

…ace redaction

Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Unicode whitespace regression is fixed. Quoted passwords with escaped quotes can still reach the uploaded transcript.

)
_SECRET_ASSIGNMENT_RE = re.compile(
r"""(?a:\b)((?a:[\w.-]){0,64}?(?:password|passwd|secret|secret[_-]?key|token|api[_-]?key"""
r"""|access[_-]?key|private[_-]?key)(?a:\b)["']?\s*[=:]\s*)("[^"]*"|'[^']*'|[^\s"'\\,;}]+)""",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — The quoted value matcher ends at an escaped quote. With a synthetic quoted password containing an escaped quote and a suffix, the suffix remains in the JSONL turn sent to conversation.append. Consume escaped characters inside quoted values and add an outgoing-request test that checks the whole value is removed.

This branch has not been deployed

No deployments
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