@sabaiway/agent-workflow-kit 1.16.0 → 1.17.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 CHANGED
@@ -4,6 +4,44 @@ Semantically versioned ([semver](https://semver.org)), newest first. The `versio
4
4
  is the current release. `upgrade` mode reads a project's `docs/ai/.workflow-version` and applies
5
5
  every `migrations/<version>-<slug>.md` newer than it, in semver order.
6
6
 
7
+ ## 1.17.0 — Hardened Codex bridge: quality-first delegation, clean capture, enforced git-write boundary (kit)
8
+
9
+ A **feature** release. The bundled `codex-cli-bridge` (`bridges/codex-cli-bridge/`) is overhauled to
10
+ make delegating to the OpenAI Codex CLI faster, quieter, and safer **without lowering output quality** —
11
+ economy comes only from quality-neutral waste removal, never a model/effort downgrade. The bridge's own
12
+ contract bumps to **`2.0.0`** (MAJOR — the hardened wrappers now *refuse* inputs the `1.0.0` wrappers
13
+ silently accepted). The kit's own modes/CLI are unchanged, so the kit is a MINOR bump; the
14
+ deployment-lineage head stays **`1.3.0`** (no `docs/ai` structural change, no migration). The kit
15
+ **package** version is a separate axis.
16
+
17
+ - **Quality-first — no silent downgrade.** Both wrappers pin frontier `gpt-5.5` @ `xhigh` and **refuse
18
+ with a loud error** if `CODEX_MODEL`/`CODEX_EFFORT` resolves to a non-default, unless the explicit
19
+ throwaway `CODEX_PROBE=1` mode is set (echoed loudly). Outside that probe mode the passthrough guard
20
+ now blocks **every** model/context/policy-affecting flag (`-m/--model`, `--add-dir`, `-C/--cd`,
21
+ `-p/--profile`, `--oss`, …), not just the previous subset.
22
+ - **Clean output capture.** `-o` (final message only) + a `--json` event trace +
23
+ `hide_agent_reasoning=true` + `--color never` replace the streamed reasoning transcript; the session id
24
+ is persisted to a sidecar (`CODEX_SESSION_FILE`) for resume; on failure the trace tail is surfaced to
25
+ stderr (no silent failure). Reasoning still runs at `xhigh` — quality unchanged.
26
+ - **Hard timeout.** New `CODEX_HARD_TIMEOUT` (`timeout`/`gtimeout`, generous `xhigh`-sized defaults —
27
+ exec `3600` s / review `1800` s, `--kill-after=15s`); a hard kill (124/137) reports `codex exceeded
28
+ hard timeout`. A host with no `timeout` warns and runs uncapped (no silent skip).
29
+ - **Precomputed-diff review.** `review code` now assembles the diff itself (`git status` + cached/unstaged
30
+ `git diff` + untracked file **contents**, binary-skipped; a payload above the
31
+ `CODEX_REVIEW_MAX_TOTAL_BYTES` threshold goes via a repo-local temp file, never truncated) and feeds it
32
+ to `codex exec` — killing the agentic
33
+ discovery roaming that read unrelated files (incl. `~/.claude`). Reads stay `read-only` for
34
+ surrounding-file context; a no-change preflight exits before spending a run. Optional structured
35
+ findings via `CODEX_REVIEW_SCHEMA=1` (default off, raw-text fallback).
36
+ - **Invariant-preserving resume + enforced git-write boundary.** A dedicated `--resume-last` /
37
+ `--resume <id>` entrypoint re-establishes every wrapper invariant (`--ignore-user-config`, the pin,
38
+ posture restated via `-c`). A **physical `git` shim** (a real executable on a temp `PATH`, since
39
+ `execve` bypasses bash functions) enforces a strict read allowlist and blocks every write verb by
40
+ default — defence beyond the prompt contract.
41
+ - **First hermetic bridge tests + tarball `70 → 72` files.** `bridges/codex-cli-bridge/bin/{codex-exec,codex-review}.test.mjs`
42
+ ship as byte-identical mirror payload (matching `agy.test.mjs`); `npm pack --dry-run --json`
43
+ re-verified. The byte-identical bridge mirror + `capability.json` stay valid.
44
+
7
45
  ## 1.16.0 — Onboarding & discoverability: `help`, honest versioning, an enriched `status` (kit)
8
46
 
9
47
  A **feature** release (additive, backward-compatible). Makes the kit self-explanatory: a discoverable
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: agent-workflow-kit
3
3
  description: Deploy or upgrade a portable AI-agent memory-and-workflow system in any project. Use when the user wants to bootstrap `docs/ai/` + an entry-point `AGENTS.md` (+ `CLAUDE.md` alias) + cap/archive/index enforcement in a new or existing repo, set up the Memory Map and session protocols, install the docs-rotation pre-commit hook, or run `/agent-workflow-kit` / `/agent-workflow-kit upgrade`. Triggers on phrases like "set up the memory system", "deploy the AI workflow here", "bootstrap docs/ai", "upgrade the workflow".
4
4
  disable-model-invocation: true
5
5
  metadata:
6
- version: '1.16.0'
6
+ version: '1.17.0'
7
7
  ---
8
8
 
9
9
  # agent-workflow-kit
@@ -2,7 +2,7 @@
2
2
  name: codex-cli-bridge
3
3
  description: Delegate work to the OpenAI Codex CLI (`codex`) under a ChatGPT subscription — run plan/instruction EXECUTION in a sandboxed workspace, or get a read-only ADVISORY review of a plan or working-tree diff — as a second delegated-execution backend beside Antigravity. Use when the user wants to hand a bounded coding task or plan to `codex exec`, get a second-opinion review from codex, install or authenticate Codex CLI, understand its sandbox/network/approval policy, drive codex efficiently from the main agent (exec vs review, resume, the commit boundary), bridge project context (`AGENTS.md`) into codex, or troubleshoot codex flags, models, auth, or its no-TTY headless behaviour.
4
4
  metadata:
5
- version: '1.0.0'
5
+ version: '2.0.0'
6
6
  ---
7
7
 
8
8
  # codex-cli-bridge
@@ -46,21 +46,28 @@ this skill. Both wrappers enforce the subscription path before invoking codex:
46
46
  regardless of that flag);
47
47
  - they **preflight `codex login status`** and refuse to run unless it reports `Logged in using ChatGPT`.
48
48
 
49
- ## Models
49
+ ## Models quality-first pinned
50
50
 
51
- The wrappers default to `gpt-5.5` at reasoning effort `xhigh` (the strongest setting verified in this
52
- environment), both overridable per call. `codex --version` reports the CLI version, **not** the model
53
- list check your Codex CLI / ChatGPT account for the model slugs available to you, or let a wrong
54
- `-m` surface the error.
51
+ Delegated codex work ALWAYS runs on the **frontier model at maximum reasoning effort**: the wrappers
52
+ **pin** `gpt-5.5` / `xhigh` and **refuse** (exit 2, loud) a non-default `CODEX_MODEL` / `CODEX_EFFORT`
53
+ knowingly-worse output is never traded for quota. The pin is deliberate (an explicit `-m gpt-5.5`
54
+ guarantees the *strongest* model, not merely the CLI's current default); a release-time gate against
55
+ <https://developers.openai.com/codex/models> re-checks that `gpt-5.5` is still the strongest selectable
56
+ Codex model. Economy comes only from **quality-neutral waste removal** (clean capture, a hard timeout,
57
+ a precomputed review diff, `resume` instead of re-sending context), never from a downgrade.
58
+
59
+ The ONLY escape is a **throwaway probe** whose result is effort-independent (a reachability / smoke
60
+ check): set `CODEX_PROBE=1` (echoed loudly) to relax the model/effort guard. Never use a probe run's
61
+ output as real delegated work.
55
62
 
56
63
  | Variable | Default | Effect |
57
64
  |---|---|---|
58
- | `CODEX_MODEL` | `gpt-5.5` | model passed to `-m` |
59
- | `CODEX_EFFORT` | `xhigh` | reasoning effort passed to `-c model_reasoning_effort=…` |
65
+ | `CODEX_MODEL` | `gpt-5.5` (pinned) | model passed to `-m`; a non-default is REFUSED unless `CODEX_PROBE=1` |
66
+ | `CODEX_EFFORT` | `xhigh` (pinned) | reasoning effort (`-c model_reasoning_effort=…`); non-default REFUSED unless `CODEX_PROBE=1` |
60
67
 
61
- ```bash
62
- CODEX_MODEL=<slug> CODEX_EFFORT=<low|medium|high|xhigh> codex-exec <file>
63
- ```
68
+ `codex --version` reports the CLI version, **not** the model list. Quota is metered in **messages**
69
+ (a rolling 5h window + a weekly cap), not raw tokens — which is why the levers above are about removing
70
+ waste, never lowering quality. Full knob list: [§ Environment knobs](#environment-knobs).
64
71
 
65
72
  ## Usage
66
73
 
@@ -70,27 +77,55 @@ Drive codex only through the two wrappers (installed on `PATH`), run from the ta
70
77
  # EXECUTION (workspace-write sandbox, network OFF, never prompts):
71
78
  codex-exec docs/plans/<slug>.md # drive a plan file
72
79
  echo "apply review fix: ..." | codex-exec - # ad-hoc instruction from stdin
73
- CODEX_MODEL=<slug> codex-exec <file> # override the model
74
- codex-exec <file|-> -- <extra codex flags...> # passthrough codex flags after `--`
80
+ codex-exec <file|-> -- <unguarded codex flags...> # passthrough codex flags after `--` (guarded ones rejected)
81
+
82
+ # RESUME (iterate on the SAME session without re-sending context):
83
+ codex-exec --resume-last docs/plans/<slug>.md # continue the last session (id from the sidecar)
84
+ echo "now do step 2 ..." | codex-exec --resume <session-id> -
75
85
 
76
86
  # REVIEW (read-only sandbox — codex cannot edit anything, only emits findings):
77
87
  codex-review plan docs/plans/<slug>.md # critique a plan
78
- codex-review code # review the current working-tree diff
88
+ codex-review code # review the current working-tree diff (precomputed)
79
89
  codex-review code "focus on the new reducer" # review with extra focus
80
90
  ```
81
91
 
82
92
  `codex exec` is headless: there is **no TTY**, so `approval_policy=never` — anything needing
83
- escalation is refused and reported, never interactively approved. Extra `codex` flags go after a
84
- literal `--`; args without the separator are rejected (never silently dropped). Full flag/policy
85
- detail: [`references/sandbox-and-flags.md`](references/sandbox-and-flags.md).
93
+ escalation is refused and reported, never interactively approved. The wrappers capture only codex's
94
+ **final message** (`-o`; the JSON event stream + reasoning go to a discarded trace), so output is
95
+ clean; a successful **non-resume** `codex-exec` also records the session id to a sidecar
96
+ (`${CODEX_SESSION_FILE:-./.codex-last-session}`) so `--resume-last` can find it. Extra `codex` flags
97
+ go after a literal `--`; the wrapper rejects any that would defeat the policy or the pinned model (see
98
+ [§ Environment knobs](#environment-knobs) and the flag tiers in
99
+ [`references/sandbox-and-flags.md`](references/sandbox-and-flags.md)); args without the separator are
100
+ rejected, never silently dropped.
101
+
102
+ ## Environment knobs
103
+
104
+ All optional; the defaults are the supported path. Anything that would lower quality (model/effort) or
105
+ defeat a policy is guarded — see [§ Models](#models-quality-first-pinned).
106
+
107
+ | Variable | Default | Effect |
108
+ |---|---|---|
109
+ | `CODEX_MODEL` | `gpt-5.5` (pinned) | model; non-default REFUSED unless `CODEX_PROBE=1` |
110
+ | `CODEX_EFFORT` | `xhigh` (pinned) | reasoning effort; non-default REFUSED unless `CODEX_PROBE=1` |
111
+ | `CODEX_HARD_TIMEOUT` | `3600` (exec) / `1800` (review) | hard wall-clock cap (seconds) via `timeout`/`gtimeout`; exit 124/137 ⇒ "exceeded hard cap". No `timeout` binary ⇒ loud warning + uncapped (never silent). |
112
+ | `CODEX_SESSION_FILE` | `./.codex-last-session` | where `codex-exec` records the session id and where `--resume-last` reads it |
113
+ | `CODEX_REVIEW_MAX_TOTAL_BYTES` | `1500000` | `codex-review code`: above this the assembled diff goes via a git-dir temp file instead of inline — never truncated |
114
+ | `CODEX_REVIEW_SCHEMA` | unset | `codex-review`: `=1` returns findings as a validated JSON object (`--output-schema`), with a raw-text fallback. Default off. |
115
+ | `CODEX_PROBE` | unset | `=1` ⇒ throwaway-probe mode: relaxes the model/effort guard AND the tier-2 passthrough guard (echoed loudly). Never for real work. |
116
+
117
+ The git-write shim, `--ignore-user-config`, and the `*_API_KEY` scrub are NOT env-tunable — they are
118
+ fixed invariants.
86
119
 
87
120
  ## Project context (how `codex` sees the repo)
88
121
 
89
- From its **current working directory** `codex` auto-reads the root **`AGENTS.md`** so when you run a
90
- wrapper from a project root, the project's Hard Constraints are available to codex with no wiring (a
122
+ `codex` auto-**merges** `AGENTS.md` (root→cwd, plus a global `~/.codex/AGENTS.md`) straight into its
123
+ developer context, truncated at `project_doc_max_bytes` (default 32 KiB) so when you run a wrapper
124
+ from a project root, the project's Hard Constraints are already in front of the model with no wiring (a
91
125
  probe confirmed codex returned a repo's declared dialogue language from `AGENTS.md`). The wrappers
92
- therefore **hardcode no project rules**: the orchestrator contract tells codex to read the target
93
- `AGENTS.md` and obey it.
126
+ therefore **hardcode no project rules**, and the orchestrator contract is **lean**: it tells codex to
127
+ *obey* the already-merged `AGENTS.md` Hard Constraints + declared gates — it does NOT waste a step
128
+ telling codex to go *read* a file that is already in context.
94
129
 
95
130
  **Fallback is strict.** Both wrappers preflight that they run inside a git work tree and that a root
96
131
  `AGENTS.md` exists — if either is missing they **STOP and report** (a wasted subscription run is
@@ -105,17 +140,28 @@ See [`references/driving-codex.md`](references/driving-codex.md) for the full pl
105
140
  - **`codex-exec` for doing, `codex-review` for judging.** Use exec to implement a plan/fix under the
106
141
  sandbox; use review to get advisory findings on a plan or diff without any edits.
107
142
  - **The orchestrator commits — codex never does.** The execution contract forbids every git write
108
- (branch/add/commit/stash/reset/checkout/tag/rewrite); you review codex's diff, then commit yourself.
143
+ (branch/add/commit/stash/reset/checkout/tag/rewrite), and `codex-exec` additionally enforces it with
144
+ a physical **git-write shim** on the codex subprocess's `PATH`: read-only git verbs pass through,
145
+ every write/unknown verb is blocked (codex spawns `git` via `execve`, which bypasses shell
146
+ functions — so the boundary must be a real file). You review codex's diff, then commit yourself.
109
147
  - **Treat output as advisory** and verify before acting — re-run the project's gates yourself, reject
110
148
  advice that conflicts with user instructions or repo rules.
111
149
  - **Hand codex a self-contained task.** It cannot see your conversation — for an ad-hoc instruction,
112
150
  embed the goal, the relevant paths, and the expected result; codex reads `AGENTS.md` for the rules.
113
- - **Re-dispatch with `codex exec resume`** (run codex directly the wrapper's flag/stdin shape can't
114
- host the `resume` subcommand) instead of re-sending context. **Caveat:** resume runs outside the
115
- wrapper and may not re-accept `--sandbox` / policy flags restate the policy, or start a fresh
116
- `codex-exec` run when a guaranteed sandbox/network posture matters.
151
+ - **Iterate with `codex-exec --resume-last` / `--resume <id>`** instead of re-sending context. The
152
+ resume entrypoint re-establishes EVERY wrapper invariant (subscription-only, `--ignore-user-config`,
153
+ the pinned model/effort) and **restates the full posture via `-c`**`codex exec resume` resets the
154
+ sandbox/approval/network posture and rejects the `-s`/`--add-dir`/`-C` posture flags, so the wrapper
155
+ sets `sandbox_mode=workspace-write` + `approval_policy=never` +
156
+ `sandbox_workspace_write.network_access=false` explicitly. It reads the session id from the sidecar
157
+ (`--resume-last`) or takes it as an argument.
117
158
  - **Network is OFF in exec.** New dependencies and any network step are installed by hand, then codex
118
159
  is re-dispatched.
160
+ - **`codex-review code` precomputes the diff.** The wrapper assembles the change set (repo map, status,
161
+ staged + unstaged diff, untracked file contents) and feeds it in, so codex does not roam the
162
+ filesystem rediscovering it; a clean tree exits 0 before a run is spent. Native `codex review` is
163
+ deliberately NOT used — it rejects `--ignore-user-config` and would load a personal config.toml,
164
+ breaking the subscription/config-isolation invariant.
119
165
 
120
166
  ## Complementary skills (optional, standalone-first)
121
167
 
@@ -140,8 +186,15 @@ The wrappers work in any git repo where `codex` is installed and authenticated.
140
186
  install dependencies or reach the network — do that by hand, then re-dispatch.
141
187
  - **No live approvals** — `codex exec` has no TTY, so `approval_policy=never`; an action that would
142
188
  need escalation is reported, not approved interactively.
143
- - **`resume` may drop sandbox/policy flags** — restate the policy or start a fresh run when the
144
- posture matters (see the driving reference).
189
+ - **`resume` resets the posture** — `codex exec resume` rejects `-s`/`--add-dir`/`-C` and forgets the
190
+ original sandbox/approval/network policy. The `codex-exec --resume`/`--resume-last` entrypoint
191
+ restates it via `-c`; only a *raw* `codex exec resume` (bypassing the wrapper) loses the posture.
192
+ - **Hard timeout** — a hung run is killed at `CODEX_HARD_TIMEOUT` (exec 3600s / review 1800s) and
193
+ reported (exit 124/137); raise it for a known-healthy slow run. If neither `timeout` nor `gtimeout`
194
+ is on `PATH` the wrapper warns loudly and runs uncapped (never silently).
195
+ - **Native `codex review` is out of scope** — it rejects `--ignore-user-config` (would load a personal
196
+ `config.toml` and break the subscription/config-isolation invariant) and can't be cleanly captured;
197
+ `codex-review` runs `codex exec` over a precomputed diff instead.
145
198
  - **bubblewrap** — on Linux, if `bubblewrap` is not on `PATH` codex prints a warning and uses a
146
199
  bundled copy; install it via your package manager to silence the warning.
147
200
  - codex output is advisory and may be incomplete or out of date — the main agent verifies before