Skip to content

feat: modified_after cutoff for read_conversations and read_events - #4

Open
asubbarao wants to merge 1 commit into
mainfrom
feat/modified-after
Open

asubbarao wants to merge 1 commit into
mainfrom
feat/modified-after

Conversation

@asubbarao

Copy link
Copy Markdown
Owner

Problem

read_conversations() reads every transcript file on every call. On a working machine that is gigabytes of JSONL (here: ~800 Claude files and ~800 Codex rollouts, about 3 GB), so an incremental load that only wants the last few minutes still opens everything and filters afterwards. A WHERE timestamp > … cannot help: the files are read before the filter runs.

Change

An optional named parameter on read_conversations:

FROM read_conversations(source='claude', modified_after := TIMESTAMP '2026-10-08 18:00')

During discovery, any transcript file whose filesystem modified time is at or before modified_after is skipped. This covers Claude and Claude Desktop transcripts, nested subagents/agent-*.jsonl, and Codex rollout-*.jsonl. Absent or NULL means no cutoff, and the columns are unchanged.

A changed file is still read whole, since transcripts are appended to, so callers dedupe on uuid. The cutoff is held for the duration of one call's load and restored afterwards, so other calls are unaffected.

Tests

  • test/sql/modified_after.test: a cutoff before every fixture returns the same rows as no parameter (Claude with subagents, Codex). A cutoff after every fixture returns zero rows (Claude, Codex). NULL equals absent, a string literal is accepted, and the schema is unchanged.
  • A unit test in src/utils.rs sets real file times on Claude, subagent and Codex files and checks that a 2010 cutoff keeps only the 2020 files, and that discovery sees every file again after the call.
  • make release && make test_release on DuckDB 1.5.5: 22/22 SQL test files pass, and cargo test --lib gives 7/7.

🤖 Generated with Claude Code

Discovery skips transcript files last modified at or before
modified_after := TIMESTAMP, so an incremental load reads only changed
files (Claude, Claude Desktop, nested subagents, Codex rollouts).
NULL or absent means no cutoff; columns are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

2 participants