klyn-jarvis
v1.1.3
Published
JARVIS AI Assistant — Intelligent voice-enabled AI with streaming search, natural speech synthesis, and a JARVIS-inspired interface
Readme
KlynJarvis v1.1.0
JARVIS-inspired AI assistant with CLI, MCP, multi-provider LLM, parallel agents, and workflow automation
Node.js 18+ · TypeScript · Private License
What is KlynJarvis?
KlynJarvis is a JARVIS-inspired AI assistant featuring streaming chat, natural voice synthesis, and a cinematic dark interface. It offers dual interfaces — a Next.js web UI and a Commander.js CLI — backed by a 29-file agent subsystem with 25+ tools, parallel sub-agents, dynamic workflows, and MCP integration.
Features
| Category | Features | |---|---| | Web UI | Streaming SSE chat, Voice Engine v3 (prosody, emotional alignment), Wake word detection, Dark cinematic interface | | CLI | Interactive REPL, Single query mode, Web server mode, Configuration management | | MCP Server | 16 tools (code generation, analysis, debugging, refactoring), stdio transport, External tool integration | | Multi-Provider LLM | 30+ providers: OpenAI, Anthropic, Gemini, Mistral, Cohere, DeepSeek, Groq, Together, xAI, Qwen, Ollama, +20 more | | Agent System | 29-file subsystem, 25+ tools, Approval flow, Sandbox execution, Error recovery | | Parallel Agents | Sub-agent orchestration, Dependency graph resolution, 4 workflow templates | | Dynamic Workflows | Runtime script engine, Variable interpolation, 5 step types | | Permission Engine | Per-agent rulesets, Condition evaluation (path, command, time), Inheritance | | Event System | GlobalBus with middlewares, Event filtering, Replay, Performance monitoring | | Fork Sessions | Conversation branching, Session tree, 3 merge strategies | | Context Management | Token counting, Importance scoring, Automatic compression |
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ KlynJarvis v1.1.0 │
├────────────────────────────┬────────────────────────────────────┤
│ Web UI │ CLI (Commander.js) │
│ Next.js + React + Tailwind│ REPL / Chat / Serve / Config │
├────────────────────────────┴────────────────────────────────────┤
│ Agent System (29 files) │
│ ┌──────────┐ ┌───────────┐ ┌──────────┐ ┌──────────────────┐ │
│ │ Loop │ │ Tools │ │ Approval │ │ Permissions │ │
│ │ (v3) │ │ (25+) │ │ Flow │ │ (per-agent) │ │
│ └──────────┘ └───────────┘ └──────────┘ └──────────────────┘ │
│ ┌───────────┐ ┌───────────┐ ┌──────────┐ ┌────────────────┐ │
│ │ Parallel │ │ Workflows │ │ Events │ │ Fork Sessions │ │
│ │ Agents │ │ Runtime │ │ GlobalBus│ │ (branching) │ │
│ └───────────┘ └───────────┘ └──────────┘ └────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ MCP Server (16 tools, stdio transport) │
├─────────────────────────────────────────────────────────────────┤
│ Multi-Provider LLM (30+ providers, unified abstraction) │
│ OpenAI · Anthropic · Gemini · Mistral · Cohere · DeepSeek │
│ Groq · Together · Fireworks · xAI · Qwen · Ollama · +20 more │
└─────────────────────────────────────────────────────────────────┘Tech Stack
| Layer | Technology | |---|---| | Framework | Next.js 16 (App Router, standalone) | | UI | React 19, Tailwind CSS 4, shadcn/ui (48 components) | | State | Zustand 5 with localStorage persistence | | Database | Prisma ORM (SQLite dev / PostgreSQL prod) | | Voice | Web Speech API (STT + TTS), Voice Engine v3 | | AI/LLM | 30+ providers: OpenAI, Anthropic, Gemini, Mistral, Cohere, DeepSeek, Groq, Together, xAI, Qwen, Ollama, +20 more | | CLI | Commander.js 12, tsx (dev), esbuild (bundle) | | MCP | @modelcontextprotocol/sdk | | Agent | 29-file subsystem, 25+ tools, Parallel orchestration |
Quick Start
Prerequisites
- Node.js 18+
- npm or bun
Installation
Global Install (Recommended)
npm install -g klyn-jarvis
klyn --helpFrom Source
git clone https://github.com/Klyntech/KlynJarvis.git
cd KlynJarvis
npm install
npx prisma generate
npx prisma db push
cp .env.example .envRun Web UI
npm run devOpen http://localhost:3000
Run CLI
npm run cliOr build and install globally:
npm run build:cli:bundle
npm link
klynCLI Usage
Commands
| Command | Description |
|---|---|
| klyn | Start interactive REPL (default) |
| klyn chat "query" | Single query mode with streaming |
| klyn repl | Interactive chat session |
| klyn serve | Start web server |
| klyn config [key] [value] | Show/set configuration |
| klyn tools | List available tools |
| klyn version | Show version |
REPL Commands
| Command | Description |
|---|---|
| /exit | Exit the REPL |
| /quit | Exit the REPL |
| /help | Show help |
| /clear | Clear conversation |
| /tools | List tools |
| /history | Show chat history |
| /system <msg> | Set system prompt |
Supported Providers (30+)
KlynJarvis supports 30+ LLM providers through a unified provider abstraction. Most providers use the OpenAI-compatible API format, so adding new providers is trivial.
Tier 1: Major Providers
| Provider | Default Model | Env Variable |
|---|---|---|
| OpenAI | gpt-4o | OPENAI_API_KEY |
| Anthropic | claude-sonnet-4-20250514 | ANTHROPIC_API_KEY |
| Google Gemini | gemini-2.0-flash | GEMINI_API_KEY |
| Mistral | mistral-large-latest | MISTRAL_API_KEY |
| Cohere | command-r-plus | COHERE_API_KEY |
Tier 2: OpenAI-Compatible Aggregators
| Provider | Default Model | Env Variable |
|---|---|---|
| OpenRouter | openai/gpt-4o | OPENROUTER_API_KEY |
| Together AI | meta-llama/Llama-3-70b-chat-hf | TOGETHER_API_KEY |
| Fireworks AI | accounts/fireworks/models/llama-v3p1-70b-instruct | FIREWORKS_API_KEY |
| Groq | llama-3.3-70b-versatile | GROQ_API_KEY |
| DeepInfra | meta-llama/Meta-Llama-3.1-70B-Instruct | DEEPINFRA_API_KEY |
| Novita AI | meta-llama/llama-3.1-70b-instruct | NOVITA_API_KEY |
Tier 3: Chinese AI Providers
| Provider | Default Model | Env Variable |
|---|---|---|
| DeepSeek | deepseek-chat | DEEPSEEK_API_KEY |
| Moonshot (Kimi) | moonshot-v1-128k | MOONSHOT_API_KEY |
| Zhipu (GLM) | glm-4 | ZHIPU_API_KEY |
| Qwen (Alibaba) | qwen-max | QWEN_API_KEY |
| Baichuan | Baichuan4 | BAICHUAN_API_KEY |
| MiniMax | abab6.5s-chat | MINIMAX_API_KEY |
| Yi (01.AI) | yi-large | YI_API_KEY |
| StepFun | step-1-32k | STEPFUN_API_KEY |
| SenseNova | nova-ptc-k5-pro | SENSENOVA_API_KEY |
Tier 4: Cloud Provider AI
| Provider | Default Model | Env Variable |
|---|---|---|
| Azure OpenAI | gpt-4 | AZURE_OPENAI_API_KEY |
| Google Vertex AI | gemini-2.0-flash | GOOGLE_APPLICATION_CREDENTIALS |
| AWS Bedrock | anthropic.claude-3-sonnet | AWS_ACCESS_KEY_ID |
| Cloudflare Workers AI | @cf/meta/llama-3.1-8b-instruct | CLOUDFLARE_API_TOKEN |
Tier 5: Specialized Providers
| Provider | Default Model | Env Variable |
|---|---|---|
| Hugging Face | meta-llama/Meta-Llama-3.1-8B-Instruct | HUGGINGFACE_API_KEY |
| xAI (Grok) | grok-2 | XAI_API_KEY |
| Writer | palmyra-x-004 | WRITER_API_KEY |
| Aleph Alpha | phamba-llama-3.1-8b | ALEPHALPHA_API_KEY |
| Inflection | pi-4 | INFLECTION_API_KEY |
| Voyage AI | voyage-3 | VOYAGE_API_KEY |
| Nomic AI | nomic-embed-text | NOMIC_API_KEY |
Tier 6: Local / Self-Hosted
| Provider | Default Model | Endpoint |
|---|---|---|
| Ollama | llama3 | http://localhost:11434 |
| LM Studio | default | http://localhost:1234 |
| vLLM | default | http://localhost:8000 |
| Text Generation WebUI | default | http://localhost:5000 |
| KoboldCpp | default | http://localhost:5001 |
| llamafile | default | http://localhost:8080 |
| llama.cpp | default | http://localhost:8080 |
Provider Aliases
| Alias | Resolves To |
|---|---|
| gpt4, gpt | openai |
| claude, sonnet, haiku, opus | anthropic |
| geminiPro, palm | gemini |
| mixtral | mistral |
| command | cohere |
| llama, codellama | ollama |
| grok | xai |
| palmyra | writer |
| glm | zhipu |
| qwenMax | qwen |
Configuration
# Set provider via CLI
klyn config --provider gemini --model gemini-2.0-flash
# Set provider via environment variable
export GEMINI_API_KEY=your-key-here
klyn
# Use OpenRouter for access to multiple providers
klyn config --provider openrouter
export OPENROUTER_API_KEY=your-key-here
klyn chat "Hello, which model are you?"MCP Server
Available Tools
| Tool | Description |
|---|---|
| klynjarvis_chat | Chat with KlynJarvis |
| generate_code | Generate code from description |
| analyze_code | Analyze code for issues |
| debug | Debug errors |
| refactor | Refactor code |
| explain | Explain code |
| create_file | Create a file |
| read_file | Read a file |
| edit_file | Edit a file |
| search_files | Search files |
| run_command | Run shell command |
| web_search | Search the web |
| git_operations | Git operations |
| database_query | Database queries |
| test_generation | Generate tests |
| documentation | Generate docs |
Agent System
The agent subsystem consists of 29 files providing:
- Core Loop — Agentic iteration with tool execution and context management
- 25+ Tools — File operations, code analysis, web search, git, database
- Approval Flow — Human-in-the-loop for sensitive operations
- Sandbox — Safe code execution environment
- Error Recovery — Automatic retry and fallback strategies
- Parallel Agents — Sub-agent orchestration with dependency resolution
- Workflows — Dynamic script engine with variable interpolation
- Permissions — Per-agent rulesets with condition evaluation
- Events — GlobalBus for decoupled communication
- Fork Sessions — Conversation branching and merging
API Reference
| Endpoint | Method | Description |
|---|---|---|
| /api/chat | POST | Streaming chat (SSE) |
| /api/chat/approve | POST | Tool approval |
| /api/health | GET | Health check |
| /api/providers | GET | List LLM providers |
| /api/search | POST | Web search |
| /api/sessions | GET/POST | Session management |
| /api/tools | POST | Tool execution |
| /api/voice/asr | POST | Speech-to-text |
| /api/voice/tts | POST | Text-to-speech |
| /api/zai/[...path] | ALL | Z-AI proxy |
Project Structure
src/
├── app/ # Next.js App Router (14 files)
│ ├── page.tsx # Main JARVIS UI
│ ├── layout.tsx # Root layout
│ └── api/ # 10 API endpoints
├── components/
│ ├── jarvis/ # Custom JARVIS components (5)
│ └── ui/ # shadcn/ui components (48)
├── hooks/ # React hooks (4)
├── lib/
│ ├── agent/ # Agent subsystem (29 files)
│ ├── events/ # Event system
│ ├── context-manager.ts # Context management
│ ├── store.ts # Zustand store
│ ├── voice-engine.ts # Voice Engine v3
│ └── ... # Other libraries
├── cli/ # CLI application (5 files)
│ ├── index.ts # Entry point
│ ├── config.ts # Config loader
│ ├── session.ts # Chat session
│ ├── ui.ts # Terminal UI
│ └── providers/ # LLM providers (4)
└── mcp/ # MCP integration (5 files)
├── server.ts # MCP server
├── client.ts # MCP client
├── tools.ts # 16 tool definitions
└── integration.ts # Agent bridgeDeployment
Render (Primary)
- Fork the repo
- Create a Web Service on Render
- Connect your GitHub repo
- Render auto-detects
render.yaml - Set environment variables
- Deploy
Environment Variables
| Variable | Description | Required |
|---|---|---|
| ZAI_BASE_URL | Z-AI API base URL | Yes |
| ZAI_API_KEY | Z-AI API key | Yes |
| ZAI_CHAT_ID | Chat session ID | No |
| ZAI_TOKEN | Auth token | No |
| ZAI_USER_ID | User identifier | No |
| DATABASE_URL | Database connection string | Yes |
| GEMINI_API_KEY | Google Gemini API key | Optional |
| OPENAI_API_KEY | OpenAI API key | Optional |
| ANTHROPIC_API_KEY | Anthropic API key | Optional |
| NODE_ENV | Environment mode | Yes |
| PORT | Server port | No |
| LLM_PROVIDER | Default LLM provider | No |
Roadmap
Phase 3
- [ ] Context Window Optimization
- [ ] Streaming Responses
- [ ] Persistent Sessions
- [ ] Agent Memory System
Phase 4
- [ ] Agent Marketplace
- [ ] Plugin System
- [ ] Multi-user Support
- [ ] Webhook Integrations
License
Private — All rights reserved.
