@trusted-ai/xbot 0.1.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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Guoqing Bao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # ๐Ÿค– xbot: A Minimal AI Agent in Rust for Automation and Development
2
+
3
+ `xbot` is a Rust-native autonomous bot runtime for persistent chat automation, tool execution, scheduled work, and multi-channel message delivery. ๐Ÿš€
4
+
5
+ ## โœจ Features
6
+
7
+ - ๐Ÿง  **Persistent Agent Runtime** - Long-running agent runtime with persistent sessions, per-session serialization, and configurable concurrency control
8
+ - ๐Ÿ“ **Permanent Memory Capture** - LLM-driven memory consolidation, automatic task summaries, explicit `/memorize` support, and topic-relevant memory lookup
9
+ - ๐Ÿ› ๏ธ **Rich Toolset** - Filesystem, shell, web fetch, web search, messaging, cron, and background-task tools
10
+ - ๐ŸŒ **Provider Integration** - OpenAI-compatible, Anthropic, GitHub Copilot (OAuth), Cursor, and local engines
11
+ - ๐Ÿงต **Hybrid Model Routing** - Run the main task on a remote frontier API such as DeepSeek `deepseek-v4-pro`, while background subagents use a local Qwen/vLLM/Ollama model for fast parallel work
12
+ - ๐Ÿ”Œ **MCP Support** - MCP stdio tool integration for external tool servers
13
+ - ๐Ÿงฉ **Built-in Skills** - Software engineering, research/reporting, GitHub/CI, scheduled operations, memory management, cron, and clawhub marketplace
14
+ - ๐Ÿ“ฌ **Multi-Channel** - 13 channel backends: `email`, `slack`, `telegram`, `feishu`, `dingtalk`, `discord`, `matrix`, `whatsapp`, `qq`, `wecom`, `weixin`, `mochat`, and extensible plugin channels
15
+ - ๐ŸŒ **Gateway Process** - Webhook ingress, health checks, readiness checks, Prometheus metrics, and a web admin UI
16
+ - ๐Ÿ”„ **Streaming** - Stream delta support with per-channel streaming, retry logic with exponential backoff
17
+ - ๐Ÿช **Hook System** - Extensible `AgentHook` trait for lifecycle callbacks without modifying the core agent loop
18
+
19
+ ## Overview (Hybrid Model Routing)
20
+ <img src="docs/xbot.png" alt="xbot terminal" width="600">
21
+
22
+ The screenshot highlights one of `xbot`'s core advantages: the main agent can use a remote high-capability model, while subagents fan out onto a separate local model. This lets you reserve paid remote tokens for synthesis and hard reasoning, and spend local GPU capacity on parallel exploration, code reading, tests, and report gathering.
23
+
24
+ ## ๐Ÿ“š Documentation
25
+
26
+ - [๐Ÿš€ Getting Started](./docs/USAGE.md)
27
+ - [๐Ÿ“ฆ Installation](./docs/INSTALLATION.md)
28
+ - [๐Ÿงต Hybrid Remote Main + Local Subagents](./docs/HYBRID_MODELS.md)
29
+ - [๐Ÿ—๏ธ Architecture](./docs/ARCHITECTURE.md)
30
+ - [โš™๏ธ Operations Guide](./docs/OPERATIONS.md)
31
+
32
+ ## โšก Quick Start
33
+
34
+ ### Install xbot:
35
+
36
+ ```bash
37
+ cargo install xbot
38
+ # or install a .deb from GitHub Releases
39
+ # or npm install -g @trusted-ai/xbot
40
+ ```
41
+
42
+ The installed command is `xbot`. See [Installation](./docs/INSTALLATION.md) for details.
43
+
44
+ ### Initialize config and workspace:
45
+
46
+ ```bash
47
+ xbot onboard
48
+ ```
49
+
50
+ This will generate:
51
+
52
+ ```python
53
+ # Global config file
54
+ Config: ~/.xbot/config.json
55
+ # Global workspace
56
+ Workspace: ~/.xbot/workspace
57
+ ```
58
+
59
+ ### Config Providers
60
+
61
+ `xbot` supports both remote and local OpenAI-compatible backends. ๐ŸŽฏ
62
+ You can configure them interactively:
63
+
64
+ ```bash
65
+ xbot config --provider
66
+ # cargo run --release -- config --provider
67
+ ```
68
+
69
+ Or manually edit `~/.xbot/config.json`. Refer to: [Getting Started](./docs/USAGE.md)
70
+
71
+ For the recommended hybrid setup, use a remote main model such as DeepSeek `deepseek-v4-pro` and a local OpenAI-compatible server such as vLLM serving Qwen for subagents. See [Hybrid Remote Main + Local Subagents](./docs/HYBRID_MODELS.md).
72
+
73
+ ### Config Communication Channels
74
+
75
+ Before starting the backend, you should configure your preferred communication channels (Slack, Telegram, etc.) to enable message ingress and delivery. ๐Ÿ“ฌ
76
+
77
+ Use the interactive configuration tool:
78
+
79
+ ```bash
80
+ xbot config --channel
81
+ # cargo run --release -- config --channel
82
+ ```
83
+
84
+ List, configure, and log in to channels:
85
+
86
+ ```bash
87
+ xbot channels list # List all available channels
88
+ xbot channels status # Show enabled/disabled state
89
+ xbot channels setup discord # Setup instructions (how to get tokens)
90
+ xbot channels login weixin # Interactive login (QR code scan)
91
+ ```
92
+
93
+ Use `channels setup <name>` to see step-by-step instructions for obtaining the required tokens and keys for any channel. For channels that support interactive login (Weixin QR code, WhatsApp bridge), use `channels login`. For manual configuration or detailed channel options, see [Getting Started](./docs/USAGE.md#5-channel-configuration).
94
+
95
+ > [!TIP]
96
+ > **Slack Users:** Set up Slack App for Agents [Slack Manual](https://www.meta-intelligence.tech/en/insight-openclaw-slack).
97
+ > **Telegram Users:** Set up Telegram App for Agents [Telegram Manual](https://www.meta-intelligence.tech/en/insight-openclaw-telegram).
98
+
99
+
100
+ ## ๐ŸงพUsage
101
+
102
+ ## CLI usage
103
+
104
+ ### One-shot prompt:
105
+
106
+ ```bash
107
+ # this will scan and init the project for following tasks (XBOT.md)
108
+ xbot chat /init
109
+ # this will do one task a time
110
+ xbot chat "find bugs in this project"
111
+ # cargo run --release -- chat /init
112
+ ```
113
+
114
+ ### Interactive shell (TUI, rich terminal UI):
115
+
116
+ ```bash
117
+ xbot repl
118
+ # cargo run --release -- repl
119
+ ```
120
+
121
+ The CLI includes:
122
+ - ๐Ÿ“ก Streamed responses
123
+ - ๐Ÿ“œ Persistent history
124
+ - ๐Ÿ’ป Local shell commands such as `/help` and `/clear`
125
+ - ๐Ÿค– Agent commands such as `/new`, `/clear`, `/memorize <text>`, `/status`, `/init` and `/stop`
126
+
127
+ `chat` and `repl` use the current directory as the workspace by default and create `.xbot/` there. Use `xbot repl --global` or `xbot chat --global "..."` for the configured global workspace, or `--workspace <path>` for an explicit workspace.
128
+
129
+ ### Manage skills:
130
+
131
+ ```bash
132
+ xbot skills list
133
+ xbot skills init my-custom-skill
134
+ ```
135
+
136
+ ## โšก Backend Bot
137
+ ### Start the backend (Personal AI Assistant):
138
+
139
+ ```bash
140
+ xbot run
141
+ # cargo run --release -- run
142
+ ```
143
+
144
+ `run` uses the configured global workspace by default. Use `xbot run --workspace .` when the backend should run against the current project workspace.
145
+
146
+ Sending task(s) to `xbot` using configured channels (such as Slack APP).
147
+
148
+ ### Check runtime configuration and local state:
149
+
150
+ ```bash
151
+ xbot status
152
+ xbot sessions
153
+ xbot jobs
154
+ xbot channels status
155
+ xbot skills list
156
+ ```
157
+
158
+ ## ๐Ÿ“ก Runtime Surfaces
159
+
160
+ ### Channel Backends
161
+
162
+ - ๐Ÿ“ง **email**: IMAP polling + SMTP send
163
+ - ๐Ÿ’ฌ **slack**: Socket Mode or webhook ingress + send
164
+ - โœˆ๏ธ **telegram**: webhook ingress + send
165
+ - ๐Ÿฆ˜ **feishu**: webhook ingress + send, including inbound media/resource handling
166
+ - ๐Ÿ”” **dingtalk**: Stream gateway WebSocket + REST send
167
+ - ๐ŸŽฎ **discord**: Gateway v10 WebSocket + REST send
168
+ - ๐Ÿ  **matrix**: CS API v3 long-poll sync + send
169
+ - ๐Ÿ“ฑ **whatsapp**: WebSocket bridge to Node.js Baileys
170
+ - ๐Ÿง **qq**: QQ Bot API WebSocket gateway + REST send
171
+ - ๐Ÿข **wecom**: Enterprise WeChat AI Bot WebSocket
172
+ - ๐Ÿ’ฌ **weixin**: Personal WeChat via HTTP long-poll
173
+ - ๐ŸŒ **mochat**: HTTP polling with session/panel support
174
+ - ๐Ÿ”Œ **mcp**: stdio-based external tool servers exposed as native tools
175
+
176
+ ### Channel Commands
177
+
178
+ When messaging the bot through Slack, Telegram, or other channels, you can send these signals as standalone messages:
179
+
180
+ - `stop` or `/stop` - Immediately stop the current agent task and cancel running subagents.
181
+ - `clear`, `new`, `/clear`, or `/new` - Start a new session and restore `.xbot/memory/HISTORY.md` to the default template.
182
+ - `memorize <text>` or `/memorize <text>` - Store durable user-directed memory in `.xbot/memory/MEMORY.md` through the `memory-entry-writer` summarization skill.
183
+ - `status` or `/status` - Get the current version and runtime usage stats.
184
+ - `help` or `/help` - Show available commands.
185
+
186
+ ### Gateway Endpoints
187
+
188
+ The gateway exposes:
189
+
190
+ - โœ… `GET /healthz` - Health check
191
+ - ๐ŸŸข `GET /readyz` - Readiness check
192
+ - ๐Ÿ“Š `GET /status` - Runtime status
193
+ - ๐Ÿ“ˆ `GET /metrics` - Prometheus metrics
194
+ - ๐ŸŽ›๏ธ `GET /admin` - Web admin UI
195
+ - ๐Ÿ”ง `GET /api/admin/*` - Admin API
196
+
197
+ ## โœ… Verification
198
+
199
+ ```bash
200
+ cargo fmt
201
+ cargo test
202
+ ```
203
+
204
+ ## ๐ŸŽฏ Use Cases
205
+
206
+ - ๐Ÿค– **Personal AI Assistant** - Always-on AI assistant across your communication channels
207
+ - ๐Ÿ“Š **Automated Monitoring** - Scheduled tasks and webhook-based monitoring
208
+ - ๐Ÿ”ง **DevOps Automation** - Tool execution, file operations, and system management
209
+ - ๐Ÿ“ **Research & Reporting** - Web search, analysis, and report generation
210
+ - ๐Ÿ”„ **CI/CD Integration** - GitHub/CI automation and status updates
211
+
212
+ ---
213
+
214
+ **Built with โค๏ธ in Rust** ๐Ÿฆ€
package/bin/xbot.js ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const { spawnSync } = require("child_process");
7
+
8
+ function targetTriple() {
9
+ const platform = process.platform;
10
+ const arch = process.arch;
11
+ if ((platform !== "linux" && platform !== "darwin") || (arch !== "x64" && arch !== "arm64")) {
12
+ throw new Error(`Unsupported platform: ${platform}-${arch}. Supported: linux/darwin x64/arm64.`);
13
+ }
14
+ return `${platform}-${arch}`;
15
+ }
16
+
17
+ function main() {
18
+ const target = targetTriple();
19
+ const root = path.resolve(__dirname, "..");
20
+ const binary = path.join(root, "vendor", target, "xbot");
21
+ if (!fs.existsSync(binary)) {
22
+ throw new Error(
23
+ `xbot native binary is missing for ${target}. Reinstall the package or set XBOT_INSTALL_BASE_URL for a custom release mirror.`
24
+ );
25
+ }
26
+
27
+ const env = { ...process.env };
28
+ if (!env.XBOT_BUILTIN_SKILLS_DIR) {
29
+ env.XBOT_BUILTIN_SKILLS_DIR = path.join(root, "skills");
30
+ }
31
+
32
+ const result = spawnSync(binary, process.argv.slice(2), {
33
+ stdio: "inherit",
34
+ env
35
+ });
36
+ if (result.error) {
37
+ throw result.error;
38
+ }
39
+ if (result.signal) {
40
+ process.kill(process.pid, result.signal);
41
+ }
42
+ process.exit(result.status === null ? 1 : result.status);
43
+ }
44
+
45
+ try {
46
+ main();
47
+ } catch (err) {
48
+ console.error(`xbot: ${err.message}`);
49
+ process.exit(1);
50
+ }
@@ -0,0 +1,161 @@
1
+ # xbot Architecture
2
+
3
+ ## Runtime Model
4
+
5
+ `xbot` is organized as a message-driven runtime:
6
+
7
+ 1. A channel receives inbound user activity.
8
+ 2. The channel publishes an `InboundMessage` onto the bus.
9
+ 3. `AgentRuntime` acquires a global semaphore permit and a per-session lock, then invokes `AgentLoop`.
10
+ 4. `AgentLoop` builds context, calls the model, executes tools, and persists the turn.
11
+ 5. Outbound messages are published back onto the bus.
12
+ 6. `ChannelManager` delivers outbound messages through the target transport, with retry logic and stream delta support.
13
+
14
+ This keeps transport, orchestration, and model execution separate. The global semaphore (`max_concurrent_requests`, default 3) prevents unbounded parallel processing, and the per-session mutex ensures messages for the same session are serialized.
15
+
16
+ ## Main Components
17
+
18
+ | Module | Responsibility |
19
+ | --- | --- |
20
+ | `src/engine/orchestrator.rs` | Agent turn loop, session commands, tool iteration |
21
+ | `src/engine/context.rs` | Runtime context assembly from workspace files, media, and topic-relevant memory |
22
+ | `src/engine/hook.rs` | `AgentHook` trait for lifecycle callbacks (streaming, iteration, tool execution) |
23
+ | `src/storage/session_store.rs` | JSONL-backed session storage |
24
+ | `src/engine/memory.rs` | Permanent memory storage, LLM-driven consolidation, history reset, relevance filtering |
25
+ | `src/tools.rs` | Tool registry and built-in tool implementations |
26
+ | `src/runtime/worker.rs` | Bus worker with global semaphore and per-session serialization |
27
+ | `src/channels/` | Transport adapters, channel manager, stream delta coalescing, and retry logic |
28
+ | `src/runtime/http.rs` | HTTP ingress plus health/readiness/status endpoints |
29
+ | `src/observability.rs` | Runtime telemetry, metrics, provider instrumentation, and system/provider snapshots |
30
+ | `src/cron.rs` | Scheduled jobs and execution history |
31
+ | `src/runtime/heartbeat.rs` | Periodic task review loop |
32
+ | `src/providers/` | Provider clients, Anthropic native support, and registry metadata |
33
+ | `src/runtime/bootstrap.rs` | Backend startup validation, OAuth handling, and provider construction |
34
+ | `src/integrations/mcp.rs` | MCP stdio client and tool registration |
35
+ | `src/cli/channels_cli.rs` | `xbot channels list/status/login` CLI subcommands |
36
+ | `src/cli/skills_cli.rs` | `xbot skills list/init` CLI subcommands |
37
+
38
+ ## Design Choices
39
+
40
+ ### Domain-first module layout
41
+
42
+ The crate is organized by runtime domain instead of by a flat file list:
43
+
44
+ - `engine/` owns reasoning, context construction, memory policy, skills, hook lifecycle, and background subtasks
45
+ - `runtime/` owns process wiring, HTTP ingress, validation, concurrency control, and long-running services
46
+ - `storage/` owns session persistence and the internal message bus
47
+ - `channels/` owns transport adapters, stream delta coalescing, and retry logic
48
+ - `providers/` owns model backends, Anthropic native support, and provider metadata
49
+ - `integrations/` owns external protocol bridges such as MCP
50
+ - `observability.rs` owns metrics and monitoring state shared across the runtime
51
+ - `cli/` owns interactive configuration, channel management, and skill management subcommands
52
+
53
+ That layout keeps operational concerns separate from agent behavior and avoids coupling transports, storage, and orchestration together.
54
+
55
+ ### Trait-based boundaries
56
+
57
+ Providers, tools, and channels are all expressed as traits. That keeps the runtime swappable and makes transport-specific logic independent from agent execution.
58
+
59
+ ### Message bus orchestration
60
+
61
+ The bus is the seam between transport and reasoning. Channels do not call the agent directly, and the agent does not know how messages are physically delivered.
62
+
63
+ ### Persistent workspace state
64
+
65
+ Sessions, memory files, cron jobs, and skills are stored on disk so the runtime can be restarted without losing state.
66
+
67
+ `MEMORY.md` is the permanent store for durable facts and structured task summaries, while `HISTORY.md` is a resettable event log. The context builder reads only memory slices relevant to the current task instead of injecting the whole file. Completed tasks and `/memorize` requests are condensed into structured memory entries through the `memory-entry-writer` skill before they are appended.
68
+
69
+ ### LLM-driven memory consolidation
70
+
71
+ When the session exceeds 75% of the context window, the consolidator attempts LLM-driven summarization first: it sends a chunk of older messages to the provider and parses a structured JSON response containing a history entry and an optional durable memory update. If the LLM call fails 3 consecutive times, the consolidator falls back to raw archive (appending message text directly to `HISTORY.md`). This matches nanobot's consolidation strategy while keeping the implementation idiomatic in Rust.
72
+
73
+ ### Hook-based extensibility
74
+
75
+ The `AgentHook` trait provides lifecycle callbacks (`before_iteration`, `on_stream`, `on_stream_end`, `before_execute_tools`, `after_iteration`, `finalize_content`) that allow extending the agent loop without modifying its core logic. The `CallbackHook` implementation bridges streaming tokens and progress updates to the existing message bus.
76
+
77
+ ### OpenAI-compatible provider contract
78
+
79
+ `xbot` uses an OpenAI-compatible chat-completions contract as the common provider interface. That keeps remote APIs and local runtimes behind the same operational path.
80
+
81
+ ## Backend Operation
82
+
83
+ `xbot run` starts:
84
+
85
+ - provider client
86
+ - agent runtime
87
+ - cron service
88
+ - heartbeat service
89
+ - enabled channels
90
+ - HTTP gateway
91
+
92
+ The same process also exposes:
93
+
94
+ - the admin UI
95
+ - the admin JSON API
96
+ - the Prometheus metrics endpoint
97
+
98
+ The HTTP gateway is operationally useful even when the main traffic is not HTTP because it exposes:
99
+
100
+ - `GET /healthz`
101
+ - `GET /readyz`
102
+ - `GET /status`
103
+
104
+ ## Channel Model
105
+
106
+ The currently supported transport set is:
107
+
108
+ - `email` - IMAP polling + SMTP send
109
+ - `slack` - Socket Mode WebSocket or webhook + REST send
110
+ - `telegram` - webhook + REST send
111
+ - `feishu` - webhook + REST send with media handling
112
+ - `dingtalk` - Stream gateway WebSocket + REST batch send
113
+ - `discord` - Gateway v10 WebSocket + REST send with mention/typing support
114
+ - `matrix` - CS API v3 long-poll `/sync` + REST send
115
+ - `whatsapp` - WebSocket bridge to Node.js Baileys
116
+ - `qq` - QQ Bot API WebSocket gateway + REST send
117
+ - `wecom` - Enterprise WeChat AI Bot WebSocket
118
+ - `weixin` - Personal WeChat via HTTP long-poll (QR login)
119
+ - `mochat` - HTTP polling with session/panel support
120
+
121
+ Each channel owns:
122
+
123
+ - its transport-specific config
124
+ - inbound normalization
125
+ - outbound formatting and delivery
126
+ - any channel-specific file/media handling
127
+ - optional `send_delta` for streaming-capable transports
128
+
129
+ The `ChannelManager` dispatch loop handles:
130
+
131
+ - stream delta coalescing (`_stream_delta` / `_stream_end` metadata)
132
+ - configurable retry with exponential backoff (`send_max_retries`, default 3)
133
+ - muted tool hint batching and summary generation
134
+
135
+ ## Local Provider Support
136
+
137
+ Local providers are treated as normal backends when they expose an OpenAI-style API. The runtime does not require an API key for known local engines such as:
138
+
139
+ - `ollama`
140
+ - `vllm`
141
+
142
+ Custom local gateways can also be configured through the `custom` provider entry.
143
+
144
+ ## MCP Integration
145
+
146
+ Enabled MCP servers are connected during agent startup. Their tool definitions are registered into the same tool registry as the built-in filesystem, shell, web, cron, and messaging tools.
147
+
148
+ Current transport support:
149
+
150
+ - `stdio`
151
+
152
+ The startup path validates MCP configuration before the runtime begins serving traffic.
153
+
154
+ ## Testing Strategy
155
+
156
+ `xbot` uses both module-local unit tests and integration tests:
157
+
158
+ - unit tests live next to the code for parsing, config validation, and loader behavior
159
+ - integration tests under `tests/` exercise runtime flow, channel behavior, and backend wiring
160
+
161
+ The split keeps low-level behavior close to its implementation while preserving end-to-end coverage for the public runtime surfaces.
@@ -0,0 +1,156 @@
1
+ # Hybrid Remote Main + Local Subagents
2
+
3
+ `xbot` can route the main task and background subagents to different model backends.
4
+
5
+ A common high-value setup is:
6
+
7
+ - main agent: remote API model such as DeepSeek `deepseek-v4-pro`
8
+ - subagents: local OpenAI-compatible server such as vLLM/Ollama/LM Studio serving Qwen
9
+
10
+ This gives the main turn a stronger synthesis model while letting subagents spend local GPU capacity on parallel repository search, file reads, tests, and bounded investigations.
11
+
12
+ ## When To Use This
13
+
14
+ Use hybrid routing when:
15
+
16
+ - the main answer needs a stronger remote model
17
+ - subagents mostly do bounded exploration or implementation slices
18
+ - you want lower remote API spend during parallel work
19
+ - you have a local GPU box or LAN inference server available
20
+
21
+ In the TUI, the header and subagent cards show the active main model and subagent model, matching the screenshot in `docs/xbot.png`.
22
+
23
+ ## Prerequisites
24
+
25
+ You need:
26
+
27
+ - a configured remote provider API key, for example DeepSeek
28
+ - a local or LAN OpenAI-compatible endpoint for the subagent model
29
+ - the model name exactly as the local endpoint expects it
30
+
31
+ Example local endpoint:
32
+
33
+ ```text
34
+ http://127.0.0.1:8000/v1
35
+ ```
36
+
37
+ Example LAN endpoint:
38
+
39
+ ```text
40
+ http://10.0.0.50:9000/v1
41
+ ```
42
+
43
+ ## Start A Local Qwen Server
44
+
45
+ One option is vLLM:
46
+
47
+ ```bash
48
+ python -m vllm.entrypoints.openai.api_server \
49
+ --host 0.0.0.0 \
50
+ --port 8000 \
51
+ --model Qwen/Qwen3.6-27B-FP8
52
+ ```
53
+
54
+ Use the model identifier that your server exposes. If your server exposes `Qwen3.6-27B-FP8`, put that exact value in `agents.subagents.model`.
55
+
56
+ ## Configure Interactively
57
+
58
+ Run:
59
+
60
+ ```bash
61
+ cargo run --release -- config --provider
62
+ ```
63
+
64
+ Use the prompts to:
65
+
66
+ 1. Configure the main provider as `deepseek`.
67
+ 2. Input your deepseek api key and select the main model to `deepseek-v4-pro`.
68
+ 3. Configure subagents with a separate `custom` provider.
69
+ 4. Point subagents at the local OpenAI-compatible `apiBase`.
70
+
71
+ ## Configure Manually
72
+
73
+ Edit `~/.xbot/config.json`.
74
+
75
+ Minimal example:
76
+
77
+ ```json
78
+ {
79
+ "agents": {
80
+ "defaults": {
81
+ "model": "deepseek-v4-pro",
82
+ "provider": "deepseek",
83
+ "contextWindowTokens": 262144,
84
+ "maxTokens": 8192,
85
+ "maxConcurrentTools": 5
86
+ },
87
+ "subagents": {
88
+ "model": "Qwen3.6-27B-FP8",
89
+ "provider": "local-qwen",
90
+ "apiBase": "http://127.0.0.1:8000/v1"
91
+ }
92
+ },
93
+ "providers": {
94
+ "deepseek": {
95
+ "apiBase": "https://api.deepseek.com",
96
+ "apiKey": "sk-your-deepseek-key",
97
+ "extraHeaders": {}
98
+ },
99
+ "local-qwen": {
100
+ "apiBase": "http://127.0.0.1:8000/v1",
101
+ "apiKey": "",
102
+ "extraHeaders": {}
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ Notes:
109
+
110
+ - `agents.defaults` controls the main agent.
111
+ - `agents.subagents` controls spawned background subagents.
112
+ - `agents.subagents.provider` can be any provider key present under `providers`.
113
+ - `agents.subagents.apiBase` overrides the provider API base for subagents.
114
+ - Local or private-network API bases can use an empty `apiKey`.
115
+ - Do not commit real API keys or private endpoint details.
116
+
117
+ ## Verify The Setup
118
+
119
+ Check the resolved configuration:
120
+
121
+ ```bash
122
+ cargo run --release -- status
123
+ ```
124
+
125
+ Start the TUI:
126
+
127
+ ```bash
128
+ cargo run --release -- repl
129
+ ```
130
+
131
+ Ask for a task that naturally uses delegation, for example:
132
+
133
+ ```text
134
+ review the recent TUI changes and delegate independent checks to subagents
135
+ ```
136
+
137
+ Expected behavior:
138
+
139
+ - the main header shows the remote main model, for example `deepseek-v4-pro`
140
+ - subagent cards show the local model, for example `Qwen3.6-27B-FP8`
141
+ - subagent tool work uses the local OpenAI-compatible endpoint
142
+
143
+ ## Troubleshooting
144
+
145
+ If subagents fail to start:
146
+
147
+ - confirm the local server responds at `/v1/chat/completions`
148
+ - confirm `agents.subagents.model` matches the model name exposed by your server
149
+ - confirm `providers.<subagent-provider>.apiBase` or `agents.subagents.apiBase` includes `/v1`
150
+ - run `cargo run --release -- status` to inspect the active provider/model resolution
151
+
152
+ If the main agent uses the wrong model:
153
+
154
+ - set `agents.defaults.provider` explicitly to `deepseek`
155
+ - set `agents.defaults.model` explicitly to `deepseek-v4-pro`
156
+ - remove stale session model metadata by starting a new session with `/new`
@@ -0,0 +1,78 @@
1
+ # Installation
2
+
3
+ `xbot` supports direct installation without cloning the repository.
4
+
5
+ ## Debian / Ubuntu
6
+
7
+ Download the `.deb` for your architecture from the GitHub release page, then install it:
8
+
9
+ ```bash
10
+ sudo apt install ./xbot-linux-x64.deb
11
+ ```
12
+
13
+ or:
14
+
15
+ ```bash
16
+ sudo dpkg -i ./xbot-linux-x64.deb
17
+ sudo apt-get install -f
18
+ ```
19
+
20
+ The Debian package installs:
21
+
22
+ - `/usr/bin/xbot`
23
+ - `/usr/share/xbot/skills`
24
+ - README and license files under `/usr/share/doc/xbot`
25
+
26
+ No systemd service or `/etc` config is installed in the v1 package. Run `xbot onboard` after installation to create `~/.xbot/config.json` and the default workspace.
27
+
28
+ ## npm
29
+
30
+ The npm package is published under the `trusted-ai` organization scope.
31
+
32
+ ```bash
33
+ npm install -g @trusted-ai/xbot
34
+ xbot --help
35
+ ```
36
+
37
+ The npm package installs a small Node.js launcher named `xbot`. During `postinstall`, it downloads the matching prebuilt native binary from GitHub Releases, verifies `SHA256SUMS`, and stores it under the package directory.
38
+
39
+ Supported npm binary targets:
40
+
41
+ - `linux-x64`
42
+ - `linux-arm64`
43
+ - `darwin-x64`
44
+ - `darwin-arm64`
45
+
46
+ Optional install environment variables:
47
+
48
+ - `XBOT_INSTALL_BASE_URL`: override the release artifact base URL
49
+ - `XBOT_INSTALL_VERSION`: override the package version used for artifact names
50
+ - `XBOT_INSTALL_TAG`: override the GitHub release tag
51
+
52
+ ## Cargo
53
+
54
+ The crates.io package is published as `xbot`.
55
+
56
+ ```bash
57
+ cargo install xbot
58
+ ```
59
+
60
+ The installed binary is named `xbot`.
61
+
62
+ Before publishing a release, run:
63
+
64
+ ```bash
65
+ cargo package --list
66
+ cargo publish --dry-run
67
+ ```
68
+
69
+ ## Source Checkout
70
+
71
+ Development installs still work with Cargo:
72
+
73
+ ```bash
74
+ cargo run --release -- --help
75
+ cargo build --release
76
+ ```
77
+
78
+ The source checkout automatically uses the repository `skills/` directory as the built-in skills location.