Elffuss BraidHub

kikocis/continue public

cfc91aa76b54 · 4.3 KiBRawPermalink
1---
2title: "@Codebase"
3description: Talk to your codebase
4keywords: [talk, embeddings, reranker, codebase, experimental]
5---
6
7Continue indexes your codebase so that it can later automatically pull in the most relevant context from throughout your workspace. This is done via a combination of embeddings-based retrieval and keyword search. By default, all embeddings are calculated locally using `transformers.js` and stored locally in `~/.continue/index`.
8
9<Info>
10 **Note:** `transformers.js` cannot be used in JetBrains IDEs. However, you can
11 select a different embeddings model from [the list
12 here](../model-roles/embeddings.mdx).
13</Info>
14
15Currently, the codebase retrieval feature is available as the "codebase" and "folder" context providers. You can use them by typing `@Codebase` or `@Folder` in the input box, and then asking a question. The contents of the input box will be compared with the embeddings from the rest of the codebase (or folder) to determine relevant files.
16
17Here are some common use cases where it can be useful:
18
19- Asking high-level questions about your codebase
20 - "How do I add a new endpoint to the server?"
21 - "Do we use VS Code's CodeLens feature anywhere?"
22 - "Is there any code written already to convert HTML to markdown?"
23- Generate code using existing samples as reference
24 - "Generate a new React component with a date picker, using the same patterns as existing components"
25 - "Write a draft of a CLI application for this project using Python's argparse"
26 - "Implement the `foo` method in the `bar` class, following the patterns seen in other subclasses of `baz`.
27- Use `@Folder` to ask questions about a specific folder, increasing the likelihood of relevant results
28 - "What is the main purpose of this folder?"
29 - "How do we use VS Code's CodeLens API?"
30 - Or any of the above examples, but with `@Folder` instead of `@Codebase`
31
32Here are use cases where it is not useful:
33
34- When you need the LLM to see _literally every_ file in your codebase
35 - "Find everywhere where the `foo` function is called"
36 - "Review our codebase and find any spelling mistakes"
37- Refactoring
38 - "Add a new parameter to the `bar` function and update usages"
39
40## Configuration
41
42There are a few options that let you configure the behavior of the `@codebase` context provider, which are the same for the `@folder` context provider:
43
44<Tabs>
45 <Tab title="YAML">
46 ```yaml title="config.yaml"
47 context:
48 - provider: codebase
49 params:
50 nRetrieve: 25
51 nFinal: 5
52 useReranking: true
53 ```
54 </Tab>
55 <Tab title="JSON">
56 ```json title="config.json"
57 {
58 "contextProviders": [
59 {
60 "name": "codebase",
61 "params": {
62 "nRetrieve": 25,
63 "nFinal": 5,
64 "useReranking": true
65 }
66 }
67 ]
68 }
69 ```
70 </Tab>
71</Tabs>
72
73### `nRetrieve`
74
75Number of results to initially retrieve from vector database (default: 25)
76
77### `nFinal`
78
79Final number of results to use after re-ranking (default: 5)
80
81### `useReranking`
82
83Whether to use re-ranking, which will allow initial selection of `nRetrieve` results, then will use an LLM to select the top `nFinal` results (default: true)
84
85## Ignore files during indexing
86
87Continue respects `.gitignore` files in order to determine which files should not be indexed. If you'd like to exclude additional files, you can add them to a `.continueignore` file, which follows the exact same rules as `.gitignore`.
88
89Continue also supports a **global** `.continueignore` file that will be respected for all workspaces, which can be created at `~/.continue/.continueignore`.
90
91If you want to see exactly what files Continue has indexed, the metadata is stored in `~/.continue/index/index.sqlite`. You can use a tool like [DB Browser for SQLite](https://sqlitebrowser.org/) to view the `tag_catalog` table within this file.
92
93If you need to force a refresh of the index, reload the VS Code window with <kbd>cmd/ctrl</kbd> + <kbd>shift</kbd> + <kbd>p</kbd> + "Reload Window".
94
95## Repository map
96
97Models in the Claude 3, Llama 3.1/3.2, Gemini 1.5, and GPT-4o families will automatically use a [repository map](../custom-providers#repository-map) during codebase retrieval, which allows the model to understand the structure of your codebase and use it to answer questions. Currently, the repository map only contains the filepaths in the codebase.