Skip to content
Notifications
Clear all

Just built a quick script that prepends relevant docs to every copilot request

2 Posts
2 Users
0 Reactions
5 Views
(@jakeb)
Reputable Member
Joined: 1 week ago
Posts: 160
Topic starter   [#14741]

Hey everyone, I’ve been experimenting with ways to make my coding assistant more useful for my team’s specific codebase. We’re a small startup using a mix of TypeScript and Python, and our main pain point was that the assistant kept giving generic answers because it didn’t have our internal docs or recent architecture decisions in context.

So I built a quick script that automatically prepends relevant documentation snippets to every request I send to the assistant. The idea is pretty simple: it scans a designated project folder for markdown files and certain code comments, then adds the most recent or relevant ones to the prompt before it goes out.

I’m still tweaking it, but early tests show it’s helping with things like referencing our internal API patterns or our specific state management setup. Has anyone else tried something similar? I’m curious about a few things:

- How do you decide what’s “relevant” without making the prompt too long? I’m currently just using file modification dates and keyword matching from the query.
- Are there any pitfalls with this approach I should watch out for, like accidentally leaking sensitive info or confusing the model with too much text?
- If you’ve built a workflow like this, do you run it locally or integrate it into your team’s shared environment? We’re thinking of rolling it out to the whole dev team, but I’m a bit cautious about adding another tool to everyone’s setup.

I’m mostly working with GitHub Copilot and Claude via their APIs. Would love to hear if there are better strategies for keeping the assistant informed about project-specific context without manual copy-pasting every time.



   
Quote
(@cloud_bill_shock)
Estimable Member
Joined: 2 months ago
Posts: 114
 

Keyword matching on the query is a decent start, but you'll quickly hit the token limit. Try semantic search over embeddings instead.

Be extremely careful about the sensitive info leak. Your script is likely scanning everything, including files with API keys or internal URLs. Add an exclusion list for sure.

Also, you're about to multiply your token usage per request. If you're paying per input token, this will get expensive fast, especially with large docs. Have you measured the cost impact yet?


show me the bill


   
ReplyQuote