agentleFS
mcowgermcowger/generic-copilot/AGENTS.md

generic-copilot

AGENTS.md41 starsChanged 12 months agoMITArchived repositoryView on GitHub

Purpose: This file provides context, instructions, and rules for AI coding agents working on the generic-copilot project. Agents MUST read and follow these guidelines. generic-copilot is a Visual Studio Code extension that integrates any Vercel AI SDK-compatible LLM provider into GitHub Copilot Chat. It leverages the VS Code Language Model API to act as a chat provider. Key Features: * Acts as a languageModelChatProvider. * Supports multiple providers (OpenAI, OpenRouter, Google, etc.) via Vercel AI SDK. * Includes a React-based…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

18 rules. About 0 are common, 2 are distinctive, and 16 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 16

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Root (Extension): Run npm install in the project root.

    line 29
  2. Very specific:

    Webview (UI): Run npm install in webview-ui/.

    line 30
  3. Distinctive:

    Do not run terminal commands to verify files - use built in tools where possible.

    line 39
  4. Very specific:

    NEVER: use console.log, console.info, console.error or print.

    line 48
  5. Very specific:

    ALWAYS: use the OutputLogger singleton from src/outputLogger.ts.

    line 49
  6. Very specific:

    Import: import { logger } from "./outputLogger".

    line 50
  7. Very specific:

    Use vscode.workspace.getConfiguration("generic-copilot") to access settings.

    line 64
  8. Very specific:

    Use vscode.secrets for storing sensitive data like API keys.

    line 65
  9. Very specific:

    Use named caches per concern (e.g., toolCallMetadata, yourFeatureName) to avoid cross-contamination.

    line 78
  10. Distinctive:

    If you add a new metadata type, define or import a small interface for it near the usage site and cast explicitly when reading/writing the …

    line 80
  11. Very specific:

    Create a new client in src/ai/providers/ implementing ProviderClient.

    line 83
  12. Very specific:

    Update src/ai/providerClientFactory.ts to handle the new vercelType.

    line 84
  13. Very specific:

    Update package.json configuration schema to allow the new type.

    line 85
  14. Very specific:

    Update webview-ui components if specific UI handling is needed.

    line 86
  15. Very specific:

    When adding new properties to ModelItem or ProviderConfig in src/types.ts:

    line 89
  16. Very specific:

    Update Type Definitions: Add the property to the interface in src/types.ts.

    line 90
  17. Very specific:

    Update Configuration Schema: Add the property to package.json under contributes.configuration.

    line 91
  18. Very specific:

    Update UI Components: Update the relevant React components (e.g., webview-ui/src/components/Models.tsx or Providers.tsx) to display and …

    line 94

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Purpose: This file provides context, instructions, and rules for AI coding agents working on the generic-copilot project. Agents MUST read and follow these guidelines.

1. Project Overview

generic-copilot is a Visual Studio Code extension that integrates any Vercel AI SDK-compatible LLM provider into GitHub Copilot Chat. It leverages the VS Code Language Model API to act as a chat provider.

Key Features:

  • Acts as a languageModelChatProvider.
  • Supports multiple providers (OpenAI, OpenRouter, Google, etc.) via Vercel AI SDK.
  • Includes a React-based Webview for configuration and monitoring (webview-ui).
  • Uses VS Code Secret Storage for API keys.

2. Tech Stack & Dependencies

  • Runtime: Node.js (VS Code Extension Host).
  • Language: TypeScript (Strict mode).
  • Frameworks:
    • VS Code Extension API: Uses proposed APIs (chatProvider, languageModel*).
    • Vercel AI SDK: Core AI logic (@ai-sdk/openai, @ai-sdk/google, ai).
    • React: Used in webview-ui for the configuration panel.
  • Package Manager: npm.

3. Development Workflow

Installation

The project has two distinct parts that need dependency installation:

  1. Root (Extension): Run npm install in the project root.
  2. Webview (UI): Run npm install in webview-ui/.

Helper Task: The shell: Prepare Env task in VS Code automates this.

Build Scripts (package.json)

  • npm run compile:all: Compiles both the extension and the webview.
  • npm run watch:extension: Watches src/ for changes and recompiles.
  • npm run watch:webview: Watches webview-ui/ for changes.
  • npm run package: Packages the extension into a .vsix file.
  • Do not run terminal commands to verify files - use built in tools where possible.

Debugging

  • Reloading: The extension implements a dev-time auto-restart watcher in src/extension.ts that reloads the window when out/ changes.

4. Coding Conventions & Rules

🛑 Logging (CRITICAL)

  • NEVER use console.log, console.info, console.error or print.
  • ALWAYS use the OutputLogger singleton from src/outputLogger.ts.
    • Import: import { logger } from "./outputLogger"; (or relative path).
    • Usage:
      • logger.info("Message")
      • logger.debug("Debug info")
      • logger.warn("Warning")
      • logger.error("Error message", errorObj)

Error Handling

  • Catch errors explicitly.
  • Log errors using logger.error(), passing the error object to capture the stack trace.
  • Show user-facing errors using vscode.window.showErrorMessage ONLY if immediate user action is required.

VS Code API Usage

  • This extension relies on Proposed APIs. Ensure enabledApiProposals in package.json matches the APIs used.
  • Use vscode.workspace.getConfiguration("generic-copilot") to access settings.
  • Use vscode.secrets for storing sensitive data like API keys.

Architecture

  • src/extension.ts: Entry point. Registers providers and commands.
  • src/ai/: Contains Vercel AI SDK integration.
    • providerClientFactory.ts: Instantiates the correct client based on config.
    • providers/: specific implementations (e.g., google.ts, openai.ts).
  • src/configurationPanel.ts: Handles the Webview panel creation and message passing.
  • webview-ui/: Standalone React application. Builds to out/webview-ui/.

Metadata Cache (important)

  • The cache lives in src/ai/utils/metadataCache.ts and is accessed via CacheRegistry.getCache(name).
  • The cache stores unknown; always cast on get/set to the shape you expect (e.g., as ToolCallMetadata). Do not widen the cache type globally.
  • Use named caches per concern (e.g., toolCallMetadata, yourFeatureName) to avoid cross-contamination. Avoid reusing names across unrelated features.
  • The cache has a size limit (FIFO eviction). Do not store large payloads or secrets; it is meant for transient provider metadata (e.g., Google thoughtSignature).
  • If you add a new metadata type, define or import a small interface for it near the usage site and cast explicitly when reading/writing the cache.

5. Adding New Providers

  1. Create a new client in src/ai/providers/ implementing ProviderClient.
  2. Update src/ai/providerClientFactory.ts to handle the new vercelType.
  3. Update package.json configuration schema to allow the new type.
  4. Update webview-ui components if specific UI handling is needed.

6. Modifying Data Models (Configuration)

When adding new properties to ModelItem or ProviderConfig in src/types.ts:

  1. Update Type Definitions: Add the property to the interface in src/types.ts.
  2. Update Configuration Schema: Add the property to package.json under contributes.configuration.
  3. Update Webview Data Mapping:
    • CRITICAL: You MUST update the toGrouped function in webview-ui/src/App.tsx to include the new property. The Webview does not automatically ingest new fields; they must be explicitly mapped.
  4. Update UI Components: Update the relevant React components (e.g., webview-ui/src/components/Models.tsx or Providers.tsx) to display and edit the new field.

Failure to follow these rules, especially regarding logging and build processes, will result in rejected code.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.