CodeCrew
To Run CodeCrew, open the Command Palette in Visual Studio Code by pressing Ctrl+Shift+P
(or Cmd+Shift+P
on macOS) and execute CodeCrew
.
CodeCrew revolutionizes the way you code by introducing a multi-agent backend AI chatbot, designed to enhance your coding efficiency. By integrating various APIs, CodeCrew unifies multiple Large Language Models (LLMs) within a single chat stream. This innovative approach allows these models to interact—discussing, reviewing, and complementing each other's code—thereby offering you a comprehensive and collaborative coding assistant.
Setting Up API Keys
CodeCrew requires API keys for the integrated LLMs to function properly. When you first run CodeCrew, it will attempt to retrieve the necessary API keys from the following sources, in order:
Environment Variables: CodeCrew will check if the API keys are set as environment variables in your system. Make sure to set the environment variables with the appropriate names (e.g., OPENAI_API_KEY
, GEMINI_PROJECT_ID
, GEMINI_LOCATION
) before running CodeCrew.
Configuration File: If the API keys are not found in the environment variables, CodeCrew will look for a configuration file named config.json
located in the .env
folder within your project directory. Create a config.json
file in the .env
folder and specify the API keys in the following format:
{
"OPENAI_API_KEY": "your_openai_api_key",
"GEMINI_PROJECT_ID": "your_gemini_project_id",
"GEMINI_LOCATION": "your_gemini_location"
}
Secure Storage: If the API keys are not found in the environment variables or the configuration file, CodeCrew will prompt you to enter the API keys when you first run the extension. You can choose to securely store the API keys locally using Visual Studio Code's secure storage. This way, you don't have to enter the API keys every time you use CodeCrew.
CodeCrew will securely locally store the API keys using Visual Studio Code's secure storage, ensuring that they are encrypted and not accessible to other extensions.
By providing multiple options for setting up API keys, CodeCrew offers flexibility and convenience while prioritizing the security of your sensitive information.
Restarting CodeCrew
If you encounter any issues or need to restart CodeCrew for any reason, you can easily do so by Open the Command Palette in Visual Studio Code by pressing Ctrl+Shift+P
(or Cmd+Shift+P
on macOS) and find the "CodeCrew: Restart Extension" command. This will restart the extension and reload all the necessary components.
Available Commands
:r <file/directory path>
: Load content from a file or directory into the chat
- Option 1: Enter the path to a file or directory, and CodeCrew will prompt you to exclude specific subdirectories and choose which file extensions to include.
- Option 2: Right-click on a file or directory in the Explorer, and select
Add to Context
from the context menu. You can also exclude a file or directory by selecting Exclude from Context
or clear the entire context by selecting Clear Context
. Note that context is branch dependent. The files are only added to the context of the active branch.
- Important Note: Context files are not used if you do not start your chat with :r.
:b <branch name>
: Switch to a different conversation branch
:s <conversation range>
: Split the conversation at the specified message range and create a new branch. The conversation range can be specified in the following formats:
:s num1-num2
: Creates a branch that includes conversations from num1
to num2
(inclusive).
:s num1-
: Creates a branch that includes conversations from num1
to the end of the conversation.
:s -num2
: Creates a branch that includes conversations from the beginning to num2
(inclusive).
:s num
: Creates a branch that includes conversations from the beginning to num
(inclusive).
This command is particularly useful when one of the AI agents reaches its context window limit, and you still want to keep the relevant part of the context. For example, if an AI agent has a context limit of 10 messages and the conversation has exceeded that limit, you can use :s -10
to create a new branch with the last 10 messages. This way, you can continue the conversation with the AI agent in the new branch while preserving the relevant context.
:v <tag>
: Tag the last user message with a custom tag. You can click on the tagged message to navigate to that part of the conversation.
:t
: Trims the context history for the default or current model. This option is useful when the conversation history becomes too long and exceeds the token limit of the model. By using :t
, the context history will be automatically trimmed to fit within the token limit, keeping the most recent and relevant messages.
@<model> :t
: Trims the context history for a specific model. This option allows you to switch to a different model and trim the context history specifically for that model. It is useful when you want to use a different model with a limited context history.
:del <branch name>
: Delete a conversation branch
:del <conversation index>
: Delete a specific user-assistant exchange from the conversation, identified by its index number
:save
: Save the current branch content to a file
:copy
: Copy the current branch content to the clipboard
:help
: Show the help message
Managing Conversation Branches
In addition to the commands mentioned above, CodeCrew provides a user-friendly interface for managing conversation branches:
- Click the "+" button to create a new branch. You can either start with a blank branch or upload an existing chat history in JSON format.
- Each branch is displayed with its name and a context menu (accessed by right-clicking the branch name). The context menu provides options to copy the branch content, save it to a file, or delete the entire branch.
- Expand a branch to view the conversation history, including any tagged messages. Tagged messages are displayed with a colored tag, and you can click on them to navigate directly to that part of the conversation.
Accessing CodeCrew
CodeCrew can be accessed through the chat tab in your IDE. If you close the chat tab, you can easily reopen it by clicking on the smiley icon located in the bottom right corner of your IDE.
By combining these commands and interface elements, CodeCrew offers a comprehensive set of tools for efficient conversation management, context integration, and collaboration with AI models within your coding environment.