How to: Show current context size

I’ve added this to my Cursor Settings > General > Rules for AI

End every request with "Total context size: ~nk tokens" and list the files you have in view.

4 Likes

I’ve also discovered you can ask it to “Context dump”

For reference this is the transparency Cline gives, it would be great to have something like this, my workaround at least gives some idea of what is going on (Assuming it’s accurate).

2 Likes

It would be really nice if cursor could implement something like this, to give us a general idea of ​​the context used and at the same time allow us to delete certain files from the context if necessary to use the available one more efficiently.

I also tried to expose the current model and remaining fast requests but it was wildly inaccurate :frowning:

Hey, in Cursor, you can click on the three dots at the bottom of the chat to view the size of the used context.

3 Likes

v0.49.3

Is it available for ubuntu? I can’t find it mate.

Unfortunately… I tried to create a rule that did the above and found the disparity in tokens and selected model between both the prompt and even fetching against the authenticated https://www.cursor.com/api/usage?user=user_${user_id} cursor API

As far as I know there is no official publicly exposed API.

see spike: adds rule to display info about context size, account info by usrrname · Pull Request #8 · usrrname/cursorrules · GitHub

Wow it sure gets defensive about how it figures out the context size…
(Was using gemini-flash-2.5-preview)

tl,dr: {context_size} was working because this particular keyword seemed to be a read-only property that’s provided by Cursor.

It kinda-sorta is inconvenient that {javascriptFunctions()} were interpolated inside the quasi-XML/YAML format of the rule too – and this too was codegen-ed.

Example: spike: adds rule to display info about context size, account info by usrrname · Pull Request #8 · usrrname/cursorrules · GitHub

Everything above with a grain of :salt: since it’s questionable halulu.

I think I hit the fourth wall…

Cursor really don’t want users to know that less tokens make Cursor golden fish.
For example, if claude-3.7-sonnet read like 10+ files, then it forget what is the task, and start to summrize the project…

1 Like