thedevstockgirl
thedevstockgirl4mo ago

Convex Cursor docs

I came across this while searching for how to pass convex docs to cursor. Is there a guide somewhere on how to use with with Cursor docs feature? https://github.com/get-convex/convex-search-indexer/blob/main/convex/docs.ts
GitHub
convex-search-indexer/convex/docs.ts at main · get-convex/convex-se...
Search indexing service for Convex documentation, stack posts, etc – built on Convex! - get-convex/convex-search-indexer
24 Replies
jamwt
jamwt4mo ago
this has been @Tom Redman 's obsession over the last few days -- getting a great integration of cursor context / rules etc that we can talk about and share with everyone. he might have an update on when he's gonna have it ready
thedevstockgirl
thedevstockgirlOP4mo ago
Awesomeness. Will be on the lookout. Thank you
Tom Redman
Tom Redman4mo ago
HEY EVERYBODY! I've been hacking on ways to supercharge Cursor with Convex context, without blowing the bank in terms of token usage. Here's what I've got. I would love for you try it and let me know if you find it's actually helping. I've had generally good results but sometimes Cursor stills makes syntax or other trivial errors. Step 1: .cursorrules - place this in the root of your projects. Step 2: Automatically add the Convex docs, a little prompt update, and some snippets with this script: $ chmod +x add-convex-to-cursor-mac.sh $ ./add-convex-to-cursor-mac.sh (Currently the script is only for Mac. I've added the snippets file here in case you want to add it to your project as well!) Step 3: There is no step 3!
Tom Redman
Tom Redman4mo ago
FYI, I turned ~3k tokens into ~1k by asking Claude to compress the prompt:
Compress the following text in a way such that you (Claude 3.5) can reconstruct it as close as possible to the original. This is for yourself. Do not make it human readable. Aggressively compress it, while still keeping ALL the information to fully reconstruct it. Also use the fewest token possible, your text should be way smaller than the one I give you.
I am going to clear your context and have you reconstruct it WITHOUT the original to refer to. You MUST be able to reconstruct it to 95% of the original. You must keep the code examples to eliminate all syntax errors.

## Text to compress:
[lots of Convex examples]
Compress the following text in a way such that you (Claude 3.5) can reconstruct it as close as possible to the original. This is for yourself. Do not make it human readable. Aggressively compress it, while still keeping ALL the information to fully reconstruct it. Also use the fewest token possible, your text should be way smaller than the one I give you.
I am going to clear your context and have you reconstruct it WITHOUT the original to refer to. You MUST be able to reconstruct it to 95% of the original. You must keep the code examples to eliminate all syntax errors.

## Text to compress:
[lots of Convex examples]
And it outputs this type of thing:
CVX^dev^spec^React,Vite,Shadcn,TW^3xchk^code^run1st^
Style:concise TS,func,decl,iter,mod,desc vars,struct:exp comp,subcomp,help,static,types
Name:dash-dir,named exp
TS:all,iface>type,no enum,func comp
Syntax:func kw,concise,decl JSX
Err:early,log,user-msg,Zod form,ret vals SA,err bound
UI:Shadcn,Radix,TW,resp,mobile1st
Perf:min useClient/Effect/State,RSC,Susp,dyn load,img opt
Key:nuqs URL,Web Vitals,lim useClient
CVX docs:data fetch,file store,HTTP Act
react-router-dom route,TW style,Shadcn if avail
CVX^dev^spec^React,Vite,Shadcn,TW^3xchk^code^run1st^
Style:concise TS,func,decl,iter,mod,desc vars,struct:exp comp,subcomp,help,static,types
Name:dash-dir,named exp
TS:all,iface>type,no enum,func comp
Syntax:func kw,concise,decl JSX
Err:early,log,user-msg,Zod form,ret vals SA,err bound
UI:Shadcn,Radix,TW,resp,mobile1st
Perf:min useClient/Effect/State,RSC,Susp,dyn load,img opt
Key:nuqs URL,Web Vitals,lim useClient
CVX docs:data fetch,file store,HTTP Act
react-router-dom route,TW style,Shadcn if avail
It's pretty cool. cc @thedevstockgirl 🙂
thedevstockgirl
thedevstockgirlOP4mo ago
Ok. Awesome. Will try today right after my meetings. Thanks so much for this @Tom Redman , Will revert back in a couple of hours.
Web Dev Cody
Web Dev Cody4mo ago
@Tom Redman does that .sh script basically do the same as adding the convex docs url manually into cursor? or is it doing a lot more?
Tom Redman
Tom Redman4mo ago
Yup it just added docs.convex.dev to Cursor docs, and a mini addition to the rules "Prefer Convex where appropriate", and finally the snippets That's all it is
Web Dev Cody
Web Dev Cody4mo ago
nice ok ty
thedevstockgirl
thedevstockgirlOP4mo ago
@Web Dev Cody , is this what you are doing?
No description
Matt Luo
Matt Luo4mo ago
1) I thought Claude 3.5 Sonnet was already trained on Convex documentation and repos. So, does this script of adding docs.convex.dev to context improve the accuracy of Claude 3.5 Sonnet further? 2) Or, is this script fundamentally about enabling the other models like chat-gpt?
Web Dev Cody
Web Dev Cody4mo ago
yes, I did that although I'm not sure if cursor is smart enough to web crawl docs? @Tom Redman is that true?
Tom Redman
Tom Redman4mo ago
Yes it can! It crawls and indexes docs you provide. @Matt Luo It has some Convex context from it's base training but some is outdated and I'm not sure it references it "directly" in the same way as vectorizing and referencing the embeddings (which is what Cursor does when you give it docs)
thedevstockgirl
thedevstockgirlOP4mo ago
@Tom Redman I can't tell if I did it correctly. Did not have JQ installed. So had to install and redo. Not sure if it did properly. Probably call out the brew install jq
No description
Tom Redman
Tom Redman4mo ago
@thedevstockgirl that is right! nice call! I will add that either readme or automate it if possible. Did it run after you installed jq?
linhle123
linhle1234mo ago
@Tom Redman not sure if you've seen this: https://github.com/getcursor/crawler?tab=readme-ov-file If I understand correctly we can get convex docs available in cursor by default (no script needed). Just need to submit a 1 line change to this file (https://github.com/getcursor/crawler/blob/main/docs.jsonl) to tell cursor to index all of convex's docs there's only 1 engineer merging the changes and he's in no hurry to do that: https://github.com/getcursor/crawler/pulls. Might be worth pinging him directly to get convex docs into cursor. That would be so useful! In the mean time I'm using Tom's script.
GitHub
GitHub - getcursor/crawler: Easily show documentation to Cursor's c...
Easily show documentation to Cursor's coding AI. Contribute to getcursor/crawler development by creating an account on GitHub.
GitHub
crawler/docs.jsonl at main · getcursor/crawler
Easily show documentation to Cursor's coding AI. Contribute to getcursor/crawler development by creating an account on GitHub.
Tom Redman
Tom Redman4mo ago
I didn’t know about this! Brilliant. Thanks for the suggestion
linhle123
linhle1234mo ago
I just stumbled upon it today. Convex doc in cursor would be such a big win to me. I'll leave that big task to you Tom. Or if you prefer I can try to make it happen too.
RJ
RJ4mo ago
Prompted by this thread, I just went into my Cursor settings today and tried to add them via the UI there, and it seemed to work
No description
linhle123
linhle1234mo ago
I've been adding convex docs into cursor like a caveman, like this. Which link did you use to get cursor to index that many pages btw?
No description
RJ
RJ4mo ago
I just used https://docs.convex.dev/ 🤷‍♂️
Hmza
Hmza4mo ago
cursor actually scrapes all the pages from sitemap if you provide a url. its common practice. i didn't know you were adding each page manually. that seems like a lot of work 😵‍💫
linhle123
linhle1234mo ago
yeah I notice cursor didn't just index 1 page but somehow crawl around a given url. But as you can see for 1 url I gave, it scrape 12 pages. 12 seems random to me and I didn't know how the scraping work. now I know to just use https://docs.convex.dev/
Matt Luo
Matt Luo4mo ago
So to incorporate the latest convex version’s v.record(), do you just re-index in Cursor on docs.convex.dev and it would just work?
Hmza
Hmza4mo ago
Yes