使用静态上下文进行免费 AI 编码
CWC is a free and privacy-first AI coding toolkit for VS Code.
## Introduction **CWC** proposes a workflow that is 10X faster at one-tenth the cost of coding with agents alone. #### The workflow 1. Type instructions 2. Run [Agentic Search](#-agentic-search) for task-relevant context files 3. Select useful examples for model guidance 4. Send a zero-overhead [file editing](#-file-editing) prompt with a chatbot or an API call 5. Apply the response #### Key takeaways - shorter reasoning when intent is easier to unpack - limiting tool calling to directory and file lookups - live examples from the repository replace skills - context reuse without ever-growing sessions - iterate on instructions without context bloat ## Privacy **CWC** operates 100% on your machine—no code, prompts or usage data are collected. ## Prompts **CWC** helps construct prompts for common day-to-day coding tasks. ### Agentic search _Task-relevant files from your favorite coding agent, utilizing its one-off prompt (headless) mode._ #### Supported CLIs - Antigravity - Claude Code - Codex - Cursor - Grok Build - Muse Code - OpenCode AGENT ``` # Task In the project, find the complete set of primary and structural files relevant to the query. # Output formatting Output strictly as a bulleted list of file paths without explanations or any other text (e.g., - `path/to/file.ext`). # Query [INSTRUCTIONS] ``` ### Intelligent search _A quick way for task-relevant files from a single message._ WEB ``` # Files [WORKSPACE FILES/SPECIFIC FOLDER/SELECTED FILES] # Task Among the attached files, find the complete set of primary and structural files relevant to the query. # Output formatting Your response must begin with "**Intelligent file search results:**", then a bulleted list of file paths, followed by a brief explanation. Example: **Intelligent file search results:** * `src/index.ts` * `src/greetings/hello.ts` * `src/greetings/welcome.ts` These files contain the core greeting logic and module exports. # Query [INSTRUCTIONS] ``` API ``` # Files [WORKSPACE FILES/SPECIFIC FOLDER/SELECTED FILES] # Task Among the attached files, find the complete set of primary and structural files relevant to the query. # Output formatting Output strictly as a bulleted list of file paths without explanations or any other text. Example: * `src/index.ts` * `src/greetings/hello.ts` * `src/greetings/welcome.ts` # Query [INSTRUCTIONS] ``` ### File editing _Implementing new features, fixing bugs or doing refactors._ WEB/API ``` # Files [SELECTED FILES] # Output formatting Whenever showing a new, updated, renamed, or deleted file, provide a brief explanation, then print the path in a markdown heading (e.g. ### New file: `src/examples/hello.py`, ### Updated file: `src/examples/hello.py`, ### Renamed file: `src/examples/hello.py` (old) `src/welcome.py` (new), ### Deleted file: `src/examples/hello.py`), followed by a markdown code block showing the original and updated code snippets with Git-style merge conflict syntax. Example: [EXAMPLE] # Task [INSTRUCTIONS] ``` ### Asking about files _Multi-purpose: explanations, code reviews, you name it._ WEB/API ``` # Files [SELECTED FILES] # Task [INSTRUCTIONS] ``` ### Code at cursor _TAB completions from SOTA reasoning models._ WEB ``` … ``` API ``` # Files [SELECTED FILES] ### File `[ACTIVE FILE PATH]` [PREFIX][INSTRUCTIONS][SUFFIX] # Output formatting Find correct replacement for the symbol. Respond with replacement text within "replacement" XML tags, without explanations or any other text. Example: !== undefined' ``` ### Commit messages _Generate commit messages based on staged changes and context files._ WEB/API ``` # Files [SELECTED FILES WHEN EDITS WERE ACCEPTED] # Changes [STAGED CHANGES] # Output formatting Your response must begin with "**Commit message:**", then proceed with the message. Example: **Commit message:** Bump version to 1.0.1 # Task Write a brief and precise summary for the changes, limited to a single sentence. Because the summary will be used for a commit message, don't use any markdown formatting and don't include a trailing dot. Use an imperative tone to ensure clarity and focus on the primary change or purpose. ``` ### Patch repair _Applying malformed edits._ WEB/API ``` [ORIGINAL FILE] [MALFORMED EDITS] # Output formatting Your response must begin with a markdown heading identifying the file, followed by a markdown code block containing the updated file. The heading must be: "### Patch repair: `path/to/file.ext`". Example: [EXAMPLE] # Task Apply the attached changes to the file without explanations or any other text. ``` ## Prompt caching **CWC** orders context files by modification and selection recency. This, combined with instructions placement at the message's very end effecively utilizes prompt caching, across tasks. ## Enabling autofill Automatically place prompts in your favorite chatbot via the official browser extension ([source code](https://github.com/robertpiosik/CodeWebChat/tree/dev/apps/browser)). - [Chrome Web Store](https://chromewebstore.google.com/detail/autofill-for-code-web-chat/ljookipcanaglfaocjbgdicfbdhhjffp) - [Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/autofill-for-code-web-chat/) > [!TIP] > Elevate your workflow with smart workspaces (called [projects](https://help.openai.com/en/articles/10169521-projects-in-chatgpt), [gems](https://gemini.google/pl/overview/gems), or [spaces](https://docs.github.com/en/copilot/concepts/context/spaces)). #### Supported chatbots - AI Studio - Arena - ChatGPT - Claude - Copilot - DeepSeek - Doubao - Gemini - GitHub Copilot - Grok - HuggingChat - Kimi - Meta - Mistral - Open WebUI - OpenRouter - Qwen - Together - Yuanbao - Z > [!IMPORTANT] > The _Apply response_ button placed under responses is not a means of automatic output extraction, it's an alias for the original _copy to clipboard_ button. Review the [content script](https://github.com/robertpiosik/CodeWebChat/blob/dev/apps/browser/src/content-scripts/send-prompt-content-script/send-prompt-content-script.ts) to learn about implementation details. > [!NOTE] > Use [forwarding](https://code.visualstudio.com/docs/debugtest/port-forwarding) of port _55155_ when using remote machine via SSH. ## Commands ### Code at Cursor - `Code at Cursor` - Get an inline snippet while using the current context. - `Code at Cursor using...` - Inline snippet with configuration selection. - `Code at Cursor with Instructions` - Inline snippet with instructions. - `Code at Cursor with Instructions using...` - Inline snippet with instructions and configuration selection. ### Context - `Save File Selection` - Save the current context. - `Restore File Selection` - Restore a saved context. - `Select Workspace File...` - Select a file from the workspace. - `Search Files...` - Select files based on a search query. - `Search in Selected Files...` - Search within currently selected files. - `Select Clipboard Paths...` - Select files based on paths in your clipboard. - `Select Unstaged Files...` - Select files with unstaged changes. - `Select Files of Commit...` - Select files modified in a specific commit. ### Copy - `Copy Markdown` - Copy contents of the current file selection. - `Copy Markdown of Open Editors` - Copy contents of file selection in open editors. - `Copy Paths...` - Copy paths of the current file selection. - `Copy Paths of Open Editors...` - Copy paths of file selection in open editors. ### Commit messages - `Commit Changes` - Generate commit message in your preferred style and commit. ### History - `History` - Manage saved states of the workspace. - `Create New Checkpoint` - Create a history entry of the workspace state. ### Actions - `Apply Chat Response` - Integrate LLM response. ### Misc - `Duplicate Workspace` - Copy the extension's state in a new window. ## Building from source ### Prerequisites - [Node.js](https://nodejs.org/) (v20.x recommended) - [pnpm](https://pnpm.io/) ### Steps 1. Clone the repository: `git clone https://github.com/robertpiosik/CodeWebChat.git && cd CodeWebChat` 2. Install workspace dependencies: `pnpm install` 3. Navigate to the editor app and build the package: `cd apps/editor && pnpm run build` 4. Install the generated `.vsix` file in VS Code: Open the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`), run **Extensions: Install from VSIX...**, and select the newly created file.暂无开放 Issues,或尚未同步最近议题。