adaptive-director-skill 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ahmed Tamer
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,149 @@
1
+ # Adaptive Director Skill
2
+
3
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org)
4
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0%20(pure%20built--ins)-blue.svg)](#architecture)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
7
+ > **One task in. The right agents take it from there.**
8
+
9
+ **Adaptive Director Skill** is a lightweight, skill-first orchestration layer for AI coding agents. Give it a single development task, and it dynamically directs each phase—**Planning, Implementation, Review, Fixing, and Verification**—to the best available agent, model, and reasoning effort.
10
+
11
+ Instead of burning expensive reasoning tokens on simple edits or trusting a weak model with complex architecture and reviews, it directs work intelligently based on capability and budget.
12
+
13
+ ```text
14
+ User Task
15
+
16
+ Adaptive Director
17
+
18
+ Plan → Implement → Review → Verify
19
+ ↓ ↓ ↓
20
+ Best Best Independent
21
+ Agent Coder Reviewer
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Why Use It?
27
+
28
+ Running an entire task with a single agent often leads to three common problems:
29
+ - **Weak models on critical planning:** Lightweight models make architectural mistakes.
30
+ - **Wasted reasoning tokens:** Using maximum reasoning for minor code changes burns quota needlessly.
31
+ - **Review blind spots:** Agents struggle to catch their own errors during self-review.
32
+
33
+ ### How It Solves This
34
+
35
+ ```mermaid
36
+ flowchart LR
37
+ Task([User Task]) --> Plan["1. Plan<br/>(High Reasoning)"]
38
+ Plan --> Impl["2. Implement<br/>(Fast Coder)"]
39
+ Impl --> Rev["3. Review<br/>(Independent Agent)"]
40
+ Rev --> Gate{"Critical<br/>Issues?"}
41
+ Gate -- Yes --> Fix["Targeted Fix<br/>(Max 1 Cycle)"]
42
+ Fix --> Rev
43
+ Gate -- No --> Ver["4. Verify<br/>(Automated Tests)"]
44
+ Ver --> Done([Verified])
45
+ ```
46
+
47
+ | Phase | Adaptive Decision |
48
+ |---|---|
49
+ | **Plan** | Directed to a strong reasoning model |
50
+ | **Implement** | Routed to an efficient coding specialist |
51
+ | **Review** | Checked by an independent reviewer (never self-reviewed) |
52
+ | **Fix** | Automated 1-cycle fix for critical findings |
53
+ | **Verify** | Validated via project test suites (`flutter test`, `npm test`, `pytest`) |
54
+
55
+ ---
56
+
57
+ ## Quick Start
58
+
59
+ Adaptive Director runs with **zero external npm dependencies** (pure Node.js built-ins).
60
+
61
+ ### 1. Clone & Setup
62
+
63
+ ```bash
64
+ git clone https://github.com/tamourax/Adaptive-Orchestrator.git
65
+ cd Adaptive-Orchestrator
66
+
67
+ # Probe local agents (Claude, Codex, Antigravity, Cursor, etc.)
68
+ node scripts/setup.mjs
69
+
70
+ # Verify installation with smoke test
71
+ node scripts/smoke-test.mjs
72
+ ```
73
+
74
+ ### 2. Run with Your AI Agent
75
+
76
+ Load `SKILL.md` into your coding agent (Claude Code, Antigravity, Codex, etc.) and prompt:
77
+
78
+ ```text
79
+ Use $adaptive-director-skill to implement Stripe checkout in Flutter
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Example Walkthrough
85
+
86
+ **Task:** `"Implement Stripe in Flutter"`
87
+
88
+ 1. **Plan:** Claude (High Effort) inspects the repo and builds the execution plan.
89
+ 2. **Implement:** Codex (Medium Effort) writes the code without committing.
90
+ 3. **Review:** An independent Claude session inspects the diff.
91
+ - *Finds 1 Critical issue:* PaymentIntent confirmed twice on retry.
92
+ 4. **Fix:** Codex receives a targeted brief to fix only that critical bug.
93
+ 5. **Re-Review:** Reviewer confirms the fix.
94
+ 6. **Verify:** Runs `flutter analyze && flutter test`.
95
+ 7. **Done:** Changes left uncommitted for final developer review.
96
+
97
+ ---
98
+
99
+ ## Architecture
100
+
101
+ > *"Reasoning stays with agents. Deterministic operations stay in scripts."*
102
+
103
+ ```text
104
+ adaptive-director/
105
+ ├── SKILL.md # The brain: instructions read by your AI agent
106
+ ├── data/registry.json # Baseline model capability scores (1–5)
107
+ ├── references/ # Handoff schemas, rules, and delegate docs
108
+ └── scripts/ # Deterministic Node.js helpers (pure built-ins)
109
+ ├── discover.mjs # Detects local agent CLIs
110
+ ├── route.mjs # Computes agent + effort assignments
111
+ ├── run-state.mjs # Manages isolated phase briefs & workspaces
112
+ └── resume.mjs # Recovers interrupted runs
113
+ ```
114
+
115
+ ### Routing Priority Order
116
+
117
+ 1. **User Overrides:** Explicit settings in `~/.adaptive-director/config.yaml`
118
+ 2. **Delegate Lanes:** Optional `delegate-skills` fleet lanes (when `--delegate` is active)
119
+ 3. **Capability Registry:** Best available local model meeting phase requirements
120
+ 4. **Fallback:** Default host agent
121
+
122
+ ---
123
+
124
+ ## Core Principles
125
+
126
+ - **Independent Review:** The coder never reviews its own work.
127
+ - **Max Reasoning Opt-in:** `max` effort is locked by default; requires `--allow-max`.
128
+ - **Runaway Loop Protection:** Maximum 1 automated fix cycle before alerting the user.
129
+ - **Context Isolation:** Each agent receives only a self-contained brief on disk (`.adaptive-director/runs/`), preventing context window bloat.
130
+ - **Zero Dependencies:** Runs on vanilla Node.js 18+.
131
+
132
+ ---
133
+
134
+ ## Configuration (`~/.adaptive-director/config.yaml`)
135
+
136
+ ```yaml
137
+ defaultBudget: balanced # conservative | balanced | quality
138
+
139
+ # Optional overrides:
140
+ agentOverrides.plan: claude
141
+ agentOverrides.implement: codex
142
+ agentOverrides.review: claude
143
+ ```
144
+
145
+ ---
146
+
147
+ ## License
148
+
149
+ MIT License © 2026 [Ahmed Tamer](https://github.com/tamourax). See [LICENSE](LICENSE) for details.
package/SKILL.md ADDED
@@ -0,0 +1,395 @@
1
+ ---
2
+ name: adaptive-director-skill
3
+ description: >
4
+ Adaptive multi-agent director for coding tasks.
5
+ Routes every phase (plan, implement, review, fix, verify) to the right
6
+ agent, model, and reasoning effort automatically.
7
+ version: 0.1.0
8
+ ---
9
+
10
+ # Adaptive Director Skill
11
+
12
+ > **One task in. The right agents take it from there.**
13
+
14
+ ---
15
+
16
+ ## What This Skill Does
17
+
18
+ When you invoke this skill with a coding task, you:
19
+
20
+ 1. Classify the task
21
+ 2. Determine which phases to run
22
+ 3. Route each phase to the right agent, model, and effort level
23
+ 4. Execute phases using handoff files (not shared chat history)
24
+ 5. Handle review findings (fix critical issues once, then re-review)
25
+ 6. Verify the result
26
+ 7. Produce a final status report
27
+
28
+ You do NOT implement, review, or verify yourself unless you are the best available agent for those phases and the routing engine assigns you.
29
+
30
+ ---
31
+
32
+ ## Core Rules
33
+
34
+ These rules are absolute:
35
+
36
+ ```
37
+ 1. Max reasoning is DISABLED by default.
38
+ → Only use if --allow-max was passed.
39
+
40
+ 2. Delegate execution is DISABLED by default.
41
+ → Only use if --delegate was passed.
42
+
43
+ 3. Native agents/sub-agents are preferred.
44
+
45
+ 4. Review MUST be independent.
46
+ → The reviewer must not be the same execution context that implemented.
47
+
48
+ 5. Critical findings MUST be fixed before verification.
49
+
50
+ 6. Warning findings are reported but do not block.
51
+
52
+ 7. Suggestion findings are informational only.
53
+
54
+ 8. Maximum 1 automatic fix/re-review cycle.
55
+ → If critical issues remain after re-review → Status: Blocked.
56
+
57
+ 9. Never commit. Committing belongs to the user.
58
+
59
+ 10. Never guess unavailable agent capabilities.
60
+ → If unknown, mark as unknown.
61
+ ```
62
+
63
+ ---
64
+
65
+ ## How to Start a Run
66
+
67
+ ### Step 1: Read user input
68
+
69
+ Extract:
70
+ - Task description
71
+ - Flags: `--budget`, `--delegate`, `--allow-max`, `--dry-run`
72
+ - Default budget: `balanced`
73
+
74
+ ### Step 2: Classify the task
75
+
76
+ Run initial heuristic classification:
77
+
78
+ ```bash
79
+ # Small: rename, fix typo, update text, minor fix, change color/label
80
+ # Medium: integration, API feature, module refactor, password reset
81
+ # Large: architecture refactor, auth redesign, migration, payment system
82
+ ```
83
+
84
+ Use the heuristic. Do NOT call an agent for classification yet.
85
+ The Planner will reclassify after repo inspection if needed.
86
+
87
+ ### Step 3: Get routing for each phase
88
+
89
+ For EACH phase in the task's phase list, call `route.mjs`:
90
+
91
+ ```bash
92
+ echo '{
93
+ "taskSize": "medium",
94
+ "phase": "plan",
95
+ "budget": "balanced",
96
+ "allowMax": false,
97
+ "delegateEnabled": false
98
+ }' | node scripts/route.mjs
99
+ ```
100
+
101
+ `route.mjs` returns:
102
+ ```json
103
+ {
104
+ "agent": "claude",
105
+ "model": "claude-sonnet-4-5",
106
+ "effort": "high",
107
+ "execution": "native"
108
+ }
109
+ ```
110
+
111
+ Repeat for all phases. Build a routing table.
112
+
113
+ ### Step 4: Dry run check
114
+
115
+ If `--dry-run` was passed:
116
+ - Print the routing table
117
+ - Exit. No execution.
118
+
119
+ ### Step 5: Init run workspace
120
+
121
+ ```bash
122
+ node scripts/run-state.mjs init \
123
+ --task "Implement Stripe in Flutter" \
124
+ --size medium \
125
+ --budget balanced
126
+ ```
127
+
128
+ Returns `{ "runId": "run-abc123", "workspacePath": "..." }`.
129
+ Save the `runId`. You will use it for all subsequent operations.
130
+
131
+ ### Step 6: Execute phases
132
+
133
+ See the **Phase Execution** section below.
134
+
135
+ ---
136
+
137
+ ## Phase Map
138
+
139
+ | Task Size | Phases |
140
+ |-----------|--------|
141
+ | small | implement → review |
142
+ | medium | plan → implement → review → verify |
143
+ | large | plan → implement → review → [fix if critical] → verify |
144
+
145
+ ---
146
+
147
+ ## Phase Execution
148
+
149
+ Execute phases in order. For each phase:
150
+
151
+ ### 1. Update metadata
152
+ ```bash
153
+ node scripts/run-state.mjs update \
154
+ --run-id run-abc123 \
155
+ --status running \
156
+ --phase plan
157
+ ```
158
+
159
+ ### 2. Build the brief
160
+ ```bash
161
+ node scripts/run-state.mjs build-brief \
162
+ --run-id run-abc123 \
163
+ --phase plan
164
+ ```
165
+
166
+ The brief is a self-contained prompt. Pass it to the assigned agent.
167
+ **Do not share full chat history with the agent — use the brief only.**
168
+
169
+ ### 3. Execute the phase
170
+
171
+ Use the routing decision from Step 3 above:
172
+
173
+ - `execution: native` → use a native sub-agent or spawn the agent CLI
174
+ - `execution: delegate` → use `delegate-skills` relay for the assigned agent
175
+
176
+ Pass the brief as the task for the agent.
177
+
178
+ ### 4. Write the phase result
179
+
180
+ After the agent completes, write its output:
181
+
182
+ ```bash
183
+ node scripts/run-state.mjs write-phase \
184
+ --run-id run-abc123 \
185
+ --phase plan \
186
+ --status completed \
187
+ --summary "<agent output>"
188
+ ```
189
+
190
+ If the phase is `review` or `fix`, also parse findings and include:
191
+ ```bash
192
+ --findings-json '[{"severity":"critical","title":"...","description":"...","file":"..."}]'
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Special Phase: Plan + Reclassification
198
+
199
+ After the **plan** phase completes:
200
+
201
+ 1. Look for a JSON block at the end of the planner's output:
202
+ ```json
203
+ {"recommended_size": "large", "reason": "..."}
204
+ ```
205
+
206
+ 2. If `recommended_size` differs from the initial classification:
207
+ - Log: `Reclassified: medium → large (reason)`
208
+ - Rebuild the routing table for the new size
209
+ - Update metadata
210
+
211
+ 3. Continue with the updated phase list and routing.
212
+
213
+ ---
214
+
215
+ ## Special Phase: Review
216
+
217
+ After the **review** phase:
218
+
219
+ 1. Parse findings from the review output.
220
+ Look for lines like:
221
+ ```
222
+ [CRITICAL] <title>
223
+ [WARNING] <title>
224
+ [SUGGESTION] <title>
225
+ ```
226
+
227
+ 2. Write phase result with findings JSON.
228
+
229
+ 3. Check for CRITICAL findings:
230
+
231
+ ```
232
+ Critical found?
233
+ ├── No → continue to Verify
234
+ └── Yes → enter Fix Loop
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Fix Loop
240
+
241
+ Maximum: **1 automatic cycle**.
242
+
243
+ ### Fix phase
244
+
245
+ ```bash
246
+ node scripts/run-state.mjs build-brief --run-id run-abc123 --phase fix
247
+ ```
248
+
249
+ Execute with the assigned fix agent. The brief includes the previous review.
250
+
251
+ ### Re-review
252
+
253
+ Build and execute a new review brief. Parse findings again.
254
+
255
+ ```
256
+ Re-review: Critical still found?
257
+ ├── No → continue to Verify
258
+ └── Yes → Status: Blocked
259
+ Report remaining issues to user.
260
+ STOP.
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Special Phase: Verify
266
+
267
+ Run project-appropriate verification commands:
268
+
269
+ | Project Type | Detected by | Commands |
270
+ |-------------|------------|---------|
271
+ | Flutter | `pubspec.yaml` | `flutter analyze`, `flutter test` |
272
+ | Node.js | `package.json` | `npm test`, `npm run build` |
273
+ | Laravel | `composer.json` | `php artisan test` |
274
+ | Python | `pyproject.toml` or `requirements.txt` | `pytest` |
275
+ | Unknown | (none) | skip |
276
+
277
+ If commands pass → `Status: Verified`
278
+ If commands fail → `Status: Blocked`
279
+
280
+ Write final result:
281
+ ```bash
282
+ node scripts/run-state.mjs write-phase \
283
+ --run-id run-abc123 \
284
+ --phase verify \
285
+ --status completed \
286
+ --summary "flutter analyze: passed. flutter test: 42 tests passed."
287
+ ```
288
+
289
+ ---
290
+
291
+ ## Final Report
292
+
293
+ Print a clean summary:
294
+
295
+ ```
296
+ Adaptive Orchestrator
297
+
298
+ Task: Implement Stripe in Flutter
299
+ Run ID: run-abc123
300
+ Size: medium
301
+ Budget: balanced
302
+
303
+ Execution:
304
+ ✓ Plan completed
305
+ ✓ Implementation completed
306
+ ⚠ Review found 1 CRITICAL issue
307
+ ✓ Fix completed
308
+ ✓ Re-review passed
309
+ ✓ Verification passed
310
+
311
+ Status: Verified
312
+ ```
313
+
314
+ Or if blocked:
315
+ ```
316
+ Status: Blocked
317
+
318
+ Remaining critical issue:
319
+ [CRITICAL] PaymentIntent confirmed twice
320
+ File: lib/payment_service.dart
321
+ PaymentIntent.confirm() is called twice on retry...
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Resume a Run
327
+
328
+ If a run was interrupted:
329
+
330
+ ```bash
331
+ node scripts/resume.mjs
332
+ ```
333
+
334
+ Returns the most recent interrupted run's metadata (or null).
335
+
336
+ Use `currentPhase` from metadata to determine where to continue.
337
+ Rebuild briefs using `run-state.mjs build-brief` for remaining phases.
338
+
339
+ ---
340
+
341
+ ## Coordinator-Only Mode
342
+
343
+ If the current agent's model is below the minimum capability for critical phases:
344
+
345
+ ```
346
+ Current model planning score < 3 (required for plan)
347
+ Current model review score < 3 (required for review)
348
+ → Role: Coordinator Only
349
+ ```
350
+
351
+ In Coordinator-Only mode:
352
+ - Do NOT plan or review yourself
353
+ - Dispatch ALL critical phases to stronger agents via routing
354
+ - Only: pass briefs, receive results, update run state, report outcome
355
+
356
+ The routing engine already handles this — it will NOT select a weak model for planning or review.
357
+
358
+ ---
359
+
360
+ ## What This Skill Does NOT Do
361
+
362
+ ```
363
+ ✗ Self-learning
364
+ ✗ Automatic quota detection
365
+ ✗ Cost prediction
366
+ ✗ Multiple delegates per phase
367
+ ✗ Unlimited review loops
368
+ ✗ Automatic rollback
369
+ ✗ Cloud features
370
+ ```
371
+
372
+ ---
373
+
374
+ ## Quick Reference
375
+
376
+ | Script | Purpose |
377
+ |--------|---------|
378
+ | `scripts/discover.mjs` | Detect installed agents and delegate fleet |
379
+ | `scripts/setup.mjs` | Interactive setup + config write |
380
+ | `scripts/route.mjs` | Deterministic routing (stdin JSON → stdout JSON) |
381
+ | `scripts/run-state.mjs` | Run workspace: init, update, read, write, brief |
382
+ | `scripts/resume.mjs` | Find and return interrupted run |
383
+
384
+ | Reference | Content |
385
+ |-----------|---------|
386
+ | `references/capability-registry.md` | Score definitions, phase requirements |
387
+ | `references/routing-rules.md` | Classification, effort table, agent priority |
388
+ | `references/handoff-schema.md` | File schemas, run-state.mjs usage |
389
+ | `references/delegate-integration.md` | Delegate setup and rules |
390
+
391
+ ---
392
+
393
+ ## One-Line Description
394
+
395
+ > **Give Adaptive Director one coding task. It routes every phase to the right agent, model, and reasoning effort automatically.**
@@ -0,0 +1,42 @@
1
+ {
2
+ "models": {
3
+ "claude-opus-4": { "planning": 5, "coding": 4, "review": 5 },
4
+ "claude-opus-3": { "planning": 5, "coding": 4, "review": 5 },
5
+ "claude-sonnet-4-5":{ "planning": 4, "coding": 4, "review": 4 },
6
+ "claude-sonnet-3-5":{ "planning": 4, "coding": 4, "review": 4 },
7
+ "claude-haiku-3-5": { "planning": 2, "coding": 3, "review": 2 },
8
+ "o3": { "planning": 5, "coding": 3, "review": 5 },
9
+ "o4-mini": { "planning": 3, "coding": 4, "review": 3 },
10
+ "gpt-4o": { "planning": 3, "coding": 4, "review": 3 },
11
+ "gemini-2-5-pro": { "planning": 4, "coding": 4, "review": 4 },
12
+ "gemini-2-0-flash": { "planning": 2, "coding": 3, "review": 2 },
13
+ "codex-default": { "planning": 2, "coding": 5, "review": 2 },
14
+ "unknown": { "planning": 1, "coding": 1, "review": 1 }
15
+ },
16
+ "phase_requirements": {
17
+ "plan": { "min_planning": 3 },
18
+ "implement": { "min_coding": 2 },
19
+ "review": { "min_review": 3 },
20
+ "fix": { "min_coding": 2 },
21
+ "verify": { "min_planning": 2 }
22
+ },
23
+ "effort_table": {
24
+ "conservative": {
25
+ "plan": "medium", "implement": "medium",
26
+ "review": "high", "fix": "medium", "verify": "medium"
27
+ },
28
+ "balanced": {
29
+ "plan": "high", "implement": "medium",
30
+ "review": "high", "fix": "medium", "verify": "medium"
31
+ },
32
+ "quality": {
33
+ "plan": "high", "implement": "medium",
34
+ "review": "high", "fix": "medium", "verify": "high"
35
+ }
36
+ },
37
+ "phase_map": {
38
+ "small": ["implement", "review"],
39
+ "medium": ["plan", "implement", "review", "verify"],
40
+ "large": ["plan", "implement", "review", "fix", "verify"]
41
+ }
42
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "adaptive-director-skill",
3
+ "version": "0.1.0",
4
+ "description": "Adaptive Director Skill — Skill-first adaptive multi-agent orchestration for AI coding agents",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Ahmed Tamer",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/tamourax/Adaptive-Orchestrator.git"
11
+ },
12
+ "files": [
13
+ "SKILL.md",
14
+ "README.md",
15
+ "LICENSE",
16
+ "scripts/",
17
+ "references/",
18
+ "data/"
19
+ ],
20
+ "scripts": {
21
+ "test": "node scripts/smoke-test.mjs",
22
+ "setup": "node scripts/setup.mjs",
23
+ "discover": "node scripts/discover.mjs"
24
+ },
25
+ "keywords": [
26
+ "ai",
27
+ "agents",
28
+ "coding-agents",
29
+ "multi-agent",
30
+ "orchestration",
31
+ "director",
32
+ "codex",
33
+ "claude",
34
+ "agentic-coding",
35
+ "skill"
36
+ ],
37
+ "engines": {
38
+ "node": ">=18.0.0"
39
+ }
40
+ }