How cplieger/vibekit works
1. Top-level shape
Vibekit is a two-part system: a Go backend that owns all state and orchestration, and a TypeScript frontend under static-src that renders a live UI from server events. The server is the source of truth; the browser never mutates state locally except by sending commands.
2. Primary runtime and entrypoints
The Go app starts from main.go / cmd/wire-codegen, with the main server code in internal/server. The repo also builds a container image and includes compose.yaml, so deployment is typically a single self-hosted service exposing one HTTP port.
3. Core interaction loop
The user interface sends mutations as POST /api/command-style requests, and the server broadcasts resulting state changes back to all connected clients over Server-Sent Events. This fan-out model is what enables multi-device, multi-tab synchronization without local optimistic state.
4. Chat orchestration center
internal/hub is the central application coordinator. It ties together chat state, command dispatch, terminal sessions, SSE streaming, permissions, model switching, pending actions, and bridge lifecycle management. If you are drawing the architecture, this is the main hub connecting most subsystems.
5. Agent bridge to Kiro
Each active chat owns a kiro-cli acp subprocess, managed by internal/bridge. This bridge converts between Vibekit’s internal command/event model and the Agent Client Protocol used by Kiro, and it streams model output, tool calls, and lifecycle events back into the hub.
6. Persistent chat and replay state
internal/chat, internal/buffer, internal/sessions, and internal/dedup implement chat storage, buffering, history retention, and replay behavior. The README describes one JSON file per chat with atomic writes, and the code tree shows dedicated archive/purge paths for retention and cleanup.
7. Workspace, files, and editor boundaries
internal/filehandler, internal/fileutil, internal/workspace, internal/steering, and parts of internal/hub handle filesystem access into /workspace. The frontend’s editor, diff, conflict, and file-browser modules mirror these server-side capabilities, but the server remains the gatekeeper for reads, writes, staging, and conflict handling.
8. Checkpoint and restore subsystem
internal/checkpoint implements a content-addressed snapshot system for workspace files, including indexing, diffing, restore, and garbage collection. This is separate from git: it supports atomic per-file restore and cross-chat conflict detection, so it should be shown as its own storage/restore boundary.
9. Supervised write gate and pending operations
In supervised mode, file writes are not applied directly. Instead they flow through internal/pending, internal/permissions, and hub-side staging logic so the user can accept/reject/merge at a per-hunk level before changes touch disk. This is a distinct control point between agent output and filesystem mutation.
10. Git and forge integrations
internal/git, internal/gitexec, internal/forges, and internal/steering cover repository introspection plus GitHub/GitLab/Gitea workflows. The system can inspect branches, commits, PRs, and sync state, and it uses first-party CLIs such as gh, glab, and tea through forge adapters and auth flows.
11. Authentication and identity
internal/auth manages login, logout, and who-am-I flows for the web UI, while TRUSTED_PROXIES affects how client IPs are resolved for audit logs. This is an application-level auth boundary; it protects the UI, but it does not reduce the underlying power of the agent over shell and workspace access.
12. MCP and tool ecosystem
internal/mcp plus hub-side MCP registry code manage Model Context Protocol server configuration, persistence, and prewarming. The frontend has dedicated MCP screens, but on the backend MCP is treated as a registry and routing concern for tools exposed to the agent.
13. Live terminal and subprocess control
internal/hub and internal/command coordinate a real browser terminal, per-agent command terminals, shell execution, and slash-command style actions. The server owns the PTY/subprocess lifecycle; the browser is only a transport and display layer.
14. Push notifications and external delivery
internal/push handles web-push subscription storage, crypto, validation, and sending. This is a separate outbound integration path used for turn-complete and permission prompts, and it depends on browser push infrastructure rather than the chat SSE channel.
15. Frontend structure
static-src is a large client-side application with action modules, handlers, UI primitives, transport/SSE plumbing, editor and chat views, and generated wire code. It is organized as a projection of server state: it listens to SSE, dispatches commands, and renders specialized screens for chat, files, git, MCP, settings, and terminal behavior.
16. Cross-cutting assurance and quality
The repo is heavily test-driven, with fuzz, property, and contract tests across most packages, plus CI, CodeQL, and security workflows. That matters architecturally because many boundaries are enforced by tests rather than by runtime frameworks, especially around protocol decoding, permissions, checkpointing, and state replay.
Main entry points: hub.go Chat hub · server.go HTTP server · transport.ts Transport · index.ts Action modules
Components 23
Go backend
Server-side orchestration, state, and integrations
- HTTP server · Routes UI, API, static assets, and security middleware
internal/server/server.go - Chat hub · Central coordinator for chat, commands, SSE, bridges, and workspace actions
internal/hub/hub.go - Commands · Turns UI and agent actions into executable operations
internal/command/command.go - Kiro bridge · Manages per-chat kiro-cli subprocesses and protocol translation
internal/bridge/bridge.go - Chat store · Persistent chat history, archive, purge, and replay state
internal/chat/store.go - Sessions · Tracks active conversations and replay/session continuity
internal/sessions/sessions.go - Output buffer · Buffers partial and replayable terminal/model output
internal/buffer/buffer.go - Dedup · Suppresses repeated events and noisy updates
internal/dedup/dedup.go - File gate · Reads, writes, uploads, listings, and download handling for workspace files
internal/filehandler/filehandler.go - Permissions · Supervised approval rules for commands and file mutations
internal/permissions/permissions.go - Pending ops · Tracks writes and merges awaiting user decision
internal/pending/pending.go - Auth · UI login, logout, and who-am-I flows
internal/auth/auth.go
TypeScript UI
Browser app that renders server state and sends commands
- Frontend app · Browser UI that renders server state and dispatches commands
static-src/app.ts - Transport · Client-side SSE and API plumbing for state sync
static-src/transport.ts - Action modules · UI command dispatchers for chat, files, git, MCP, permissions, and settings
static-src/actions/index.ts - UI views · Chat, editor, diff, files, terminal, git, MCP, and settings screens
static-src/chat.ts
Storage and external systems
Persistent state, git/forge, and outbound delivery boundaries
- Checkpoints · Content-addressed workspace snapshots, diff, restore, and GC
internal/checkpoint/manager.go - MCP registry · Persists and prewarms Model Context Protocol servers and tools
internal/mcp/store.go - Git layer · Repository introspection, staging, sync, and AI-assisted git actions
internal/git/handlers.go - Forge adapters · GitHub, GitLab, and Gitea auth and repo workflows via CLI and HTTP
internal/forges/manager.go - Push service · Web-push subscription storage and outbound notifications
internal/push/service.go
Packaging and entrypoints
Process startup and deployment surfaces
- Main entry · Go process startup and dependency wiring
main.go - Wire codegen · Generates dependency wiring for the Go app
cmd/wire-codegen/main.go
Connections 26
- Main entry → HTTP server: starts · Main process boots the HTTP server
- Wire codegen → Main entry: generates wiring · Dependency injection code supports startup composition
- HTTP server → Chat hub: routes to · Server hands application requests to the hub
- HTTP server → Auth: authenticates · Login and identity endpoints protect the web UI
- HTTP server → Frontend app: serves UI · Server delivers the browser application and assets
- Frontend app → Transport: listens/sends · Frontend consumes SSE and posts commands through transport
- Transport → HTTP server: API + SSE · Client talks to the server over command requests and event streams
- Transport → Action modules: dispatches · Transport feeds UI action handlers
- Action modules → UI views: updates · Actions drive specialized UI screens and panels
- Action modules → Chat hub: commands · UI mutations are sent as hub-facing commands
- Chat hub → Commands: executes · Central coordinator dispatches chat and shell operations
- Chat hub → Kiro bridge: spawns · Each active chat gets a managed Kiro bridge process
- Chat hub → Chat store: persists · Chat state and replay history are stored durably
- Chat hub → Sessions: tracks · Session lifecycle and active conversation state
- Chat hub → Output buffer: buffers · Output and replay data are buffered for streaming clients
- Chat hub → Dedup: filters · Repeated events are suppressed before fan-out
- Chat hub → File gate: gates files · Workspace reads and writes flow through file handling boundaries
- Chat hub → Checkpoints: snapshots · Workspace restore and diff use the checkpoint subsystem
- Chat hub → Permissions: checks policy · Supervised operations are validated before mutation
- Chat hub → Pending ops: stages writes · Pending mutations are held for approve/reject/merge flows
- Chat hub → MCP registry: routes tools · Hub exposes MCP registry and prewarm state
- Chat hub → Git layer: inspects repo · Git status, staging, sync, and repo workflows are coordinated here
- Git layer → Forge adapters: integrates · Forge adapters support hosting-provider workflows and auth
- Chat hub → Push service: notifies · Turn-complete and permission prompts can be delivered via push
- File gate → Checkpoints: restore/diff · Workspace file mutation boundary connects to snapshots and restore
- Permissions → Pending ops: governs · Approval policy determines whether staged operations can proceed