Architecture
How Cortex Works
Cortex is a VS Code extension that integrates OpenCode as the agentic runtime (local server). Cortex adds the IDE layer β chat sidebar, local codebase context, and Cursor/Windsurf-like workflows β inside your own editor. Models come from your OpenCode subscription.
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β VS Code UI β ββ β Cortex Ext. β ββ β OpenCode β
β (Sidebar + β β (TypeScript) β β (Server) β
β Inline) β β β β β
ββββββββββββββββ ββββββββββββββββ ββββββββ¬ββββββββ
β
βββββββββΌββββββββ
β OpenCode β
β models β
β (your sub) β
βββββββββββββββββ Components
- SidebarProvider β manages the chat panel lifecycle, message routing, and plan/build modes
- OpenCode Client β HTTP client that talks to the local OpenCode server
- Context Service β gathers relevant code context via lexical + embedding search
- Inline Completion β provides ghost-text suggestions in the editor
- Plan Store β manages saved plans with checklists for the PlanβBuild workflow
Plan β Build Workflow
- Plan mode: Cortex analyzes your request and creates a structured plan with checklist
- Approval: You review and approve the plan
- Build mode: Cortex implements changes step by step, updating the checklist