Repository navigation
feat: show the files Cursor's agents wrote, and an IDE chat's context and changes - #26
Merged
Merged
Conversation
… and changes show now lists, for a Cursor CLI or IDE session, the files its agents wrote, newest first, with the models that wrote them. Cursor records every line an agent writes in ~/.cursor/ai-tracking/ai-code-tracking.db under the conversation id, for the CLI and the IDE alike, so the session id and its subagent ids find them. Ten are listed; --all lists every one. Paths inside the session's folder are written relative to it, and a long path is cut from the front so the file name stays. For an IDE chat, show adds how full the context window is and Cursor's own count of the chat's changes, both from composerHeaders. That count reads zero for some chats that edited files (be14583f wrote 46 files and reads zero), so it is printed only when it is not zero, and the list of files is the fuller record. show --json carries both as cursor_edits and cursor_composer. Both are read when show runs and are not kept in the index. A failed read leaves its part out instead of failing the command. Rejected: showing the tracking row count as lines written. hash is the table's key and Cursor does not say how it forms it, so the count is not a reliable line count. Tested: go test ./...; on the live machine show lists 46 files for be14583f and 21 for 5caeee9b, and a warm show costs about 40 ms more.
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
ccli showgains two Cursor additions, both read offline from files Cursor already keeps:~/.cursor/ai-tracking/ai-code-tracking.db(session id plus subagent ids). Ten by default,--allfor every one. Paths under the session's folder are relative; long paths are cut from the front so the file name stays.contextUsagePercentand Cursor'stotalLinesAdded/totalLinesRemoved/filesChangedCountfromcomposerHeaders. The change count reads zero for some chats that did edit files, so it is shown only when not zero.show --jsoncarries them ascursor_editsandcursor_composer. Nothing new is stored in the index; a failed side read leaves its part out without failingshow.Not included on purpose: the tracking row count as "lines written" (the table's key is an undocumented hash, so the count is unreliable).
Test plan
TestReadListsFilesNewestFirst,TestReadWithoutDatabase(tracking reader: order, model ranking, subagent ids, missing database)TestCursorDetailEditsAndComposer(end to end throughquery.Session, IDE chat with a subagent plus a CLI chat)TestSessionShowsCursorEditsAndComposer(zero changes hidden, relative paths, ten-file limit,--all)go test ./...showabout 40 ms slower.