Keural AI — VS Code Extension
An AI chat assistant extension for Visual Studio Code, powered by the Keural AI platform.
Features
- AI Chat Sidebar — Persistent chat panel in the activity bar for ongoing conversations with Keural AI
- Ask About Code — Select any code, right-click, and ask a question about it
- Explain Code — Select code and instantly get an AI-generated explanation
- New Chat — Start a fresh conversation at any time
- Streaming Responses — Responses stream token-by-token in real time
- Secure Authentication — Login via browser OAuth flow; API key stored in VS Code's encrypted SecretStorage
- Agent Mode — Executes local tools (read/write files, run terminal, search code) in a loop to complete coding tasks autonomously
The extension does not call the LLM directly. Every message goes through the full Keural backend stack — FastAPI orchestration and the RAG pipeline — before reaching the model.
Architecture
┌─────────────────────────────────────────────────────────────┐
│ VS Code Extension │
│ │
│ Chat Mode Agent Mode │
│ User types message User types task │
│ │ │ │
│ keuralClient.ts agentClient.ts │
│ (SSE stream) (SSE stream + tool loop) │
└──────────────┬──────────────────────────┬───────────────────┘
│ │
│ POST /fastapi/v1/ │ POST /agent/chat
│ experiment/chat │ (keural-vscode-agent)
│ │
▼ ▼
┌─────────────────────────┐ ┌──────────────────────────────┐
│ Keural FastAPI │ │ keural-vscode-agent │
│ (Orchestration) │ │ (Local Agent Service) │
│ │ │ │
│ • Builds system prompt │ │ • Specialized coding agent │
│ • Loads conversation │ │ • Calls same FastAPI chat │
│ history from Spring │ │ endpoint internally │
│ • Decides: RAG? Web? │ │ • Returns tool_call events │
│ File creation? │ │ for extension to execute │
│ • Calls RAG service │ └──────────────────────────────┘
│ for document context │ │
│ • Streams SSE response │ Tool results sent back in loop
└──────────┬──────────────┘ │
│ │
▼ ┌────────▼──────────────────┐
┌──────────────────────┐ │ Extension executes tools │
│ RAG Service │ │ locally inside VS Code: │
│ │ │ • read_file │
│ • Vector search │ │ • write_file │
│ (Qdrant) │ │ • edit_file │
│ • Reranking │ │ • list_files │
│ • Returns relevant │ │ • run_terminal │
│ document context │ │ • search_code │
└──────────────────────┘ └───────────────────────────┘
│
▼
┌──────────────────────┐
│ LLM Model │
│ (via vLLM) │
│ │
│ Keural AI Platform │
└──────────────────────┘
Chat Mode Flow
- User sends a message in VS Code
- Extension sends it to FastAPI
/fastapi/v1/experiment/chat
- FastAPI builds the system prompt and loads conversation history from Spring
- FastAPI calls RAG service if document context is needed
- RAG retrieves and reranks relevant chunks from Qdrant vector DB
- FastAPI sends the full context + message to the LLM and streams the response back
- Extension displays the streamed response token-by-token
Agent Mode Flow
- User sends a coding task in VS Code
- Extension sends it to keural-vscode-agent (local backend)
- Agent calls FastAPI, which routes through the full RAG + LLM stack
- LLM responds with a
tool_call (e.g. read_file, run_terminal)
- Extension executes the tool locally inside VS Code
- Tool result is sent back to the agent → loops until task is complete
- Final answer is streamed to the user
Requirements
- Visual Studio Code
v1.85.0 or higher
- A Keural AI account (keural.ai)
- Desktop VS Code (not code-server) — required for the
vscode:// URI login callback
Installation
From VS Code Marketplace
Search for Keural AI in the Extensions panel (Ctrl+Shift+X) and click Install.
From .vsix (manual)
- Download the latest
.vsix from the Releases page
- Open VS Code → Command Palette (
Ctrl+Shift+P) → Extensions: Install from VSIX...
- Select the downloaded file
From source
git clone git@github.com:MKD-CORP/keural-vscode-extension.git
cd keural-vscode-extension
npm install
npm run compile
Then press F5 in VS Code to launch the Extension Development Host.
Getting Started
1. Login
- Click the Keural AI icon in the activity bar (left sidebar)
- Click Login
- Your browser will open the Keural login page
- After logging in, VS Code receives the auth callback automatically
2. Chat Mode
- Type your message in the chat input and press Enter or click Send
- Responses stream in real time, powered by the full RAG + LLM pipeline
3. Agent Mode
- Click the Agent button in the header to switch modes
- Describe a coding task (e.g. "create a React component", "fix the bug in utils.ts")
- The agent will read files, write code, and run terminal commands autonomously
4. Ask About Selected Code
- Select code in the editor
- Right-click → Keural: Ask About Selected Code
- Enter your question — the chat panel opens with the answer
5. Explain Code
- Select code in the editor
- Right-click → Keural: Explain Code
- The chat panel opens with an explanation
Commands
| Command |
Description |
Keural: Login |
Open browser to log in to Keural AI |
Keural: Logout |
Clear the current session |
Keural: New Chat |
Start a new conversation |
Keural: Ask About Selected Code |
Ask a question about selected code |
Keural: Explain Code |
Get an explanation of selected code |
Extension Settings
| Setting |
Default |
Description |
keural.apiUrl |
https://dev-api.keural.ai |
Keural FastAPI backend URL |
keural.agentUrl |
http://110.8.41.182:28100 |
Keural VS Code Agent backend URL |
keural.springUrl |
https://keural.ai |
Keural Spring API URL (for login) |
keural.webSearch |
false |
Enable web search in responses |
keural.locale |
auto-detected |
Response language (ko or en), auto-detected from VS Code locale |
Authentication Flow
User clicks Login
→ Browser opens: https://dev-api.keural.ai/api/app-auth
→ User logs in on Keural web
→ Spring redirects to: vscode://mkd-corp.keural-vscode/auth?code=UUID
→ VS Code URI handler receives the code
→ Extension exchanges code: POST /api/app-auth/token
→ Receives apiKey (no expiry)
→ apiKey stored in VS Code SecretStorage
The apiKey is sent as Authorization: Bearer {apiKey} on all subsequent API requests.
Development
Project Structure
keural-vscode/
├── src/
│ ├── extension.ts # Entry point, command & URI handler registration
│ ├── authManager.ts # SecretStorage-based session management
│ ├── roomManager.ts # Chat room ID management
│ ├── keuralClient.ts # SSE streaming chat client (Chat mode)
│ ├── agentClient.ts # SSE streaming agent client (Agent mode)
│ └── chatViewProvider.ts # Webview panel provider
├── media/
│ ├── chat.html # Webview HTML
│ ├── chat.css # Webview styles
│ ├── chat.js # Webview scripts
│ ├── keural_logo.png # Extension marketplace icon
│ └── keural_mark.svg # Activity bar icon (K symbol)
└── package.json
Build
npm run compile # One-time build
npm run watch # Watch mode
npm run lint # ESLint
Package
npm install -g @vscode/vsce
vsce package --allow-missing-repository
Supported Models
Publisher
MKD Corp (mkd-corp)
License
Private — All rights reserved © MKD Corp