How marcfs31/kevin-ai works
Kevin AI combines a local C inference engine, a browser-based chat application, and a Python tool service. The main workflow is user chat in the web app, streamed requests to the model server, and optional tool use against configured projects and integrations. The graph preserves documented model loading, vision, quantization, and project capabilities. Source excerpts are partial, so some documented subsystem links are shown without claiming unsampled implementation details.
Main entry points: chat_tools.py Tool service · lm_chat.c Chat generation · lm_model.c Model-family dispatch · App.tsx Chat interface
Components 31
Web chat
- Chat interface
web/src/App.tsx - Browser conversations
web/src/lib/storage.ts - Files and images
web/src/lib/attachments.ts - Agent workflow
web/src/lib/agent.ts - HTTP and streaming API
web/src/lib/api.ts
Inference engine
- Model HTTP server
src/cli/lm-serve.c - Chat generation
src/chat/lm_chat.c - Prompt templates
src/chat/lm_template.c - Tool call formatting
src/chat/lm_toolfmt.c - Text tokenizer
src/tokenizer/lm_tok.c - Inference API
include/lm/lm.h - Quantization command
src/cli/lm-quant.c
Tool service
- Tool service
tools/chat_tools.py - Project operations
tools/chat_projects.py - Tool server
tools/chat_server.py - MCP integrations
tools/chat_tools.py - Web search
tools/chat_tools.py - Project files and git
Model runtime
- Model-family dispatch
src/model/lm_model.c - Gemma model
src/model/lm_gemma.c - Qwen2 model
src/model/lm_qwen2.c - Vision encoder
src/model/lm_vision.c - Safetensors reader
src/io/lm_st.c - GGUF reader
src/io/lm_gguf.c - Tensor operations
src/core/lm_ops.c - CPU kernels
src/core/lm_kernels.c - Weight quantization
src/core/lm_quant.c
Other components
- User
- GitHub
- MCP servers
- SearXNG
Connections 29
- User → Chat interface: chats in
README.md - Chat interface → Browser conversations: loads and saves
web/src/App.tsx - Chat interface → Agent workflow: runs
web/src/App.tsx - Chat interface → HTTP and streaming API: requests
web/src/App.tsx - Files and images → HTTP and streaming API: supplies content
web/src/lib/attachments.ts - HTTP and streaming API → Model HTTP server: streams requests
README.md - HTTP and streaming API → Tool service: calls tools
README.md - Model HTTP server → Chat generation: dispatches chat
src/cli/lm-serve.c - Chat generation → Prompt templates: renders prompts
- Chat generation → Text tokenizer: uses token IDs
- Chat generation → Inference API: feeds tokens
include/lm/lm.h - Chat generation → Tool call formatting: formats tool calls
- Model-family dispatch → Gemma model: dispatches family
src/model/lm_model.c - Model-family dispatch → Qwen2 model: dispatches GGUF
src/model/lm_model.c - Model-family dispatch → Safetensors reader: binds weights
src/model/lm_model.c - Model-family dispatch → GGUF reader: locates GGUF
src/model/lm_model.c - Gemma model → Tensor operations: runs operations
- Gemma model → CPU kernels: uses kernels
- Model HTTP server → Vision encoder: handles images
src/cli/lm-serve.c - Quantization command → Weight quantization: quantizes weights
- Tool service → Tool server: serves requests
tools/chat_tools.py - Tool service → Project operations: delegates project work
tools/chat_tools.py - Tool service → MCP integrations: runs MCP tools
README.md - Tool service → Web search: searches web
README.md - Tool server → Project files and git: accesses projects
README.md - Project operations → Project files and git: works with files and git
- Tool service → GitHub: opens pull requests
README.md - MCP integrations → MCP servers: connects to
README.md - Web search → SearXNG: queries
README.md