Elffuss BraidHub

kikocis/continue public

35c0ed0a3308 · 4.3 KiBRawPermalink
1---
2title: "@Codebase"
3description: Talk to your codebase
4keywords: [talk, embeddings, reranker, codebase, experimental]
5---
6
7# @Codebase
8
9Continue 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`.
10
11<Info>
12 **Note:** `transformers.js` cannot be used in JetBrains IDEs. However, you can
13 select a different embeddings model from [the list
14 here](../model-roles/embeddings.mdx).
15</Info>
16
17Currently, 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.
18
19Here are some common use cases where it can be useful:
20
21- Asking high-level questions about your codebase
22 - "How do I add a new endpoint to the server?"
23 - "Do we use VS Code's CodeLens feature anywhere?"
24 - "Is there any code written already to convert HTML to markdown?"
25- Generate code using existing samples as reference
26 - "Generate a new React component with a date picker, using the same patterns as existing components"
27 - "Write a draft of a CLI application for this project using Python's argparse"
28 - "Implement the `foo` method in the `bar` class, following the patterns seen in other subclasses of `baz`.
29- Use `@Folder` to ask questions about a specific folder, increasing the likelihood of relevant results
30 - "What is the main purpose of this folder?"
31 - "How do we use VS Code's CodeLens API?"
32 - Or any of the above examples, but with `@Folder` instead of `@Codebase`
33
34Here are use cases where it is not useful:
35
36- When you need the LLM to see _literally every_ file in your codebase
37 - "Find everywhere where the `foo` function is called"
38 - "Review our codebase and find any spelling mistakes"
39- Refactoring
40 - "Add a new parameter to the `bar` function and update usages"
41
42## Configuration
43
44There are a few options that let you configure the behavior of the `@codebase` context provider, which are the same for the `@folder` context provider:
45
46<Tabs>
47 <Tab title="YAML">
48 ```yaml title="config.yaml"
49 context:
50 - provider: codebase
51 params:
52 nRetrieve: 25
53 nFinal: 5
54 useReranking: true
55 ```
56 </Tab>
57 <Tab title="JSON">
58 ```json title="config.json"
59 {
60 "contextProviders": [
61 {
62 "name": "codebase",
63 "params": {
64 "nRetrieve": 25,
65 "nFinal": 5,
66 "useReranking": true
67 }
68 }
69 ]
70 }
71 ```
72 </Tab>
73</Tabs>
74
75### `nRetrieve`
76
77Number of results to initially retrieve from vector database (default: 25)
78
79### `nFinal`
80
81Final number of results to use after re-ranking (default: 5)
82
83### `useReranking`
84
85Whether 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)
86
87## Ignore files during indexing
88
89Continue 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`.
90
91Continue also supports a **global** `.continueignore` file that will be respected for all workspaces, which can be created at `~/.continue/.continueignore`.
92
93If 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.
94
95If 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".
96
97## Repository map
98
99Models in the Claude 3, Llama 3.1/3.2, Gemini 1.5, and GPT-4o families will automatically use a [repository map](../custom-providers.mdx#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.