agentix-cli 0.4.0 → 0.5.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 +107 -188
- package/dist/chunk-WT2UJMBC.js +68 -0
- package/dist/chunk-WT2UJMBC.js.map +1 -0
- package/dist/cli.js +8 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +176 -16
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AIBBZF4E.js +0 -41
- package/dist/chunk-AIBBZF4E.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AgentX
|
|
2
2
|
|
|
3
|
-
**Self-hosted multi-agent orchestrator.** Routes messages from Telegram, WhatsApp, Discord, crons, and cross-machine A2A mesh to AI agents running on Claude Code, OpenAI, Ollama, or any LLM provider.
|
|
3
|
+
**Self-hosted multi-agent orchestrator.** Routes messages from Telegram, WhatsApp, Discord, GitLab, crons, webhooks, and cross-machine A2A mesh to AI agents running on Claude Code, OpenAI, Ollama, or any LLM provider.
|
|
4
4
|
|
|
5
5
|
> **Experimental.** Built as a self-hosted, bring-your-own-key alternative to third-party AI orchestrators affected by [Anthropic's updated terms of use](https://www.anthropic.com/policies). You run it on your own machines with your own API keys or Claude subscription.
|
|
6
6
|
|
|
@@ -13,138 +13,96 @@ npm install -g agentix-cli
|
|
|
13
13
|
## Quick start
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
#
|
|
17
|
-
agentx
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
agentx agent add
|
|
21
|
-
|
|
22
|
-
# 3. Add a Telegram bot (interactive, verifies token)
|
|
23
|
-
agentx channel add
|
|
24
|
-
|
|
25
|
-
# 4. Start
|
|
26
|
-
agentx daemon start
|
|
16
|
+
agentx init # Create config + workspace
|
|
17
|
+
agentx agent add # Add an agent (interactive)
|
|
18
|
+
agentx channel add # Add a channel (Telegram/WhatsApp/Discord/GitLab)
|
|
19
|
+
agentx daemon start # Start
|
|
27
20
|
```
|
|
28
21
|
|
|
29
|
-
That's it. Your agent is live on Telegram.
|
|
30
|
-
|
|
31
22
|
## How it works
|
|
32
23
|
|
|
33
24
|
```
|
|
34
25
|
Telegram ──┐
|
|
35
|
-
WhatsApp ──┤
|
|
36
|
-
Discord ───┤
|
|
37
|
-
|
|
26
|
+
WhatsApp ──┤ ┌─ claude -p --cwd /workspace
|
|
27
|
+
Discord ───┤ agentx │
|
|
28
|
+
GitLab ───┤ daemon ────┤─ openai API
|
|
29
|
+
Cron ──────┤ │
|
|
30
|
+
Webhook ───┤ └─ ollama generate
|
|
38
31
|
A2A mesh ──┘
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Each agent = a workspace directory. For Claude Code agents, permissions, hooks, MCP servers, skills, and memory live in the workspace's `.claude/` directory. AgentX just orchestrates when and where agents run.
|
|
45
|
-
|
|
46
|
-
## CLI Commands
|
|
47
|
-
|
|
48
|
-
### Daemon (core)
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
agentx daemon start # Start foreground
|
|
52
|
-
agentx daemon start --detach # Start background
|
|
53
|
-
agentx daemon stop # Stop daemon
|
|
54
|
-
agentx daemon status # Show agents, crons, mesh health
|
|
55
|
-
agentx daemon logs -f # Follow logs
|
|
56
|
-
agentx daemon send <agent> <msg> # Send a task to an agent
|
|
57
|
-
agentx daemon send <agent> <msg> --peer server-2 # Send to remote agent
|
|
58
|
-
agentx daemon deploy <host> -i ~/.ssh/key --restart # Deploy + restart remote
|
|
32
|
+
│
|
|
33
|
+
Context Engine
|
|
34
|
+
(8 layers, token-budgeted)
|
|
59
35
|
```
|
|
60
36
|
|
|
61
|
-
|
|
37
|
+
Each agent = a workspace directory with Claude Code configuration (`.claude/`, `CLAUDE.md`, skills, hooks, MCP servers). AgentX orchestrates when and where agents run.
|
|
62
38
|
|
|
63
|
-
|
|
64
|
-
agentx agent add # Interactive: creates workspace, CLAUDE.md, settings, wiki skill
|
|
65
|
-
agentx agent list # List all agents
|
|
66
|
-
agentx agent remove <id> # Remove from config (keeps workspace)
|
|
67
|
-
```
|
|
39
|
+
## Features
|
|
68
40
|
|
|
69
41
|
### Channels
|
|
42
|
+
- **Telegram** — Multi-account bots, streaming responses, HTML formatting, typing indicators, seen reactions, bot-to-bot delegation, media handling (photos, voice, audio, video, documents)
|
|
43
|
+
- **WhatsApp** — Baileys integration, QR pairing, self-chat mode, per-contact/group agent routing
|
|
44
|
+
- **Discord** — Bot with mention-based routing, DM support
|
|
45
|
+
- **GitLab** — Webhook channel: comments, issues, MRs, pipeline events route to agents. Agents reply as GitLab comments. @mention-based agent resolution in comments.
|
|
46
|
+
- **Webhooks** — Generic `POST /webhook/:agentId` endpoint for Stripe, Sentry, GitHub, etc.
|
|
47
|
+
|
|
48
|
+
### Core
|
|
49
|
+
- **Multi-agent** — Named agents with custom permissions, concurrency limits, mention-based routing
|
|
50
|
+
- **Context engine** — 8-layer structured context with per-layer token budgets (channel, scope, identity, peers, intent, artifacts, history, wiki)
|
|
51
|
+
- **Wiki knowledge base** — Karpathy/Farzapedia-inspired Markdown wiki with permissions (private/shared/public). Agents compile conversations into articles.
|
|
52
|
+
- **Session continuity** — `--resume SESSION_ID` for Claude Code, conversation history injection for other tiers
|
|
53
|
+
- **Bot-to-bot** — Agents mention each other on Telegram, conversation chains with loop prevention (visited set + max depth)
|
|
54
|
+
- **Group context** — Persistent group conversation log, agents see last 30 messages when mentioned
|
|
55
|
+
- **Media handling** — Photos, voice messages, audio, video, documents downloaded and passed to agent
|
|
56
|
+
- **Reply-to context** — When replying to a message, agent sees the original text
|
|
57
|
+
|
|
58
|
+
### Operations
|
|
59
|
+
- **Cron scheduler** — Timezone-aware recurring tasks with run logging
|
|
60
|
+
- **A2A mesh** — Cross-machine agent communication over Tailscale/VPN
|
|
61
|
+
- **Rate limiting** — Per-agent, 10/min, 100/hour (configurable)
|
|
62
|
+
- **Token tracking** — Estimated tokens per agent per day, 7-day summaries
|
|
63
|
+
- **Process management** — PID file, graceful shutdown, uncaught exception handlers
|
|
64
|
+
- **72 unit tests** — Config, sessions, wiki, group log, context engine, telegram format
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
agentx channel add # Interactive: Telegram bot token, verify, bind to agent
|
|
73
|
-
agentx channel list # List all channel bindings
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**Supported channels:**
|
|
77
|
-
- **Telegram** — Multi-account bots, streaming responses, MarkdownV2, typing indicators, seen reactions, bot-to-bot delegation
|
|
78
|
-
- **WhatsApp** — Via Baileys (QR pairing), self-chat mode (message yourself to talk to agent), per-contact/group agent routing
|
|
79
|
-
- **Discord** — Via discord.js, mention-based routing, DM support
|
|
80
|
-
|
|
81
|
-
### Cron jobs
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
agentx cron add # Interactive: schedule, agent, prompt, timezone
|
|
85
|
-
agentx cron list # List all jobs with status
|
|
86
|
-
agentx cron enable <id> # Enable a job
|
|
87
|
-
agentx cron disable <id> # Disable a job
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Mesh (multi-machine)
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
agentx mesh add # Interactive: URL, name, verifies connectivity
|
|
94
|
-
agentx mesh list # List peers with health status
|
|
95
|
-
agentx mesh remove <name> # Remove a peer
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Skills
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
agentx skill add ./path/to/skill --agent my-agent # Add to one agent
|
|
102
|
-
agentx skill add ./path/to/skill --all # Add to all agents
|
|
103
|
-
agentx skill list # List skills per agent
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Hooks
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
agentx hook add <agent> # Interactive: event, type (command/http), matcher
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Migration
|
|
66
|
+
## CLI Commands
|
|
113
67
|
|
|
68
|
+
### Daemon
|
|
114
69
|
```bash
|
|
115
|
-
agentx
|
|
116
|
-
agentx
|
|
117
|
-
agentx
|
|
70
|
+
agentx daemon start [--detach] # Start (foreground or background)
|
|
71
|
+
agentx daemon stop # Graceful shutdown
|
|
72
|
+
agentx daemon status # Agents, crons, mesh health
|
|
73
|
+
agentx daemon logs [-f] # Tail logs
|
|
74
|
+
agentx daemon send <agent> <msg> # Send task to agent
|
|
75
|
+
agentx daemon send <agent> <msg> --peer server-2 # Remote agent
|
|
76
|
+
agentx daemon deploy <host> -i key [--restart] # Deploy (runs tests first)
|
|
118
77
|
```
|
|
119
78
|
|
|
120
|
-
###
|
|
121
|
-
|
|
79
|
+
### Management
|
|
122
80
|
```bash
|
|
123
|
-
agentx
|
|
124
|
-
agentx
|
|
81
|
+
agentx agent add / list / remove <id>
|
|
82
|
+
agentx channel add / list # Telegram, WhatsApp, Discord, GitLab
|
|
83
|
+
agentx cron add / list / enable / disable <id>
|
|
84
|
+
agentx mesh add / list / remove <name>
|
|
85
|
+
agentx skill add <path> [--agent X] [--all] / list
|
|
86
|
+
agentx hook add <agent>
|
|
87
|
+
agentx config check # Validate config + workspaces
|
|
88
|
+
agentx config show # Print resolved config
|
|
89
|
+
agentx migrate openclaw [path] [--dry-run]
|
|
90
|
+
agentx init [--force]
|
|
125
91
|
```
|
|
126
92
|
|
|
127
93
|
## Configuration
|
|
128
94
|
|
|
129
|
-
Single `agentx.json
|
|
95
|
+
Single `agentx.json`. Environment variables expanded (`${VAR_NAME}`). Auto-loads `.env`.
|
|
130
96
|
|
|
131
97
|
```jsonc
|
|
132
98
|
{
|
|
133
|
-
"node": {
|
|
134
|
-
"id": "my-machine",
|
|
135
|
-
"name": "My Machine",
|
|
136
|
-
"bind": "127.0.0.1:18800"
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
"providers": {
|
|
140
|
-
"claude": { "apiKey": "${ANTHROPIC_API_KEY}" }
|
|
141
|
-
},
|
|
99
|
+
"node": { "id": "my-machine", "name": "My Machine", "bind": "127.0.0.1:18800" },
|
|
142
100
|
|
|
143
101
|
"agents": {
|
|
144
102
|
"assistant": {
|
|
145
103
|
"name": "Assistant",
|
|
146
104
|
"workspace": "/path/to/workspace",
|
|
147
|
-
"tier": "claude-code",
|
|
105
|
+
"tier": "claude-code", // "sdk" or "orchestrator"
|
|
148
106
|
"model": "claude-sonnet-4-6",
|
|
149
107
|
"mentions": ["@my_bot"],
|
|
150
108
|
"maxConcurrent": 2,
|
|
@@ -162,7 +120,6 @@ Single `agentx.json` file. Environment variables expanded (`${VAR_NAME}`). Auto-
|
|
|
162
120
|
},
|
|
163
121
|
"whatsapp": {
|
|
164
122
|
"enabled": true,
|
|
165
|
-
"sessionDir": ".agentx/whatsapp-sessions",
|
|
166
123
|
"defaultAgent": "assistant",
|
|
167
124
|
"routes": [
|
|
168
125
|
{ "contact": "+1234567890", "agent": "assistant" },
|
|
@@ -173,6 +130,20 @@ Single `agentx.json` file. Environment variables expanded (`${VAR_NAME}`). Auto-
|
|
|
173
130
|
"enabled": true,
|
|
174
131
|
"token": "${DISCORD_BOT_TOKEN}",
|
|
175
132
|
"agentBinding": "assistant"
|
|
133
|
+
},
|
|
134
|
+
"gitlab": {
|
|
135
|
+
"enabled": true,
|
|
136
|
+
"host": "https://gitlab.example.com",
|
|
137
|
+
"token": "${GITLAB_TOKEN}",
|
|
138
|
+
"webhookPort": 18810,
|
|
139
|
+
"routes": [
|
|
140
|
+
{ "project": "team/project-a", "agent": "pm-a" },
|
|
141
|
+
{ "project": "*", "agent": "atlas" }
|
|
142
|
+
],
|
|
143
|
+
"agentMappings": [
|
|
144
|
+
{ "agentId": "coder", "gitlabUsernames": ["coder-bot"], "keywords": ["coder"] },
|
|
145
|
+
{ "agentId": "devops", "gitlabUsernames": ["devops-bot"], "keywords": ["deploy"] }
|
|
146
|
+
]
|
|
176
147
|
}
|
|
177
148
|
},
|
|
178
149
|
|
|
@@ -182,8 +153,7 @@ Single `agentx.json` file. Environment variables expanded (`${VAR_NAME}`). Auto-
|
|
|
182
153
|
"schedule": "0 9 * * *",
|
|
183
154
|
"timezone": "UTC",
|
|
184
155
|
"agent": "assistant",
|
|
185
|
-
"prompt": "Generate today's status report."
|
|
186
|
-
"timeout": 600
|
|
156
|
+
"prompt": "Generate today's status report."
|
|
187
157
|
}
|
|
188
158
|
},
|
|
189
159
|
|
|
@@ -196,115 +166,64 @@ Single `agentx.json` file. Environment variables expanded (`${VAR_NAME}`). Auto-
|
|
|
196
166
|
}
|
|
197
167
|
```
|
|
198
168
|
|
|
199
|
-
##
|
|
200
|
-
|
|
201
|
-
Each agent is a directory with Claude Code configuration:
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
my-workspace/
|
|
205
|
-
├── .claude/
|
|
206
|
-
│ ├── settings.json # Permissions, hooks, env vars
|
|
207
|
-
│ ├── .mcp.json # MCP servers
|
|
208
|
-
│ ├── agents/ # Subagents
|
|
209
|
-
│ └── skills/ # SKILL.md files (gitlab, wiki, etc.)
|
|
210
|
-
├── CLAUDE.md # Agent identity and instructions
|
|
211
|
-
└── ... (project files)
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
New agents created via `agentx agent add` get `CLAUDE.md`, `settings.json`, and the wiki skill automatically.
|
|
215
|
-
|
|
216
|
-
## Three execution tiers
|
|
217
|
-
|
|
218
|
-
| Tier | How | Auth | Best for |
|
|
219
|
-
|------|-----|------|----------|
|
|
220
|
-
| `claude-code` | Spawns `claude` CLI | Subscription | Full power: subagents, MCP, skills, hooks, 1M context |
|
|
221
|
-
| `sdk` | Claude Agent SDK | API key | Programmatic control, headless servers |
|
|
222
|
-
| `orchestrator` | AgentX's own loop | Any provider key | Non-Claude providers (OpenAI, Ollama) |
|
|
223
|
-
|
|
224
|
-
## Session continuity
|
|
225
|
-
|
|
226
|
-
Agents remember conversations:
|
|
227
|
-
- **Claude Code tier**: `--resume SESSION_ID` with reliable ID from `--output-format json`
|
|
228
|
-
- **Other tiers**: Recent conversation history injected into each prompt
|
|
229
|
-
- **Wiki context**: Relevant knowledge articles injected before each response
|
|
169
|
+
## Context Engine
|
|
230
170
|
|
|
231
|
-
|
|
171
|
+
Every agent prompt is built from 8 structured layers, each with a token budget:
|
|
232
172
|
|
|
233
|
-
|
|
173
|
+
| Layer | Priority | Budget | Content |
|
|
174
|
+
|-------|----------|--------|---------|
|
|
175
|
+
| Channel | 1 | 200 | Channel type + rules (GitLab: no @handles, use GFM) |
|
|
176
|
+
| Scope | 2 | 200 | Group name, project path, or DM |
|
|
177
|
+
| Identity | 3 | 300 | Agent system prompt (first line) |
|
|
178
|
+
| Peers | 4 | 400 | Team roster with handles (Telegram only) |
|
|
179
|
+
| Intent | 5 | 200 | Extracted from message: deploy, review, bugfix... |
|
|
180
|
+
| Artifacts | 6 | 500 | Media, reply-to text, issue/MR references |
|
|
181
|
+
| History | 7 | 1200 | Group conversation or session history |
|
|
182
|
+
| Wiki | 8 | 1000 | Relevant knowledge articles |
|
|
234
183
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
```
|
|
238
|
-
.agentx/wiki/
|
|
239
|
-
├── WIKI.md # Master index
|
|
240
|
-
├── raw/entries/ # Auto-ingested conversations
|
|
241
|
-
├── projects/ # Compiled knowledge
|
|
242
|
-
├── decisions/
|
|
243
|
-
└── patterns/
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
**Permissions**: `private` (owner only), `shared` (listed agents), `public` (all agents).
|
|
247
|
-
|
|
248
|
-
## A2A Mesh
|
|
249
|
-
|
|
250
|
-
Run `agentx daemon` on multiple machines. Agents communicate cross-machine via HTTP over Tailscale/VPN.
|
|
251
|
-
|
|
252
|
-
```
|
|
253
|
-
MacBook (Nadia, DevOps) ←── Tailscale ──→ Server (Atlas, MTGL, KSI, ...)
|
|
254
|
-
:18800 :19900
|
|
255
|
-
```
|
|
184
|
+
Total budget: 4000 tokens. Lower layers truncated if over budget.
|
|
256
185
|
|
|
257
186
|
## HTTP API
|
|
258
187
|
|
|
259
|
-
The daemon exposes a REST API:
|
|
260
|
-
|
|
261
188
|
| Endpoint | Method | Description |
|
|
262
189
|
|----------|--------|-------------|
|
|
263
|
-
| `/health` | GET |
|
|
190
|
+
| `/health` | GET | Status, agents, crons, mesh, today's usage |
|
|
264
191
|
| `/agents` | GET | List agents |
|
|
265
192
|
| `/crons` | GET | List cron jobs |
|
|
266
|
-
| `/mesh` | GET | Mesh
|
|
193
|
+
| `/mesh` | GET | Mesh peers |
|
|
194
|
+
| `/usage` | GET | 7-day token usage per agent |
|
|
267
195
|
| `/task` | POST | `{ "agent": "id", "message": "..." }` |
|
|
268
196
|
| `/mesh/task` | POST | `{ "peer": "name", "message": "..." }` |
|
|
197
|
+
| `/webhook/:agentId[/:source]` | POST | Webhook callback (GitLab, GitHub, Stripe, Sentry) |
|
|
269
198
|
| `/.well-known/agent-card.json` | GET | A2A agent discovery |
|
|
270
199
|
|
|
200
|
+
## Three execution tiers
|
|
201
|
+
|
|
202
|
+
| Tier | How | Auth | Best for |
|
|
203
|
+
|------|-----|------|----------|
|
|
204
|
+
| `claude-code` | Spawns `claude` CLI | Subscription | Full power: subagents, MCP, skills, hooks, 1M context |
|
|
205
|
+
| `sdk` | Claude Agent SDK | API key | Programmatic control, headless servers |
|
|
206
|
+
| `orchestrator` | AgentX's own loop | Any provider key | Non-Claude providers (OpenAI, Ollama) |
|
|
207
|
+
|
|
271
208
|
## Migrating from OpenClaw
|
|
272
209
|
|
|
273
210
|
```bash
|
|
274
|
-
agentx migrate openclaw
|
|
211
|
+
agentx migrate openclaw # Auto-imports agents, channels, crons, skills
|
|
275
212
|
```
|
|
276
213
|
|
|
277
|
-
Auto-imports agents, Telegram bots, cron jobs, and WhatsApp config. Also ports:
|
|
278
|
-
- Skills to workspace `.claude/skills/`
|
|
279
|
-
- Permissions to `.claude/settings.json`
|
|
280
|
-
- Agent identity to `CLAUDE.md`
|
|
281
|
-
- WhatsApp sessions (reuses existing pairing)
|
|
282
|
-
|
|
283
|
-
| OpenClaw | AgentX |
|
|
284
|
-
|----------|--------|
|
|
285
|
-
| Gateway + Node | Single daemon per machine |
|
|
286
|
-
| OAuth proxy | Direct API key or subscription |
|
|
287
|
-
| `openclaw.json` | `agentx.json` |
|
|
288
|
-
| `exec-approvals.json` | `.claude/settings.json` per workspace |
|
|
289
|
-
|
|
290
214
|
## Use cases
|
|
291
215
|
|
|
292
|
-
- **Team of Telegram bots** — each project gets its own bot + agent
|
|
216
|
+
- **Team of Telegram bots** — each project gets its own bot + agent
|
|
217
|
+
- **GitLab code review** — comment on MR, agent reviews and replies as a GitLab comment
|
|
293
218
|
- **WhatsApp assistant** — message yourself, agent replies in self-chat
|
|
294
219
|
- **Scheduled content** — cron jobs generate blog posts, reports, social media drafts
|
|
295
220
|
- **Multi-machine swarm** — agents on MacBook + server collaborate via mesh
|
|
296
|
-
- **
|
|
297
|
-
- **
|
|
221
|
+
- **Webhook automation** — Sentry error → DevOps agent investigates, Stripe payment → billing agent processes
|
|
222
|
+
- **Bot-to-bot delegation** — Nadia mentions @devops, DevOps picks up and responds
|
|
298
223
|
|
|
299
224
|
## Legal
|
|
300
225
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
- Each user provides their own API key or Claude subscription
|
|
304
|
-
- No credentials are stored, shared, or proxied by AgentX
|
|
305
|
-
- Built on official public packages: Claude API, Claude Agent SDK, Claude Code CLI
|
|
306
|
-
- Provider-agnostic — works with any LLM, not locked to Anthropic
|
|
307
|
-
- Same model as LangChain, CrewAI, AutoGen, Dify, n8n
|
|
226
|
+
Self-hosted, bring-your-own-key. No credentials stored or proxied. Built on official public packages (Claude API, Claude Agent SDK, Claude Code CLI). Same model as LangChain, CrewAI, AutoGen.
|
|
308
227
|
|
|
309
228
|
## License
|
|
310
229
|
|