| 1 | --- |
| 2 | title: How to Make Your Agent Aware of Codebases and Documentation |
| 3 | description: Learn how to give your AI agent access to codebases and documentation for more context-aware assistance |
| 4 | keywords: [agent, codebase, documentation, MCP, context, RAG, tools] |
| 5 | sidebarTitle: Codebase and Documentation Awareness |
| 6 | --- |
| 7 | |
| 8 | AI coding agents work best when they understand the context of your project. This guide shows you how to give your agent access to codebases and documentation, making it more helpful and accurate. |
| 9 | |
| 10 | ## Make your agent aware of your open codebase |
| 11 | |
| 12 | When your agent understands your current codebase, it can provide more relevant suggestions and answers. |
| 13 | |
| 14 | ### Let your agent explore the codebase using tools |
| 15 | |
| 16 | Your agent can use built-in tools to navigate and understand your code: |
| 17 | |
| 18 | 1. **File exploration tools**: The agent can read files, search for patterns, and understand project structure |
| 19 | 2. **Code search**: Use search to find relevant code snippets |
| 20 | 3. **Git integration**: Access commit history and understand code evolution |
| 21 | |
| 22 | ### Create rules to help the agent understand your codebase |
| 23 | |
| 24 | Rules guide your agent's behavior and understanding. Place markdown files in `.continue/rules` in your project to provide context: |
| 25 | |
| 26 | ```markdown |
| 27 | # Project Architecture |
| 28 | |
| 29 | This is a React application with: |
| 30 | |
| 31 | - Components in `/src/components` |
| 32 | - API routes in `/src/api` |
| 33 | - State management using Redux in `/src/store` |
| 34 | |
| 35 | ## Coding Standards |
| 36 | |
| 37 | - Use TypeScript for all new files |
| 38 | - Follow the existing naming conventions |
| 39 | - Write tests for all new features |
| 40 | ``` |
| 41 | |
| 42 | <Tip> |
| 43 | Place rules files at different levels of your project hierarchy to scope when |
| 44 | they trigger |
| 45 | </Tip> |
| 46 | |
| 47 | Learn more about [rules configuration](/customize/deep-dives/rules). |
| 48 | |
| 49 | ## Make your agent aware of other codebases |
| 50 | |
| 51 | Sometimes you need your agent to understand code beyond your current project. |
| 52 | |
| 53 | ### Public codebases |
| 54 | |
| 55 | For open-source projects and public repositories, you have several options: |
| 56 | |
| 57 | #### Rules with hyperlinks |
| 58 | |
| 59 | Create rules that point to external codebases: |
| 60 | |
| 61 | ```markdown |
| 62 | # External Dependencies |
| 63 | |
| 64 | Our authentication system is based on: |
| 65 | |
| 66 | - [Auth.js documentation](https://authjs.dev/) |
| 67 | - [Example implementation](https://github.com/nextauthjs/next-auth-example) |
| 68 | |
| 69 | When implementing auth features, reference these patterns. |
| 70 | ``` |
| 71 | |
| 72 | #### GitHub and GitLab CLIs |
| 73 | |
| 74 | Enable `gh` or `glab` CLI access for your agent to interact with repositories. |
| 75 | |
| 76 | Add rules to guide CLI usage: |
| 77 | |
| 78 | ```markdown |
| 79 | # Repository Access |
| 80 | |
| 81 | You can use the `gh` CLI to: |
| 82 | |
| 83 | - Search for issues: `gh issue list --repo owner/repo` |
| 84 | - View pull requests: `gh pr list --repo owner/repo` |
| 85 | - Clone repositories: `gh repo clone owner/repo` |
| 86 | ``` |
| 87 | |
| 88 | #### DeepWiki MCP |
| 89 | |
| 90 | [DeepWiki MCP](https://hub.continue.dev/deepwiki/deepwiki-mcp) lets your agent explore any public GitHub repository. |
| 91 | |
| 92 | Once configured, your agent can explore repositories like: |
| 93 | |
| 94 | - "Explore the React repository structure" |
| 95 | - "Find how authentication is implemented in NextAuth.js" |
| 96 | |
| 97 | ### Internal codebases |
| 98 | |
| 99 | For private and internal repositories, you need additional setup: |
| 100 | |
| 101 | #### Custom MCP servers |
| 102 | |
| 103 | Create an MCP server that has access to your internal repositories. |
| 104 | |
| 105 | #### Custom code RAG |
| 106 | |
| 107 | For faster retrieval and lower costs with very large internal codebases, consider implementing a [custom code RAG](/guides/custom-code-rag) system. This is an advanced approach that requires more setup but can provide performance benefits at scale. |
| 108 | |
| 109 | ## Make your agent aware of relevant documentation |
| 110 | |
| 111 | Documentation provides crucial context for your agent to understand APIs, frameworks, and best practices. |
| 112 | |
| 113 | ### Public documentation |
| 114 | |
| 115 | #### Rules with documentation links |
| 116 | |
| 117 | Guide your agent to relevant documentation: |
| 118 | |
| 119 | ```markdown |
| 120 | # Documentation Resources |
| 121 | |
| 122 | For framework-specific questions, refer to: |
| 123 | |
| 124 | - React: https://react.dev/reference/react |
| 125 | - Next.js: https://nextjs.org/docs |
| 126 | - Tailwind CSS: https://tailwindcss.com/docs |
| 127 | |
| 128 | Always cite documentation when explaining concepts. |
| 129 | ``` |
| 130 | |
| 131 | #### Context7 MCP |
| 132 | |
| 133 | [Context7 MCP](https://hub.continue.dev/upstash/context7-mcp) enables your agent to search and retrieve information from public documentation: |
| 134 | |
| 135 | Your agent can then answer questions like: |
| 136 | |
| 137 | - "How do I use React hooks?" |
| 138 | - "What's the syntax for Tailwind CSS animations?" |
| 139 | |
| 140 | ### Internal documentation |
| 141 | |
| 142 | For private documentation and wikis: |
| 143 | |
| 144 | #### Rules with internal links |
| 145 | |
| 146 | Create rules that reference internal resources: |
| 147 | |
| 148 | ```markdown |
| 149 | # Internal Documentation |
| 150 | |
| 151 | Our team documentation is available at: |
| 152 | |
| 153 | - API Documentation: https://internal.docs/api |
| 154 | - Architecture Guide: https://internal.docs/architecture |
| 155 | - Deployment Process: https://internal.docs/deployment |
| 156 | |
| 157 | Always follow our internal standards when suggesting code. |
| 158 | ``` |
| 159 | |
| 160 | #### Custom MCP servers for docs |
| 161 | |
| 162 | Create an MCP server that accesses your internal documentation. |
| 163 | |
| 164 | ## Migrating from deprecated context providers |
| 165 | |
| 166 | If you were previously using the `@Codebase` or `@Docs` context providers, here's how to migrate to the new approach: |
| 167 | |
| 168 | ### Migrating from @Codebase |
| 169 | |
| 170 | The `@Codebase` context provider has been deprecated. Instead: |
| 171 | |
| 172 | 1. **Use built-in tools**: Your agent can now use file exploration and search tools to understand your codebase |
| 173 | 2. **Add rules**: Create `.continue/rules` files to provide context about your project structure |
| 174 | 3. **Use MCP servers**: For external codebases, use DeepWiki MCP or custom MCP servers |
| 175 | |
| 176 | ### Migrating from @Docs |
| 177 | |
| 178 | The `@Docs` context provider has been deprecated. Instead: |
| 179 | |
| 180 | 1. **Use Context7 MCP**: For public documentation, Context7 MCP provides similar functionality |
| 181 | 2. **Add documentation links in rules**: Create rules that reference documentation URLs |
| 182 | 3. **Use custom MCP servers**: For internal documentation, create an MCP server with access to your docs |
| 183 | |
| 184 | The new approach provides better integration with Continue's Agent features and more intelligent context selection. |
| 185 | |
| 186 | ## Next steps |
| 187 | |
| 188 | - Learn more about [MCP servers](/reference/continue-mcp) |
| 189 | - Explore [rules configuration](/customize/deep-dives/rules) |
| 190 | - Set up [custom agents](/guides/understanding-agents) with specific knowledge domains |