agent-orchestration-skill 0.0.0-stage → 1.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/bin/cli.mjs ADDED
@@ -0,0 +1,249 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * bin/cli.mjs — Zero-dependency NPX installer, doctor & CLI runner for `agent-orchestration`.
4
+ *
5
+ * Supports:
6
+ * npx github:haulth/agent-orchestration [install] [--dry-run] [--no-backup] [--home <dir>]
7
+ * npx github:haulth/agent-orchestration doctor
8
+ * npx github:haulth/agent-orchestration uninstall
9
+ * npx github:haulth/agent-orchestration <route|anatomy|run|batch|verdict|stats|sandbox|discover> [args...]
10
+ */
11
+ import fs from "node:fs";
12
+ import path from "node:path";
13
+ import os from "node:os";
14
+ import { spawnSync } from "node:child_process";
15
+ import { fileURLToPath } from "node:url";
16
+
17
+ const __filename = fileURLToPath(import.meta.url);
18
+ const ROOT_DIR = path.resolve(path.dirname(__filename), "..");
19
+
20
+ const COPY_ITEMS = [
21
+ "SKILL.md",
22
+ "CATALOG.md",
23
+ "README.md",
24
+ "LICENSE",
25
+ "package.json",
26
+ ".npmignore",
27
+ "bin",
28
+ "install",
29
+ "assets",
30
+ "references",
31
+ "scripts",
32
+ ];
33
+
34
+ function defaultTargets(homeDir) {
35
+ return [
36
+ path.join(homeDir, ".claude", "skills", "agent-orchestration"),
37
+ path.join(homeDir, ".agents", "skills", "agent-orchestration"),
38
+ path.join(homeDir, ".codex", "skills", "agent-orchestration"),
39
+ path.join(homeDir, ".gemini", "config", "skills", "agent-orchestration"),
40
+ ];
41
+ }
42
+
43
+ function findPython() {
44
+ const candidates =
45
+ process.platform === "win32"
46
+ ? [
47
+ ["python", ["-c", "import sys; assert sys.version_info >= (3, 8)"]],
48
+ ["py", ["-3", "-c", "import sys; assert sys.version_info >= (3, 8)"]],
49
+ ["python3", ["-c", "import sys; assert sys.version_info >= (3, 8)"]],
50
+ ]
51
+ : [
52
+ ["python3", ["-c", "import sys; assert sys.version_info >= (3, 8)"]],
53
+ ["python", ["-c", "import sys; assert sys.version_info >= (3, 8)"]],
54
+ ];
55
+
56
+ for (const [cmd, testArgs] of candidates) {
57
+ const res = spawnSync(cmd, testArgs, { stdio: "ignore", windowsHide: true });
58
+ if (res.status === 0) {
59
+ const prefixArgs = cmd === "py" ? ["-3"] : [];
60
+ const verRes = spawnSync(cmd, [...prefixArgs, "--version"], {
61
+ encoding: "utf-8",
62
+ windowsHide: true,
63
+ });
64
+ const ver = ((verRes.stdout || "") + (verRes.stderr || "")).trim();
65
+ return { cmd, prefixArgs, version: ver };
66
+ }
67
+ }
68
+ return null;
69
+ }
70
+
71
+ function copyTreeClean(srcDir, destDir) {
72
+ fs.mkdirSync(destDir, { recursive: true });
73
+ for (const item of COPY_ITEMS) {
74
+ const s = path.join(srcDir, item);
75
+ const d = path.join(destDir, item);
76
+ if (!fs.existsSync(s)) continue;
77
+ fs.cpSync(s, d, {
78
+ recursive: true,
79
+ force: true,
80
+ filter: (srcPath) => {
81
+ const base = path.basename(srcPath);
82
+ if (base === "__pycache__" || base === ".orch" || base === ".sandbox-skills") {
83
+ return false;
84
+ }
85
+ if (base.endsWith(".pyc")) return false;
86
+ return true;
87
+ },
88
+ });
89
+ }
90
+ }
91
+
92
+ function stamp() {
93
+ const d = new Date();
94
+ const pad = (n) => String(n).padStart(2, "0");
95
+ return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
96
+ }
97
+
98
+ function cmdInstall(args) {
99
+ let homeDir = os.homedir();
100
+ let dryRun = false;
101
+ let noBackup = false;
102
+ for (let i = 0; i < args.length; i++) {
103
+ if (args[i] === "--dry-run") dryRun = true;
104
+ else if (args[i] === "--no-backup") noBackup = true;
105
+ else if (args[i] === "--home" && args[i + 1]) {
106
+ homeDir = path.resolve(args[++i]);
107
+ }
108
+ }
109
+
110
+ const py = findPython();
111
+ if (!py) {
112
+ console.error("[agent-orchestration] ERROR: Python >= 3.8 is required on PATH.");
113
+ process.exit(1);
114
+ }
115
+
116
+ const targets = defaultTargets(homeDir);
117
+ const backupRoot = path.join(homeDir, ".agent-orchestration-backups");
118
+ const stateDir = process.env.AO_HOME || path.join(homeDir, ".agent-orchestration");
119
+ const ts = stamp();
120
+
121
+ for (const t of targets) {
122
+ if (fs.existsSync(t) && !noBackup) {
123
+ const relSlug = path
124
+ .relative(homeDir, t)
125
+ .replace(/[^A-Za-z0-9]+/g, "_")
126
+ .replace(/^_|_$/g, "");
127
+ const bdest = path.join(backupRoot, `${relSlug}-${ts}`);
128
+ console.log(`backup ${t} -> ${bdest}`);
129
+ if (!dryRun) {
130
+ fs.mkdirSync(backupRoot, { recursive: true });
131
+ fs.cpSync(t, bdest, { recursive: true, force: true });
132
+ }
133
+ }
134
+ console.log(`install ${t}`);
135
+ if (!dryRun) {
136
+ fs.rmSync(t, { recursive: true, force: true });
137
+ copyTreeClean(ROOT_DIR, t);
138
+ }
139
+ }
140
+
141
+ console.log(`state ${stateDir}`);
142
+ if (!dryRun) {
143
+ fs.mkdirSync(stateDir, { recursive: true });
144
+ const discoverScript = path.join(targets[1], "scripts", "discover.py");
145
+ if (fs.existsSync(discoverScript)) {
146
+ spawnSync(py.cmd, [...py.prefixArgs, discoverScript, "--quick"], {
147
+ stdio: "ignore",
148
+ windowsHide: true,
149
+ });
150
+ }
151
+ }
152
+ console.log("Done. Restart Claude Code, Codex CLI, and Antigravity (agy) to reload the skill.");
153
+ }
154
+
155
+ function cmdUninstall(args) {
156
+ let homeDir = os.homedir();
157
+ for (let i = 0; i < args.length; i++) {
158
+ if (args[i] === "--home" && args[i + 1]) {
159
+ homeDir = path.resolve(args[++i]);
160
+ }
161
+ }
162
+ for (const t of defaultTargets(homeDir)) {
163
+ if (fs.existsSync(t)) {
164
+ fs.rmSync(t, { recursive: true, force: true });
165
+ console.log(`removed ${t}`);
166
+ }
167
+ }
168
+ }
169
+
170
+ function cmdDoctor() {
171
+ console.log("=== agent-orchestration Doctor ===");
172
+ console.log(`Node.js : ${process.version} (${process.platform}/${process.arch})`);
173
+ const py = findPython();
174
+ console.log(`Python : ${py ? `${py.version} (${py.cmd})` : "NOT FOUND"}`);
175
+
176
+ const homeDir = os.homedir();
177
+ console.log("\nSkill Install Targets:");
178
+ for (const t of defaultTargets(homeDir)) {
179
+ const ok = fs.existsSync(path.join(t, "SKILL.md"));
180
+ console.log(` [${ok ? "OK" : "--"}] ${t}`);
181
+ }
182
+
183
+ if (py) {
184
+ console.log("\nLive Models & Hardware Probe:");
185
+ const routeScript = path.join(ROOT_DIR, "scripts", "route.py");
186
+ spawnSync(py.cmd, [...py.prefixArgs, routeScript, "--list-models"], {
187
+ stdio: "inherit",
188
+ windowsHide: true,
189
+ });
190
+ }
191
+ }
192
+
193
+ function forwardPython(scriptName, prefixScriptArgs, passArgs) {
194
+ const py = findPython();
195
+ if (!py) {
196
+ console.error("[agent-orchestration] ERROR: Python >= 3.8 is required.");
197
+ process.exit(1);
198
+ }
199
+ const scriptPath = path.join(ROOT_DIR, "scripts", scriptName);
200
+ const res = spawnSync(py.cmd, [...py.prefixArgs, scriptPath, ...prefixScriptArgs, ...passArgs], {
201
+ stdio: "inherit",
202
+ windowsHide: true,
203
+ });
204
+ process.exit(res.status ?? 1);
205
+ }
206
+
207
+ function printHelp() {
208
+ console.log(`agent-orchestration — Multi-Agent Orchestration Skill & CLI Engine
209
+
210
+ Usage:
211
+ npx github:haulth/agent-orchestration [install] [--dry-run] [--no-backup] [--home <dir>]
212
+ npx github:haulth/agent-orchestration doctor
213
+ npx github:haulth/agent-orchestration uninstall
214
+ npx github:haulth/agent-orchestration route [args...]
215
+ npx github:haulth/agent-orchestration anatomy <init|settle|audit|amend|inspect> [args...]
216
+ npx github:haulth/agent-orchestration <run|batch|verdict|stats> [args...]
217
+ npx github:haulth/agent-orchestration sandbox <check|search|install|list|remove|purge> [args...]
218
+ npx github:haulth/agent-orchestration discover [--quick]
219
+
220
+ Also compatible with Agent Skills CLI:
221
+ npx skills add haulth/agent-orchestration`);
222
+ }
223
+
224
+ const argv = process.argv.slice(2);
225
+ const sub = argv[0] || "install";
226
+ const rest = argv.slice(1);
227
+
228
+ if (sub === "-h" || sub === "--help" || sub === "help") {
229
+ printHelp();
230
+ } else if (sub === "install" || sub.startsWith("--")) {
231
+ cmdInstall(sub === "install" ? rest : argv);
232
+ } else if (sub === "uninstall") {
233
+ cmdUninstall(rest);
234
+ } else if (sub === "doctor") {
235
+ cmdDoctor();
236
+ } else if (sub === "route") {
237
+ forwardPython("route.py", [], rest);
238
+ } else if (sub === "anatomy") {
239
+ forwardPython("anatomy.py", [], rest);
240
+ } else if (sub === "sandbox") {
241
+ forwardPython("skill_sandbox.py", [], rest);
242
+ } else if (sub === "discover") {
243
+ forwardPython("discover.py", [], rest);
244
+ } else if (["run", "batch", "verdict", "stats"].includes(sub)) {
245
+ forwardPython("agent_run.py", [sub], rest);
246
+ } else {
247
+ printHelp();
248
+ process.exit(1);
249
+ }
@@ -0,0 +1,51 @@
1
+ # Cài đặt skill agent-orchestration (v2)
2
+
3
+ ## Yêu cầu
4
+ - Python 3 (chỉ dùng thư viện chuẩn). Cần cho `agent_run.py`, `route.py`, `discover.py`.
5
+ - Các CLI bạn muốn dùng làm worker: `codex`, `agy`, `claude`. Không có cái nào thì `route.py` tự bỏ qua vendor đó.
6
+ - `claude` đi kèm ứng dụng Claude desktop, có thể không nằm trong PATH; runner tự tìm ở `%APPDATA%\Claude\claude-code\<phiên bản>\claude.exe`.
7
+
8
+ ## Cài
9
+ Windows (PowerShell), từ thư mục skill:
10
+ ```powershell
11
+ .\install\install.ps1 -DryRun # xem trước
12
+ .\install\install.ps1 # cài thật
13
+ ```
14
+ macOS / Linux: `./install/install.sh [--dry-run]`.
15
+
16
+ Script sẽ:
17
+ 1. sao lưu bản cũ (nếu có) vào `~/.agent-orchestration-backups/`;
18
+ 2. chép skill (không kèm `install/`, `tests/`) vào:
19
+ - `~/.claude/skills/agent-orchestration` (Claude Code),
20
+ - `~/.agents/skills/agent-orchestration` (Codex, Windsurf/Devin),
21
+ - `~/.gemini/config/skills/agent-orchestration` (agy);
22
+ 3. tạo `~/.agent-orchestration/` (thư mục trạng thái dùng chung, vô hại nếu đã có);
23
+ 4. cảnh báo nếu thiếu Python.
24
+
25
+ Sau đó **khởi động lại Claude Code, Codex và agy** để chúng nạp lại skill.
26
+
27
+ ## Thư mục trạng thái `~/.agent-orchestration/`
28
+ | File | Nội dung |
29
+ |---|---|
30
+ | `ledger.jsonl` | mỗi lần chạy và mỗi phán quyết của manager (dữ liệu cho tự chủ theo thành tích) |
31
+ | `capabilities.json` / `capabilities.md` | ảnh chụp khả năng từng agent / bản đọc nhanh |
32
+ | `changes.md` | nhật ký thay đổi (chỉ thêm vào cuối) |
33
+ | `candidates.json` | model mới phát hiện, chưa được duyệt |
34
+ | `state.json` | lần kiểm tra nhanh gần nhất |
35
+
36
+ Đổi vị trí bằng biến môi trường `AO_HOME`.
37
+
38
+ ## Cập nhật bảng model
39
+ 1. Sửa `assets/models.json` (bậc `fast/standard/frontier/frontier_max` cho từng vendor, và bảng `tasks`).
40
+ 2. Cập nhật bảng phản chiếu trong `references/gates-and-routing.md`.
41
+ 3. Chạy lại `install.ps1` để đồng bộ sang 3 bản cài.
42
+
43
+ Model mới do `discover.py` phát hiện nằm ở `candidates.json`; chỉ đưa vào bước 1 sau khi bạn đồng ý hoặc sau một lần chạy thử có đo đạc.
44
+
45
+ ## Kiểm tra nhanh sau khi cài
46
+ ```powershell
47
+ python scripts\route.py --list-models
48
+ python scripts\route.py --task-type review --builder codex
49
+ python scripts\route.py --task-type design --manager agy --same-model
50
+ ```
51
+ Các lệnh kiểm tra chạy hoàn toàn cục bộ, không tốn token.
@@ -0,0 +1,63 @@
1
+ # Installs the skill into the four places the harnesses read, backing up old copies first.
2
+ # .\install.ps1 install for real
3
+ # .\install.ps1 -DryRun show what would happen
4
+ # .\install.ps1 -HomeDir X use X instead of %USERPROFILE% (for testing)
5
+ param([switch]$DryRun, [string]$HomeDir = $env:USERPROFILE)
6
+ $ErrorActionPreference = "Stop"
7
+ $HomeDir = $HomeDir.TrimEnd('\', '/')
8
+ $src = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
9
+ if (-not (Test-Path (Join-Path $src "SKILL.md"))) { throw "SKILL.md not found in $src" }
10
+ $name = "agent-orchestration"
11
+ $targets = @(
12
+ (Join-Path $HomeDir ".claude\skills\$name"), # Claude Code
13
+ (Join-Path $HomeDir ".agents\skills\$name"), # Codex CLI, Cursor, Windsurf, portable Agent Skills root
14
+ (Join-Path $HomeDir ".codex\skills\$name"), # Codex CLI legacy/native root
15
+ (Join-Path $HomeDir ".gemini\config\skills\$name") # Antigravity CLI (agy)
16
+ )
17
+ $backupRoot = Join-Path $HomeDir ".agent-orchestration-backups"
18
+ $state = Join-Path $HomeDir ".agent-orchestration"
19
+ $stamp = Get-Date -Format "yyyyMMdd-HHmmss"
20
+
21
+ $pyCmd = $null
22
+ foreach ($cand in @("python", "py", "python3")) {
23
+ if (Get-Command $cand -ErrorAction SilentlyContinue) {
24
+ $argsCheck = if ($cand -eq "py") { @("-3", "-c", "import sys; assert sys.version_info >= (3,8)") } else { @("-c", "import sys; assert sys.version_info >= (3,8)") }
25
+ & $cand @argsCheck 2>$null
26
+ if ($LASTEXITCODE -eq 0) { $pyCmd = $cand; break }
27
+ }
28
+ }
29
+ if (-not $pyCmd) {
30
+ Write-Warning "Working Python >= 3.8 was not found on PATH. agent_run.py, route.py, anatomy.py and discover.py need Python 3 (stdlib only)."
31
+ }
32
+
33
+ foreach ($t in $targets) {
34
+ if (Test-Path $t) {
35
+ $tag = ($t.Substring($HomeDir.Length) -replace '[^A-Za-z0-9]+','_').Trim('_')
36
+ $b = Join-Path $backupRoot "$tag-$stamp"
37
+ Write-Host "backup $t -> $b"
38
+ if (-not $DryRun) {
39
+ New-Item -ItemType Directory -Force $backupRoot | Out-Null
40
+ Copy-Item $t $b -Recurse -Force
41
+ }
42
+ }
43
+ Write-Host "install $t"
44
+ if (-not $DryRun) {
45
+ New-Item -ItemType Directory -Force $t | Out-Null
46
+ # Use /MIR so even if the target directory is a shell's current working directory on Windows, contents sync cleanly
47
+ robocopy $src $t /MIR /XD tests node_modules __pycache__ .orch .sandbox-skills .git /XF *.pyc .gitignore package-lock.json /NFL /NDL /NJH /NJS /NP | Out-Null
48
+ if ($LASTEXITCODE -ge 8) { throw "robocopy failed ($LASTEXITCODE) for $t" }
49
+ }
50
+ }
51
+ Write-Host "state $state"
52
+ if (-not $DryRun) {
53
+ New-Item -ItemType Directory -Force $state | Out-Null
54
+ if ($pyCmd) {
55
+ $disc = Join-Path $targets[1] "scripts\discover.py"
56
+ if (Test-Path $disc) {
57
+ if ($pyCmd -eq "py") { & py -3 $disc --quick 2>$null | Out-Null }
58
+ else { & $pyCmd $disc --quick 2>$null | Out-Null }
59
+ }
60
+ }
61
+ }
62
+ Write-Host "Done. Restart Claude Code, Codex and agy so they reload the skill."
63
+ $global:LASTEXITCODE = 0
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ # Installs the skill into the four places the harnesses read, backing up old copies first.
3
+ # ./install.sh [--dry-run] [--home DIR]
4
+ set -euo pipefail
5
+ DRY=0; HOME_DIR="${HOME%/}"
6
+ while [ $# -gt 0 ]; do case "$1" in --dry-run) DRY=1;; --home) HOME_DIR="${2%/}"; shift;; *) echo "unknown arg $1"; exit 2;; esac; shift; done
7
+ SRC="$(cd "$(dirname "$0")/.." && pwd)"; NAME=agent-orchestration
8
+ [ -f "$SRC/SKILL.md" ] || { echo "SKILL.md not found in $SRC"; exit 1; }
9
+ STAMP="$(date +%Y%m%d-%H%M%S)"; BK="$HOME_DIR/.agent-orchestration-backups"
10
+ PY=""
11
+ for C in python3 python; do
12
+ if command -v "$C" >/dev/null 2>&1 && "$C" -c "import sys; assert sys.version_info >= (3,8)" >/dev/null 2>&1; then
13
+ PY="$C"; break
14
+ fi
15
+ done
16
+ [ -n "$PY" ] || echo "warning: Python >= 3.8 not found; the scripts need Python 3 (stdlib only)"
17
+ for T in "$HOME_DIR/.claude/skills/$NAME" "$HOME_DIR/.agents/skills/$NAME" "$HOME_DIR/.codex/skills/$NAME" "$HOME_DIR/.gemini/config/skills/$NAME"; do
18
+ if [ -e "$T" ]; then
19
+ TAG="$(echo "${T#$HOME_DIR}" | tr -c 'A-Za-z0-9' '_' | sed -E 's/^_+//; s/_+$//')"
20
+ B="$BK/$TAG-$STAMP"; echo "backup $T -> $B"
21
+ [ $DRY = 1 ] || { mkdir -p "$BK"; cp -R "$T" "$B"; rm -rf "$T"; }
22
+ fi
23
+ echo "install $T"
24
+ if [ $DRY = 0 ]; then
25
+ mkdir -p "$T"
26
+ (cd "$SRC" && tar --exclude='tests' --exclude='node_modules' --exclude='__pycache__' --exclude='.orch' --exclude='.sandbox-skills' --exclude='.git' --exclude='package-lock.json' --exclude='.gitignore' --exclude='*.pyc' -cf - .) | (cd "$T" && tar -xf -)
27
+ fi
28
+ done
29
+ if [ $DRY = 0 ]; then
30
+ mkdir -p "$HOME_DIR/.agent-orchestration"
31
+ if [ -n "$PY" ] && [ -f "$HOME_DIR/.agents/skills/$NAME/scripts/discover.py" ]; then
32
+ "$PY" "$HOME_DIR/.agents/skills/$NAME/scripts/discover.py" --quick >/dev/null 2>&1 || true
33
+ fi
34
+ fi
35
+ echo "Done. Restart Claude Code, Codex and agy so they reload the skill."
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "agent-orchestration-skill",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Multi-agent orchestration skill & CLI engine for Claude Code, Codex CLI, and Antigravity (agy) with Orchestration Anatomy, Keyhole Interlocks, Dynamic Model Routing, and Ephemeral Skill Sandbox.",
5
+ "license": "MIT",
6
+ "author": "haulth",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/haulth/agent-orchestration.git"
11
+ },
12
+ "homepage": "https://github.com/haulth/agent-orchestration#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/haulth/agent-orchestration/issues"
15
+ },
16
+ "bin": {
17
+ "agent-orchestration-skill": "bin/cli.mjs",
18
+ "agent-orchestration": "bin/cli.mjs",
19
+ "ao-skill": "bin/cli.mjs"
20
+ },
21
+ "files": [
22
+ "SKILL.md",
23
+ "CATALOG.md",
24
+ "README.md",
25
+ "LICENSE",
26
+ "bin/*.mjs",
27
+ "scripts/*.py",
28
+ "references/**/*.md",
29
+ "assets/*.json",
30
+ "install/*"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "keywords": [
36
+ "agent-skills",
37
+ "skills",
38
+ "claude-code",
39
+ "codex",
40
+ "antigravity",
41
+ "agy",
42
+ "multi-agent",
43
+ "orchestration",
44
+ "anatomy"
45
+ ]
46
+ }
@@ -0,0 +1,32 @@
1
+ # Adapter: Antigravity (`agy` CLI & Native Subagents)
2
+
3
+ ## Quick card
4
+ - **Native subagents (preferred when Antigravity is the manager or the ONLY agent on the machine):**
5
+ - Use `define_subagent(Name="...", Description="...", SystemPrompt="...", EnableWriteTools=False)` to create specialized domain lenses (e.g., `First-Principles Architect`, `Adversarial Red-Team Falsifier`, `Pragmatic Minimalist`, `Runtime Engineer`).
6
+ - Call `invoke_subagent(TypeName="self"|"research"|"<custom>", Role="...", Prompt="<Zero-Prior Brief>", Model="inherit"|"flash"|"pro", Workspace="inherit"|"branch"|"share")` in parallel (2–4 sub-agents in one turn) so each explores the problem with a **clean KV-cache (0 prior conversation bias)**.
7
+ - Use `send_message(Recipient="<conversationId>", Message="...")` to continue a subagent or let agents exchange targeted follow-ups with zero cold-start overhead.
8
+ - Use `Workspace: "branch"` or `"share"` when running parallel writers/prototypes so each sub-agent works in an isolated branch/worktree without conflicting!
9
+ - **Single-Host Routing (`--single-host`):**
10
+ - `python <skill>/scripts/route.py --task-type design --manager agy --single-host`
11
+ - `python <skill>/scripts/route.py --task-type review --builder agy --manager agy --single-host` (automatically switches from Google `gemini-4-argon-high` to Anthropic `claude-opus-5-5-high` hosted inside `agy`!).
12
+ - **External CLI read-only:** `python <skill>/scripts/agent_run.py run --agent agy --brief brief.md --mode read --model gemini-4-argon-high`
13
+ - **External CLI write, with scope:** add `--mode write --may-write src/foo/ docs/x.md`. Anything changed outside that list is reported in `meta.json` `violations`.
14
+ - **Direct artifact handoff:** add `--context-file <upstream_artifact_path>` so the worker reads upstream findings first-hand.
15
+ - **Resume:** `--resume <conversation_id>` (from `meta.json` `session_id`).
16
+ - **Measured overhead (CLI):** a trivial CLI call costs about 19.5–22k tokens. Use native `invoke_subagent` for small in-session tasks, and `agent_run.py --agent agy` when calling from Codex/Claude or when you want headless schema-checked runs.
17
+
18
+ ## Models on this machine (`agy models`, updated 2026-10-24, `agy 1.4.4`)
19
+ - **Google family:**
20
+ - Frontier: `gemini-4-argon-high`
21
+ - Standard: `gemini-4-argon-medium`, `gemini-3.8-flash-high`
22
+ - Fast: `gemini-3.8-flash-low`, `gemini-4-argon-low`
23
+ - **Anthropic family (hosted on `agy`):**
24
+ - Frontier Max / Frontier: `claude-opus-5-5-high`, `claude-opus-5-5-medium`, `claude-sonnet-5-5-high`
25
+ - Standard: `claude-sonnet-5-5-medium`
26
+ - **Open-weights:** `gpt-oss-120b-medium`
27
+ - Note: `gemini-3.1-pro-*` and `gemini-3.6/3.7-*` were retired in `agy 1.4.4`. `assets/models.json` maps `standard` → `gemini-4-argon-medium`, `frontier` → `gemini-4-argon-high`, and `frontier_max` → `claude-opus-5-5-high`.
28
+
29
+ ## Headless CLI permissions & pitfalls
30
+ - Headless print mode (`agy -p`) cannot prompt, so any tool that needs confirmation is auto-denied. `agent_run.py` counts `auto-denied` in stderr and maps empty responses with denials to `permission`.
31
+ - Name exact absolute file paths in the brief (or pass `--context-file <path>`), as `agent_run.py` automatically passes `--add-dir` for the attempt folder.
32
+ - With `--json-schema`, `agy` returns `structured_output` alongside `response`. `agent_run.py` prefers `structured_output` and strips injected `toolAction`/`toolSummary` keys automatically.
@@ -0,0 +1,60 @@
1
+ # Adapter: Claude Code (Native Subagents & `claude` CLI 2.1.308+)
2
+
3
+ ## Quick card
4
+ ### 1. Calling Claude CLI (`claude -p`) as a Worker from ANY Manager (Codex, Antigravity, or Shell)
5
+ - **Read-only audit / review / architecture consult:**
6
+ ```bash
7
+ python <skill>/scripts/agent_run.py run --agent claude --brief brief.md --name arch-review \
8
+ --task-type review --tier frontier --mode read [--context-file .orch/spec.md]
9
+ ```
10
+ - **Fast cold-start mode (`--bare`) & hard USD budget cap (`--max-budget-usd`):**
11
+ ```bash
12
+ python <skill>/scripts/agent_run.py run --agent claude --brief brief.md --name fast-check \
13
+ --task-type lookup --tier fast --mode read --bare --max-budget-usd 0.25
14
+ ```
15
+ - **Scoped write (or isolated Git Worktree `--worktree`):**
16
+ ```bash
17
+ python <skill>/scripts/agent_run.py run --agent claude --brief brief.md --name impl-ui \
18
+ --task-type implement --tier standard --mode write --may-write src/ui/ [--worktree]
19
+ ```
20
+ - **Resume an existing session:**
21
+ ```bash
22
+ python <skill>/scripts/agent_run.py run --agent claude --brief delta.md --resume <session_id>
23
+ ```
24
+
25
+ ### 2. Claude Code as the In-Session Manager
26
+ - **Read-only worker:** `Agent(subagent_type: "Explore" | "general-purpose", model: "haiku"|"sonnet"|"opus", prompt: <brief>)`
27
+ - **Isolated write worker:** `Agent(subagent_type: "general-purpose", model: "sonnet", isolation: "worktree", prompt: <brief>)`
28
+ - **Resume / Direct Follow-up:** `SendMessage(to: "<agent_id>", message: "<delta>")`
29
+
30
+ ---
31
+
32
+ ## Dynamic Model Discovery (`discover.py` & `route.py`)
33
+ `discover.py` automatically discovers all models available to your Claude Code installation without spending tokens by scanning:
34
+ 1. **`~/.claude/settings.json` (`env`):** Custom gateway/proxy models such as `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL` (`nghi/claude-opus-5[1m]`), `ANTHROPIC_DEFAULT_SONNET_MODEL` (`nghi/claude-sonnet-5[1m]`), `ANTHROPIC_SMALL_FAST_MODEL` (`claude-haiku-5-5`).
35
+ 2. **`~/.claude/cache/gateway-models.json`:** All models advertised by your configured gateway (`nghi/claude-opus-5[1m]`, `nghi/claude-sonnet-5[1m]`, `nghi/claude-opus-4.8[1m]`, `nghi/claude-haiku-4.5[1m]`, etc.).
36
+ 3. **`~/.claude/cache/model-catalog/*-ccd.json`:** Official Claude Code catalog (`claude-opus-5-5`, `claude-sonnet-5-5`, `claude-fable-5-1`, `claude-haiku-5-5` with 1M context window metadata and effort levels `low|medium|high|xhigh|max`).
37
+
38
+ `route.py` scores these live discovered models (`ao_common.dynamic_tier_config`) and automatically selects the best model per tier (`fast`, `standard`, `frontier`, `frontier_max`), falling back to `assets/models.json` only if no local cache exists.
39
+
40
+ ---
41
+
42
+ ## Power Native Claude CLI Commands (2.1.308+)
43
+
44
+ | Capability | Command / Flag | When to use |
45
+ |---|---|---|
46
+ | **Fast Minimal Mode (`--bare`)** | `agent_run.py run --agent claude ... --bare`<br>(or `claude -p --bare ...`) | Skips hooks, LSP, plugin sync, auto-memory, and `CLAUDE.md` auto-discovery for ultra-fast, low-overhead worker execution (uses `ANTHROPIC_API_KEY` / settings helper). |
47
+ | **Isolated Git Worktree (`-w`, `--worktree`)** | `agent_run.py run --agent claude ... --worktree`<br>(or `claude -p --worktree <name> ...`) | Runs the worker in a fresh git worktree so parallel writers never collide. |
48
+ | **Hard Cost Cap (`--max-budget-usd`)** | `agent_run.py run --agent claude ... --max-budget-usd 0.50` | Enforces a strict dollar ceiling on API calls in `--print` mode. |
49
+ | **Background Daemon Sessions (`--bg`)** | `claude --bg -p "<prompt>"`<br>`claude agents` / `claude logs <id>` / `claude stop <id>` | Launch long-running background agents, inspect their live logs, attach to them, or stop them. |
50
+ | **Cloud Multi-Agent Review (`ultrareview`)** | `claude ultrareview [PR_or_branch]` | Run a cloud-hosted multi-agent code review on the current branch or a PR. |
51
+ | **Custom Inline Agent Definitions (`--agents`)** | `claude -p --agents '{"auditor": {"description": "...", "prompt": "..."}}' --agent auditor` | Define specialized worker roles on the fly without editing `.claude/agents/`. |
52
+ | **Fork on Resume (`--fork-session`)** | `claude -p --resume <id> --fork-session` | Branch an existing conversation into a new session ID to test an alternative approach without mutating the original thread. |
53
+
54
+ ## Raw Headless Command (`claude -p`)
55
+ ```bash
56
+ claude -p --output-format json --permission-mode plan --model "nghi/claude-opus-5[1m]" --effort high \
57
+ [--bare] [--worktree] [--max-budget-usd 1.00] [--resume <session_id>] \
58
+ [--add-dir <dir>] [--allowedTools "Read,Grep,Glob"] \
59
+ --json-schema '<schema_json>' < brief.md
60
+ ```
@@ -0,0 +1,53 @@
1
+ # Adapter: Codex CLI (`codex` 0.154.0+)
2
+
3
+ ## Quick card (Unified Runner — Preferred)
4
+ - **Read-only audit / debug / review:**
5
+ ```bash
6
+ python <skill>/scripts/agent_run.py run --agent codex --brief brief.md --name audit-core \
7
+ --task-type review --tier frontier --mode read [--context-file .orch/spec.md] [--search]
8
+ ```
9
+ - **Write, with scoped attribution (or isolated Git Worktree):**
10
+ ```bash
11
+ python <skill>/scripts/agent_run.py run --agent codex --brief brief.md --name impl-feature \
12
+ --task-type implement --tier standard --mode write --may-write src/foo/ [--worktree]
13
+ ```
14
+ - **Resume an existing session (~1.5k tokens vs ~12.5k cold start):**
15
+ ```bash
16
+ python <skill>/scripts/agent_run.py run --agent codex --brief delta.md --resume <session_id>
17
+ ```
18
+ - **Batch execution (parallel readers first, then sequential writers):**
19
+ ```bash
20
+ python <skill>/scripts/agent_run.py batch plan.json --wip 3
21
+ ```
22
+
23
+ ## Dynamic Model Discovery (`discover.py` & `route.py`)
24
+ Models are **never locked to stale hardcoded strings**. `discover.py` automatically scans:
25
+ 1. `~/.codex/.codex-global-state.json` (live `composer-recent-model-configurations-v1` and `seen-model-upgrade-list`, e.g. `gpt-6-astra`, `gpt-6.1-sol`, `gpt-5.6-sol`, `gpt-5.6-terra`),
26
+ 2. `~/.codex/models_cache.json`,
27
+ 3. `~/.codex/skills/.system/openai-docs/references/latest-model.md` (`gpt-5.6`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5.3-codex`, `gpt-5.1-codex-mini`),
28
+ 4. `~/.codex/config.toml` (`model = "..."`).
29
+
30
+ `route.py` scores all live discovered models (`ao_common.dynamic_tier_config`) and automatically picks the strongest fit for `fast`, `standard`, `frontier`, and `frontier_max` (`source: dynamic_discovered`), falling back to `assets/models.json` only if no local state exists.
31
+
32
+ ## Power Native Codex CLI Commands (0.154.0)
33
+
34
+ | Capability | Command / Flag | When to use |
35
+ |---|---|---|
36
+ | **Built-in Non-Interactive Code Review** | `codex review --uncommitted [PROMPT]`<br>`codex review --base <BRANCH> [PROMPT]`<br>`codex review --commit <SHA> [PROMPT]` | Fast, zero-ceremony second opinion on uncommitted diffs, a feature branch, or a specific commit. |
37
+ | **Isolated Git Worktree** | `agent_run.py run --agent codex ... --worktree`<br>(or raw `codex exec --worktree ...`) | Run parallel writers safely in a managed git worktree without dirtying the main working tree. |
38
+ | **Live Web Search** | `agent_run.py run --agent codex ... --search`<br>(or raw `codex exec --search ...`) | Enable native `web_search` tool without per-call approval prompts during research/explore tasks. |
39
+ | **Multimodal Image Input** | `codex exec -i screenshot.png - < brief.md` | Attach UI screenshots, architecture diagrams, or plots directly to the prompt. |
40
+ | **Apply Latest Agent Diff** | `codex apply` | Apply the latest diff produced by a Codex session via `git apply`. |
41
+ | **Native Subagents** | `spawn_agent` (with roles in `~/.codex/agents/*.toml`) | Cheap in-session delegation when Codex itself is the top-level manager. |
42
+
43
+ ## Raw `codex exec` Reference (when not using `agent_run.py`)
44
+ ```bash
45
+ codex exec -m <model> -c 'model_reasoning_effort="high"' \
46
+ -s read-only -C <repo> [--worktree] [--search] --skip-git-repo-check \
47
+ --output-schema <skill>/assets/result.schema.json -o result.json - < brief.md
48
+ ```
49
+
50
+ ## Parsing & Anti-Hallucination Verification
51
+ - Read `meta.json` first:
52
+ - Check `ok`, `failure`, `violations`, and **`evidence_warnings`** (automatically populated by `agent_run.py` if the worker's `summary` or `assumptions_challenged` lacks verifiable `file:line` or command output anchors).
53
+ - Then read `result.json`. Every critique or conclusion must cite concrete proof in `evidence[]`.