Class: Agent::Sessions::Adapters::CursorIde

Inherits:
Base
  • Object
show all
Defined in:
lib/agent/sessions/adapters/cursor_ide.rb

Overview

Cursor's IDE agent (Composer). Repointed 2026-08-24 at the store the 0.2 adapter's own warning named as the real one, now that it has been opened rather than inferred: ~/Library/Application Support/Cursor/User/ globalStorage/state.vscdb, table cursorDiskKV, keys composerData: — 6 real rows on the machine this was written on. The 0.2 declaration (~/.cursor/projects//agent-transcripts/) does not exist there at all, so this adapter reported nothing for an agent that had sessions.

What is verified: the file, the table, the key prefix, and the record's own composerId/createdAt. What is NOT: anything about the conversation itself — all six records on this machine carry "conversation": [], so the shape of a turn has never been seen here. fidelity stays :metadata and no reader exists, which is the honest report: this adapter can say a session happened and when, and must not pretend to say what was said.

Constant Summary collapse

KEY_PREFIX =
"composerData:"

Constants inherited from Base

Base::FIDELITIES

Constants included from Enumeration

Enumeration::MAX_LINE_BYTES

Instance Method Summary collapse

Methods inherited from Base

#base_dir, fidelity_value, homedir_config, #initialize, #locate, reader_class, #retention, #retention_source, store_configs, #verify, #warnings

Methods included from Enumeration

#bytes_for, #encode_project, #project_dir_name, #session_id_from, #started_at_for, #updated_at_for

Constructor Details

This class inherits a constructor from Agent::Sessions::Adapters::Base

Instance Method Details

#project_path_for(_path) ⇒ Object

Cursor's composer records do not name a project. context.fileSelections holds paths of files ATTACHED to a turn — on this machine, a settings file from an unrelated directory — and a workspace root inferred from one attachment would be a guess dressed as a fact. nil is the honest answer, and projects reporting nothing for this agent is correct rather than empty-looking.



62
# File 'lib/agent/sessions/adapters/cursor_ide.rb', line 62

def project_path_for(_path) = nil

#project_pathsObject



64
# File 'lib/agent/sessions/adapters/cursor_ide.rb', line 64

def project_paths = []

#sessionsObject

Rows, not files, so Base's glob enumeration is replaced the way opencode's is — including the existence check FIRST, so a machine without Cursor never needs the sqlite3 gem at all.

value is parsed for createdAt alone. It is the whole composer document (context, capabilities, code blocks), which is why bytes stays nil: a row in a shared database has no file size of its own, and the database's size belongs to all 7 rows together.



45
46
47
48
49
50
51
52
53
54
# File 'lib/agent/sessions/adapters/cursor_ide.rb', line 45

def sessions
  db_path = primary_layer.path
  return [].lazy unless File.exist?(db_path)

  Enumerator.new do |yielder|
    each_composer_row(db_path) do |key, value|
      yielder << build_row_session(db_path, key, value)
    end
  end.lazy
end

#sessions_for_project(_dir) ⇒ Object



66
# File 'lib/agent/sessions/adapters/cursor_ide.rb', line 66

def sessions_for_project(_dir) = [].lazy