version v7.2.
For up-to-date documentation, see the
latest version.
Code Companion - Codebase Awareness
2 minute read
Codebase Awareness
Agent mode works best when it understands the context of your project. This guide shows you how to give agent mode access to codebases, making it more helpful and accurate.
Make Agent Mode Aware of Your Open Codebase
When agent mode understands your current codebase, it can provide more relevant suggestions and answers.
Initialize Codebase Awareness with /init
Before agent mode can effectively use your codebase, you can explicitly initialize it with the
/init command in the chat input.
Run in chat :
/init
This tells Code Companion to:
- Verify it has the tools needed to analyze your repo (
ls,file_glob_search,read_file,create_new_file) - Analyze your project structure, technologies, and key configuration files
- Generate a
.continue/rules/CONTINUE.mdfile that:- Describes the project’s purpose and architecture
- Documents setup, testing, and common workflows
- Explains key concepts, patterns, and directories
- Provides troubleshooting tips and references
Use /init when:
- You open a project for the first time
- You’ve made large structural changes (e.g., moved/renamed many files)
- You switch between different workspaces and want to refresh context
Create Rules to Help the Agent Understand Your Codebase
Rules guide agent mode’s behavior and understanding. Place markdown files in .continue/rules in your project to provide context:
# Project Architecture
This is a React application with:
- Components in `/src/components`
- API routes in `/src/api`
- State management using Redux in `/src/store`
## Coding Standards
- Use TypeScript for all new files
- Follow the existing naming conventions
- Write tests for all new features
Place rules files at different levels of your project hierarchy to scope when they trigger Learn more about rules configuration .
Make Agent Mode Aware of Other Codebases
Sometimes you need agent mode to understand code beyond your current project.
For open-source projects and public repositories, you can create rules with hyperlinks that point to external codebases:
# External Dependencies
Our authentication system is based on:
- [Auth.js documentation](https://authjs.dev/)
- [Example implementation](https://github.com/nextauthjs/next-auth-example)
When implementing auth features, reference these patterns.
@Codebase
This feature is deprecated. The @Codebase context provider has been deprecated in favor of a more integrated approach to documentation awareness. Use /init instead to prepare your project for codebase-aware suggestions
Talk to your codebase
Code Companion 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.