Launch HN: Greptile (YC W24) - RAG on codebases that actually works

253 points by dakshgupta ↗ HN
Hi HN, we're the co-founders of Greptile, a tool that can accurately answer questions about complex codebases. Developers use us to spend less time wrestling with codebases and more time actually writing code. Here's a demo: https://youtu.be/qI24eKO1YX0. You can try it on 100 popular repos here: https://app.greptile.com/repo, and on your own repo (if you give permission - more on that below) here: https://app.greptile.com.

We are far from the first people to try "RAG on your codebase". We focus on full codebase comprehension: using LLMs to accurately answer difficult questions with full context of large, complex, and even multi-repo codebases.

Simple RAG alone is not sufficient for this task. Codebases aren’t like most PDFs, docs, or other similar data types. They are graphs—complex puzzles where each piece is interlinked. So Greptile does a few things past simple RAG:

(1) Instead of directly embedding code, we parse the AST of the codebase, recursively generate docstrings for each node in the tree, and then embed the docstrings.

(2) Alongside vector similarity search and keyword search, we do “agentic search” where an agent reviews the relevance of the search results, and scans the source code to follow references that might lead to something important. Then it returns the relevant sources.

For example, here are a couple questions that this system is able to answer in our test repo that simple RAG couldn’t (in our experience):

Where are the auth providers configured?” (They are in an array inside of an options.ts file, where looking at the file it’s not obvious it’s an auth related file. However, because that array is imported into the auth/route.ts file, Greptile’s agent traces and find it)

How would I add a postgres connector?” (The best way to answer this is to see how the Redis connector is set up and mirror it. Simple RAG sometimes retrieves some of the code for the Redis connector, but Greptile’s agent follows the connections to retrieve all the code that the redis connector touches, and uses that to write instructions.)

Developers (including at Stripe and Microsoft) are using Greptile for things like:

Debugging—you can paste in an error message and it does a pretty good job of diagnosing the root cause and suggesting fixes.

Grokking OSS repos—for example, if you're forking a repo, modifying it for your usecase, or just integrating it, Greptile lets you add multiple repos and dependencies in the same chat session so it has full context.

Parsing legacy code at work—especially if original engineers have left the company.

Since we're accessing your private code, we're very careful with security. We don't store any code on our servers after initial processing, and just pull snippets as needed from the GitHub API.

Quick note: when you sign in with GH, it might ask for permission to "act on your behalf". This is a quirk of GitHub's wording—our permissions are read-only and the only thing we do "on your behalf" is read code, so we can index the repo.

We came up with this idea while working at AWS—the codebase was super complicated, the docs were sparse and out of date, and our team was remote so it was slow to get answers to questions. We picked "greptile" because of "grep" and also we just wanted a somewhat silly name.

Try it out! It's a work in progress, so any feedback is appreciated. Here are the links again: for popular open source repos see https://app.greptile.com/repo, and to get it working on your own repo, start at https://app.greptile.com.

If you have experience working with a complex...

172 comments

[ 1.3 ms ] story [ 205 ms ] thread
Works well. Today I was working with how Rail's works with BigDecimals, so (knowing the answer) I asked:

"When using "as_json" in a controller to return the JSON of a model, how are BigDecimal's encoded?"

Answer: "When using as_json in a controller to return the JSON of a model, BigDecimal values are encoded as strings. This behavior is defined in the active_support/core_ext/object/json.rb file, specifically in the BigDecimal class extension for JSON encoding. The rationale behind this approach is that most..." which is exactly the case as I learnt through various PR's, Issues and code review.

This would have saved me about 30mins of work. I wonder if it takes into account the metadata, such as authors, related comments, issues and PRs?

Thanks for checking it out! Currently no metadata, just code. Were adding commit messages and PRs next. Issues and comments makes a lot of sense, adding that to the list.
We don't do direct look up/indexing for authors (although the authors file is usually somewhere in the repo for larger projects), comments, issues, or PRs just yet but that is definitely something we are looking to add.
This is super cool, my co-founder and I were brainstorming how to essentially expand the context window via first-order concepts for this exact purpose last night

Excited to try it out

Cool, will check it out

Does it integrate with Visual Studio, does it provide code suggestions?

Been doing a lot of back and forth iteration with ChatGPT to build a python project from scratch

It’s been a really good experience although frustratingly slow at times (from going back and forth between the browser and code and having to wait for gpt’s answers)

Can more documentation be automatically added? For example, it might be useful in a rails project to be able to get answers about the ruby and rails documentations

We have a VS code extension in the store (also called "greptile"), feel free to check it out!

Docs is a good idea but we haven't found a reliable enough scraper to add docs from a website. We were thinking it would be cool if you could drop in like "docs.stripe.com" and it automatically adds stripe docs to the context.

A JetBrains plugin might be worth looking at too. They are pretty popular in several language communities and still resisting the juggernaut that is VS Code.
Definitely, we currently have that on our roadmap for April, been cautious because IMO a bad IDE extension is way worse than no IDE extension.
Congrats on launching. However I don't like the 'Act on your behalf' permission this needs.
Thanks! Yeah, it’s strangely worded for what it is. We’ve emailed GitHub about it. Our permissions are read-only but since we read “on your behalf” this is technically true.
Why don't you read on your own behalf. You don't need this permission at all. It's just to harvest email addresses right?
Presumably if you have a private repo, they need permission to read it.
Private repos are one reason we'd need it, and this also gives us higher rate limits so that lots of people can use it concurrently.
Congrats on the launch! Do you need Github permissions to answer questions on open-source repos as well?
There are about a hundred open source repos you can talk to for free over at https://app.greptile.com/repo, we are looking to add more repositories as well. The permissions we get on login are from the Github App flow, you will still have to grant Greptile access specific organization/repositories for it to work with your own private repos.
Best way to get in touch if a maintainer who wants to provide public repo access?
You can email me -> daksh [at] greptile.com
No, and for the ones in app.greptile.com/repo you don’t need to log in at all.
I like clever project names :)

This looks great - I just tried to generate sample code in the react repo and was pleasantly surprised. Do you have a sense of whether this works well to generate code in general, i.e. generate an API route to return X data that works similar to the other API routes.

We love the name as well.

We haven't built it for code gen in particular, but a lot of our users seem to be using it for that. We want to really nail down people getting to understand what is going on in the codebase itself.

Thanks! This should work. The closest thing I tried was with quary.dev, where I had it generate a postgres connector and it referred to existing db connectors to generate the changes.
I've tried it on my own C++ codebase. It's fun, and I'm impressed that it could tell me which C++ standard is used (a question which is often difficult to find an answer to on random codebases), but it's really bad at analyzing templates. The answers it gives me are always incomplete and usually at least partly or mostly incorrect. I'm surprised by this in some cases, because my questions are answered by comments in the source code.

https://app.greptile.com/share/4953cbff-13ec-4427-b0af-02889...

Examining now and looks like we’ve been heavily discounting the comments in our search. Going to look into fixing it this week.

Thanks for pointing that out!

Looks good, but there are many competitors that do exactly the same thing (even opensource ones)
100% there are many. Hopefully we can build one of the better ones.
Can you please share some that you consider to be good?
Can you please share the list? I'm curious
[not part of greptile]

I can only think of two serious competitors, neither of which is open source. And I don't think anyone serious at either of those companies would claim that they have the definitive solution.

I've been looking for something like this, but local-only. Any plans to let people self-host and point at local repositories?
We’ve been grappling with making it local but two considerations

1. Haven’t figured out what should trigger updates. Every commit sounds crazy, every save would be perfect but too intensive also.

2. LLMs will not be self hosted. We haven’t been able to get the same results with any smaller LLMs

To answer your questions we definitely want to make this available for local repos and ideally self hosted, on a technical level that’s probably several month away.

Anyway to sign up for newsletter updated for when that happens? I’d be very keen to check this out once that feature lands.
We don’t have a newsletter but there should be a link to join our discord on app.greptile.com

You can also email me at daksh [at] greptile.com and I’ll set a reminder to let you know when it’s out

Thanks, some interesting challenges there.
> Haven’t figured out what should trigger updates.

What triggers updates when it is not local?

When a commit code is pushed to that remote branch
OK, then why would that be crazy for local when it is the trigger for non-local?
Just because people commit locally more often than they push.

That said, I think you're right and we might be overestimating the lift there. Will look into it more.

Also looking for something local but I feel like Apple will probably eventually release local LLMs for your entire filesystem.
[not part of greptile]

I've given it a fairly serious shot and my conclusion is that building IDE hooks is seriously depressing. IntelliJ deprecates APIs constantly and the docs don't really keep up.

And then there's the total dumpster fire that is trying to support GPU acceleration on multiple platforms.

Unfortunately it's easily 10x the work to do this kind of thing local only.

I tried asking a question about Porter and I see the error:

> Oops

> We couldn't access this repo.

> You may need to log in to view this repository, or it might not exist.

Hey looked into this error, Porter was not processed by us yet, it does take a while for a repo to be processed initially but this link should give you the progress report + you can chat with it when its done:

https://app.greptile.com/chat/github/porter-dev/porter

I followed the link because I was curious and it still said processing, so I navigated to the homepage and clicked "Try a popular repo" leading to <https://app.greptile.com/chat/3t4qpefuh9eqckcdt0b8i?repo=pos...> which then said "We couldn't access this repo." It seems the actual syntax is app.greptile.com/chat/github/postgres/postgres -> https://app.greptile.com/chat/lfbc034nkj7w03v2kb5zp?repo=git... so wherever that list of "popular repos" is coming from needs to be updated to avoid other people having bad first experiences

It also appears that the vote buttons do nothing if one is not logged in, so I'd recommend eliding them unless logged in since it's just frustrating to wonder if some JS error ate the vote or what

Hey, looking into this now. I believe the vote buttons actually do always send us feedback, but the UI could probably be better there.
Unless you are batching them up and hiding them in the upteen bazillion posthog POST requests, no, they do not

I shudder to think how much you must be spending on compute asking for that /api/poll/batch once a second, each one saying it is a Miss from cloudfront. It's especially mysterious since there's nothing on the UI that the user would see about the .filesProcessed increasing that justifies DDoSing yourself like that, IMHO

These are all great points, we should probably audit the polling.
How does it compare with something like Bloop, which also uses a combination of a syntax tree, Embeddings, FTS and LLMs?
I'd love to try it, but pretty much all my repos are >10mb. It's not because there is that much code, but because I am doing bioinformatics and the test files (for the unit tests) inflate the repo size. It would be great if there was a way to test it on just 1 large repo for perhaps a week or something, because I balk at the idea of spending $20 a month on something that I don't even know works well.

This is important because I'm not deeply familiar with public projects, so I can't accurately assess if the tool is worthwhile. Whereas with one of my repos, I'd be able to tell quality pretty quickly.

Just made a checkout code so you can use for free

HACKERNEWS100

Do I still need to provide credit card info to use the promo code? No bueno.
Use privacy.com for a single use credit card number
Nice, appreciate the suggestion.
(comment deleted)
pretty easy to fork your repo and remove all the test files.
Maybe we need a `.greptileignore` file...
That's funny, we actually do ignore those files but realizing now we don't account for that in our calculation of codebase size since we just get that via the GH API.
This comes from a place of love and empathy -- I've been here, am here, and will be here again -- but this realization reads like the first step in the long, long road from prototype to product.
As an aside I suggest using dvc. It stores only metadata of large files in the got repository while maintain a separate data repository. The data repository can also be synced with cloud storage like AWS. It really helps manage code better without raw data
Never heard of it, thanks for sharing. Will look into this today.
“Where we going we don’t need docs”. That scares me… docs are among other things there to provide context and info for things not clear from why certain choices were made or not made… no way your AI is going to guess that I put that restriction because of an explicit request from product, despite it looking wrong…
Indeed. Code describes how something is done, and possibly what is done, but it seldom fully describes why something is done, or why code exists in the first place.

The latter is typically the realm of requirements, design documentation, and possibly test plans.

Generating such documentation from code seems quite impossible, or at least wrong.

It is unfortunate that most open source software is lacking in such documentation, giving off bad signals to junior developers.

Edit: not to take away from the product being discussed here, which seems very useful! I am merely supporting the parent here.

This is a great point, and something we think about. I think to an extent a super smart version of our product could infer intent from the code but there would be definitely something amiss if the author's intent was just never available.
> The latter is typically the realm of requirements, design documentation, and possibly test plans.

You forgot one of the biggest spots for "why" documentation... git commit messages, where the point is to say why you made this change. Maybe taking into account the commit messages around the code in question would help.

"Initial commit" is my goto commit message.

Still a great idea, though. Ingesting all data from JIRA may be beneficial as well.

Yep... and the why of that message is apparent and makes perfect sense for the first commit. If you only ever start projects and never work on them again, that is all you need.
If you don't use proper commit messages you also probably don't have proper docs
We already do that and more at Maru.ai - reach out if you're interested.
Cofounder of Greptile here, good documentation is not going anywhere. What we do hate is going through bad documentation to find the tiny bit of information we need that is more often than not outdated to fit our needs. We are looking for ways to integrate information not explicitly written in code to understand codebases as well.
This sort of tech will just spur developers to put proper comments in their code, which they should have been doing in the first place.
Didn't even think about that, hopefully it turns out to be true.
Could even make it an explicit feature, to consume jsdoc/javadoc/etc comments
I hope so! Unfortunately it will definitely be massively increasing the ratio of documentation to intentional documentation, so we'll have to see whether it increases documentation usability or not.
I can imagine the founder shout “Where we going we don’t need docs” whilst shoveling VC money into the steam engine.
Yep, agreed. As a founder of another YC company that's done a bunch of RAG on code and docs, the accuracy boost you get from having good docs makes a massive difference. You really do need a human interpreter to show you "how to use" a product.
Not a single repo I've tried works. A lot of them seem not to have finished processing, but even the ones that have finished don't work.
This might have been related to temporary DB issues we had. Could you try again and let us know if you're still running into issues?
Getting "Error: Internal error while processing request." while trying on my personal public github repo. HN effect?
Co-founder here, I think it might be all the traffic haha. Working on a fix now.

Edit: chatting with processed repos should be working again now

> This repo failed to process

nice

Hey, our DB was temporarily down from the traffic, sorry about that. Could you try again if you get a chance?
Still hitting this issue for the repos I tried
Asking questions of any repo on “repo” fails with “Error: Internal error while processing request.” This is pribably because I unlinked my Github connection after trying it out, but it shouldn’t be trying to use that in this case.
Hey, we had some database issues. Should be working again now!

Edit: Some of the repos that were processing at the time might have failed to process. Reach out to us on Discord if you're seeing errors.

After giving permission, it asked to:

"Link Your Code Hosting Providers Connect your accounts for seamless integration, and to access private repositories."

What does this mean?

If you install the GitHub app and authorize access to private repositories, Greptile will have access to them. If you don't want to do that, you can still navigate to the home page to start chatting.
I linked to my github but can't find where to use the promo code :-/
You can upgrade to Pro and use the promo code by clicking on the 'Upgrade' button at the top!
it's an option once you start the checkout process to upgrade
Can it answer customer support questions on API's cryptic error messages? E.g. Give hints on changes needed in the request payload.
Assuming you can link the source code for the API's logic - that should work. Mileage may vary depending on exactly how vague the message are. For example if a single error message could mean 10 disjointed things, might not be able to exhaustively list them.
"We don't store any code on our servers after initial processing"

Are you storing the embedding vectors you've calculated from the code? If so, those are likely quite easily reversible - so I would still consider that source code stored on your servers from the point of view of a security audit.

As a result, I might actually prefer to have copies of my code stored on your servers if it resulted in faster performance.

> embedding vectors you've calculated from the code? If so, those are likely quite easily reversible

I don't think embeddings are generally reversible... you're usually projecting onto a lower dimensional space, and therefore losing information.

"Quite easily" isn't true in most cases, but embeddings are sometimes reversible. We know this because programs like Stable Diffusion sometimes output near-perfect copies of training data when given the correct prompt, and generation of that image is based on word and image embeddings alone.
I’ve never heard of reversible embeddings in practice.

In theory if you know the model being used you could reverse them.

You might be interested in "Text Embeddings Reveal (Almost) As Much As Text":

> We train our model to decode text embeddings from two state-of-the-art embedding models, and also show that our model can recover important personal information (full names) from a dataset of clinical notes.

https://arxiv.org/pdf/2310.06816.pdf

There's certainly information loss, but there is also a lot of information still present.

For now we are storing the embeddings of the generated docstrings, the intuition behind this is kinda like how HyDE works. I don't think the actual code itself is reversible from the embeddings, but yes we do want to store the actual code at some point and we will need the proper security measures for that. We are also actively developing an self-hostable version for enterprise.
(comment deleted)