@kernel.chat/kbot 3.60.0 → 3.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,17 +1,18 @@
1
1
  <p align="center">
2
2
  <strong>kbot</strong><br>
3
- <em>The only AI agent that builds its own tools and defends itself.</em>
3
+ Open-source terminal AI agent. 35 agents. 670+ tools. 20 providers. Science, finance, security, and more.
4
4
  </p>
5
5
 
6
6
  <p align="center">
7
- <img src="https://raw.githubusercontent.com/isaacsight/kernel/main/tools/video-assets/demo-hero.gif" alt="kbot demo — The Kernel Stack" width="700">
7
+ <img src="tools/video-assets/demo.gif" alt="kbot demo" width="700">
8
8
  </p>
9
9
 
10
10
  <p align="center">
11
+ <a href="https://github.com/isaacsight/kernel/actions/workflows/ci.yml"><img src="https://github.com/isaacsight/kernel/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
11
12
  <a href="https://www.npmjs.com/package/@kernel.chat/kbot"><img src="https://img.shields.io/npm/v/@kernel.chat/kbot?color=6B5B95&label=npm" alt="npm version"></a>
12
13
  <a href="https://www.npmjs.com/package/@kernel.chat/kbot"><img src="https://img.shields.io/npm/dw/@kernel.chat/kbot?color=6B5B95" alt="npm downloads"></a>
13
14
  <a href="https://github.com/isaacsight/kernel/blob/main/LICENSE"><img src="https://img.shields.io/github/license/isaacsight/kernel?color=6B5B95" alt="MIT License"></a>
14
- <a href="https://github.com/isaacsight/kernel"><img src="https://img.shields.io/github/stars/isaacsight/kernel?color=6B5B95&style=flat" alt="GitHub stars"></a>
15
+ <a href="https://kernel.chat"><img src="https://img.shields.io/badge/web-kernel.chat-6B5B95" alt="kernel.chat"></a>
15
16
  <a href="https://discord.gg/kdMauM9abG"><img src="https://img.shields.io/badge/discord-join-6B5B95?logo=discord&logoColor=white" alt="Discord"></a>
16
17
  </p>
17
18
 
@@ -19,308 +20,117 @@
19
20
  npm install -g @kernel.chat/kbot
20
21
  ```
21
22
 
22
- **Self-defending AI agent. 600+ tools. 35 agents. 20 providers. Forges new tools at runtime. Built-in cybersecurity suite. $0 local AI. MIT licensed.**
23
-
24
- > **New: [The Kernel Stack](./KERNEL_STACK.md)** — the architecture behind kbot + Claude Code. Agentic, self-improving, compound AI. Read the manifesto.
25
-
26
- ---
27
-
28
- ## What's New
29
-
30
- ### v3.37 — Dream Mode, Meta-Agent, Claude Code Plugin, Voice Mode
31
-
32
- | Feature | What it means |
33
- |---------|---------------|
34
- | **Dream Mode** | `kbot dream` — offline consolidation. kbot reviews recent sessions, extracts patterns, strengthens memory connections, and prunes stale knowledge. Like sleep for an AI agent. |
35
- | **Meta-Agent** | Self-referential self-improvement inspired by HyperAgents ([arXiv 2603.19461](https://arxiv.org/abs/2603.19461)). A two-agent loop: task agents solve problems, the Meta-Agent watches performance and rewrites task agents to be better. Unlike HyperAgents (CC BY-NC-SA), kbot is MIT — the only self-improving agent framework companies can actually use. Run `kbot meta` to trigger a cycle. |
36
- | **Claude Code Plugin** | kbot registers its 9 core specialists as Claude Code teammates via the Agent Teams integration. Delegate tasks to `coder`, `researcher`, `guardian`, etc. directly from Claude Code sessions. |
37
- | **Voice Mode** | `kbot voice` — full voice loop with speech-to-text input and text-to-speech output. Hands-free agentic coding. Works with system TTS and Whisper STT. |
38
- | **OpenClaw Integration** | [`@kernel.chat/kbot-openclaw`](https://www.npmjs.com/package/@kernel.chat/kbot-openclaw) — kbot as the brain for 50+ messaging channels. Discord, Slack, Telegram, WhatsApp, iMessage, email, and more. One agent, every platform. |
39
- | **35 agents** | 15 new specialist and domain agents since v3.28, including meta-agent, dream agent, and expanded presets. |
40
- | **600+ tools** | 210+ new tools across science, research, finance, creative, build matrix, and meta-cognition categories. |
41
-
42
- ### v3.28 — Self-Defense System
43
-
44
- kbot now protects its own integrity — and yours.
45
-
46
- | Feature | What it means |
47
- |---------|---------------|
48
- | **Memory Integrity** | HMAC signatures on all memory files. Tampered memories are detected and quarantined. |
49
- | **Prompt Injection Detection** | Real-time scanning of inputs for injection attacks, jailbreaks, and adversarial prompts. |
50
- | **Knowledge Sanitization** | Learned patterns and forged tools are sanitized before storage to prevent poisoning. |
51
- | **Forge Verification** | Cryptographic verification of forged tools — unsigned or modified tools are blocked. |
52
- | **Anomaly Detection** | Behavioral baselines with statistical anomaly scoring. Alerts on drift. |
53
- | **Incident Logging** | Tamper-proof audit log of all security events. |
54
- | **`kbot defense`** | `audit` · `sign` · `verify` · `incidents` — full CLI for the defense system. |
55
-
56
- ### v3.27 — Cybersecurity Tools
57
-
58
- Seven new security tools, available to every agent:
59
-
60
- `dep_audit` · `secret_scan` · `ssl_check` · `headers_check` · `cve_lookup` · `port_scan` · `owasp_check`
61
-
62
- Plus P0 fixes: all Supabase edge functions now enforce auth headers. No more unauthenticated access.
63
-
64
- ### v3.26 — Trader Agent & Finance Stack
65
-
66
- | Feature | What it means |
67
- |---------|---------------|
68
- | **Trader Agent** | `kbot --agent trader` — crypto market analysis, paper trading, DeFi yield scanning. |
69
- | **Finance Tools (11)** | `market_data`, `market_overview`, `price_history`, `technical_analysis`, `paper_trade`, `market_sentiment`, `defi_yields` + 4 more. |
70
- | **Wallet & Swaps (9)** | Create/import Solana wallets (AES-256-CBC encrypted). Jupiter DEX swaps. Token balances, transaction history, airdrop tracking. |
71
- | **Stock Tools (6)** | Stock screener, earnings calendar, sector rotation, company fundamentals, insider trades, options flow. |
72
- | **Sentiment (5)** | Social sentiment, whale tracking, fear & greed index, news aggregation, trend detection. |
73
- | **Introspection Engine** | `kbot insights` · `kbot reflect` · `kbot compare` — ask kbot what it knows about itself. |
74
- | **`kbot help`** | New CLI subcommand — quick reference for commands, agents, and support channels. |
75
-
76
- ---
77
-
78
23
  ## Why kbot?
79
24
 
80
- Other AI agents are static fixed tools, single providers, no memory, no learning. kbot is the first AI agent that **evolves itself** and **defends itself**:
25
+ Most terminal AI agents lock you into one provider, one model, one way of working. kbot doesn't.
26
+
27
+ - **20 providers, zero lock-in** — Claude, GPT, Gemini, Grok, DeepSeek, Groq, Mistral, SambaNova, Cerebras, OpenRouter, and more. Switch with one command.
28
+ - **Runs fully offline** — Embedded llama.cpp, Ollama, LM Studio, or Jan. $0, fully private.
29
+ - **Learns your patterns** — Bayesian skill ratings + pattern extraction. Gets faster over time.
30
+ - **35 specialist agents** — auto-routes your request to the right expert (coder, researcher, writer, guardian, quant, and 30 more).
31
+ - **670+ tools** — files, bash, git, GitHub, web search, deploy, database, game dev, VFX, research, science, finance, security, and more.
32
+ - **Programmatic SDK** — use kbot as a library in your own apps.
33
+ - **MCP server built in** — plug kbot into Claude Code, Cursor, VS Code, Zed, or Neovim as a tool provider.
34
+
35
+ ### How it compares
36
+
37
+ | | kbot | Claude Code | Codex CLI | Aider | OpenCode |
38
+ |---|---|---|---|---|---|
39
+ | AI providers | 20 | 1 | 1 | 6 | 75+ |
40
+ | Specialist agents | 35 | 0 | 0 | 0 | 0 |
41
+ | Built-in tools | 600+ | ~20 | ~15 | ~10 | ~15 |
42
+ | Science tools | 114 | 0 | 0 | 0 | 0 |
43
+ | Learning engine | Yes | No | No | No | No |
44
+ | Offline mode | Embedded + Ollama | No | No | Ollama | Ollama |
45
+ | SDK | Yes | No | Yes | No | No |
46
+ | MCP server | Yes | N/A | No | No | No |
47
+ | Web companion | kernel.chat | No | No | No | No |
48
+ | Open source | MIT | Source available | Apache 2.0 | Apache 2.0 | MIT |
49
+ | Cost | BYOK / $0 local | $20+/mo | BYOK | BYOK | BYOK |
81
50
 
82
- - **Forges its own tools** — When kbot encounters a task it can't handle, it creates a new tool on the spot via `forge_tool`. The tool persists, gets tested, and can be shared via the Forge Registry.
83
- - **Self-defending** — HMAC memory integrity, prompt injection detection, forge verification, anomaly detection, and tamper-proof incident logging. Run `kbot defense audit` anytime.
84
- - **Cybersecurity built in** — Dependency audits, secret scanning, SSL/TLS checks, header analysis, CVE lookup, port scanning, OWASP checks. Every project gets security tooling for free.
85
- - **Self-evolving** — Autopoietic health monitoring (`kbot vitals`) tracks tool success rates, token budgets, and memory pressure. The immune agent self-audits for drift and regressions.
86
- - **Cost-aware routing** — Automatically selects the cheapest model capable of handling each task. Claude for complex reasoning, DeepSeek for simple queries. Saves 60-90% on API costs.
87
- - **Fallback chains** — If Anthropic is down, kbot cascades to OpenAI, then Groq, then local. Zero manual intervention.
88
- - **20 providers, zero lock-in** — Claude, GPT, Gemini, Grok, DeepSeek, Groq, Mistral, and 13 more. Switch anytime.
89
- - **Runs fully offline** — Embedded llama.cpp runs GGUF models directly. No Ollama needed. $0, fully private.
90
- - **Learns your patterns** — Bayesian skill ratings + pattern extraction. Gets faster and smarter over time.
91
- - **35 specialist agents** — Say "fix the auth bug" and it routes to `coder`. Say "research JWT tokens" and it routes to `researcher`. Say "analyze BTC" and it routes to `trader`. Auto-routed with probabilistic confidence.
92
- - **Crash-proof** — Checkpoints after every tool call. Resume interrupted sessions automatically.
93
- - **Use as a library** — Clean SDK with typed exports. Build your own tools on top of kbot.
94
- - **Works in your IDE** — Built-in MCP server for VS Code, Cursor, Zed, Neovim. ACP for JetBrains.
95
-
96
- ## Install
51
+ ## Quick Start
97
52
 
98
53
  ```bash
99
- # npm (recommended)
54
+ # Install globally
100
55
  npm install -g @kernel.chat/kbot
101
56
 
102
- # Docker
103
- docker run -it isaacsight/kbot
57
+ # Or run directly (no install)
58
+ npx @kernel.chat/kbot
104
59
 
105
- # curl
106
- curl -fsSL https://raw.githubusercontent.com/isaacsight/kernel/main/packages/kbot/install.sh | bash
60
+ # Or use the install script (auto-installs Node.js if needed)
61
+ curl -fsSL https://kernel.chat/install.sh | bash
107
62
  ```
108
63
 
109
- ## Quick Start
110
-
111
64
  ```bash
112
- # One-shot — ask anything
113
- kbot "explain what this project does"
114
-
115
- # Interactive REPL
65
+ # Interactive mode
116
66
  kbot
117
67
 
118
- # Use your own API key (auto-detects provider)
119
- kbot auth
120
-
121
- # Or go fully local no API key, no data leaves your machine
122
- kbot local
123
-
124
- # Forge a new tool at runtime
125
- kbot "I need a tool that converts CSV to JSON with column filtering"
126
-
127
- # Check system health
128
- kbot vitals
129
-
130
- # Audit your own defenses
131
- kbot defense audit
68
+ # One-shot
69
+ kbot "explain this codebase"
70
+ kbot "fix the auth bug in src/auth.ts"
71
+ kbot "create a Dockerfile for this project"
132
72
 
133
- # Scan a project for vulnerabilities
134
- kbot --agent guardian "run a full security scan on this repo"
73
+ # Pipe mode (for scripting)
74
+ kbot -p "generate a migration for user roles" > migration.sql
135
75
 
136
- # Pipe mode compose with Unix tools
137
- kbot -p "generate a user roles migration" > migration.sql
138
- ```
139
-
140
- ## Forge — Runtime Tool Creation
141
-
142
- kbot is the only AI agent that builds its own tools. When it encounters a task no existing tool can handle, it creates one:
143
-
144
- ```bash
145
- # kbot detects it needs a tool, creates it, tests it, and uses it — all in one turn
146
- kbot "analyze the sentiment distribution across all my markdown files"
147
- # → forge_tool creates 'sentiment_analyze' → executes it → returns results
148
-
149
- # Browse and install community tools from the Forge Registry
150
- kbot forge search "kubernetes"
151
- kbot forge install k8s-pod-monitor
152
-
153
- # Publish your forged tools for others
154
- kbot forge publish sentiment_analyze
155
- ```
156
-
157
- Forged tools are first-class citizens — they get the same middleware pipeline, permission checks, forge verification, and telemetry as built-in tools.
158
-
159
- ## SDK — Use kbot as a Library
160
-
161
- ```typescript
162
- import { agent, tools, providers } from '@kernel.chat/kbot'
163
-
164
- // Run the agent programmatically
165
- const result = await agent.run("fix the auth bug", { agent: 'coder' })
166
- console.log(result.content) // AI response
167
- console.log(result.toolCalls) // tools it used
168
- console.log(result.usage) // token counts
169
-
170
- // Stream responses
171
- for await (const event of agent.stream("explain this code")) {
172
- if (event.type === 'content_delta') process.stdout.write(event.text)
173
- if (event.type === 'tool_call_start') console.log(`Using: ${event.name}`)
174
- }
175
-
176
- // Execute tools directly
177
- const files = await tools.execute('glob', { pattern: 'src/**/*.ts' })
178
- console.log(files.result)
179
-
180
- // List all 600+ tools
181
- console.log(tools.list().map(t => t.name))
182
- ```
183
-
184
- ### SDK Exports
76
+ # Use local models (free, no API key)
77
+ kbot local
185
78
 
186
- ```typescript
187
- import { agent, tools, providers } from '@kernel.chat/kbot' // Main SDK
188
- import { SilentUIAdapter, CallbackUIAdapter } from '@kernel.chat/kbot' // UI adapters
189
- import { ResponseStream } from '@kernel.chat/kbot' // Streaming
79
+ # Set up your API key
80
+ kbot auth
190
81
  ```
191
82
 
192
83
  ## Specialists
193
84
 
194
- 35 agents, auto-routed by Bayesian skill ratings, or pick one with `kbot --agent <name>`:
85
+ kbot auto-routes to the right agent for each task. Or pick one with `--agent <name>`.
195
86
 
196
87
  | | Agents |
197
88
  |---|---|
198
89
  | **Core** | kernel, researcher, coder, writer, analyst |
199
90
  | **Extended** | aesthete, guardian, curator, strategist |
200
- | **Domain** | infrastructure, quant, investigator, oracle, chronist, sage, communicator, adapter, trader |
201
- | **System** | immune, forge, meta-agent, dream, codebase-guardian |
202
- | **Presets** | hacker, operator, dreamer, creative, developer, gamedev, playtester |
203
- | **Claude Code** | kernel, coder, researcher, writer, analyst, guardian, aesthete, curator, strategist (teammate integration) |
204
-
205
- ```bash
206
- kbot --agent researcher "what papers cite Friston's Free Energy Principle?"
207
- kbot --agent guardian "review src/auth.ts for security issues"
208
- kbot --agent coder "refactor this into smaller functions"
209
- kbot --agent trader "analyze BTC momentum and run a paper trade"
210
- ```
91
+ | **Domain** | infrastructure, quant, investigator, oracle, chronist, sage, communicator, adapter |
92
+ | **Presets** | claude-code, cursor, copilot, creative, developer |
211
93
 
212
94
  ## 600+ Tools
213
95
 
214
96
  | Category | Examples |
215
97
  |----------|---------|
216
- | **Forge** | forge_tool, forge_search, forge_install, forge_publish, forge_verify |
217
- | **Files & Code** | read, write, glob, grep, multi-file write |
218
- | **Quality** | lint (ESLint/Biome/Clippy), test (Vitest/Jest/pytest), deps audit, format, type-check |
98
+ | **Files & Code** | read, write, glob, grep, lint, format, type-check |
219
99
  | **Shell** | bash, parallel execute, background tasks |
220
100
  | **Git & GitHub** | commit, diff, PR, issues, code search |
221
101
  | **Web** | search, fetch, browser automation, browser agent |
222
102
  | **Research** | arXiv, Semantic Scholar, HuggingFace, NASA, DOI |
223
103
  | **Data** | CSV read/query/write, transforms, reports, invoices |
224
- | **Creative** | p5.js generative art, GLSL shaders, SVG patterns, design variants, music |
104
+ | **Quality** | lint (ESLint/Biome/Clippy), test (Vitest/Jest/pytest), deps audit, formatting |
225
105
  | **Deploy** | Vercel, Netlify, Cloudflare Workers/Pages, Fly.io, Railway |
226
106
  | **Database** | Postgres, MySQL, SQLite queries, Prisma, ER diagrams, seed data |
227
107
  | **Containers** | Docker build/run/compose, Terraform |
108
+ | **Creative** | p5.js generative art, GLSL shaders, SVG patterns, design variants |
228
109
  | **VFX** | GLSL shaders, FFmpeg, ImageMagick, Blender, procedural textures |
229
- | **Game Dev** | scaffold, config, shaders, meshes, physics, particles, levels, tilemaps, navmesh, audio, netcode |
110
+ | **Game Dev** | 16 tools for Godot, Unity, Unreal, Bevy, Phaser, Three.js, PlayCanvas, Defold |
230
111
  | **Training** | dataset prep, fine-tuning, evaluation, model export |
231
112
  | **Social** | post to X, LinkedIn, Bluesky, Mastodon — single posts and threads |
232
- | **Sandbox** | Docker containers, E2B cloud sandboxes, isolated code execution |
233
- | **Notebooks** | Jupyter read, edit, insert, delete cells |
113
+ | **Sandbox** | Docker sandboxes, E2B cloud sandboxes, isolated code execution |
114
+ | **Notebooks** | Jupyter read/edit/insert/delete cells |
234
115
  | **Build Matrix** | cross-platform builds — mobile, desktop, WASM, embedded, server |
235
- | **LSP** | goto definition, find references, hover, rename, diagnostics, symbols |
236
- | **Memory** | persistent save, search, update, forget — survives across sessions |
116
+ | **LSP** | goto definition, find references, hover, rename, diagnostics |
117
+ | **Memory** | persistent memory save/search/update across sessions |
118
+ | **MCP** | marketplace search/install, 20 bundled servers |
237
119
  | **IDE** | MCP server, ACP server, LSP bridge |
238
- | **Finance** | market data, technical analysis, paper trading, DeFi yields, Solana wallet & swaps, stock screener, sentiment, whale tracking |
239
- | **Science & Math** | symbolic compute, matrix ops, FFT, ODEs, probability, optimization, graph theory, combinatorics, OEIS |
240
- | **Physics** | orbital mechanics, circuits, signal processing, particle physics (PDG), relativity, quantum simulator, beam analysis, fluid dynamics, EM, astronomy |
241
- | **Chemistry** | PubChem compounds, reactions, periodic table (118 elements), materials, spectroscopy, stoichiometry, crystals, thermodynamics |
242
- | **Biology** | PubMed, gene lookup, protein/PDB, BLAST, drug/ChEMBL, pathways, taxonomy, clinical trials, ecology, sequence tools |
243
- | **Earth & Climate** | earthquakes/USGS, climate/NOAA, satellite imagery, geology, ocean, air quality, soil, volcanoes, water resources, biodiversity |
244
- | **Neuroscience** | brain atlas, EEG analysis, cognitive models, neural simulation, neurotransmitters, connectome, psychophysics, neuroimaging, learning models |
245
- | **Social Science** | psychometrics, game theory, econometrics, social network analysis, inequality metrics, survey design, voting systems, behavioral experiments |
246
- | **Humanities** | corpus analysis, formal logic, argument mapping, ethics frameworks, historical timelines, language typology, phonetics (IPA), stylometry, philosophical concepts |
247
- | **Health & Epidemiology** | SIR/SEIR/SEIRS models, epidemiology calculations, disease surveillance, crop modeling, nutrition, learning analytics, vaccination modeling, environmental health |
248
- | **Deep Research** | literature review, drug discovery pipeline, genomic analysis, environmental assessment, materials discovery, knowledge graphs, hypothesis engine, meta-analysis, research notebooks |
249
- | **Cybersecurity** | dep_audit, secret_scan, ssl_check, headers_check, cve_lookup, port_scan, owasp_check |
250
- | **Self-Defense** | memory HMAC, injection detection, knowledge sanitization, forge verification, anomaly detection, incident log |
251
- | **System** | vitals, immune audit, defense audit, cost tracking, fallback status |
120
+ | **Forge** | create tools at runtime, publish to registry, install from registry |
252
121
  | **Meta** | subagents, worktrees, planner, sessions, checkpoints, self-eval |
253
-
254
- ## Finance & Trading
255
-
256
- The **trader agent** (`kbot --agent trader`) is a full-stack financial analysis and paper trading system:
257
-
258
- ```bash
259
- # Market analysis
260
- kbot --agent trader "what's the momentum on ETH right now?"
261
- kbot --agent trader "screen for undervalued large-cap stocks"
262
-
263
- # Paper trading (no real money at risk)
264
- kbot --agent trader "open a paper long on SOL with 2x leverage"
265
- kbot --agent trader "show my paper portfolio P&L"
266
-
267
- # DeFi
268
- kbot --agent trader "find the best stablecoin yields on Solana"
269
- kbot --agent trader "swap 0.1 SOL for USDC on Jupiter"
270
-
271
- # Sentiment
272
- kbot --agent trader "what's crypto twitter saying about the next FOMC?"
273
- ```
274
-
275
- **31 finance tools** across 5 categories: market data (11), wallet & swaps (9), stocks (6), and sentiment (5). All paper trading is simulated — no real funds are moved unless you explicitly configure and confirm a live wallet transaction.
276
-
277
- ## Science & Research
278
-
279
- The only terminal AI agent with a built-in science laboratory. 114 research tools across 11 domains:
280
-
281
- ```bash
282
- # Physics
283
- kbot "calculate the orbital period of a satellite at 400km altitude"
284
- kbot "simulate a quantum circuit with 4 qubits in a GHZ state"
285
-
286
- # Biology
287
- kbot "search PubMed for CRISPR delivery mechanisms published in 2025"
288
- kbot "look up the protein structure for insulin receptor"
289
-
290
- # Chemistry
291
- kbot "what are the properties of aspirin from PubChem?"
292
- kbot "balance the equation: Fe + O2 -> Fe2O3"
293
-
294
- # Deep Research
295
- kbot "run a literature review on transformer attention mechanisms"
296
- kbot "generate hypotheses for why coral bleaching accelerated in 2025"
297
- ```
298
-
299
- 114 tools across: math, physics, chemistry, biology, earth science, neuroscience, social science, humanities, health/epidemiology, deep research pipelines, and knowledge graphs.
300
-
301
- ## Middleware Pipeline
302
-
303
- Extend tool execution with composable middleware:
304
-
305
- ```typescript
306
- import { ToolPipeline, executionMiddleware } from '@kernel.chat/kbot/tools'
307
-
308
- const pipeline = new ToolPipeline()
309
-
310
- // Add custom logging middleware
311
- pipeline.use(async (ctx, next) => {
312
- console.log(`Calling ${ctx.toolName}...`)
313
- await next()
314
- console.log(`${ctx.toolName} took ${ctx.durationMs}ms`)
315
- })
316
-
317
- // Add the actual execution
318
- pipeline.use(executionMiddleware(myExecutor))
319
-
320
- await pipeline.execute({ toolName: 'bash', toolArgs: { command: 'ls' }, toolCallId: '1', metadata: {}, aborted: false })
321
- ```
322
-
323
- Built-in middleware: `permissionMiddleware`, `hookMiddleware`, `timeoutMiddleware`, `metricsMiddleware`, `truncationMiddleware`, `telemetryMiddleware`, `defenseMiddleware`.
122
+ | **Science & Math** | symbolic compute, matrix ops, FFT, ODEs, probability, optimization, graph theory, OEIS |
123
+ | **Physics** | orbital mechanics, circuits, signal processing, particles (PDG), relativity, quantum simulator, beam analysis, fluid dynamics |
124
+ | **Chemistry** | PubChem compounds, reactions, periodic table (118 elements), spectroscopy, stoichiometry, thermodynamics |
125
+ | **Biology** | PubMed, gene lookup, protein/PDB, BLAST, drug/ChEMBL, pathways, taxonomy, clinical trials |
126
+ | **Earth & Climate** | earthquakes/USGS, climate/NOAA, satellite imagery, geology, ocean, air quality, volcanoes, water resources |
127
+ | **Neuroscience** | brain atlas, EEG analysis, cognitive models, neural simulation, connectome, psychophysics |
128
+ | **Social Science** | psychometrics, game theory, econometrics, social network analysis, survey design, voting systems |
129
+ | **Humanities** | corpus analysis, formal logic, argument mapping, ethics frameworks, historical timelines, stylometry |
130
+ | **Health & Epidemiology** | SIR/SEIR models, epidemiology calculations, disease surveillance, nutrition, vaccination modeling |
131
+ | **Finance** | market data, technical analysis, paper trading, DeFi yields, wallet & swaps, stock screener, sentiment |
132
+ | **Cybersecurity** | dep_audit, secret_scan, ssl_check, headers_check, cve_lookup, port_scan, owasp_check |
133
+ | **Self-Defense** | memory HMAC, prompt injection detection, knowledge sanitization, forge verification, anomaly detection |
324
134
 
325
135
  ## 20 Providers
326
136
 
@@ -347,61 +157,43 @@ Built-in middleware: `permissionMiddleware`, `hookMiddleware`, `timeoutMiddlewar
347
157
  | OpenRouter | varies | Cloud |
348
158
  | kbot local | **Free** | Yes |
349
159
 
350
- Cost-aware routing automatically picks the cheapest provider that can handle each task. Fallback chains ensure zero downtime across providers.
351
-
352
- ## Local Mode
353
-
354
- No API key needed. No data leaves your machine. 11 models across 3 tiers:
355
-
356
- ```bash
357
- # Use Ollama (if installed)
358
- kbot local
359
-
360
- # Or run models directly — embedded llama.cpp, no external service
361
- kbot models pull llama3.3-8b
362
- kbot local --embedded
363
-
364
- # GPU-accelerated: Metal (Mac), CUDA (Linux/Windows), Vulkan
365
- ```
160
+ Set any provider's env var and kbot auto-detects it. Or run `kbot auth` for interactive setup.
366
161
 
367
- ### Model Catalog
368
-
369
- | Tier | Models | Use case |
370
- |------|--------|----------|
371
- | **Light** | Llama 3.3 3B, Qwen 3 4B, Phi-4 Mini | Fast completions, simple tasks, low-RAM machines |
372
- | **Standard** | Llama 3.3 8B, Qwen 3 8B, Mistral 7B, Codestral 22B | General-purpose coding, chat, analysis |
373
- | **Heavy** | DeepSeek R1 14B, Llama 3.3 70B (Q4), Qwen 3 32B, Codestral 22B (Q8) | Complex reasoning, large codebase analysis |
374
-
375
- All models auto-download on first use. GPU acceleration detected automatically (Metal on Apple Silicon, CUDA on NVIDIA, Vulkan fallback).
376
-
377
- ## Structured Streaming
378
-
379
- Stream typed events to any consumer:
162
+ ## SDK
380
163
 
381
164
  ```typescript
382
- import { ResponseStream } from '@kernel.chat/kbot'
383
-
384
- const stream = new ResponseStream()
165
+ import { agent, tools, providers } from '@kernel.chat/kbot'
385
166
 
386
- // Subscribe to events
387
- stream.on((event) => {
388
- switch (event.type) {
389
- case 'content_delta': process.stdout.write(event.text); break
390
- case 'tool_call_start': console.log(`Tool: ${event.name}`); break
391
- case 'tool_result': console.log(`Result: ${event.result}`); break
392
- case 'usage': console.log(`Tokens: ${event.inputTokens} in, ${event.outputTokens} out`); break
393
- }
394
- })
167
+ const result = await agent.run("fix the auth bug", { agent: 'coder' })
168
+ console.log(result.content)
395
169
 
396
- // Or use as async iterator
397
- for await (const event of stream) {
398
- // handle each event
170
+ for await (const event of agent.stream("explain this code")) {
171
+ if (event.type === 'content_delta') process.stdout.write(event.text)
399
172
  }
400
173
  ```
401
174
 
402
- **HTTP SSE**: `POST /stream` when running `kbot serve` — standard Server-Sent Events.
175
+ ## Architecture
176
+
177
+ ```mermaid
178
+ graph TD
179
+ A[User Message] --> B{Local-first check}
180
+ B -->|file, git, grep| C[Instant response — $0]
181
+ B -->|Needs AI| D{Complexity detection}
182
+ D -->|Simple| E[Bayesian Router → Specialist]
183
+ D -->|Multi-step| F[Autonomous Planner]
184
+ E --> G[Provider API + Tool Loop]
185
+ F --> G
186
+ G --> H{600+ Tools}
187
+ H --> I[File ops, bash, git, GitHub, search, deploy, DB, game dev...]
188
+ G --> J[Learning Engine]
189
+ J --> K[Patterns + Solutions + User Profile]
190
+ G --> L[Checkpointing]
191
+ L --> M[Resume from last tool call]
192
+ ```
193
+
194
+ ## MCP Server
403
195
 
404
- ## IDE Integration
196
+ Use kbot as a tool provider inside any MCP-compatible IDE:
405
197
 
406
198
  ```json
407
199
  {
@@ -413,7 +205,7 @@ for await (const event of stream) {
413
205
  }
414
206
  ```
415
207
 
416
- Works with Claude Code, Cursor, VS Code, Windsurf, Zed, Neovim. Exposes file ops, bash, git, search, planning, and more.
208
+ Works with Claude Code, Cursor, VS Code, Windsurf, Zed, Neovim.
417
209
 
418
210
  ## Commands
419
211
 
@@ -421,37 +213,25 @@ Works with Claude Code, Cursor, VS Code, Windsurf, Zed, Neovim. Exposes file ops
421
213
  |---------|-------------|
422
214
  | `kbot` | Interactive REPL |
423
215
  | `kbot "prompt"` | One-shot execution |
424
- | `kbot init` | **60-second project onboarding** — detects stack, forges tools, writes config |
425
216
  | `kbot auth` | Configure API key |
426
217
  | `kbot local` | Use local AI (Ollama, embedded, LM Studio, Jan) |
427
- | `kbot email-agent start --open` | **Email companion** — responds to all inbound via local AI ($0) |
428
- | `kbot imessage-agent start` | **iMessage agent** — free SMS/iMessage on macOS |
429
- | `kbot audit <repo>` | Security + quality audit with shareable badge |
430
- | `kbot consultation` | Consultation engine — guardrails, intake, client management |
431
- | `kbot defense audit` | **Self-defense audit** — verify memory integrity, check for anomalies |
432
- | `kbot defense sign` | Sign all memory and forge artifacts with HMAC |
433
- | `kbot defense verify` | Verify signatures on memory and forged tools |
434
- | `kbot defense incidents` | Review tamper-proof security incident log |
435
- | `kbot vitals` | Autopoietic health check — memory, tools, token budgets |
436
- | `kbot synthesis` | What kbot knows — memory, patterns, insights |
437
- | `kbot insights` | Introspection — what kbot has learned about itself |
438
- | `kbot reflect` | Self-reflection on recent sessions and decisions |
439
218
  | `kbot serve` | Start HTTP REST + SSE streaming server |
219
+ | `kbot audit <repo>` | Security + quality audit of any GitHub repo |
440
220
  | `kbot contribute <repo>` | Find good-first-issues and quick wins |
221
+ | `kbot share` | Share conversation as GitHub Gist |
222
+ | `kbot pair` | File watcher with auto-analysis |
223
+ | `kbot team` | Multi-agent TCP collaboration |
224
+ | `kbot record` | Terminal session recording (SVG, GIF, asciicast) |
441
225
  | `kbot voice` | Text-to-speech output mode |
442
226
  | `kbot watch` | Real-time file analysis on change |
443
227
  | `kbot bootstrap` | Outer-loop project optimizer (visibility scoring) |
444
228
  | `kbot plugins` | Search, install, update community plugins |
445
229
  | `kbot models` | List, pull, remove, catalog local models |
446
- | `kbot forge search <q>` | Search the Forge Registry for community tools |
230
+ | `kbot changelog` | Generate changelog from git history |
231
+ | `kbot completions` | Shell completions (bash, zsh, fish) |
232
+ | `kbot cloud` | Sync learning data to kernel.chat |
447
233
  | `kbot ide mcp` | Start MCP server for IDEs |
448
- | `kbot help` | Quick reference — commands, agents, support channels |
449
234
  | `kbot doctor` | 10-point health check |
450
- | `/agent <name>` | Switch specialist |
451
- | `/plan <task>` | Autonomous multi-step execution |
452
- | `/save` / `/resume` | Session management |
453
- | `/share` | Share conversation as GitHub Gist |
454
- | `/tutorial` | Guided walkthrough |
455
235
 
456
236
  ### Power-User Flags
457
237
 
@@ -463,218 +243,37 @@ kbot --computer-use "fill out this form" # Computer use — controls mouse a
463
243
  kbot -p "query" > output.txt # Pipe mode — clean output for scripting
464
244
  ```
465
245
 
466
- ## Under the Hood
467
-
468
- kbot's agent loop runs 11 always-on cognition modules based on peer-reviewed research:
469
-
470
- | Module | Paper | What it does |
471
- |--------|-------|-------------|
472
- | Free Energy | Friston, 2010 | Explore vs exploit decisions |
473
- | Integrated Information | Tononi, 2004 | Multi-agent synthesis quality (phi) |
474
- | Predictive Processing | Clark, 2013 | Anticipates your next action |
475
- | Autopoiesis | Maturana & Varela, 1972 | Self-healing component monitoring |
476
- | Strange Loops | Hofstadter, 1979 | Meta-cognition depth tracking |
477
- | Error Correction | Gates, 2023 | Targeted error classification + fix |
478
- | Entropy Context | Vopson, 2022 | Information decay detection |
479
- | Godel Limits | Godel/UBC | Stuck-loop detection |
480
- | Simulation | Wolpert, 2008 | Change impact prediction |
481
- | Emergent Swarm | Project Sid, 2024 | Dynamic role discovery |
482
- | Cognitive Interference | Hernandez, 2026 | Measures constructive/destructive interference between modules |
483
-
484
- These aren't metaphors. They're TypeScript modules with paper citations in the headers. The interference between modules — not the modules themselves — is where intelligent behavior emerges. See the [research paper](../../docs/cognitive-module-interference.md).
485
-
486
- ## Dream Mode
487
-
488
- ```bash
489
- kbot dream
490
- ```
491
-
492
- Offline memory consolidation. When you run `kbot dream`, kbot reviews recent sessions, extracts recurring patterns, strengthens high-value memory connections, and prunes stale or contradictory knowledge. Think of it as sleep for an AI agent — the work that makes tomorrow's sessions faster and more accurate.
493
-
494
- - **Pattern extraction** — identifies recurring tool sequences, user preferences, and project conventions
495
- - **Memory pruning** — removes outdated facts and conflicting entries
496
- - **Skill strengthening** — reinforces Bayesian skill ratings based on real outcomes
497
- - **Knowledge synthesis** — connects isolated learnings into higher-level insights
498
- - **Runs fully local** — no API calls, no data leaves your machine
499
-
500
- ## Meta-Agent
501
-
502
- ```bash
503
- kbot meta
504
- ```
505
-
506
- Self-referential self-improvement. Inspired by Meta's HyperAgents paper ([arXiv 2603.19461](https://arxiv.org/abs/2603.19461)), the Meta-Agent implements a two-agent architecture:
507
-
508
- 1. **Task agents** solve problems (the 35 specialists you already use)
509
- 2. **The Meta-Agent** observes their performance, identifies weaknesses, and improves them
510
-
511
- The improvement loop runs automatically:
512
- - **Observe** — records success/failure, duration, cost, and tool usage for every task
513
- - **Analyze** — builds performance profiles per agent, identifies failure patterns
514
- - **Propose** — generates targeted improvements (prompt rewrites, tool pre-selection, routing changes)
515
- - **Apply** — auto-applies low-risk improvements (routing, tool selection); flags high-risk ones for review
516
- - **Measure** — compares before/after performance and reverts regressions
517
-
518
- Unlike HyperAgents (CC BY-NC-SA, non-commercial license), kbot is MIT — the only self-improving agent framework that companies can actually deploy in production.
519
-
520
- ```bash
521
- kbot meta # Run one improvement cycle
522
- kbot meta stats # View cycle count, observations, active improvements
523
- kbot meta history # Review all past improvements
524
- ```
525
-
526
- ## Claude Code Plugin
527
-
528
- kbot integrates directly with Claude Code as a teammate provider. Register kbot's specialists so Claude Code can delegate tasks to the right expert:
529
-
530
- ```typescript
531
- import { registerTeammates, delegateToTeammate } from '@kernel.chat/kbot'
532
-
533
- // Get teammate definitions for all 9 core specialists
534
- const teammates = registerTeammates()
535
- // → [{ name: 'kernel', model: 'sonnet', ... }, { name: 'coder', ... }, ...]
536
-
537
- // Delegate a task to a specific specialist
538
- const result = await delegateToTeammate('guardian', 'audit src/auth.ts for security issues')
539
- console.log(result.content) // security analysis
540
- console.log(result.toolCalls) // tools used (dep_audit, secret_scan, etc.)
541
- ```
542
-
543
- Each teammate definition includes:
544
- - **name** — agent identifier (`kernel`, `coder`, `researcher`, `writer`, `analyst`, `guardian`, `aesthete`, `curator`, `strategist`)
545
- - **model** — `opus` for complex reasoning agents (analyst, strategist, guardian, researcher), `sonnet` for fast agents
546
- - **initialPrompt** — the specialist's full system prompt
547
- - **tools** — preferred tool list for the specialist's domain
548
-
549
- ## Voice Mode
550
-
551
- ```bash
552
- kbot voice
553
- ```
554
-
555
- Full voice loop — speak your tasks, hear the results. Voice mode chains speech-to-text input with text-to-speech output for hands-free agentic coding:
556
-
557
- - **STT** — Whisper-based transcription (local or API)
558
- - **TTS** — System speech synthesis (macOS `say`, Linux `espeak`, or cloud TTS)
559
- - **Continuous** — voice loop stays open between turns, no re-activation needed
560
- - **Tool narration** — kbot announces tool calls and results as it works
561
-
562
- ## OpenClaw Integration
563
-
564
- ```bash
565
- npm install @kernel.chat/kbot-openclaw
566
- ```
567
-
568
- kbot as the brain for 50+ messaging channels. OpenClaw bridges kbot's agent loop to Discord, Slack, Telegram, WhatsApp, iMessage, email, Matrix, and more — one agent, every platform.
569
-
570
- - **Channel-agnostic** — same agent logic regardless of input source
571
- - **Per-channel memory** — separate conversation contexts per channel/user
572
- - **Rate limiting** — configurable per-platform rate limits
573
- - **Media handling** — images, files, and voice messages routed through kbot's multimodal pipeline
574
-
575
- See [`@kernel.chat/kbot-openclaw`](https://www.npmjs.com/package/@kernel.chat/kbot-openclaw) on npm.
576
-
577
246
  ## Security
578
247
 
579
- kbot has two layers of security: protecting **your projects** and protecting **itself**.
248
+ - API keys encrypted at rest (AES-256-CBC)
249
+ - Destructive operations require confirmation
250
+ - Shell commands sandboxed with blocklist
251
+ - Tool execution timeout (5 min) with middleware pipeline
252
+ - Config files restricted to owner (chmod 600)
253
+ - 0 P0/P1 security issues (audited March 2026)
580
254
 
581
- ### Project Security (Cybersecurity Tools)
255
+ ## Development
582
256
 
583
257
  ```bash
584
- kbot --agent guardian "full security audit on this repo"
258
+ cd packages/kbot
259
+ npm install
260
+ npm run dev # Run in dev mode
261
+ npm run build # Compile TypeScript
262
+ npm run test # Run tests (vitest)
585
263
  ```
586
264
 
587
- | Tool | What it does |
588
- |------|-------------|
589
- | `dep_audit` | Scans dependencies for known vulnerabilities (npm, pip, cargo, go) |
590
- | `secret_scan` | Detects leaked API keys, tokens, and credentials in source code |
591
- | `ssl_check` | Validates SSL/TLS certificates, cipher suites, and protocol versions |
592
- | `headers_check` | Audits HTTP security headers (CSP, HSTS, X-Frame-Options, etc.) |
593
- | `cve_lookup` | Searches the NVD database for CVEs by package, version, or keyword |
594
- | `port_scan` | Scans open ports and identifies running services |
595
- | `owasp_check` | Tests for OWASP Top 10 vulnerabilities |
596
-
597
- ### Self-Defense System
598
-
599
- kbot protects the integrity of its own memory, tools, and behavior:
600
-
601
- - **HMAC Memory Integrity** — Every memory file is signed. Tampered memories are detected and quarantined on read.
602
- - **Prompt Injection Detection** — Inputs are scanned for known injection patterns, jailbreak attempts, and adversarial prompts before processing.
603
- - **Knowledge Sanitization** — Learned patterns and forged tool definitions are sanitized before storage to prevent knowledge poisoning.
604
- - **Forge Verification** — Forged tools are cryptographically signed. Unsigned or modified tools are blocked from execution.
605
- - **Anomaly Detection** — Behavioral baselines are maintained. Statistical anomaly scoring flags unexpected tool usage, token spikes, or routing drift.
606
- - **Incident Logging** — All security events are recorded in a tamper-proof audit log. Review with `kbot defense incidents`.
607
-
608
- ### Infrastructure Security
609
-
610
- - **AES-256-CBC encrypted keys at rest** — API keys and wallet private keys never stored in plaintext
611
- - **Permission system** — destructive operations (file delete, git push, wallet sends) require explicit confirmation
612
- - **Tool execution timeouts** — 5-minute cap with middleware pipeline; no runaway processes
613
- - **Wallet transaction limits** — configurable spend caps and confirmation gates for on-chain operations
614
- - **Shell sandboxing** — blocklist prevents dangerous commands; config files restricted to owner (chmod 600)
615
- - **Local-only telemetry** — session checkpoints and metrics never leave your machine
616
- - **Open source (MIT)** — audit the code yourself at [github.com/isaacsight/kernel](https://github.com/isaacsight/kernel)
617
-
618
- ## Standalone Packages
619
-
620
- Use kbot's brain without the full agent:
621
-
622
- | Package | What it does |
623
- |---------|-------------|
624
- | [`@kernel.chat/skill-router`](https://www.npmjs.com/package/@kernel.chat/skill-router) | Bayesian agent routing — TrueSkill-style, zero LLM calls |
625
- | [`@kernel.chat/memory-tiers`](https://www.npmjs.com/package/@kernel.chat/memory-tiers) | Three-tier memory: observations → reflections → identity |
626
- | [`@kernel.chat/tool-forge`](https://www.npmjs.com/package/@kernel.chat/tool-forge) | Runtime tool creation from structured definitions |
627
- | [`@kernel.chat/prompt-evolver`](https://www.npmjs.com/package/@kernel.chat/prompt-evolver) | GEPA-style prompt self-optimization from execution traces |
628
- | [`@kernel.chat/kbot-openclaw`](https://www.npmjs.com/package/@kernel.chat/kbot-openclaw) | OpenClaw plugin — kbot as brain for 50+ messaging channels |
629
-
630
- ## Need Help?
631
-
632
- | Channel | What it's for |
633
- |---------|---------------|
634
- | `kbot help` | Quick reference — commands, agents, support links |
635
- | `kbot doctor` | Diagnose setup issues (Node version, API keys, models) |
636
- | `kbot tutorial` | Guided walkthrough — build something step by step |
637
- | [Discord](https://discord.gg/kdMauM9abG) | Community chat, questions, show & tell |
638
- | [GitHub Issues](https://github.com/isaacsight/kernel/issues) | Bug reports & feature requests |
639
- | [support@kernel.chat](mailto:support@kernel.chat) | Email support (AI-assisted replies) |
640
-
641
- Inside the REPL, type `/help` for the full command list.
642
-
643
- ## Contributing
644
-
645
- See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, adding tools, and creating specialist agents.
646
-
647
- ## Demos
648
-
649
- <details>
650
- <summary><strong>Learning Engine</strong> — pattern extraction + skill routing</summary>
651
- <img src="https://raw.githubusercontent.com/isaacsight/kernel/main/tools/video-assets/demo-learning.gif" alt="kbot learning engine" width="700">
652
- </details>
653
-
654
- <details>
655
- <summary><strong>Agent Routing</strong> — 35 specialists, auto-routed by intent</summary>
656
- <img src="https://raw.githubusercontent.com/isaacsight/kernel/main/tools/video-assets/demo-agents.gif" alt="kbot agent routing" width="700">
657
- </details>
658
-
659
- <details>
660
- <summary><strong>Self-Defense</strong> — HMAC integrity, injection detection, audit</summary>
661
- <img src="https://raw.githubusercontent.com/isaacsight/kernel/main/tools/video-assets/demo-defense.gif" alt="kbot self-defense" width="700">
662
- </details>
265
+ ## Web Companion kernel.chat
663
266
 
664
- <details>
665
- <summary><strong>Local AI</strong> — $0 inference, fully offline</summary>
666
- <img src="https://raw.githubusercontent.com/isaacsight/kernel/main/tools/video-assets/demo-local-ai.gif" alt="kbot local AI" width="700">
667
- </details>
267
+ kbot has a web companion at [kernel.chat](https://kernel.chat) — same agents, persistent memory, and a visual interface. Free to use (20 messages/day).
668
268
 
669
- ## Links
269
+ ## Community
670
270
 
671
- - [kernel.chat](https://kernel.chat) — Web companion
672
- - [The Kernel Stack](./KERNEL_STACK.md) — Architecture manifesto
673
- - [npm](https://www.npmjs.com/package/@kernel.chat/kbot)
674
- - [Docker Hub](https://hub.docker.com/r/isaacsight/kbot)
675
- - [Discord](https://discord.gg/kdMauM9abG)
676
- - [Issues](https://github.com/isaacsight/kernel/issues)
271
+ - **Web**: [kernel.chat](https://kernel.chat)
272
+ - **npm**: [@kernel.chat/kbot](https://www.npmjs.com/package/@kernel.chat/kbot)
273
+ - **Discord**: [discord.gg/kdMauM9abG](https://discord.gg/kdMauM9abG)
274
+ - **GitHub**: [isaacsight/kernel](https://github.com/isaacsight/kernel)
275
+ - **Issues**: [Report a bug](https://github.com/isaacsight/kernel/issues)
677
276
 
678
277
  ## License
679
278
 
680
- [MIT](../../LICENSE) — [kernel.chat group](https://kernel.chat)
279
+ [MIT](LICENSE) — [kernel.chat group](https://kernel.chat)