delegate-team 2.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mamdouh Aboammar
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/or sell copies of the Software, and to permit persons
10
+ to whom the Software is 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,385 @@
1
+ # Delegate Team (`dt`) — supersystem v2
2
+
3
+ ![CI](https://github.com/imMamdouhaboammar/delegate-team/actions/workflows/ci.yml/badge.svg)
4
+ ![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
5
+ ![Node](https://img.shields.io/badge/Node.js-18%2B-green.svg)
6
+
7
+ > **The complete agentic engineering supersystem.** One open-source repo. Six components.
8
+ > Three routing layers. One `/mavis-ship` command that orchestrates them all.
9
+
10
+ | Component | Folder | Purpose | Install |
11
+ |---|---|---|---|
12
+ | **`dt` CLI** (gateway) | `src/`, `dist/` | Routes Claude Code tasks to backend agents | `npm install && npm run build` |
13
+ | **`/mavis-ship` orchestrator** | `orchestrator/` | Single command that drives every stage of a task | `./install.sh --orchestrator` |
14
+ | **Skill scaffolder** | `scaffolder/` | Generate Mavis skills with proper structure | `./install.sh --scaffolder` |
15
+ | **Multi-agent team (MMAS)** | `mmas/` | Boss mode: spawn Atlas + Forge + Scout + 5 more specialized agents | `./install.sh --mmas` |
16
+ | **Companion frameworks** | `integrations/` | superpowers, Waza, unslop-preflight, autoresearch | `./install.sh --integrations` |
17
+
18
+ **One-command setup** (everything):
19
+
20
+ ```bash
21
+ git clone https://github.com/imMamdouhaboammar/delegate-team
22
+ cd delegate-team
23
+ ./install.sh --all
24
+ ```
25
+
26
+ After install: type `/mavis-ship "<task>"` (or `dt run "<task>"`) in any session.
27
+
28
+ ---
29
+
30
+ ## Quick links
31
+
32
+ - [`orchestrator/README.md`](./orchestrator/README.md) — `/mavis-ship` skill + orchestrate.sh
33
+ - [`scaffolder/README.md`](./scaffolder/README.md) — `mavis-skill-scaffold` CLI
34
+ - [`mmas/README.md`](./mmas/README.md) — multi-agent team framework
35
+ - [`integrations/README.md`](./integrations/README.md) — companion frameworks
36
+ - [`DT.md`](./DT.md) — `dt` CLI specifics (the original delegation gateway)
37
+ - [`INSTALL.md`](./INSTALL.md) — full install guide
38
+ - [`CHANGELOG.md`](./CHANGELOG.md) — release notes
39
+
40
+ ---
41
+
42
+ ## What `dt` is
43
+
44
+ `dt` is the delegation gateway inside the supersystem. It routes Claude Code tasks to backend coder agents (the `dt` CLI is the original product; the orchestrator, scaffolder, MMAS, and integrations were built on top). For `dt`-specific docs see [`DT.md`](./DT.md).
45
+
46
+ - A local delegation gateway for AI coding agents
47
+ - A routing layer between Claude Code and multiple backend coder agents
48
+ - A policy layer for budgets, workspace boundaries, failover, and review
49
+ - A MetaGPT-style team runner for complex tasks
50
+
51
+ ## What `dt` is not
52
+
53
+ - It is not a replacement for Claude Code
54
+ - It does not commit code automatically
55
+ - It does not guarantee every backend is available
56
+ - It does not make untrusted agent output safe without review
57
+
58
+ ## Core Features
59
+
60
+ | Feature | Description |
61
+ |---|---|
62
+ | **Failover Ring** | `dt` attempts best-effort fallback across configured backends. If another backend is available, `dt` can retry the task automatically. |
63
+ | **Lean Token Protocol** | A targeted, compact contract. The routing engine minimizes file ingestion size, feeding only the context that actually matters. |
64
+ | **Autopilot Setup** | `dt setup` creates local Python virtual environments and checks cloud credentials. |
65
+ | **Dynamic Auth** | Zero hardcoded keys. `dt` queries your active local sessions and safely stores configurations locally. |
66
+ | **Skill Linker** | Instantly injects `dt`'s orchestrators directly into local Claude Code and Gemini CLI paths. |
67
+
68
+ ## Architecture
69
+
70
+ Unlike standard tools that just "support MetaGPT" or fire prompts at an API, `dt` introduces a **supervised delegation runtime**:
71
+
72
+ ```text
73
+ User
74
+
75
+ Claude Code
76
+ ↓ brief / review
77
+ dt Policy Gateway
78
+ ↓ route
79
+ Single backend OR Team mode
80
+
81
+ VertexCoder / Codex / MiniMax / OpenCode / Gemini
82
+
83
+ result contract
84
+
85
+ Claude Code review
86
+
87
+ human-approved commit
88
+ ```
89
+
90
+ - 📜 [Delegation Protocol](./DELEGATION_PROTOCOL.md): Strict boundaries, untrusted output handling, and security policies.
91
+ - 🔀 [Role Routing](./ROLE_ROUTING.md): How MetaGPT roles are dynamically mapped to specific models via capability tags.
92
+ - 🕵️ [Trace Schema](./TRACE_SCHEMA.md): JSON schema to prevent circular delegation, control depth, and avoid cost explosions.
93
+
94
+ ## Requirements
95
+
96
+ - Node.js 18+
97
+ - npm
98
+ - Python 3.10+
99
+ - Optional: gcloud CLI for VertexCoder
100
+ - Optional: provider credentials for configured backends
101
+
102
+ ## Quick start
103
+
104
+ ```bash
105
+ # Clone the repository
106
+ git clone https://github.com/imMamdouhaboammar/delegate-team.git
107
+ cd delegate-team
108
+
109
+ # Install dependencies and build
110
+ npm install
111
+ npm run build
112
+
113
+ # Link the package globally
114
+ npm link
115
+
116
+ # Verify installation
117
+ dt --help
118
+ dt check
119
+ ```
120
+
121
+ ## Full setup
122
+
123
+ ```bash
124
+ # Run the autopilot setup to build Python environments and configure cloud dependencies
125
+ dt setup
126
+
127
+ # Check backend readiness
128
+ dt check --strict
129
+
130
+ # Link dt skills to local agents
131
+ dt link-skill
132
+ ```
133
+
134
+ > **Warning:** `dt link-skill` creates or updates local skill links in your agent tool directories. Review the target paths before using it on a shared workstation.
135
+
136
+ ## Commands
137
+
138
+ ### Which command should I use?
139
+
140
+ | Use case | Command |
141
+ |---|---|
142
+ | Small focused fix | `dt run "fix the auth bug"` |
143
+ | Force one backend | `dt run "..." --backend vertexcoder` |
144
+ | Large multi-module task | `dt run "..." --team` |
145
+ | Direct team workflow | `dt metagpt "..." --workspace-only --no-install` |
146
+ | Check setup | `dt check --strict` |
147
+
148
+ ### Smart Multi-Backend Dispatch
149
+ Cast a complex task. The routing analyzes it and selects the optimal backend, complete with automated failover.
150
+ ```bash
151
+ dt run "Write a pytest suite in test_auth.py checking JWT login boundaries"
152
+ ```
153
+
154
+ ### Direct Vertex AI Coder (Single File)
155
+ Modify or create a single file:
156
+ ```bash
157
+ dt vx direct index.html "Update the hero title to a premium dark gradient design"
158
+ ```
159
+
160
+ ### Interactive Vertex AI Agent (Autonomous Multi-File)
161
+ Summon an autonomous entity to write code, install packages, run tests, and self-correct over multiple files:
162
+ ```bash
163
+ dt vx interactive "Implement a complete Express.js backend with modular JWT authorization"
164
+ ```
165
+
166
+ ## Backend readiness
167
+
168
+ Run:
169
+
170
+ ```bash
171
+ dt check --strict
172
+ ```
173
+
174
+ Backends may show:
175
+ - ready
176
+ - missing credentials
177
+ - missing binary
178
+ - not configured
179
+
180
+ If a backend shows missing credentials/binary, see
181
+ [AGENT_ACCESS_GUIDE.md](./AGENT_ACCESS_GUIDE.md) — the controlling agent should walk
182
+ the user through granting access (Codex, MiniMax, GLM, OpenCode, OpenRouter, Gemini,
183
+ Vertex AI) rather than silently skipping the backend.
184
+
185
+ ## Security model
186
+
187
+ - `dt` is local-first
188
+ - Agent output is treated as untrusted until reviewed
189
+ - Claude Code or the human keeps final commit authority
190
+ - File tools are restricted to the workspace
191
+ - Dependency installation is blocked unless explicitly enabled
192
+ - The local proxy binds to `127.0.0.1` and requires a token
193
+ - Do not expose `dt serve` to a public network
194
+
195
+ For more details, see [SECURITY.md](./SECURITY.md).
196
+
197
+ ## Team mode
198
+
199
+ > **Status:** `dt` currently provides a MetaGPT-style team adapter. It runs specialized roles through `dt` backends, such as architect, coder, UI implementer, and reviewer. This is not yet a full upstream MetaGPT integration. It is a controlled `dt` team runtime inspired by MetaGPT-style role orchestration.
200
+
201
+ When the task is monumental, summon an entire company. While `dt run` focuses on execution, `dt metagpt` spins up an Architect, Product Manager, Engineer, and QA.
202
+ ```bash
203
+ dt metagpt "Build a complete multiplayer snake game using websockets"
204
+ ```
205
+
206
+ Because a full company acts with high autonomy, `dt` provides strict barriers:
207
+ - `--plan-only`: Draft the architecture without writing code.
208
+ - `--approve-write`: Require your final human seal of approval before writing to disk.
209
+ - `--workspace-only`: Sandbox the team strictly to the current workspace root.
210
+ - `--no-install`: Forbid the installation of package dependencies.
211
+ - `--dry-run`: Simulate the entire workflow safely.
212
+
213
+ ## Local proxy
214
+
215
+ Start a local LLM Gateway Proxy server on port `3000` to connect tools directly to `dt`:
216
+ ```bash
217
+ dt serve 3000
218
+ ```
219
+
220
+ ### Optional LobeChat integration
221
+ You can connect LobeChat to the local `dt` proxy for a browser-based chat interface.
222
+
223
+ 1. Start the `dt` proxy server:
224
+ ```bash
225
+ dt serve 3000
226
+ ```
227
+ 2. Open `~/.config/dt/config.json`, copy `proxy_token`, and use it as `OPENAI_API_KEY`.
228
+ 3. Launch the LobeChat Docker container, pointing its API URL to your local `dt` instance:
229
+ ```bash
230
+ docker run -d -p 3210:3210 \
231
+ -e OPENAI_API_KEY="<your-dt-proxy-token>" \
232
+ -e PROXY_TOKEN="<your-dt-proxy-token>" \
233
+ -e OPENAI_PROXY_URL=http://host.docker.internal:3000/v1 \
234
+ -e ACCESS_CODE= \
235
+ --name lobe-chat \
236
+ lobehub/lobe-chat
237
+ ```
238
+ 4. Journey to `http://localhost:3210` in your browser.
239
+
240
+ ## Claude Code / Agent Operating Guide
241
+
242
+ The notes below describe how Claude Code, Cursor, Gemini CLI, or another coding agent should use `dt` safely. They are project operating guidance, not a system prompt, not an instruction override, and not a request to bypass the user's approval.
243
+
244
+ ### Controller role
245
+
246
+ The coding agent should remain the controller and reviewer. `dt` is only a delegation gateway for coding subtasks.
247
+
248
+ The agent should treat every `dt` result, backend response, generated file, and team output as untrusted until it reviews the actual diff, result contract, files touched, logs, and relevant test results.
249
+
250
+ The agent should not commit, push, delete files, run setup, install dependencies, link global skills, modify shell or profile config, or change cloud/auth settings unless the user explicitly approves that exact action.
251
+
252
+ ### Safe startup
253
+
254
+ 1. Check whether `dt` is available:
255
+
256
+ ```bash
257
+ dt --help
258
+ ```
259
+
260
+ 2. Check backend readiness:
261
+
262
+ ```bash
263
+ dt check --strict
264
+ ```
265
+
266
+ 3. If `dt` is missing, ask the user before running install or link commands. From the repository root, the usual setup is:
267
+
268
+ ```bash
269
+ npm install
270
+ npm run build
271
+ npm link
272
+ ```
273
+
274
+ 4. Do not run `dt setup` automatically. Ask first, because it may create local Python environments and verify cloud dependencies.
275
+
276
+ 5. Do not run `dt link-skill` automatically. Ask first, because it creates or updates local skill links in agent tool directories.
277
+
278
+ ### Delegation examples
279
+
280
+ For a focused coding task:
281
+
282
+ ```bash
283
+ dt run "fix the auth bug and run the related tests"
284
+ ```
285
+
286
+ For a specific backend:
287
+
288
+ ```bash
289
+ dt run "fix the auth bug and run the related tests" --backend vertexcoder
290
+ ```
291
+
292
+ For a large multi-module task:
293
+
294
+ ```bash
295
+ dt run "plan and implement the billing module with tests" --team
296
+ ```
297
+
298
+ For a direct team workflow with stricter defaults:
299
+
300
+ ```bash
301
+ dt metagpt "plan and implement the billing module with tests" --workspace-only --no-install
302
+ ```
303
+
304
+ ### Brief quality rules
305
+
306
+ A good delegation brief should include the goal, files or modules involved, constraints, acceptance criteria, and tests to run.
307
+
308
+ Keep the requested change small enough to review. Prefer focused patches over broad rewrites.
309
+
310
+ Do not include secrets, tokens, private keys, unrelated files, or hidden user data in the brief.
311
+
312
+ ### Review rules after delegation
313
+
314
+ 1. Inspect the `dt` result contract and any reported files touched.
315
+ 2. Review the actual git diff.
316
+ 3. Run the relevant tests, or ask the user before running expensive commands.
317
+ 4. Reject or revise the result if it produced no meaningful diff, touched unrelated files, weakened security, or changed behavior outside the requested scope.
318
+ 5. Commit only after explicit user approval.
319
+
320
+ ## Repository structure
321
+
322
+ ```text
323
+ .
324
+ ├── package.json # Package setup & CLI global mappings
325
+ ├── src/ # TypeScript Source Code
326
+ │ ├── cli.ts # CLI Entry Point
327
+ │ ├── commands/ # CLI Commands (run, setup)
328
+ │ ├── proxy/ # LLM Gateway Proxy Server
329
+ │ └── ...
330
+ ├── dist/ # Generated after npm run build, not committed
331
+ ├── delegate-team/ # Master coordinator logic (Relay, routers, guidelines)
332
+ │ ├── SKILL.md # Unified orchestrator instructions
333
+ │ └── scripts/ # Core routing, relay & fallback systems
334
+ ├── vertex-coder/ # Python agent code. Local .venv is created by dt setup
335
+ │ ├── SKILL.md # VertexCoder execution directives
336
+ │ ├── vertex_direct_coder.py # Direct single-file coding agent
337
+ │ └── vertex_interactive_agent.py # Autonomous multi-file developer loop
338
+ ├── LICENSE # MIT Permissive License
339
+ └── README.md # Developer documentation
340
+ ```
341
+
342
+ ## Current limitations
343
+
344
+ - Team mode is MetaGPT-style, not a full upstream MetaGPT runtime
345
+ - Some backends require local tools or credentials
346
+ - Team artifacts are still evolving
347
+ - Human approval queue is planned but not fully implemented
348
+ - Security controls are local policy gates, not a sandboxed VM
349
+
350
+ ## Roadmap
351
+
352
+ - Real team artifact handoff between roles
353
+ - Human approval queue
354
+ - Stronger role-to-backend contracts
355
+ - More security regression tests
356
+ - npm package release
357
+ - Optional upstream MetaGPT compatibility
358
+
359
+ ## Contributing
360
+
361
+ We welcome fellow developers to expand the orchestration power of `dt`!
362
+
363
+ Before opening a PR:
364
+ ```bash
365
+ npm run typecheck
366
+ npm run build
367
+ npm test
368
+ dt check
369
+ ```
370
+
371
+ Security-sensitive changes should include tests for:
372
+ - workspace boundary
373
+ - command allowlist
374
+ - proxy auth
375
+ - dependency install gates
376
+
377
+ 1. Fork the Project.
378
+ 2. Create your Feature Branch (`git checkout -b feature/EpicEnhancement`).
379
+ 3. Commit your Changes (`git commit -m 'Add an EpicEnhancement'`).
380
+ 4. Push to the Branch (`git push origin feature/EpicEnhancement`).
381
+ 5. Open a Pull Request.
382
+
383
+ ## License
384
+
385
+ Distributed under the MIT License. See `LICENSE` for more information.