fix: Cursor new-schema adapter + progress log append-only#53
Merged
Conversation
…torage watcher Cursor migrated prompts from globalStorage to per-workspace DBs. The old adapter read aiService.generations/prompts from the global DB which was empty after migration, so no sessions were captured. Changes: - Rewrite cursor adapter to read composer.composerHeaders from global DB, then per-workspace aiService.prompts from workspaceStorage/<id>/state.vscdb - Track seen_prompts per workspace to avoid re-reading on each poll - Use new_seen_prompts within a batch so two composers sharing the same workspace don't both re-read it (fixes duplicates) - Include project_dir in CursorCursor JSON so infer_project_dir_from_cursor routes fs-watcher events to the correct .carryover/ directory - Old schema (aiService.generations/composerData in global DB) kept as automatic fallback for pre-migration Cursor installs - Add workspaceStorage/ to Cursor transcript_paths so the fs-watcher fires when prompts are written (they no longer modify globalStorage) - Fix progress log to never reset on session change — always append - Deduplicate progress entries by exact line within each build call - Add new-schema fixtures under globalStorage/ + workspaceStorage/ - Old fixture moved to oldSchema/ for fallback-path tests
Cursor and Codex both shipped storage-format changes. The old adapters
were silently capturing nothing on current versions of either tool. This
release rewrites both, hardens the pipeline, and reshapes the handoff
into an accumulating record that survives daemon restarts.
Adapters
- Cursor: composer.composerHeaders + per-workspace aiService.prompts
(new schema), with old-schema fallback for pre-migration installs.
- Codex: event_msg.payload.{type,message} parsing, session_id captured
from session_meta and re-injected on incremental reads, plus
history.jsonl as a real-time user-prompt source.
- Both now persist project_dir in their cursors so fs-watcher events
route to the correct project directory.
- Skip-on-error parsing — one corrupt JSON line no longer blocks ingest.
- New watched paths: ~/.config/Cursor/User/workspaceStorage and
~/.codex/history.jsonl.
Pipeline / handoff
- Task and Next action accumulate (newest first, full-list dedupe).
- Progress log never resets — appends across all sessions and tools.
- New ## Session activity section: git diff --stat HEAD when available,
filesystem mtimes otherwise. Preserved across ingests when the recent
scan is empty.
- Strict response rules in the preamble — agents read silently, don't
narrate the file structure, two short paragraphs in user's tone.
- Preamble auto-refresh on daemon start so rule updates propagate to
existing handoffs without waiting for a new prompt.
- Next action falls back to the latest user prompt prefixed with
"Continue: " when no assistant text is captured (Cursor case).
Cursor caps `aiService.prompts` at ~10 entries — when a user types a new prompt and the array is full, Cursor drops the oldest. The old index-based watermark (`seen_count == array.length`) then incorrectly read as "caught up" and silently missed every subsequent prompt. Fix: persist `last_prompt_text[workspace_id]` in CursorCursor. On each read, find the rposition of that text in the array and resume from the next index. If the text is no longer present (deeply truncated), fall back to emitting the full array — progress-log + Task accumulation dedupe by content downstream. Also clippy fixes: replace `sort_by` with `sort_by_key`, `iter().any()` with `contains()`, and `>= MAX + 1` with `> MAX`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
globalStorage/state.vscdb(single DB) to per-workspaceworkspaceStorage/<hash>/state.vscdbfiles. Rewrote the adapter to readcomposer.composerHeadersfrom the global DB for workspace routing, then per-workspaceaiService.promptsfor actual messages. Old schema (pre-migration) kept as automatic fallback.build_progress_logto always append — never wipe existing entries on session change. Progress now accumulates indefinitely across all sessions and restarts.workspaceStorage/as a second transcript watch path so the daemon fires on prompt writes (they no longer touch globalStorage).new_seen_promptswithin a batch so the second composer sees the workspace already consumed.Test plan
cargo test— 246 tests pass.carryover/for correct project dir