If you’ve ever tried to use ChatGPT or Claude with a real project, you probably know the pain.
You don’t just copy a snippet — you need context.
Then more context.
Then suddenly your prompt is too big, and you’re deleting random parts hoping it still makes sense.
I ran into this over and over again.
The problem
Typical workflow looked like this:
- select some code
- copy it
- paste into ChatGPT
- realize something is missing
- go back, copy another file
- repeat
- hit token limit
- start trimming blindly
At some point it stops being useful and turns into friction.
The biggest issue wasn’t the AI — it was preparing the input.
What I actually needed
Not “AI integration” or anything fancy.
Just something that could:
- copy code with file context
- include multiple files at once
- show project structure
- keep everything readable
- and not break when the input gets large
Basically: prepare a proper prompt without thinking about it too much.
So I built a small extension
I made a VS Code extension that does exactly that.
Nothing magical — just removes the annoying parts.
What it does
- Copy selected code with file path and line numbers
- Copy entire folders as a single Markdown block
- Copy project structure (tree view)
- Show token count before sending to AI
- Format output for ChatGPT / Claude
The part that changed everything: token limits
This is where things usually fall apart.
You paste your code and get:
“This message is too long”
So I added a simple idea:
fit the content into a token limit automatically
Now you can take a big chunk of code and just:
- click “Fit to 8k / 32k / 128k”
- get something that actually works with the model
No more manual trimming.
Then I pushed it further
Instead of just cutting text, I tried something slightly smarter.
The extension can:
- detect files
- look at imports
- include related files
So when you send something to AI, it’s not just random pieces — it’s connected context.
Not perfect, but already way better than copy-pasting blindly.
Why this matters
AI tools are good, but they depend heavily on input quality.
And right now, most people are still doing this part manually.
That’s where time gets wasted.
What I learned building this
A few things stood out:
- The problem isn’t “lack of AI tools”
- It’s the friction between your codebase and the AI
Also:
- small utilities can be surprisingly impactful
- you don’t need a huge product to solve a real problem
What’s next
There’s still a lot to improve:
- better selection of relevant files
- smarter context building
- generating prompts automatically
But even in its current state, it already saves time.
If you want to try it
I published it here:
https://github.com/notasandy/copy-for-ai
https://marketplace.visualstudio.com/items?itemName=notasandy.copy-code-to-chatgpt
I’d honestly just like to know if this is useful for anyone else.
If you’ve found better ways to work with AI and real codebases, I’m curious how you approach it.
Top comments (0)