@sabaiway/agent-workflow-kit 1.6.0 → 1.7.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/CHANGELOG.md +31 -0
- package/README.md +12 -5
- package/SKILL.md +23 -2
- package/bin/install.mjs +33 -50
- package/bin/install.test.mjs +30 -1
- package/bridges/antigravity-cli-bridge/SKILL.md +178 -0
- package/bridges/antigravity-cli-bridge/bin/agy.sh +133 -0
- package/bridges/antigravity-cli-bridge/bin/agy.test.mjs +59 -0
- package/bridges/antigravity-cli-bridge/capability.json +22 -0
- package/bridges/antigravity-cli-bridge/references/driving-agy.md +108 -0
- package/bridges/antigravity-cli-bridge/references/models-and-flags.md +93 -0
- package/bridges/antigravity-cli-bridge/references/review-prompt.md +51 -0
- package/bridges/antigravity-cli-bridge/setup/README.md +65 -0
- package/bridges/codex-cli-bridge/SKILL.md +148 -0
- package/bridges/codex-cli-bridge/bin/codex-exec.sh +143 -0
- package/bridges/codex-cli-bridge/bin/codex-review.sh +84 -0
- package/bridges/codex-cli-bridge/capability.json +22 -0
- package/bridges/codex-cli-bridge/references/driving-codex.md +97 -0
- package/bridges/codex-cli-bridge/references/sandbox-and-flags.md +105 -0
- package/bridges/codex-cli-bridge/setup/README.md +78 -0
- package/capability.json +1 -1
- package/package.json +3 -2
- package/tools/detect-backends.mjs +36 -0
- package/tools/detect-backends.test.mjs +102 -0
- package/tools/fs-safe.mjs +129 -0
- package/tools/fs-safe.test.mjs +200 -0
- package/tools/setup-backends.mjs +468 -0
- package/tools/setup-backends.test.mjs +500 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Delegate plan/instruction EXECUTION to the OpenAI Codex CLI (`codex exec`).
|
|
3
|
+
#
|
|
4
|
+
# Project-agnostic wrapper for the codex-cli-bridge skill. It encodes one fixed,
|
|
5
|
+
# deterministic execution policy and prepends an ORCHESTRATOR EXECUTION CONTRACT
|
|
6
|
+
# so codex never wastes a run rediscovering it. Codex reads the TARGET project's
|
|
7
|
+
# Hard Constraints itself, from the root AGENTS.md in its working directory
|
|
8
|
+
# (codex auto-reads AGENTS.md from cwd) — this wrapper hardcodes no project rules.
|
|
9
|
+
#
|
|
10
|
+
# Fixed policy (single source of truth — passed via flags + --ignore-user-config,
|
|
11
|
+
# so behaviour is deterministic regardless of ~/.codex/config.toml):
|
|
12
|
+
# - workspace-write sandbox: codex may edit the repo, nothing outside it
|
|
13
|
+
# - network access OFF: new dependencies / network installs are done by a human
|
|
14
|
+
# - approval_policy=never: there is no TTY in exec; anything needing escalation
|
|
15
|
+
# is refused and reported, then handled by hand
|
|
16
|
+
# - strongest model at maximum reasoning effort (override CODEX_MODEL/CODEX_EFFORT)
|
|
17
|
+
#
|
|
18
|
+
# Auth: SUBSCRIPTION ONLY. Uses the cached ChatGPT login under CODEX_HOME
|
|
19
|
+
# (~/.codex). The wrapper unsets every *_API_KEY plus OPENAI_BASE_URL and passes
|
|
20
|
+
# --ignore-user-config, so a stray key or a personal ~/.codex/config.toml can
|
|
21
|
+
# never silently switch billing or change behaviour. No credentials are bundled.
|
|
22
|
+
#
|
|
23
|
+
# Usage (installed on PATH as `codex-exec`):
|
|
24
|
+
# codex-exec docs/plans/<slug>.md # drive a plan file
|
|
25
|
+
# echo "apply review fix: ..." | codex-exec - # ad-hoc instruction (stdin)
|
|
26
|
+
# CODEX_MODEL=<slug> codex-exec <file> # override the model
|
|
27
|
+
# codex-exec <file|-> -- <extra codex flags...> # passthrough codex flags
|
|
28
|
+
set -euo pipefail
|
|
29
|
+
|
|
30
|
+
CODEX_MODEL="${CODEX_MODEL:-gpt-5.5}" # default coding model (verified locally); override per call
|
|
31
|
+
CODEX_EFFORT="${CODEX_EFFORT:-xhigh}" # maximum reasoning effort
|
|
32
|
+
CHATGPT_LOGIN_GUARD="Logged in using ChatGPT"
|
|
33
|
+
|
|
34
|
+
# --- Subscription-only guard -------------------------------------------------
|
|
35
|
+
# Never let an API key (or a user config) silently switch codex to paid api-key
|
|
36
|
+
# billing or alternate behaviour. Clear the explicit vars first, then any other
|
|
37
|
+
# *_API_KEY that may have been added later (`compgen` is a bash builtin).
|
|
38
|
+
unset OPENAI_API_KEY CODEX_API_KEY OPENAI_BASE_URL 2>/dev/null || true
|
|
39
|
+
while IFS= read -r _api_key_var; do
|
|
40
|
+
unset "$_api_key_var" 2>/dev/null || true
|
|
41
|
+
done < <(compgen -v 2>/dev/null | grep '_API_KEY$' || true)
|
|
42
|
+
|
|
43
|
+
# --- Environment preflight (fail fast, before spending a subscription run) ----
|
|
44
|
+
if ! command -v codex >/dev/null 2>&1; then
|
|
45
|
+
echo "error: 'codex' (OpenAI Codex CLI) not found on PATH. See this skill's setup/README.md." >&2
|
|
46
|
+
exit 127
|
|
47
|
+
fi
|
|
48
|
+
if ! codex login status 2>&1 | grep -qF "$CHATGPT_LOGIN_GUARD"; then
|
|
49
|
+
echo "error: codex is not on a ChatGPT subscription (expected '$CHATGPT_LOGIN_GUARD')." >&2
|
|
50
|
+
echo " Run 'codex login' once; this skill is subscription-only and won't use api-key billing." >&2
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
54
|
+
echo "error: codex-exec must run inside a git working tree (codex exec needs one; the diff is your review surface)." >&2
|
|
55
|
+
exit 2
|
|
56
|
+
fi
|
|
57
|
+
if [[ ! -f AGENTS.md ]]; then
|
|
58
|
+
echo "error: no root AGENTS.md in the current directory — run from the target project root." >&2
|
|
59
|
+
echo " (codex reads AGENTS.md for the project's Hard Constraints and declared gates)" >&2
|
|
60
|
+
exit 2
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
read -r -d '' ORCHESTRATOR_DIRECTIVE <<'DIRECTIVE' || true
|
|
64
|
+
ORCHESTRATOR EXECUTION CONTRACT — read before the task, follow it exactly:
|
|
65
|
+
1. Work directly in the current working tree on the current git branch. NEVER run
|
|
66
|
+
any git write command (no branch, add, commit, stash, reset, checkout, tag, or
|
|
67
|
+
history rewrite) — the orchestrator commits after review.
|
|
68
|
+
2. Read the target project's root AGENTS.md and obey EVERY Hard Constraint it
|
|
69
|
+
declares, plus this task's own "do NOT" / out-of-scope section.
|
|
70
|
+
3. After implementing, run a SELF-REVIEW pass over your own changes — `git status`
|
|
71
|
+
for untracked files and `git diff` for tracked ones, reading the contents of
|
|
72
|
+
any new untracked files — against the task and those Hard Constraints; fix
|
|
73
|
+
anything that drifts so the handed-back work is clean.
|
|
74
|
+
4. Run the verification / gate set the project declares (in AGENTS.md or the
|
|
75
|
+
task). If the project declares NO gate set, STOP and report — do NOT invent
|
|
76
|
+
checks. Fix every failure before finishing.
|
|
77
|
+
5. Do NOT commit. If you hit a blocker needing escalation (network access, writes
|
|
78
|
+
outside the repo, a live approval, or an ambiguous decision), STOP and report
|
|
79
|
+
it clearly — never guess.
|
|
80
|
+
|
|
81
|
+
TASK:
|
|
82
|
+
DIRECTIVE
|
|
83
|
+
|
|
84
|
+
if [[ $# -lt 1 ]]; then
|
|
85
|
+
echo "usage: $0 <plan-file|-> [-- extra codex args...]" >&2
|
|
86
|
+
exit 2
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
prompt_src="$1"; shift
|
|
90
|
+
|
|
91
|
+
# Split off passthrough codex flags after a literal `--`. Extra args WITHOUT the
|
|
92
|
+
# `--` separator are a mistake — they would be silently dropped, so fail loudly.
|
|
93
|
+
passthrough=()
|
|
94
|
+
if [[ $# -gt 0 ]]; then
|
|
95
|
+
if [[ "$1" == "--" ]]; then
|
|
96
|
+
shift
|
|
97
|
+
passthrough=("$@")
|
|
98
|
+
else
|
|
99
|
+
echo "error: unexpected argument '$1'. Pass extra codex flags after a literal '--':" >&2
|
|
100
|
+
echo " $0 <plan-file|-> -- <codex flags...>" >&2
|
|
101
|
+
exit 2
|
|
102
|
+
fi
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# This wrapper OWNS the safety policy (sandbox level, approval policy, network
|
|
106
|
+
# access, and every -c config override). Reject passthrough flags that would
|
|
107
|
+
# defeat it — appended flags can otherwise override the fixed ones. Benign flags
|
|
108
|
+
# (--add-dir, --cd, --ephemeral, -m, --image, ...) still pass through.
|
|
109
|
+
if [[ ${#passthrough[@]} -gt 0 ]]; then
|
|
110
|
+
for _arg in "${passthrough[@]}"; do
|
|
111
|
+
case "$_arg" in
|
|
112
|
+
-c*|--config*|-s*|--sandbox*|--dangerously-bypass-approvals-and-sandbox|--dangerously-bypass-hook-trust|--full-auto)
|
|
113
|
+
echo "error: passthrough flag '$_arg' is not allowed — this wrapper fixes the sandbox / approval / network / config policy." >&2
|
|
114
|
+
echo " Drop it, or invoke 'codex' directly if you truly need a different policy." >&2
|
|
115
|
+
exit 2
|
|
116
|
+
;;
|
|
117
|
+
esac
|
|
118
|
+
done
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
if [[ "$prompt_src" == "-" ]]; then
|
|
122
|
+
task="$(cat)"
|
|
123
|
+
elif [[ -f "$prompt_src" ]]; then
|
|
124
|
+
task="$(cat "$prompt_src")"
|
|
125
|
+
else
|
|
126
|
+
echo "error: '$prompt_src' is not a file (use '-' to read the prompt from stdin)" >&2
|
|
127
|
+
exit 2
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
if [[ -z "${task//[[:space:]]/}" ]]; then
|
|
131
|
+
echo "error: empty plan/instruction" >&2
|
|
132
|
+
exit 2
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
printf '%s\n\n%s' "$ORCHESTRATOR_DIRECTIVE" "$task" | codex exec \
|
|
136
|
+
--ignore-user-config \
|
|
137
|
+
--sandbox workspace-write \
|
|
138
|
+
-c approval_policy="never" \
|
|
139
|
+
-c sandbox_workspace_write.network_access=false \
|
|
140
|
+
-c model_reasoning_effort="$CODEX_EFFORT" \
|
|
141
|
+
-m "$CODEX_MODEL" \
|
|
142
|
+
"${passthrough[@]+"${passthrough[@]}"}" \
|
|
143
|
+
-
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Read-only ADVISORY review BY the OpenAI Codex CLI. Runs under the read-only
|
|
3
|
+
# sandbox, so codex structurally CANNOT edit/create/delete files or write to git
|
|
4
|
+
# — it can only read and emit findings. The orchestrator reads those findings and
|
|
5
|
+
# decides what to act on; codex never applies them itself.
|
|
6
|
+
#
|
|
7
|
+
# Project-agnostic wrapper for the codex-cli-bridge skill. Codex reads the target
|
|
8
|
+
# project's Hard Constraints itself, from the root AGENTS.md in its cwd.
|
|
9
|
+
#
|
|
10
|
+
# Modes:
|
|
11
|
+
# codex-review plan <plan-file> # critique an implementation plan
|
|
12
|
+
# codex-review code [extra focus...] # review the current working-tree diff
|
|
13
|
+
#
|
|
14
|
+
# Auth/policy: subscription-only, identical to codex-exec.sh. The read-only
|
|
15
|
+
# sandbox grants no writes and no network in v0.140.0, so review needs no separate
|
|
16
|
+
# network flag (the sandbox_workspace_write.* config applies only to workspace-write).
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
CODEX_MODEL="${CODEX_MODEL:-gpt-5.5}"
|
|
20
|
+
CODEX_EFFORT="${CODEX_EFFORT:-xhigh}"
|
|
21
|
+
CHATGPT_LOGIN_GUARD="Logged in using ChatGPT"
|
|
22
|
+
|
|
23
|
+
# --- Subscription-only guard (see codex-exec.sh) -----------------------------
|
|
24
|
+
unset OPENAI_API_KEY CODEX_API_KEY OPENAI_BASE_URL 2>/dev/null || true
|
|
25
|
+
while IFS= read -r _api_key_var; do
|
|
26
|
+
unset "$_api_key_var" 2>/dev/null || true
|
|
27
|
+
done < <(compgen -v 2>/dev/null | grep '_API_KEY$' || true)
|
|
28
|
+
|
|
29
|
+
# --- Environment preflight (fail fast) ---------------------------------------
|
|
30
|
+
if ! command -v codex >/dev/null 2>&1; then
|
|
31
|
+
echo "error: 'codex' (OpenAI Codex CLI) not found on PATH. See this skill's setup/README.md." >&2
|
|
32
|
+
exit 127
|
|
33
|
+
fi
|
|
34
|
+
if ! codex login status 2>&1 | grep -qF "$CHATGPT_LOGIN_GUARD"; then
|
|
35
|
+
echo "error: codex is not on a ChatGPT subscription (expected '$CHATGPT_LOGIN_GUARD'). Run 'codex login' once." >&2
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
39
|
+
echo "error: codex-review must run inside a git working tree." >&2
|
|
40
|
+
exit 2
|
|
41
|
+
fi
|
|
42
|
+
if [[ ! -f AGENTS.md ]]; then
|
|
43
|
+
echo "error: no root AGENTS.md in the current directory — run from the target project root." >&2
|
|
44
|
+
exit 2
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
mode="${1:-}"
|
|
48
|
+
shift || true
|
|
49
|
+
|
|
50
|
+
case "$mode" in
|
|
51
|
+
plan)
|
|
52
|
+
target="${1:-}"
|
|
53
|
+
shift || true
|
|
54
|
+
if [[ ! -f "$target" ]]; then
|
|
55
|
+
echo "error: plan file '$target' not found" >&2
|
|
56
|
+
exit 2
|
|
57
|
+
fi
|
|
58
|
+
if [[ $# -gt 0 ]]; then
|
|
59
|
+
echo "error: unexpected arguments after plan file: $*" >&2
|
|
60
|
+
exit 2
|
|
61
|
+
fi
|
|
62
|
+
directive="You are REVIEWING an implementation plan — ADVISORY ONLY. You are in a read-only sandbox: do NOT edit, create, or delete any file, and do NOT rewrite the plan. Read the plan below, the project's root AGENTS.md, and the relevant repository code it references. Output findings ONLY, one per line, as: [blocker|major|minor|nit] — location — issue — suggested change. Cover: correctness risks, missing or mis-ordered steps, ambiguities a cold executor would trip on, violated project Hard Constraints (AGENTS.md), scope creep, and missing verification/gates. End with a one-line overall verdict (ship / revise / rethink)."
|
|
63
|
+
prompt="${directive}"$'\n\nPLAN:\n'"$(cat "$target")"
|
|
64
|
+
;;
|
|
65
|
+
code)
|
|
66
|
+
directive="You are REVIEWING the current uncommitted working-tree changes — ADVISORY ONLY. You are in a read-only sandbox: do NOT edit, create, or delete any file and do NOT run any git write command. Run \`git status --short\` to list ALL changes, \`git diff\` for the tracked changes, and for every path marked \`??\` by git status READ that file's full contents (plain \`git diff\` omits untracked files). Also read the project's root AGENTS.md. Then output findings ONLY, one per line, as: [blocker|major|minor|nit] — file:line — issue — suggested fix. Focus on correctness bugs, project Hard Constraints (AGENTS.md), behaviour drift vs the intended change, and test/gate gaps. End with a one-line overall verdict (ship / revise / rethink)."
|
|
67
|
+
if [[ $# -gt 0 ]]; then
|
|
68
|
+
directive="${directive} Extra focus: $*"
|
|
69
|
+
fi
|
|
70
|
+
prompt="$directive"
|
|
71
|
+
;;
|
|
72
|
+
*)
|
|
73
|
+
echo "usage: $0 plan <plan-file> | code [extra focus...]" >&2
|
|
74
|
+
exit 2
|
|
75
|
+
;;
|
|
76
|
+
esac
|
|
77
|
+
|
|
78
|
+
printf '%s' "$prompt" | codex exec \
|
|
79
|
+
--ignore-user-config \
|
|
80
|
+
--sandbox read-only \
|
|
81
|
+
-c approval_policy="never" \
|
|
82
|
+
-c model_reasoning_effort="$CODEX_EFFORT" \
|
|
83
|
+
-m "$CODEX_MODEL" \
|
|
84
|
+
-
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"family": "agent-workflow",
|
|
3
|
+
"schema": 1,
|
|
4
|
+
"name": "codex-cli-bridge",
|
|
5
|
+
"kind": "execution-backend",
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"provides": ["execute", "review"],
|
|
8
|
+
"roles": {
|
|
9
|
+
"execute": { "cmd": "codex-exec", "source": "bin/codex-exec.sh", "output": "diff" },
|
|
10
|
+
"review": { "cmd": "codex-review", "source": "bin/codex-review.sh", "modes": ["plan", "code"], "output": "advisory" }
|
|
11
|
+
},
|
|
12
|
+
"detect": {
|
|
13
|
+
"installed": {
|
|
14
|
+
"env": "CODEX_CLI_BRIDGE_DIR",
|
|
15
|
+
"default": "~/.claude/skills/codex-cli-bridge",
|
|
16
|
+
"file": "SKILL.md"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"cost": "subscription",
|
|
20
|
+
"quota": { "kind": "subscription", "finite": true },
|
|
21
|
+
"provenance": { "author": "sabaiway", "source": "github:sabaiway/agent-workflow" }
|
|
22
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# How the main agent drives `codex`
|
|
2
|
+
|
|
3
|
+
`codex` is a **delegated-execution backend**: the main agent stays the orchestrator and hands codex a
|
|
4
|
+
bounded sub-task answered from the **ChatGPT subscription**. Codex has two modes here — a sandboxed
|
|
5
|
+
**executor** (`codex-exec`) and a read-only **reviewer** (`codex-review`). Treat all codex output as
|
|
6
|
+
**advisory**: the orchestrator owns the accepted edits, the verification, the commit, and the final
|
|
7
|
+
judgment.
|
|
8
|
+
|
|
9
|
+
## Delegation checklist
|
|
10
|
+
|
|
11
|
+
1. Decide the mode: `codex-exec` to *do* (edit the repo under the sandbox), `codex-review` to *judge*
|
|
12
|
+
(advisory findings, no edits).
|
|
13
|
+
2. Run the wrapper from the **target project root** so codex auto-reads its `AGENTS.md` (the wrappers
|
|
14
|
+
also preflight that a root `AGENTS.md` and a git work tree exist).
|
|
15
|
+
3. For an ad-hoc instruction, make it self-contained: codex cannot see your conversation — embed the
|
|
16
|
+
goal, the relevant paths, the non-goals, and the expected result. The project's rules come from
|
|
17
|
+
`AGENTS.md`.
|
|
18
|
+
4. Let codex run; then **review its diff yourself** and re-run the project's gates.
|
|
19
|
+
5. **Commit yourself** — codex never commits.
|
|
20
|
+
|
|
21
|
+
## Exec vs review
|
|
22
|
+
|
|
23
|
+
Use **`codex-exec`** when there is a concrete plan or focused instruction to implement, the project
|
|
24
|
+
declares Hard Constraints + gates in `AGENTS.md`, the work fits network-off `workspace-write`, and you
|
|
25
|
+
can review the resulting diff.
|
|
26
|
+
|
|
27
|
+
Use **`codex-review plan`** for a cold second opinion on a plan before executing it (risks, missing or
|
|
28
|
+
mis-ordered steps, scope creep, missing gates).
|
|
29
|
+
|
|
30
|
+
Use **`codex-review code`** for advisory, severity-tagged findings on uncommitted changes — including
|
|
31
|
+
when **untracked** files matter: the wrapper prompt tells codex to run `git status --short` and read
|
|
32
|
+
the contents of `??` files, because plain `git diff` omits them.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
codex-exec docs/plans/<slug>.md # drive a plan file
|
|
38
|
+
echo "apply review fix: tighten the guard in X, keep tests green" | codex-exec -
|
|
39
|
+
CODEX_MODEL=<slug> CODEX_EFFORT=high codex-exec <file> # tune model/effort
|
|
40
|
+
codex-exec <file|-> -- --add-dir ../shared # passthrough codex flags after `--`
|
|
41
|
+
|
|
42
|
+
codex-review plan docs/plans/<slug>.md # critique a plan before executing it
|
|
43
|
+
codex-review code # review the current working-tree diff
|
|
44
|
+
codex-review code "focus on the reducer and its tests"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`codex-exec` prepends an **orchestrator execution contract**: work in the current tree, never
|
|
48
|
+
git-write, obey the target `AGENTS.md`, self-review the diff (incl. untracked files), run the
|
|
49
|
+
project's declared gates (STOP if none are declared), don't commit, report blockers.
|
|
50
|
+
|
|
51
|
+
## Prompt shapes (for ad-hoc `codex-exec -` instructions)
|
|
52
|
+
|
|
53
|
+
Execution:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
Implement the change below from the current project root.
|
|
57
|
+
Respect root AGENTS.md, especially its Hard Constraints and declared gates.
|
|
58
|
+
Do not run git write commands. Do not commit.
|
|
59
|
+
If a dependency install, network call, missing gate set, or out-of-repo write is needed, STOP and report.
|
|
60
|
+
|
|
61
|
+
<the focused instruction + relevant paths>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The review prompt shapes are built into `codex-review` itself — you only pass `plan <file>` or
|
|
65
|
+
`code [focus]`; the wrapper supplies the severity-tagged-findings + verdict directive.
|
|
66
|
+
|
|
67
|
+
## Re-dispatch vs. fresh run
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
codex exec resume --last # run codex DIRECTLY — not through codex-exec
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Resume is **not** reachable through `codex-exec`: the wrapper's shape (fixed flags + a trailing `-`
|
|
74
|
+
that reads the prompt from stdin) can't host the `resume` subcommand, and the wrapper rejects
|
|
75
|
+
policy-affecting passthrough flags anyway. Run `codex exec resume` directly when you want to continue
|
|
76
|
+
a session without re-sending context — but note it runs **outside** the wrapper, so it does not
|
|
77
|
+
inherit the enforced sandbox/network/approval policy and **may not re-accept those flags**. Restate
|
|
78
|
+
the policy in the resumed instruction, or just start a fresh `codex-exec` run when the posture must be
|
|
79
|
+
guaranteed (see `sandbox-and-flags.md`).
|
|
80
|
+
|
|
81
|
+
## Escalation policy (edits, network, git)
|
|
82
|
+
|
|
83
|
+
- **Repo edits** are codex's job *inside* `codex-exec`'s workspace-write sandbox — but you **review the
|
|
84
|
+
diff** before accepting/committing it. `codex-review` makes no edits at all.
|
|
85
|
+
- **New dependencies / network installs** are done by hand (exec has network OFF), then codex is
|
|
86
|
+
re-dispatched.
|
|
87
|
+
- **Git writes** (branch/add/commit/stash/reset/checkout/tag/rewrite) are never delegated — the
|
|
88
|
+
orchestrator commits after review. The execution contract forbids them.
|
|
89
|
+
|
|
90
|
+
## Handling output
|
|
91
|
+
|
|
92
|
+
codex output is advisory. Before acting:
|
|
93
|
+
|
|
94
|
+
- Re-run the project's gates yourself; don't trust a "green" claim you didn't see.
|
|
95
|
+
- Inspect the diff yourself; check edits against the project's `AGENTS.md` rules.
|
|
96
|
+
- Reject advice that conflicts with user instructions, repository rules, or security boundaries.
|
|
97
|
+
- Report uncertainty clearly, and summarise only verified claims back to the user.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# `codex` sandbox, flags & policy (reference)
|
|
2
|
+
|
|
3
|
+
The source of truth is the live binary: `codex --version`, `codex --help`, `codex exec --help`. The
|
|
4
|
+
tables below were captured from **codex-cli 0.140.0**; if the binary disagrees, the binary wins. The
|
|
5
|
+
wrapper commands are `codex-exec` and `codex-review`, backed by `bin/codex-exec.sh` /
|
|
6
|
+
`bin/codex-review.sh`.
|
|
7
|
+
|
|
8
|
+
## Sandbox levels — when to use which
|
|
9
|
+
|
|
10
|
+
| Level | Can write? | Network? | Wrapper that uses it |
|
|
11
|
+
|---|---|---|---|
|
|
12
|
+
| `read-only` | no | no | `codex-review` (codex only reads + emits findings) |
|
|
13
|
+
| `workspace-write` | repo (cwd) only | OFF (we force it off) | `codex-exec` (codex edits the repo) |
|
|
14
|
+
| `danger-full-access` | anywhere | yes | never used by this skill |
|
|
15
|
+
|
|
16
|
+
`codex-exec` always passes:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
--sandbox workspace-write \
|
|
20
|
+
-c approval_policy="never" \
|
|
21
|
+
-c sandbox_workspace_write.network_access=false
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`codex-review` always passes:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
--sandbox read-only \
|
|
28
|
+
-c approval_policy="never"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Under `read-only`, codex *structurally* cannot edit, create, delete, or git-write — it can only read
|
|
32
|
+
and report. In v0.140.0 `read-only` also grants **no network**, so `codex-review` relies on that and
|
|
33
|
+
passes no separate network flag — the `sandbox_workspace_write.*` config (including
|
|
34
|
+
`network_access`) applies **only** to `workspace-write`.
|
|
35
|
+
|
|
36
|
+
## Network-OFF invariant (exec)
|
|
37
|
+
|
|
38
|
+
`codex-exec` keeps network access OFF on purpose: **new dependencies and any network step are
|
|
39
|
+
installed by a human**, not by codex. If a task needs a new package, codex must STOP and report it;
|
|
40
|
+
the orchestrator installs it, then re-dispatches.
|
|
41
|
+
|
|
42
|
+
## Escalation & approvals
|
|
43
|
+
|
|
44
|
+
There is **no TTY** in `codex exec`, so `approval_policy=never`: codex never pauses for an interactive
|
|
45
|
+
approval. Any action that would need escalation (network, writes outside the repo, an ambiguous
|
|
46
|
+
decision) is **refused and reported**, and the orchestrator handles it by hand. Codex must never run a
|
|
47
|
+
git write command — the orchestrator commits after reviewing the diff.
|
|
48
|
+
|
|
49
|
+
## Commit prohibition
|
|
50
|
+
|
|
51
|
+
Delegated codex runs do not own repository history. The wrappers' contract prohibits every git write:
|
|
52
|
+
no branch, add, commit, stash, reset, checkout, tag, or history rewrite. The orchestrator reviews the
|
|
53
|
+
diff, runs final verification, and commits only when that is the desired next step.
|
|
54
|
+
|
|
55
|
+
## `resume` caveat
|
|
56
|
+
|
|
57
|
+
`codex exec resume` re-dispatches an existing session without re-sending context. **It may not
|
|
58
|
+
re-accept `--sandbox` / `approval_policy` / network flags** — do not assume the original posture
|
|
59
|
+
carries over. Restate the policy in the resumed instruction, or start a fresh `codex-exec` run when a
|
|
60
|
+
guaranteed sandbox/network posture matters.
|
|
61
|
+
|
|
62
|
+
## Subscription / config invariant
|
|
63
|
+
|
|
64
|
+
Both wrappers, before invoking codex:
|
|
65
|
+
|
|
66
|
+
- **unset** `OPENAI_API_KEY`, `CODEX_API_KEY`, `OPENAI_BASE_URL`, and every other `*_API_KEY`, so a
|
|
67
|
+
stray key can't switch to paid api-key billing;
|
|
68
|
+
- pass **`--ignore-user-config`** so a personal `~/.codex/config.toml` cannot change behaviour. Auth
|
|
69
|
+
still works: codex reads the cached login from `CODEX_HOME` (`~/.codex`) regardless of that flag;
|
|
70
|
+
- preflight `codex login status` and refuse unless it contains `Logged in using ChatGPT`;
|
|
71
|
+
- preflight a git work tree and a root `AGENTS.md`, failing fast (before a run is spent) if missing.
|
|
72
|
+
|
|
73
|
+
## Verified commands & flags (v0.140.0)
|
|
74
|
+
|
|
75
|
+
| Command / flag | Verified behaviour |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `codex exec` | non-interactive run from stdin / a prompt arg (headless, no TTY) |
|
|
78
|
+
| `codex exec resume` | resume an exec session (see the resume caveat) |
|
|
79
|
+
| `codex exec review` | review path reachable under `exec` |
|
|
80
|
+
| `codex review` | repository review path; supports reviewing uncommitted changes |
|
|
81
|
+
| `codex login` / `codex login status` | subscription auth flow + status check |
|
|
82
|
+
| `codex sandbox` / `codex apply` / `codex resume` | sandbox / apply / resume helper subcommands |
|
|
83
|
+
| `-c key=value` | override a config value (dotted path, TOML-parsed) — how policy is set deterministically |
|
|
84
|
+
| `--sandbox <mode>` | `read-only` \| `workspace-write` \| `danger-full-access` (this skill uses the first two) |
|
|
85
|
+
| `-c approval_policy=never` | never pause for interactive approval (required: exec has no TTY) |
|
|
86
|
+
| `-c sandbox_workspace_write.network_access=false` | network OFF under workspace-write (the exec invariant) |
|
|
87
|
+
| `-m <model>` | model to use (wrapper default `gpt-5.5` via `CODEX_MODEL`) |
|
|
88
|
+
| `-c model_reasoning_effort=<effort>` | reasoning effort (wrapper default `xhigh` via `CODEX_EFFORT`) |
|
|
89
|
+
| `--ignore-user-config` | do NOT load `$CODEX_HOME/config.toml`; auth still uses `CODEX_HOME` |
|
|
90
|
+
| `--add-dir <dir>` | extra writable dir alongside the workspace |
|
|
91
|
+
| `-C, --cd <dir>` | use `<dir>` as the working root |
|
|
92
|
+
| `--skip-git-repo-check` | allow running outside a git repo (exec normally requires one) |
|
|
93
|
+
| `--ephemeral` | do not persist session files |
|
|
94
|
+
|
|
95
|
+
## Troubleshooting
|
|
96
|
+
|
|
97
|
+
- **`could not find bubblewrap on PATH`** (Linux): codex falls back to a bundled bubblewrap. Install
|
|
98
|
+
`bubblewrap` (`sudo apt install bubblewrap` or equivalent) to silence the warning; it is only a
|
|
99
|
+
blocker if sandbox startup actually fails.
|
|
100
|
+
- **`not on a ChatGPT subscription`** (wrapper preflight): run `codex login`; confirm with
|
|
101
|
+
`codex login status` → `Logged in using ChatGPT`.
|
|
102
|
+
- **`must run inside a git working tree` / `no root AGENTS.md`** (wrapper preflight): run the wrapper
|
|
103
|
+
from the target project root.
|
|
104
|
+
- **codex wants to install a dependency**: it can't (network OFF in exec) — install it by hand, then
|
|
105
|
+
re-dispatch.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Setting up OpenAI Codex CLI (`codex`) on a clean machine
|
|
2
|
+
|
|
3
|
+
This setup is **secret-free**. `codex` itself is **not** bundled — it requires a binary install and a
|
|
4
|
+
one-time interactive sign-in with your own ChatGPT subscription. Do this once per machine, then the
|
|
5
|
+
skill works in any git repository that has a root `AGENTS.md`.
|
|
6
|
+
|
|
7
|
+
## 1. Install the binary
|
|
8
|
+
|
|
9
|
+
Install the official OpenAI Codex CLI using the current official channel for your platform, then
|
|
10
|
+
confirm it is on `PATH`:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @openai/codex # or: brew install codex (use the current official channel)
|
|
14
|
+
codex --version # this skill was verified with codex-cli 0.140.0 or newer
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The binary is **`codex`**. If `codex --version` works but the wrappers can't find it, fix your
|
|
18
|
+
`PATH`. If the installed binary's help disagrees with this skill's references, the live binary wins.
|
|
19
|
+
|
|
20
|
+
## 2. Sign in once (subscription only)
|
|
21
|
+
|
|
22
|
+
Run `codex login` once and complete the **ChatGPT** sign-in:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
codex login
|
|
26
|
+
codex login status # expect: Logged in using ChatGPT
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This caches credentials under `CODEX_HOME` (`~/.codex`, e.g. `~/.codex/auth.json`). That directory is
|
|
30
|
+
**personal** — never copy, commit, package, print, or share it. This skill needs **no API keys** and
|
|
31
|
+
must not be configured with api-key billing; both wrappers unset every `*_API_KEY` (and
|
|
32
|
+
`OPENAI_BASE_URL`) and pass `--ignore-user-config`, so billing can never silently fall back to
|
|
33
|
+
pay-as-you-go and a personal `~/.codex/config.toml` can never change behaviour.
|
|
34
|
+
|
|
35
|
+
## 3. Put the wrappers on `PATH`
|
|
36
|
+
|
|
37
|
+
The skill ships two wrappers: `bin/codex-exec.sh` and `bin/codex-review.sh`. Expose them on `PATH`
|
|
38
|
+
under the stable names `codex-exec` / `codex-review` via idempotent managed symlinks (refuse to
|
|
39
|
+
clobber a non-symlink):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
mkdir -p "$HOME/.local/bin"
|
|
43
|
+
skill_dir="$HOME/.claude/skills/codex-cli-bridge" # adjust if installed elsewhere
|
|
44
|
+
for w in codex-exec codex-review; do
|
|
45
|
+
src="$skill_dir/bin/$w.sh"
|
|
46
|
+
dst="$HOME/.local/bin/$w"
|
|
47
|
+
if [ -e "$dst" ] && [ ! -L "$dst" ]; then
|
|
48
|
+
echo "STOP: $dst exists and is not a symlink"; exit 1
|
|
49
|
+
fi
|
|
50
|
+
chmod +x "$src"
|
|
51
|
+
ln -sfn "$src" "$dst"
|
|
52
|
+
done
|
|
53
|
+
export PATH="$HOME/.local/bin:$PATH" # add to ~/.bashrc / ~/.zshrc to persist
|
|
54
|
+
command -v codex-exec && command -v codex-review
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 4. Smoke test
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
codex --version # version prints
|
|
61
|
+
env -u OPENAI_API_KEY -u CODEX_API_KEY -u OPENAI_BASE_URL codex login status
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Expected: the version prints, and login status includes exactly `Logged in using ChatGPT` (the
|
|
65
|
+
`env -u …` mirrors the wrappers, so stray keys can't mask the real auth mode). If the status does not
|
|
66
|
+
include that text, redo step 2. If a wrapper reports `'codex' not found`, fix your `PATH` (step 1);
|
|
67
|
+
if it reports a missing git work tree or root `AGENTS.md`, run it from a project root that has them.
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
|
|
71
|
+
- The wrappers are **subscription-only** by design and will not use api-key billing.
|
|
72
|
+
- `codex-exec` runs a **workspace-write** sandbox with **network OFF**; `codex-review` runs
|
|
73
|
+
**read-only**. See [`../references/sandbox-and-flags.md`](../references/sandbox-and-flags.md).
|
|
74
|
+
- `codex exec` requires a git repository, and the wrappers also require a root `AGENTS.md`. The
|
|
75
|
+
orchestrator commits, not codex. Re-run `codex login` only when the cached login expires or the
|
|
76
|
+
account changes.
|
|
77
|
+
- On Linux, install `bubblewrap` (`sudo apt install bubblewrap` or equivalent) to silence the
|
|
78
|
+
"could not find bubblewrap" warning; codex otherwise uses a bundled copy.
|
package/capability.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Portable, cross-agent memory & workflow for AI coding agents — Claude Code, Codex, Cursor, Devin Desktop. One command deploys an AGENTS.md entry point + docs/ai context with cap/archive/index enforcement into any repo.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"references/",
|
|
50
50
|
"launchers/",
|
|
51
51
|
"migrations/",
|
|
52
|
-
"tools/"
|
|
52
|
+
"tools/",
|
|
53
|
+
"bridges/"
|
|
53
54
|
],
|
|
54
55
|
"engines": {
|
|
55
56
|
"node": ">=18"
|
|
@@ -58,6 +58,9 @@ export const KNOWN_BACKENDS = [
|
|
|
58
58
|
credential: { env: 'CODEX_HOME', default: '~/.codex', file: 'auth.json' },
|
|
59
59
|
setupUrl: 'https://github.com/sabaiway/agent-workflow/blob/main/codex-cli-bridge/setup/README.md',
|
|
60
60
|
setupPathLocal: 'setup/README.md',
|
|
61
|
+
// The short canonical guided commands. Binary-install is platform-variant and longer, so it is
|
|
62
|
+
// REFERENCED via setupRef (§1 of that README), never duplicated here (would drift with the README).
|
|
63
|
+
guide: { setupRef: 'codex-cli-bridge/setup/README.md', loginCmd: 'codex login', verifyCmd: 'codex login status' },
|
|
61
64
|
},
|
|
62
65
|
{
|
|
63
66
|
name: 'antigravity-cli-bridge',
|
|
@@ -66,6 +69,7 @@ export const KNOWN_BACKENDS = [
|
|
|
66
69
|
credential: { env: null, default: '~/.gemini/antigravity-cli', file: 'antigravity-oauth-token' },
|
|
67
70
|
setupUrl: 'https://github.com/sabaiway/agent-workflow/blob/main/antigravity-cli-bridge/setup/README.md',
|
|
68
71
|
setupPathLocal: 'setup/README.md',
|
|
72
|
+
guide: { setupRef: 'antigravity-cli-bridge/setup/README.md', loginCmd: 'agy', verifyCmd: 'echo "say OK" | agy-run -' },
|
|
69
73
|
},
|
|
70
74
|
];
|
|
71
75
|
|
|
@@ -257,6 +261,38 @@ export const detectBackend = (entry, deps = {}) => {
|
|
|
257
261
|
|
|
258
262
|
export const detectBackends = (deps = {}) => KNOWN_BACKENDS.map((entry) => detectBackend(entry, deps));
|
|
259
263
|
|
|
264
|
+
// ── guidance (axis-aware, for the `setup` flow) ───────────────────────────────
|
|
265
|
+
|
|
266
|
+
const registryEntry = (name) => KNOWN_BACKENDS.find((b) => b.name === name);
|
|
267
|
+
|
|
268
|
+
// The skill axis can't be auto-fixed in every state: an absent dir IS placeable from the bundled
|
|
269
|
+
// kit; any other non-ok state (stub/foreign/invalid/unsupported, or an `unknown` marker fs error)
|
|
270
|
+
// is a STOP — never overwrite a dir we don't provably own.
|
|
271
|
+
const skillHint = (status, guide) =>
|
|
272
|
+
status.manifestState === NOT_INSTALLED
|
|
273
|
+
? `place the bundled bridge skill — run \`/agent-workflow-kit setup ${status.name}\``
|
|
274
|
+
: `bridge skill dir is "${status.manifestState}" — STOP and inspect ${status.skillDir ?? 'the skill dir'} (see ${guide?.setupRef ?? status.setupHint?.url})`;
|
|
275
|
+
|
|
276
|
+
// guideFor inspects the manifest/cli/credentials axes INDEPENDENTLY (never the collapsed readiness)
|
|
277
|
+
// and returns an ORDERED list of the manual steps still owed — possibly several at once (e.g. a
|
|
278
|
+
// fresh machine needs both the CLI and a login). `[]` ⇒ nothing manual left (the linker handles the
|
|
279
|
+
// wrappers). Each step is `{ need: 'skill'|'cli'|'credentials', hint }`. Pure; no fs, no side effects.
|
|
280
|
+
export const guideFor = (status) => {
|
|
281
|
+
const guide = registryEntry(status.name)?.guide;
|
|
282
|
+
const out = [];
|
|
283
|
+
if (status.manifestState !== OK) out.push({ need: 'skill', hint: skillHint(status, guide) });
|
|
284
|
+
if (status.cli.state !== PRESENT) {
|
|
285
|
+
out.push({ need: 'cli', hint: `install the "${status.cli.bin}" CLI — see ${guide?.setupRef ?? status.setupHint?.url} §1` });
|
|
286
|
+
}
|
|
287
|
+
if (status.credentials.state !== PRESENT) {
|
|
288
|
+
out.push({
|
|
289
|
+
need: 'credentials',
|
|
290
|
+
hint: `sign in once (subscription): ${guide?.loginCmd ?? 'see the setup README'} (verify: ${guide?.verifyCmd ?? 'see the setup README'})`,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
return out;
|
|
294
|
+
};
|
|
295
|
+
|
|
260
296
|
// ── report ───────────────────────────────────────────────────────────────────
|
|
261
297
|
|
|
262
298
|
const MARK = { [PRESENT]: '✓', [MISSING]: '✗', [UNKNOWN]: '?' };
|