✨ Cody Sidekick ✨

A Visual Studio Code extension providing a unified sidebar panel for managing configurations and accessing guides for the Cody AI extension by Sourcegraph.
Cody Sidekick aims to simplify your Cody configuration workflow. Stop manually editing JSON and Markdown files! Manage your Custom Models, experimental Custom Rules, view Official Docs, and access helpful Prompting Guides—all from a convenient panel in your Activity Bar.
Core Features
- 🏠 Unified UI Panel: Access all features from a single "Cody Sidekick" icon (
$(tools) ) in the Activity Bar.
- ⚙️ Custom Models Manager:
- Visually manage
cody.dev.models in your settings.json .
- Easily switch between Workspace and User (Global) configuration scopes via tabs.
- Add, Edit, and Delete custom model configurations through a user-friendly form.
- Supports standard and advanced fields: Provider, Model ID, Display Name, API Model Identifier (for compatible types), Max Input/Output Tokens, Capabilities (Chat, Autocomplete, Reasoning), Category, Status, Reasoning Effort (if reasoning supported), API Key, and API Endpoint (optional/required based on provider).
- Clear card-based overview of all configured models in the selected scope.
- Handles conditional display of fields based on provider selection.
- 🧪 Custom Rules Manager (Experimental):
- Manage custom rule files (
*.rule.md ) within the .sourcegraph directory of your workspace.
- Add new rules via a form (Title, Language, Description, Content), automatically generating filenames and frontmatter.
- Edit the content and metadata of existing rules loaded from the
.sourcegraph folder.
- Delete rule files directly from the UI.
- Easily toggle the global
cody.rules.enabled setting required for rules to function.
- 📚 Documentation Viewer:
- View the official Sourcegraph Cody documentation directly within VS Code via an embedded iframe.
- 💡 Tips & Tricks Section:
- Cody Prompts Guide: A dedicated guide on writing effective prompts specifically for Cody's features (Chat, Commands, Autocomplete).
- Prompt Engineering Guide: A detailed general guide covering principles and advanced techniques (like Zero-Shot, Few-Shot, CoT) for crafting effective prompts for any Large Language Model (LLM).
- 🎨 Native Look & Feel: Uses VS Code theme variables for seamless integration.
- ↩️ Easy Navigation: Simple menus allow quick switching between managers and guides.
- 📢 Output Channel: Provides detailed logs for troubleshooting under "Cody Sidekick".
Installation
- Install Cody Sidekick from the Visual Studio Code Marketplace.
- Ensure you have the official Cody AI extension by Sourcegraph installed and configured.
- (For Rules Feature Only):
- You need to have a workspace/folder open in VS Code.
- Enable the
Cody Experimental Rule setting. You can do this easily within the "Manage Custom Rules" section of this extension, or manually search for "Cody Experimental Rule" in VS Code settings and check the box.
Getting Started
- Access: Click the Cody Sidekick icon (
$(tools) ) added to your Activity Bar (the leftmost sidebar).
- Main Menu: The Cody Sidekick panel will open, displaying the main navigation menu.
- Navigate:
- Click "Manage Custom Models" to manage
cody.dev.models in settings.json .
- Click "Manage Custom Rules (Experimental)" to manage
.rule.md files in .sourcegraph .
- Click "View Official Docs" to browse the Cody documentation.
- Click "Tips & Tricks" to access the prompting guides.
- Use the "Back" or "Back to Menu" buttons within each section to navigate.
Features in Detail
Custom Models Manager
- Access: Main Menu → Manage Custom Models.
- Scopes: Use the "Workspace" and "User (Global)" tabs to select which
settings.json scope to modify.
- Adding Models: Click "Add Model". Fill in the details. Required fields depend on the provider, but typically include Provider, Model ID, Tokens, and API Key (for new models). Optional fields like Display Name, API Endpoint, API Model Name, Capabilities, Category, Status, and Reasoning Effort enhance configuration.
- Editing/Deleting: Models are shown as cards. Use "Edit" (pencil) and "Delete" (trash) icons. When editing, leave the API Key field blank to keep the existing key.
- Conditional Fields: The form smartly shows/hides fields like "API Model Identifier", "API Endpoint", and "Reasoning Effort" based on the selected provider or capabilities.
- Refreshing: Use the "Refresh" icon if you manually edit
settings.json .
Custom Rules Manager (Experimental)
Access: Main Menu → Manage Custom Rules (Experimental).
Requirement: Requires an open workspace and the Cody Experimental Rule setting to be enabled.
Functionality: Create, edit, and delete .rule.md files inside a .sourcegraph directory at your workspace root. Cody uses these to tailor chat behavior.
Adding Rules: Fill in Title (used for filename), optional Language/Description, and the Rule Content. Click "Save Rule".
Editing/Deleting: Existing rules are listed. "Edit" loads the rule into the form; "Delete" removes the file.
Settings Toggle: A toggle at the top allows enabling/disabling the necessary cody.rules.enabled global setting directly.
File Structure: The manager creates/modifies files with YAML frontmatter:
'''markdown
title: Your Rule Title
lang: yourlanguage # Optional
description: Your optional description # Optional
Your detailed rule content...
'''
Documentation Viewer
- Access: Main Menu → View Official Docs.
- Functionality: Embeds
https://sourcegraph.com/docs/cody within the panel for quick reference without leaving VS Code.
Tips & Tricks
- Access: Main Menu → Tips & Tricks.
- Functionality: Provides access to helpful guides:
- Cody Prompts Guide: Focuses on practical tips for prompting Cody features effectively (Chat, Commands, context usage).
- Prompt Engineering Guide: A comprehensive guide covering general principles (Clarity, Context, Persona, Constraints) and techniques (Zero-Shot, Few-Shot, Chain-of-Thought, Self-Consistency, Role Reversal, Decomposition) applicable to interacting with any LLM.
Configuration Modified
This extension modifies the following based on your actions:
Custom Models Manager: The cody.dev.models array within your VS Code settings.json file (User or Workspace scope).
{
// ... other settings
"cody.dev.models": [
// Models configured via the Sidekick will appear here
{
"provider": "google",
"model": "gemini-1.5-pro-latest",
"displayName": "Gemini 1.5 Pro",
"apiKey": "YOUR_API_KEY_HERE", // Stored in settings.json
"category": "accuracy",
"status": "stable",
"capabilities": ["chat"],
"contextWindow": {
"maxInputTokens": 1048576,
"maxOutputTokens": 8192
}
},
{
"provider": "groq",
"model": "mixtral-8x7b-32768",
"modelName": "mixtral-8x7b-32768", // Required by compatible provider
"apiKey": "YOUR_GROQ_KEY", // Stored in settings.json
"apiEndpoint": "https://api.groq.com/openai/v1", // Required by Groq
"category": "speed",
"capabilities": ["chat", "autocomplete", "reasoning"],
"reasoningEffort": "medium", // Optional if reasoning capability selected
"contextWindow": {
"maxInputTokens": 32768,
"maxOutputTokens": 4096
}
}
// ... other models
]
}
Custom Rules Manager: Creates, modifies, or deletes files matching *.rule.md inside the .sourcegraph directory in your workspace root.
Example (.sourcegraph/use-async-await.rule.md ):
'''markdown:.sourcegraph/use-async-await.rule.md
title: Use Async/Await
lang: javascript
description: Prefer async/await over Promise.then() for cleaner asynchronous code
When writing asynchronous JavaScript code, use the async and await keywords instead of .then() and .catch() chains where possible.
Reasoning:
async/await makes asynchronous code look and behave a bit more like synchronous code, which helps with readability and debugging. Error handling with try...catch is often more straightforward.
Bad Code:
'''javascript
function fetchData(url) {
fetch(url)
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Fetch error:', error);
});
}
'''
Good Code:
'''javascript
async function fetchData(url) {
try {
const response = await fetch(url);
const data = await response.json();
console.log(data);
} catch (error) {
console.error('Fetch error:', error);
}
}
'''
'''
Custom Rules Manager: The cody.rules.enabled setting in your VS Code global settings.json .
{
// ... other settings
"cody.rules.enabled": true // or false, managed by the toggle
}
Important Notes & Limitations
- Rules are Experimental: The custom rules feature in Cody itself is experimental. Use with caution and expect potential changes.
- Rules Manager requires an open workspace folder.
- Does not manage the advanced
cody.experimental.symf.path or other complex experimental settings.
- Does not manage the more complex
cody.codebase , cody.serverEndpoint , or enterprise-specific authentication settings.
- Basic input validation is performed, but provider-specific model rules or complex rule syntax are not enforced by this extension.
Requirements
- Visual Studio Code (latest version recommended).
- Cody AI extension by Sourcegraph installed and configured (logged in).
- (For Rules): An open workspace/folder in VS Code.
- (For Rules): The
Cody Experimental Rule setting enabled in VS Code settings (can be toggled within the extension).
Known Issues
- Please report any bugs or unexpected behavior via the repository's issue tracker (link TBD) or by contacting the maintainer.
Contributing & Feedback
Contributions, suggestions, and bug reports are welcome! Please feel free to contact Kynlo on Discord or open an issue/PR on the repository (link TBD).
| |