@kbediako/codex-orchestrator 0.1.19 → 0.1.21

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 CHANGED
@@ -137,14 +137,17 @@ codex-orchestrator skills install
137
137
 
138
138
  Options:
139
139
  - `--force` overwrites existing files.
140
+ - `--only <skills>` installs only selected skills (comma-separated). Combine with `--force` to overwrite only those.
140
141
  - `--codex-home <path>` targets a different Codex home directory.
141
142
 
142
143
  Bundled skills (may vary by release):
144
+ - `collab-subagents-first`
143
145
  - `delegation-usage`
144
146
  - `standalone-review`
145
147
  - `docs-first`
146
148
  - `collab-evals`
147
149
  - `collab-deliberation`
150
+ - `release`
148
151
  - `delegate-early` (compatibility alias; use `delegation-usage`)
149
152
 
150
153
  ## DevTools readiness
@@ -605,7 +605,15 @@ async function handleSkills(rawArgs) {
605
605
  const format = flags['format'] === 'json' ? 'json' : 'text';
606
606
  const force = flags['force'] === true;
607
607
  const codexHome = readStringFlag(flags, 'codex-home');
608
- const result = await installSkills({ force, codexHome });
608
+ const onlyRaw = flags['only'];
609
+ let only;
610
+ if (onlyRaw !== undefined) {
611
+ if (typeof onlyRaw !== 'string') {
612
+ throw new Error('--only requires a comma-separated list of skill names.');
613
+ }
614
+ only = onlyRaw.split(',').map((entry) => entry.trim()).filter(Boolean);
615
+ }
616
+ const result = await installSkills({ force, codexHome, only });
609
617
  if (format === 'json') {
610
618
  console.log(JSON.stringify(result, null, 2));
611
619
  }
@@ -946,6 +954,7 @@ Commands:
946
954
  --format json Emit machine-readable output (dry-run only).
947
955
  skills install Install bundled skills into $CODEX_HOME/skills.
948
956
  --force Overwrite existing skill files.
957
+ --only <skills> Install only selected skills (comma-separated).
949
958
  --codex-home <path> Override the target Codex home directory.
950
959
  --format json Emit machine-readable output.
951
960
  mcp serve [--repo <path>] [--dry-run] [-- <extra args>]
@@ -972,6 +981,7 @@ function printSkillsHelp() {
972
981
  Commands:
973
982
  install Install bundled skills into $CODEX_HOME/skills.
974
983
  --force Overwrite existing skill files.
984
+ --only <skills> Install only selected skills (comma-separated).
975
985
  --codex-home <path> Override the target Codex home directory.
976
986
  --format json Emit machine-readable output.
977
987
  `);
@@ -12,18 +12,28 @@ export async function installSkills(options = {}) {
12
12
  const targetRoot = join(codexHome, 'skills');
13
13
  const written = [];
14
14
  const skipped = [];
15
- const skillNames = await listSkillNames(sourceRoot);
16
- await copyDir(sourceRoot, targetRoot, {
15
+ const availableSkills = await listSkillNames(sourceRoot);
16
+ const selectedSkills = resolveSelectedSkills(availableSkills, options.only);
17
+ const copyOptions = {
17
18
  force: options.force ?? false,
18
19
  written,
19
20
  skipped
20
- });
21
+ };
22
+ if (selectedSkills.length === availableSkills.length) {
23
+ await copyDir(sourceRoot, targetRoot, copyOptions);
24
+ }
25
+ else {
26
+ await mkdir(targetRoot, { recursive: true });
27
+ for (const skill of selectedSkills) {
28
+ await copyDir(join(sourceRoot, skill), join(targetRoot, skill), copyOptions);
29
+ }
30
+ }
21
31
  return {
22
32
  written,
23
33
  skipped,
24
34
  sourceRoot,
25
35
  targetRoot,
26
- skills: skillNames
36
+ skills: selectedSkills
27
37
  };
28
38
  }
29
39
  export function formatSkillsInstallSummary(result, cwd = process.cwd()) {
@@ -61,6 +71,22 @@ async function listSkillNames(sourceRoot) {
61
71
  const entries = await readdir(sourceRoot, { withFileTypes: true });
62
72
  return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
63
73
  }
74
+ function resolveSelectedSkills(availableSkills, only) {
75
+ if (!only) {
76
+ return availableSkills;
77
+ }
78
+ const trimmed = only.map((entry) => entry.trim()).filter(Boolean);
79
+ if (trimmed.length === 0) {
80
+ throw new Error('No skills specified for --only.');
81
+ }
82
+ const requested = Array.from(new Set(trimmed));
83
+ const available = new Set(availableSkills);
84
+ const unknown = requested.filter((skill) => !available.has(skill));
85
+ if (unknown.length > 0) {
86
+ throw new Error(`Unknown skill(s): ${unknown.join(', ')}. Available skills: ${availableSkills.join(', ')}`);
87
+ }
88
+ return requested;
89
+ }
64
90
  async function assertDirectory(path) {
65
91
  const info = await stat(path).catch(() => null);
66
92
  if (!info || !info.isDirectory()) {
package/docs/README.md CHANGED
@@ -103,7 +103,7 @@ Use `npx @kbediako/codex-orchestrator resume --run <run-id>` to continue interru
103
103
  - `codex-orchestrator init codex [--cwd <path>] [--force]`: copy starter templates into a repo (includes `mcp-client.json` and `AGENTS.md`; no overwrite unless `--force`).
104
104
  - `codex-orchestrator doctor [--format json]`: check optional tooling dependencies and print install commands.
105
105
  - `codex-orchestrator devtools setup [--yes]`: print DevTools MCP setup instructions (`--yes` applies `codex mcp add ...`).
106
- - `codex-orchestrator skills install [--force] [--codex-home <path>]`: install bundled skills into `$CODEX_HOME/skills` (global skills remain the primary reference when installed).
106
+ - `codex-orchestrator skills install [--force] [--only <skills>] [--codex-home <path>]`: install bundled skills into `$CODEX_HOME/skills` (global skills remain the primary reference when installed).
107
107
  - `codex-orchestrator self-check --format json`: emit a safe JSON health payload for smoke tests.
108
108
  - `codex-orchestrator --version`: print the package version.
109
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbediako/codex-orchestrator",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: collab-subagents-first
3
+ description: Manage non-trivial tasks via focused collab subagents to save context and improve throughput. Use when work spans multiple files/components, can be split into independent streams, needs separate validation/review, or risks context bloat. Favor direct execution for trivial one-shot tasks.
4
+ ---
5
+
6
+ # Collab Subagents First
7
+
8
+ ## Overview
9
+
10
+ Delegate as a manager, not as a pass-through. Split work into narrow streams, give each subagent a rich brief, and keep parent context lean by collecting short structured summaries plus evidence paths.
11
+
12
+ Note: If a global `collab-subagents-first` skill is installed, prefer that and fall back to this bundled skill.
13
+
14
+ ## Delegation gate
15
+
16
+ Use subagents when any condition is true:
17
+ - Task spans more than one subsystem or more than one file.
18
+ - Work naturally splits into independent streams (for example research + implementation + verification).
19
+ - Work likely exceeds about 5-10 minutes.
20
+ - Separate review/verification is required before handoff.
21
+ - Parent context is growing and summary compression is needed.
22
+ - You are unsure whether the task should be delegated.
23
+
24
+ Default rule:
25
+ - For any non-trivial task, spawn at least one subagent early (even if work is mostly single-stream) to offload execution and preserve parent context.
26
+
27
+ Skip subagents when all conditions are true:
28
+ - Single-file or tightly scoped change.
29
+ - No parallelizable stream exists.
30
+ - Execution and verification are straightforward in one pass.
31
+ - Expected duration is under about 5 minutes.
32
+
33
+ ## Workflow
34
+
35
+ 1) Define parent success criteria
36
+ - Write 3-6 acceptance bullets before spawning.
37
+ - Define "done" and required validation upfront.
38
+
39
+ 2) Choose delegation shape
40
+ - Minimum for non-trivial work: 1 subagent (`implement` or `research`).
41
+ - Standard: 2 subagents (`implement` + `review/verify`).
42
+ - Complex/high-risk: 3-4 subagents (`research`, `implement`, `tests`, `review`).
43
+ - If uncertain, spawn a short-lived `scout` subagent first to propose decomposition and risks.
44
+
45
+ 3) Split into narrow streams
46
+ - Prefer 1-4 streams based on the chosen shape.
47
+ - Assign one owner per stream and avoid overlapping file ownership.
48
+ - Good stream labels: `research`, `implement`, `tests`, `review`.
49
+
50
+ 4) Send a rich brief to each subagent
51
+ - Use the required brief template from `references/subagent-brief-template.md`.
52
+ - Include objective, scope, constraints, acceptance criteria, and expected output format.
53
+ - Require concise summaries and evidence paths; avoid long logs in chat.
54
+
55
+ 5) Run streams in parallel when independent
56
+ - Spawn multiple subagents for independent streams.
57
+ - Wait for all subagents to finish before final synthesis.
58
+
59
+ 6) Synthesize with context compression
60
+ - Merge only decisions, findings, and evidence links into parent context.
61
+ - Keep full details in artifacts/files instead of long conversation dumps.
62
+ - Force summary discipline: keep each subagent synthesis to a short block with outcome, files, validation, findings, and open questions only.
63
+
64
+ 7) Verify before handoff
65
+ - Run parent-level validation/tests.
66
+ - Run standalone review on merged changes (see review loop below).
67
+
68
+ 8) Re-check delegation need at checkpoints
69
+ - Re-evaluate delegation after major context growth (for example every 6-8 parent messages, or after crossing about 8 touched files, or when the plan changes materially).
70
+ - If parent context starts bloating, spawn/redirect subagents instead of continuing in parent.
71
+ - Keep the delegation tree shallow. Prefer parent fan-out over subagent-of-subagent chains.
72
+
73
+ ## Spawn payload + labels (current behavior)
74
+
75
+ - `spawn_agent` accepts exactly one input style:
76
+ - `message` (plain text), or
77
+ - `items` (structured input).
78
+ - Do not send both `message` and `items` in one spawn call.
79
+ - Use `items` when you need explicit structured context (for example `mention` paths like `app://...` or selected `skill` entries) instead of flattening everything into one long string.
80
+ - Spawn returns an `agent_id` (thread id). Collab event rendering/picker labels are id-based today; do not depend on custom visible agent names.
81
+ - To keep operator readability high despite id labels, encode the role clearly in your stream labels and first-line task brief (for example `review`, `tests`, `research`).
82
+
83
+ ## Collab lifecycle hygiene (required)
84
+
85
+ When you use collab tools (`spawn_agent` / `wait` / `close_agent`):
86
+ - Keep a local list of every returned `agent_id`.
87
+ - For every successful `spawn_agent`, run `wait` and then `close_agent` for that same id.
88
+ - Always close agents on error/timeout paths; do a final cleanup pass before finishing so no id is left unclosed.
89
+ - If spawn fails with `agent thread limit reached`, stop spawning immediately, close any known ids, then retry once. If you still cannot spawn, proceed without collab (solo or via delegation) and explicitly note the degraded mode.
90
+
91
+ ## Required subagent contract
92
+
93
+ Require each subagent response to include:
94
+ - `Outcome`: done / blocked / partial.
95
+ - `Changes`: files touched or "none".
96
+ - `Validation`: commands run and pass/fail results.
97
+ - `Findings`: prioritized defects/risks (or "none found").
98
+ - `Evidence`: artifact paths, manifests, or command outputs summary.
99
+ - `Open questions`: only unresolved items that block correctness.
100
+
101
+ Reject and rerun when responses are:
102
+ - Missing validation evidence for code changes.
103
+ - Missing ownership/scope boundaries.
104
+ - Excessively verbose with no actionable summary.
105
+
106
+ ## Execution constraints for subagents
107
+
108
+ - Subagents are spawned with approval policy effectively set to `never`.
109
+ - Design subagent tasks so they can complete without approval/escalation prompts.
110
+ - Keep privileged/high-risk operations in the parent thread when interactive approval is required.
111
+ - Subagents inherit core execution context (for example cwd/sandbox constraints), so include environment assumptions explicitly in each brief.
112
+
113
+ ## Review loop (standalone-review pairing)
114
+
115
+ Use a two-layer review loop:
116
+
117
+ 1) Subagent self-review (when possible)
118
+ - If `codex review` is available in the working repo, have the subagent run the repo's standalone-review flow (including hardened fallback rules) for:
119
+ - `--uncommitted`, or
120
+ - `--base <branch>` when branch comparison is clearer.
121
+ - Capture top findings and fixes in the subagent summary.
122
+ - If self-review cannot run (tool/policy/trust constraints), require a manual checklist summary: correctness, regressions, missing tests.
123
+
124
+ 2) Parent independent review (required)
125
+ - After integrating subagent work, run a standalone review from the parent.
126
+ - Prefer the global `standalone-review` skill workflow for consistent checks.
127
+
128
+ Do not treat wrapper handoff-only output as a completed review.
129
+
130
+ ## Orchestrator + RLM path (optional, recommended for deep loops)
131
+
132
+ - Prefer orchestrator RLM/delegation loops for long-horizon, recursive, or high-risk tasks when available.
133
+ - Keep this additive: still perform final parent synthesis and standalone review.
134
+ - If orchestrator is unavailable, continue with local subagent orchestration and standalone review.
135
+
136
+ ## Compatibility guardrail (JSONL/collab drift)
137
+
138
+ - Symptoms: missing collab/delegate tool-call evidence, framing/parsing errors, or unstable collab behavior after CLI upgrades.
139
+ - Check versions first: `codex --version` and `codex-orchestrator --version`.
140
+ - CO repo refresh path (safe default): `scripts/codex-cli-refresh.sh --repo <codex-repo> --no-push`.
141
+ - Rebuild managed CLI only: `codex-orchestrator codex setup --source <codex-repo> --yes --force`.
142
+ - If local codex is materially behind upstream, sync before diagnosing collab behavior differences.
143
+ - If compatibility remains unstable, continue with non-collab execution path and document the degraded mode.
144
+
145
+ ## Depth-limit guardrail
146
+
147
+ - Collab spawn depth is bounded. At max depth, `spawn_agent` will fail and the branch must execute directly.
148
+ - Near max depth, collab may be disabled for newly spawned children; plan for leaf execution.
149
+ - When depth errors appear, stop recursive delegation and switch to parent-driven execution.
150
+
151
+ ## Anti-patterns
152
+
153
+ - Do not delegate one giant stream with vague ownership.
154
+ - Do not spawn subagents before acceptance criteria are defined.
155
+ - Do not merge subagent output without independent validation.
156
+ - Do not copy raw multi-hundred-line logs into parent context.
157
+ - Do not keep long single-agent execution in parent when a focused subagent can own it.
158
+ - Do not skip delegation solely because there is only one implementation stream; single-stream delegation is valid for context offload.
159
+ - Do not rely on human-readable agent names in TUI labels for control flow; use stream ownership and evidence paths as source of truth.
160
+ - Do not end the parent work with unclosed collab agent ids.
161
+
162
+ ## Completion checklist
163
+
164
+ - At least one subagent was used for non-trivial work (or explicit reason documented for skipping).
165
+ - Streams defined with clear ownership and acceptance criteria.
166
+ - Subagent briefs include complete context and constraints.
167
+ - All subagents completed or explicitly closed as blocked.
168
+ - Parent synthesis includes concise decisions and evidence paths.
169
+ - Parent-level review completed (standalone review or equivalent).
170
+ - Collab lifecycle closed (`spawn_agent` -> `wait` -> `close_agent` per id) or degraded mode explicitly recorded.
@@ -0,0 +1,90 @@
1
+ # Subagent Brief Template
2
+
3
+ Use this template when spawning or re-scoping a subagent. Fill every field.
4
+
5
+ ## Template
6
+
7
+ ```text
8
+ You are assigned a focused subtask. You are not alone in the codebase; other agents may edit unrelated files. Ignore unrelated edits and do not revert work you do not own.
9
+
10
+ Task label:
11
+ Objective:
12
+ Timebox:
13
+ Working repo/path:
14
+ Base branch / comparison scope:
15
+
16
+ Why this matters:
17
+ - <1-3 bullets of product/technical context>
18
+
19
+ Known context digest:
20
+ - <current branch / relevant files / recent decisions>
21
+ - <known runtime/tooling quirks in this repo>
22
+ - <links/paths to specs, tasks, notes, or manifests>
23
+
24
+ In scope:
25
+ - <exact responsibilities>
26
+
27
+ Out of scope:
28
+ - <explicit exclusions>
29
+
30
+ Ownership:
31
+ - Files/paths you may edit: <paths>
32
+ - Files/paths you must not edit: <paths>
33
+
34
+ Acceptance criteria:
35
+ - <bullet 1>
36
+ - <bullet 2>
37
+ - <bullet 3>
38
+
39
+ Validation required:
40
+ - Commands to run: <commands>
41
+ - Minimum checks: <tests/lint/build/review expectations>
42
+
43
+ Review:
44
+ - If available, run the repo's standalone-review flow on your changes before final response (`--uncommitted` or `--base <branch>` as appropriate).
45
+ - If review cannot run, provide a manual self-review for correctness, regressions, and missing tests.
46
+
47
+ Output format (required):
48
+ 1. Outcome: done | partial | blocked
49
+ 2. Changes: <file list + short summary>
50
+ 3. Validation: <command> -> <pass/fail>
51
+ 4. Findings: <prioritized issues/risks, or "none found">
52
+ 5. Evidence: <paths/log references>
53
+ 6. Open questions: <only blockers>
54
+
55
+ Keep the response concise. Put detailed notes in a file and return the path.
56
+ ```
57
+
58
+ ## Brief quality bar (required)
59
+
60
+ - Include enough context so the subagent can act without back-and-forth.
61
+ - Include explicit file ownership boundaries.
62
+ - Include a concrete output format and validation expectations.
63
+ - Include at least one "do not do" constraint to prevent drift.
64
+ - If task is review-only, explicitly prohibit implementation edits.
65
+
66
+ ## Fast variants
67
+
68
+ ### Research stream
69
+
70
+ ```text
71
+ Objective: answer <question> with evidence.
72
+ Deliverable: 3-7 bullets + key risks + recommendation.
73
+ No code edits unless explicitly requested.
74
+ ```
75
+
76
+ ### Implementation stream
77
+
78
+ ```text
79
+ Objective: implement <specific change>.
80
+ Deliverable: patch + validation output + self-review notes.
81
+ ```
82
+
83
+ ### Verification stream
84
+
85
+ ```text
86
+ Objective: validate <existing change>.
87
+ Deliverable: failing/passing checks, defect list by severity, and minimal fix suggestions.
88
+ No broad refactors.
89
+ ```
90
+
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: release
3
+ description: Ship a signed tag + GitHub Release + npm publish for @kbediako/codex-orchestrator with low-friction, agent-first steps (PR -> watch-merge -> tag -> watch publish -> downstream smoke).
4
+ ---
5
+
6
+ # Release (CO Maintainer)
7
+
8
+ Use this skill when the user asks to ship a new CO version to npm/downstream users.
9
+ If a global `release` skill is installed, prefer that and fall back to this bundled skill.
10
+
11
+ ## Guardrails (required)
12
+
13
+ - Never publish from an unmerged branch: release tags must point at `main`.
14
+ - Release tags must be **signed annotated tags** (`git tag -s vX.Y.Z -m "vX.Y.Z"`).
15
+ - Confirm `gh auth status` is OK before any PR/release steps.
16
+ - Prefer non-interactive commands; avoid anything that can hang on prompts.
17
+ - If any check fails (Core Lane, Cloud Canary, CodeRabbit, release workflow), stop and fix before proceeding.
18
+
19
+ ## Workflow
20
+
21
+ ### 1) Preflight
22
+
23
+ ```bash
24
+ gh auth status -h github.com
25
+ git status -sb
26
+ git checkout main
27
+ git pull --ff-only
28
+ ```
29
+
30
+ ### 2) Version bump PR
31
+
32
+ Pick a version (usually patch): `0.1.N+1`.
33
+
34
+ ```bash
35
+ VERSION="0.1.20"
36
+ BRANCH="task/release-${VERSION}"
37
+
38
+ git checkout -b "$BRANCH"
39
+ npm version "$VERSION" --no-git-tag-version
40
+ git add package.json package-lock.json
41
+ git commit -m "chore(release): bump version to ${VERSION}"
42
+ git push -u origin "$BRANCH"
43
+ ```
44
+
45
+ Open PR (use `--body-file` to avoid literal `\\n` rendering):
46
+
47
+ ```bash
48
+ cat <<EOF > /tmp/pr-body.md
49
+ ## What
50
+ - Bump version to ${VERSION}.
51
+
52
+ ## Why
53
+ - Ship latest main to npm/downstream users.
54
+
55
+ ## How Tested
56
+ - CI on this PR (Core Lane / Cloud Canary / CodeRabbit).
57
+ EOF
58
+
59
+ gh pr create --title "chore(release): bump version to ${VERSION}" --body-file /tmp/pr-body.md
60
+ ```
61
+
62
+ Monitor + auto-merge once green:
63
+
64
+ ```bash
65
+ PR_NUMBER="$(gh pr view --json number --jq .number)"
66
+ codex-orchestrator pr watch-merge --pr "$PR_NUMBER" --auto-merge --delete-branch --quiet-minutes 1 --interval-seconds 20
67
+ ```
68
+
69
+ ### 3) Create signed tag + push
70
+
71
+ ```bash
72
+ git checkout main
73
+ git pull --ff-only
74
+
75
+ TAG="v${VERSION}"
76
+ git tag -s "$TAG" -m "$TAG"
77
+ git tag -v "$TAG"
78
+ git push origin "$TAG"
79
+ ```
80
+
81
+ ### 4) Watch the release workflow + confirm npm publish
82
+
83
+ ```bash
84
+ TAG_SHA="$(git rev-list -n 1 "$TAG")"
85
+ RUN_ID=""
86
+ for i in {1..30}; do
87
+ RUN_ID="$(
88
+ gh run list \
89
+ --workflow release.yml \
90
+ --limit 20 \
91
+ --json databaseId,headBranch,headSha \
92
+ --jq ".[] | select((.headBranch==\"${TAG}\") or (.headSha==\"${TAG_SHA}\")) | .databaseId" \
93
+ | head -n 1 \
94
+ || true
95
+ )"
96
+ if [[ -n "$RUN_ID" && "$RUN_ID" != "null" ]]; then
97
+ break
98
+ fi
99
+ sleep 2
100
+ done
101
+ if [[ -z "$RUN_ID" || "$RUN_ID" == "null" ]]; then
102
+ echo "::error::No release workflow run found for ${TAG}."
103
+ exit 1
104
+ fi
105
+ gh run watch "$RUN_ID" --exit-status
106
+
107
+ npm view @kbediako/codex-orchestrator version
108
+ gh release view "v${VERSION}" --json url,assets --jq '{url: .url, assets: (.assets|map(.name))}'
109
+ ```
110
+
111
+ ### 5) Update global + downstream smoke
112
+
113
+ ```bash
114
+ npm i -g @kbediako/codex-orchestrator@"${VERSION}"
115
+ codex-orchestrator --version
116
+
117
+ TMPDIR="$(mktemp -d)"
118
+ cd "$TMPDIR"
119
+ npx -y @kbediako/codex-orchestrator@"${VERSION}" --version
120
+ npx -y @kbediako/codex-orchestrator@"${VERSION}" pr watch-merge --help | head -n 10
121
+ ```
122
+
123
+ If the release included bundled skill changes, refresh local skills:
124
+
125
+ ```bash
126
+ codex-orchestrator skills install --force
127
+ ```