@sabaiway/agent-workflow-kit 23.0.0 → 23.2.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +1 -1
  4. package/bridges/antigravity-cli-bridge/SKILL.md +11 -10
  5. package/bridges/antigravity-cli-bridge/bin/agy-jev.test.mjs +56 -7
  6. package/bridges/antigravity-cli-bridge/bin/agy-review.sh +80 -62
  7. package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +0 -21
  8. package/bridges/antigravity-cli-bridge/bin/agy.sh +86 -12
  9. package/bridges/antigravity-cli-bridge/capability.json +2 -2
  10. package/bridges/antigravity-cli-bridge/references/models-and-flags.md +3 -3
  11. package/bridges/antigravity-cli-bridge/setup/README.md +1 -1
  12. package/bridges/codex-cli-bridge/SKILL.md +23 -24
  13. package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +82 -47
  14. package/bridges/codex-cli-bridge/bin/codex-exec.sh +133 -52
  15. package/bridges/codex-cli-bridge/bin/codex-review-jev.test.mjs +44 -14
  16. package/bridges/codex-cli-bridge/bin/codex-review.sh +103 -30
  17. package/bridges/codex-cli-bridge/capability.json +6 -6
  18. package/bridges/codex-cli-bridge/references/driving-codex.md +6 -7
  19. package/bridges/codex-cli-bridge/references/sandbox-and-flags.md +8 -11
  20. package/bridges/codex-cli-bridge/setup/README.md +3 -3
  21. package/capability.json +1 -1
  22. package/package.json +1 -1
  23. package/references/modes/recommendations.md +2 -2
  24. package/references/modes/setup.md +2 -0
  25. package/references/modes/upgrade.md +3 -3
  26. package/references/modes/velocity.md +1 -1
  27. package/tools/apply-danger-check.mjs +1 -1
  28. package/tools/bridge-sandbox-recipe.mjs +7 -3
  29. package/tools/bridge-settings-read.mjs +2 -0
  30. package/tools/detect-backends.mjs +22 -14
  31. package/tools/fs-safe.mjs +2 -2
  32. package/tools/manifest/schema.md +2 -2
  33. package/tools/refresh-parity.mjs +3 -3
  34. package/tools/services/antigravity.json +3 -0
  35. package/tools/services/codex.json +5 -0
  36. package/tools/services/index.mjs +49 -5
  37. package/tools/services/jev.json +1 -0
  38. package/tools/setup-backends.mjs +37 -48
  39. package/tools/velocity-profile.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,56 @@ 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
+ ## 23.2.0 — a service the kit does not ship goes into your own services list (AD-226)
8
+
9
+ **A bridge run can now reach a service the kit does not ship: you list it once in your own
10
+ `~/.config/agent-workflow/services.json`, and the kit adds it to every placed bridge and to the project's sandbox
11
+ settings.** The kit only reads that file, never writes it. Each entry maps a new service id to the same six keys as a
12
+ kit service file (`hosts`, `writableDirs`, `excludedCommands`, `passedVariables`, `billingVariables`,
13
+ `runReachesHosts`); Mode: setup describes it. With no such file every output is what it was, but for the two lines
14
+ below.
15
+
16
+ - **Placement and every refresh write your services into each bridge's facts file.** `/agent-workflow-kit setup`,
17
+ `init` and `/agent-workflow-kit upgrade` write each placed bridge's `service-facts.txt` from the bridge's own
18
+ services, then yours, so the bridge wrappers reach your hosts and pass your variables.
19
+ - **The bridge tier adds your hosts, state folders and excluded commands** to `.claude/settings.json` for every bridge
20
+ the project uses: the dry-run, the apply, the Recommendations item, the danger check and the autonomy preview read
21
+ the same list.
22
+ - **A broken list stops the step before it writes anything**, naming the file: fix or remove it, then run the same
23
+ step again (`/agent-workflow-kit setup` after a stopped place, `/agent-workflow-kit upgrade` after a refresh that
24
+ could not run).
25
+ - **No list can hand a billing key to a run.** Every service now names its billing variables (codex `OPENAI_API_KEY`,
26
+ `CODEX_API_KEY`, `OPENAI_BASE_URL`; antigravity `GEMINI_API_KEY`), and a passed variable equal to one is refused.
27
+ - **A service you remove leaves the facts files at the next refresh**; the sandbox entries the tier already added stay,
28
+ and you remove them from `.claude/settings.json` yourself.
29
+ - **Two changed lines:** an equal-version refresh no longer reports the placed `service-facts.txt` as a local edit,
30
+ since every refresh writes it anew; and a read-only refresh that cannot repair a file now says it still differs
31
+ "from what the refresh writes", where it said "from the bundled copy".
32
+
33
+ ## 23.1.0 — every bridge wrapper reads its hosts and passed keys from the file in its own folder (AD-225)
34
+
35
+ **The bridge wrappers no longer carry their own copy of the Jev hosts and key: each reads them from the
36
+ `service-facts.txt` the kit writes into its bridge folder.** A host or key change is now one edit to the kit's service
37
+ files; the wrappers, their `--help` and their banners follow it. For the facts the kit ships today a run reaches the
38
+ same hosts, passes the same key and prints the same posture banners; a profile run's network instruction now reads
39
+ `the reachable host list is …`, and agy-run's line before dispatch now opens `passed variables: TYPESAFE_API_KEY;` in
40
+ place of `jev: TYPESAFE_API_KEY passed;`. This kit carries codex bridge 6.0.0 and antigravity bridge 8.0.0; your next
41
+ `/agent-workflow-kit upgrade` (or `init`) refreshes the bridges you placed, with no question.
42
+
43
+ - **A broken or missing facts file stops the run.** `codex-exec`, `codex-review`, `agy-run` and `agy-review` check the
44
+ file before `--help` and before any CLI starts. A missing, unreadable or malformed file exits 127 with one line
45
+ naming the file, the bad line and `/agent-workflow-kit upgrade`, which writes it again.
46
+ - **Your own `HOST` still reaches the CLI.** The wrappers keep what they read under their own names, so a `HOST`
47
+ variable you exported is passed on as before.
48
+ - **agy-review runs the agy wrapper from its own folder**, never an `agy-run` found first on your PATH, so both read the
49
+ same facts.
50
+ - **The bridge pages name no host and no key** outside the two Jev paragraphs: they say the run reaches the hosts its
51
+ `service-facts.txt` lists.
52
+ - **The setup check takes the sign-in folders from the service files.** When it cannot use one, the credentials read as
53
+ `unknown` and the reason is printed instead of a sign-in hint.
54
+ - **The service files refuse two unsafe shapes:** a `*.` host in a service the run itself reaches, and
55
+ `OPENAI_BASE_URL` as a passed variable.
56
+
7
57
  ## 23.0.0 — the kit reads each bridge's hosts and state folders from a separate file for each service (AD-224)
8
58
 
9
59
  **The network hosts and state folders the kit sets up for a bridge now come from a separate kit file for each service
package/README.md CHANGED
@@ -259,7 +259,7 @@ file), or run the guarded `/agent-workflow-kit uninstall`.
259
259
  | `/agent-workflow-kit core-evidence` | any time | **the ONE loop-evidence writer** (strip-the-kit) — every core evidence record lands in a single append-only JSONL store inside the git dir (never committable; versioned schema, latest-per-key supersession, byte-identical duplicates refused, malformed lines fail every reader closed). `red-proof "<file>#<pattern>"` declares an observed-red **BEFORE a bugfix** (N/N red runs + content custody + base + the pre-fix fingerprint; green/mixed/timeout are DISTINGUISHED refusals — nothing written); `degrade --backend --reason` is the ONLY escape for an unavailable review backend (per-tree, never all backends); `summary` renders the whole loop state statelessly (gate result · per-backend verdicts · red-proofs · degrades) — no ledger, no rounds, nothing remembered. Honest residual: records are forgeable — self-discipline, not a security boundary. Never commits, never runs a subscription CLI. |
260
260
  | `/agent-workflow-kit coverage-check` | any time | **the final-run checker** (D3(c)+(d)) — **certifies coverage ONLY inside the `--final` run that owns the lcov** (ownership is exclusive by CONVENTION over the fixed path, not enforced — a concurrent writer to it is a stated residual, queued as LCOV-EXCLUSIVE-OWNERSHIP): an artifact on disk proves nothing about the tree it came from, so a standalone run prints its findings and states `attested=no` / `NO VERDICT` rather than a PASS (an lcov that predates an edit would otherwise certify a line the suite never executed). `attested=` claims a verdict was ISSUED, pass or fail — a run over uncovered lines still reads `attested=yes` and still exits 1, and a run whose coverage arm never executed (no lcov) reads `attested=no` even inside `--final`, because nothing was read and nothing is certified. The runner passes a nonce whose one-way commitment over `{nonce, fingerprint, base}` is the `final-start.attempt` it recorded; a context describing another tree, or matching no recorded attempt, is a REFUSAL, never a verdict. Findings are unchanged — reads the lcov the declared `unit-tests` gate produced at the FIXED git-dir path and fails on any uncovered CHANGED executable Node line (listed `file:line`; a changed file absent from the map is a file-level red; out-of-domain/unsupported files are LISTED — the claim narrowed honestly); VERIFIES every current-base red-proof declaration (bound test exists · custody hash unchanged · green N/N now · pre-fix fingerprint differs); prints `lcov-sha256=<hex|none>` of the exact bytes it consumed — the sha the `--final` receipt binds and re-hashes. An absent lcov is a LOUD `skipped-no-lcov`; a symlinked path is a refusal. `--check` is the gate exit code — declare it as the LAST gate (`run-gates --final` refuses otherwise). Read-only. |
261
261
  | `/agent-workflow-kit commit-guard` | any time | **the read-only pre-commit guard** (D10) — makes the commit capture the whole current working tree, so «verified» and «about to be committed» are the same bytes (the receipt itself has a stated residual — see the mode doc). FIRST it refuses an **INDEX that lags the verified working tree** (the gates and the fingerprint describe the WORKING tree while `git commit` takes the INDEX alone, and the fingerprint cannot tell them apart — so a lagging index used to ship a strict subset of what was verified): unstaged tracked paths or reviewable untracked-not-ignored paths, named up to a bounded cap with the remainder stated, a dirty tracked **submodule** named separately with its own recovery, and fail-closed on an undecidable probe. This deliberately blocks a partial commit. Then it binds the LATEST completed `run-gates --final` receipt to the EXACT current tree: refuses on a missing/red/stale receipt, fingerprint drift under the run, a dangling later attempt, declaration content drift, evidence-hash or lcov drift, or unsatisfied review obligations (the same review-state decision, recomputed over a sanitized env — forged out-of-repo stores never satisfy). Re-runs NO gate or test. Wire it into `.git/hooks/pre-commit` (the installer writes the RESOLVED invocation). `git commit --no-verify` stays the stated residual. |
262
- | `/agent-workflow-kit recommendations` | any time (every `upgrade` ends with it) | **read-only deployment advisor** (AD-044) — computes what in THIS deployment is configured sub-optimally (allowlist not seeded, autonomy render drifted, OS sandbox unavailable, gates undeclared, bridge friction, sandbox-mask clutter, a feature-spec layer never adopted) and renders **verdict-first**: one composed verdict line (does anything need attention?), then each item as **{severity · what · one-line benefit · an optional `recipe:` line (the bridge-tier item's missing-entries line — each missing entry by kind: allow rules, exclusions, hosts, state dirs, then what the execution wrapper codex-exec needs, then the host condition; the worktrees-dir ack fallback for a host that ignores the settings key, the agents hidden-mode reconcile follow-up, a user item's own facts, the spec-adoption decline preview, or another offer's decline preview) · the exact consent-gated apply one-liner}**; `references/advisor-writers.md` names each variant's writer or user step. The agent PRESENTS the section in the user's conversational language — every fact and count, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; raw tool block on request — and runs EXACTLY the rendered one-liners and the follow-up commands required by the mode doc, only on the answer authorizing that step — your yes to apply or your explicit decline to record it — with a second yes where the mode doc requires it, surfacing each item's posture note first; a kit item it applies with no question, its check line first, the harness's own dialog the only ask, or the one plain step where auto mode refuses its check or apply. Renders **present-even-when-empty** (`no recommendations — flow optimal.`); a failed probe degrades to a stated skip line. Registry strings are fact-true frozen one-line data (posture/risk notes live in the mode doc at the consent moment); `velocity --bridge-tier` seeds the used bridges' review allow rules, `<wrapper> *` exclusions (`codex-exec *` where an execute slot delegates, keeping its permission prompt), declared hosts into `sandbox.network.allowedDomains`, and home-relative state dirs into `sandbox.filesystem.allowWrite`; hosts and dirs come from the kit service fragments (`agent-workflow-kit/tools/services/`) each bridge's `capability.json` names in `services`, and the advisor's `bridge-tier` item counts and names each missing one. `--cwd` is required (the target project is explicit); writes nothing, never commits, never runs a subscription CLI. |
262
+ | `/agent-workflow-kit recommendations` | any time (every `upgrade` ends with it) | **read-only deployment advisor** (AD-044) — computes what in THIS deployment is configured sub-optimally (allowlist not seeded, autonomy render drifted, OS sandbox unavailable, gates undeclared, bridge friction, sandbox-mask clutter, a feature-spec layer never adopted) and renders **verdict-first**: one composed verdict line (does anything need attention?), then each item as **{severity · what · one-line benefit · an optional `recipe:` line (the bridge-tier item's missing-entries line — each missing entry by kind: allow rules, exclusions, hosts, state dirs, then what the execution wrapper codex-exec needs, then the host condition; the worktrees-dir ack fallback for a host that ignores the settings key, the agents hidden-mode reconcile follow-up, a user item's own facts, the spec-adoption decline preview, or another offer's decline preview) · the exact consent-gated apply one-liner}**; `references/advisor-writers.md` names each variant's writer or user step. The agent PRESENTS the section in the user's conversational language — every fact and count, nothing added or dropped; commands, paths, hosts and rule strings byte-exact; raw tool block on request — and runs EXACTLY the rendered one-liners and the follow-up commands required by the mode doc, only on the answer authorizing that step — your yes to apply or your explicit decline to record it — with a second yes where the mode doc requires it, surfacing each item's posture note first; a kit item it applies with no question, its check line first, the harness's own dialog the only ask, or the one plain step where auto mode refuses its check or apply. Renders **present-even-when-empty** (`no recommendations — flow optimal.`); a failed probe degrades to a stated skip line. Registry strings are fact-true frozen one-line data (posture/risk notes live in the mode doc at the consent moment); `velocity --bridge-tier` seeds the used bridges' review allow rules, `<wrapper> *` exclusions (`codex-exec *` where an execute slot delegates, keeping its permission prompt), declared hosts into `sandbox.network.allowedDomains`, and home-relative state dirs into `sandbox.filesystem.allowWrite`; hosts and dirs come from the kit service fragments (`agent-workflow-kit/tools/services/`) each bridge's `capability.json` names in `services`, then from your own services list (`services.json` beside the bridge settings file, Mode: setup), and the advisor's `bridge-tier` item counts and names each missing one. `--cwd` is required (the target project is explicit); writes nothing, never commits, never runs a subscription CLI. |
263
263
  | `/agent-workflow-kit doc-parity` | any time | **read-only doc-parity lint** (AD-049) — kills the doc-drift class where a mode-contract doc silently lags a code constant (a `--check` doc still reading `300` after the diff cap moved to `400`): a **closed, exported registry** binds each live constant (review caps, schema versions, the ledger's own class/scope vocabulary, and the autonomy-doctor EXIT/status/trusted-dir contract) to the exact token its `references/modes/*.md` contract must carry, and asserts the CURRENT value renders into every bound file — a drifted doc, an unreadable file, or an absent token **fails closed**. The values are sourced from the live imports (never re-typed), so the lint can't itself go stale; adding a binding is adding a checked entry (closed-world, edit-safe). `--check` is the gate exit code a kit maintainer runs: the lint checks the kit's own package. Never writes, never commits, never runs a subscription CLI. |
264
264
  | `/agent-workflow-kit dispatch` | any time | **the delegation engine** — makes "how much does delegating a sub-task actually buy?" a measured number instead of a feeling. `check <file>` validates a sub-task brief's contract block and exits 0/1 naming the first violated field — **form only**: whether the task is genuinely bounded, its design decided and its acceptance adequate stays your judgment, and a well-formed absurdity passes here by construction. `advise --step-class <c>` answers the question that comes BEFORE that one — which vehicle should carry this kind of sub-task, whether it is even present on this machine, and what the ledger has already recorded for threads of that class (finished, failed, closed without a fold, and still open — counted separately) — and it decides nothing: it refuses no dispatch, gates no verb, and a choice that diverges from the advice is noted rather than blocked. It reads the filesystem only: nothing is launched to find out what is installed, an absent ledger prints "no recorded history", an unreadable one prints the store's own words, and either way the advice still prints. The same block appears as a footer under a form-valid `check` — never under a refusal, so it can never hide one. `register` pre-registers an acceptance wave (step classes, pairing key, minimum observations per class, the mean and first-pass thresholds) so the bar can never be chosen after the results it judges — immutable per wave. `observe` records ONE hand-written observation (`solo-construction`, the baseline whose ratio is 1 by construction — except over a scope measuring zero bytes, which has no ratio at all and is recorded ineligible by name — or `self-reported`) — delegated numbers are never hand-written, they are derived. The writer verbs are where that derivation happens: `open` puts a delegated thread on the record with every mint-time field copied from the brief's own header, refusing a deadline the wrapper's cap plus its kill grace would not fit inside, and recording whether the tree it started from was clean against the thread's base — HEAD by default, or the tree `--checkpoint <oid>` names, so the second task of a story is measured over the first one's uncommitted work instead of opening dirty (a dirty one makes the result honestly unmeasurable rather than quietly counted), while `--task <brief>` also records which task brief the thread carries out and the files that brief lists, refusing, since the last commit, a task thread whose files overlap by path prefix those of an open task thread or of a folded thread of another brief (`files-overlap`), and a mix of the two kinds — an untasked open beside an open task thread or, for a `code` open of backend `codex`, after a task fold, and a task open beside an open untasked thread (`mixed-open`), refusing at open a Files path the snapshot scope can never hold (`task-files-scope`), and measuring a task thread over its files alone, so `return` and `fold` refuse a changed path that no open or folded task thread on the same base claims (`out-of-files`); `await` waits for that one dispatch to answer and writes nothing — only the finished receipt satisfies it, a run still holding the nonce means keep waiting, and a wait that runs out says so with its own exit code, names whether the deadline or your own timeout ended it, and authorizes nothing: a wait that ended without an answer is a question for you, never permission to dispatch again; `return` absorbs the receipt the wrapper minted — only a finished one, checked against the contract it actually ran, its deadline and its own report, and refused outright when the tree hides changes from git or moves while the return is being computed — and derives the bytes from git rather than from anyone's claim; `fold` is the acceptance, and it refuses if the tree moved since the return — precisely, it re-confirms **equality of the visible canonical payload**, which is a change detector rather than a cryptographic identity of the tree: under the default head base that payload's untracked section is unframed and carries no file mode, so a content or symlink target that imitates the marker opening the next entry can alias two trees, and making an untracked file executable moves nothing (both named as residuals in the mode doc, with the fix queued); under a checkpoint base it is one indexed diff that carries modes. A change set carrying a binary, a non-regular path, a submodule, or a symlink whose target is not valid UTF-8 is **refused** at `return` and `fold` — CONSERVATIVELY, rather than promise what the default head payload may not be able to follow — and the same refusals hold for a checkpoint thread. `degrade` closes a thread that never earned a fold, on the record and with its reason. `aggregate` prints one wave: the registered thresholds, every observation as context, and per step class the finished threads — a folded success with git-provable bytes contributes its ratio, one whose bytes are unprovable is excluded from the mean but still counts in the first-pass rate, and a failed thread, a degrade-closed one, or one folded after failing acceptance each count as a real zero. Below the registered minimum nothing is computed (insufficient); at or above it is computed and labeled PILOT evidence. It REFUSES rather than guessing: no pre-registration, an unfinished thread in scope, a recorded refusal-to-delegate that never opened a thread, or an ambiguous wave each stop the computation by name. `handoff-return --slug <s>` closes the worktree loop after `land --prepare`: it re-attests that main still holds exactly the prepared tree under the same HEAD (both recorded in the handoff at prepare time), prints the satellite handoff's user-owned content byte for byte with its boundaries, byte lengths and the main-owned destinations each part folds into, prints the handoff digest and both OIDs as its proof, states the after-the-fold order (a fold landed after the gates leaves them stale), and records ONE self-reported worktree-stream observation only when the whole prepared change set is measurable — a deletion, a rename, a symlink, a submodule or a mode-only change ends with a named NOT RECORDED instead, never a partial number. Appends only to its own ledger inside the git dir (never committable); it also writes `handoff-return`'s `write-tree` tree object and, for a checkpoint measurement, the leaf's OWN temporary index file and the blobs its forced adds store — never a ref, never the real index; never commits, never runs a subscription CLI. |
265
265
  | `/agent-workflow-kit worktrees` | any time | **parallel feature worktrees** — run several features in DIFFERENT agent sessions on one repo, zero interference on working-tree files (the ONE exception is the dependency cache, below): `provision <slug> --plan <file>` creates a sibling git worktree on branch `aw/<slug>` and populates it (registry-derived footprint copy-if-missing — a tracked file is never overwritten; EXACTLY ONE seeded feature plan; the `handoff-<slug>.md` record from minute zero; `node_modules` symlinked where the link stays ignored — a shared MUTABLE dependency cache: writes through it hit MAIN's node_modules; for isolation run the printed isolated-install command (`--install` only PRINTS it; on `--resume` run the printed unlink-first recovery first — printed only for a link whose RAW TARGET is MAIN's `node_modules`, since a foreign or unreadable link is reported as such with no removal advised); absolute root-pinned gate commands rebased on untracked copies only, and only while their bytes equal the MAIN source or its rebased form — user-modified copies stay untouched); `list` is read-only (slug, branch, base, dirty, handoff); `prompt <slug>` is read-only too and re-prints the satellite's cold-start prompt — the same text `provision` ends its report with: where the worktree is, its ONE seeded plan, the handoff as the one channel back, MAIN's orientation (shared series index, landing) and, under its own heading because it is probed on the satellite, that checkout's install posture — every value derived LIVE rather than replayed from the frozen provision record, a recorded value that no longer matches NAMED as a divergence (with the cause its source makes likely) instead of printed as the runnable one, every offered command marked with WHO runs it (`MAIN $ …` for the landing, `HERE $ …` for this checkout's own install, a posture with nothing to run staying prose), and a control character in any rendered value a typed STOP rather than a forged prompt line; `land <slug> --prepare` locks the common git dir, fail-closes on divergence or incomplete satellite state, transfers the complete accepted satellite diff onto a CLEAN main, runs sync plus the declared gates, and reports HEAD/TRANSFER/PREPARED OIDs — the commit ALWAYS stays a dialogue ask; `cleanup <slug>` takes the same lock and removes a LANDED worktree only after live landed-verification against main HEAD, while `--abandon` is the ONE destructive arm (destroys unlanded work; **no preview step** on any writer). The parent dir is the `docs/ai/worktrees.json` `parentDir` setting (default: the repo's sibling parent); an unwritable parent prints the `worktrees-dir` check line: the agent applies the grant on your chat yes after the check, one entry in this copy's `.claude/settings.local.json`, never the committed project settings (`init` is the route you may take instead, and the ack is the fallback for a host that ignores the key), else the printed terminal command runs it. Never commits, never pushes, never runs a subscription CLI. |
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". New to the epic, story and task tier? Run `/agent-workflow-kit tier`. A typed decision with a confidence from Jev? Run `/agent-workflow-kit jev`.
4
4
  disable-model-invocation: true
5
5
  metadata:
6
- version: '23.0.0'
6
+ version: '23.2.0'
7
7
  ---
8
8
 
9
9
  # agent-workflow-kit
@@ -2,7 +2,7 @@
2
2
  name: antigravity-cli-bridge
3
3
  description: Delegate work to Google's Antigravity CLI (`agy`) — the successor to Gemini CLI — to reach Gemini, Claude, and GPT-OSS models under a Google AI Pro/Ultra subscription from the terminal. Use when the user wants to run a headless `agy` prompt, hand a focused task or second-opinion review to `agy`, install or authenticate Antigravity CLI, check or economise its quota/models, bridge project context into `agy`, set up a second delegated-execution backend beside Codex, or troubleshoot `agy` flags, models, auth, conversations, or its headless behaviour.
4
4
  metadata:
5
- version: '7.1.0'
5
+ version: '8.0.0'
6
6
  ---
7
7
 
8
8
  # antigravity-cli-bridge
@@ -44,16 +44,15 @@ wrapper [`bin/agy.sh`](bin/agy.sh) on `PATH` as `agy-run`.
44
44
 
45
45
  Never read, print, copy, commit, or package that token — it is personal and is **never bundled** with
46
46
  this skill. The wrapper [`bin/agy.sh`](bin/agy.sh) **unsets `OPENAI_BASE_URL` and every `*_API_KEY` except
47
- `TYPESAFE_API_KEY`** (`ANTIGRAVITY_API_KEY`, `GEMINI_API_KEY`, `GOOGLE_API_KEY`, `GOOGLE_GENAI_API_KEY`
48
- included; `TYPESAFE_API_KEY` passes as given) before invoking `agy`, so a stray key can never silently
49
- switch you to pay-as-you-go billing.
47
+ the passed variables its service-facts.txt lists** (those variables pass as given) before invoking `agy`,
48
+ so a stray key can never silently switch you to pay-as-you-go billing.
50
49
 
51
50
  **Caveat:** the subscription has a finite quota. Keep probes short (see *How the main agent drives
52
51
  agy*); the model every review and kept run uses is the host posture below, never a per-call pick.
53
52
 
54
53
  ## Models
55
54
 
56
- The model is **one host setting**: `AGY_MODEL=<exact display string>` in the bridge settings file
55
+ The model is **a host setting**: `AGY_MODEL=<exact display string>` in the bridge settings file
57
56
  `${XDG_CONFIG_HOME:-~/.config}/agent-workflow/bridge-settings.conf` is the host posture, else the
58
57
  built-in default `Gemini 3.8 Flash (High)`. An `AGY_MODEL` environment value off the host posture
59
58
  (an explicitly empty one included) is a one-off, which `agy-run` (the probe role) runs and
@@ -226,9 +225,11 @@ AGY_MODEL="<an offered display string>" agy-run \
226
225
  **The Jev skill in a delegated run.** A headless `agy-run` loads the vendor's Jev skill from the user root the kit's
227
226
  `jev-skill` command fills, `~/.gemini/config/skills` (measured 2026-10-02 on agy 1.2.14: a probe skill under that
228
227
  root was listed, none under `~/.gemini/antigravity-cli/skills`), and `TYPESAFE_API_KEY` passes the wrappers as given
229
- while every other `*_API_KEY` is unset; nothing in agy's permissions is widened, no flag is added and no setting is
230
- written. With the key set, `agy-run` prints one line before dispatch: a headless agy runs the Jev request only where
231
- the user's agy permissions allow commands, and the first denied command ends the run. `agy-review` makes no Jev
228
+ under the shared key rule: every `*_API_KEY` except the passed variables its service-facts.txt lists is unset;
229
+ nothing in agy's permissions is widened, no flag is added and no setting is written. The run hosts its
230
+ service-facts.txt lists do not widen those permissions. With a non-empty passed
231
+ variable, `agy-run` prints one line naming the non-empty passed variables before dispatch: a headless agy runs a
232
+ request that uses them only where the user's agy permissions allow commands, and the first denied command ends the run. `agy-review` makes no Jev
232
233
  request while its model obeys its prompts, which forbid every tool; that prohibition is advisory, not a sandbox. The documented opt-in `-- --dangerously-skip-permissions`
233
234
  stays admitted, and such a run carries the key into an agy whose network and file tool are unconfined. Two residuals
234
235
  stand: the key now sits in every run's environment, and a `web_search` or fetch tool agy is permitted to run may reach
@@ -255,8 +256,8 @@ checklist, prompt templates, output handling). Essentials:
255
256
  writes (branch/add/commit/stash/reset/rewrite) with the orchestrator, and tell `agy` in the prompt
256
257
  to return findings only. Add `-- --sandbox` when delegating anything that could trigger
257
258
  terminal/tool work; opt into `-- --add-dir . --dangerously-skip-permissions` only for a flow that
258
- genuinely needs writes, then review the diff afterwards (such a run also carries `TYPESAFE_API_KEY`,
259
- when set, into an agy whose network and file tool are unconfined).
259
+ genuinely needs writes, then review the diff afterwards (such a run also carries the passed variables
260
+ its service-facts.txt lists, as given, into an agy whose network and file tool are unconfined).
260
261
 
261
262
  ## Complementary skills (optional, standalone-first)
262
263
 
@@ -3,25 +3,26 @@
3
3
  // opt-in stays admitted. A recording stub stands in front of the harness fake agy.
4
4
  import { describe, it, after } from 'node:test';
5
5
  import assert from 'node:assert/strict';
6
- import { writeFileSync, readFileSync, existsSync, rmSync } from 'node:fs';
6
+ import { writeFileSync, readFileSync, existsSync, rmSync, cpSync, symlinkSync } from 'node:fs';
7
7
  import { join, dirname } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { spawnSync } from 'node:child_process';
10
10
  import { makeSandbox, farmFor, FAKE_AGY } from './agy-review-harness.test.mjs';
11
+ const stripGitLocationEnv = (env) => Object.fromEntries(Object.entries(env).filter(([key]) => !/^[Gg][Ii][Tt]_/.test(key)));
11
12
 
12
13
  const HERE = dirname(fileURLToPath(import.meta.url));
13
14
  const REVIEW = join(HERE, 'agy-review.sh');
14
15
  const AGY_RUN = join(HERE, 'agy.sh');
15
- const LIMIT = `jev: TYPESAFE_API_KEY passed; a headless agy runs the Jev request only where your agy permissions allow commands ${String.fromCharCode(0x2014)} the first denied command ends the run`;
16
+ const LIMIT = `passed variables: TYPESAFE_API_KEY; a headless agy runs a request that uses them only where your agy permissions allow commands ${String.fromCharCode(0x2014)} the first denied command ends the run`;
16
17
  const KEYS = { TYPESAFE_API_KEY: 'jev-key', ANTIGRAVITY_API_KEY: 'a', GEMINI_API_KEY: 'g', GOOGLE_API_KEY: 'o', GOOGLE_GENAI_API_KEY: 'n', FOO_API_KEY: 'foo' };
17
- const PASSED = 'key=[jev-key] google=unset,unset,unset,unset foo=unset';
18
+ const PASSED = 'key=[jev-key] google=unset,unset,unset,unset foo=unset bar=unset';
18
19
 
19
20
  // Every spawn of agy appends its kind and the key states; a run also says so on stderr before the fake answers.
20
21
  const RECORDER = [
21
22
  '#!/usr/bin/env bash',
22
23
  'st() { if [[ -n "${!1+x}" ]]; then printf "[%s]" "${!1}"; else printf unset; fi; }',
23
24
  'case "${1:-}" in --help|-h) kind=help ;; --version) kind=version ;; models) kind=models ;; *) kind=run; echo STUB-DISPATCH >&2 ;; esac',
24
- 'echo "$kind key=$(st TYPESAFE_API_KEY) google=$(st ANTIGRAVITY_API_KEY),$(st GEMINI_API_KEY),$(st GOOGLE_API_KEY),$(st GOOGLE_GENAI_API_KEY) foo=$(st FOO_API_KEY) child=$(st AW_AGY_REVIEW_CHILD)" >>"$AGY_JEV_LOG"',
25
+ 'echo "$kind key=$(st TYPESAFE_API_KEY) google=$(st ANTIGRAVITY_API_KEY),$(st GEMINI_API_KEY),$(st GOOGLE_API_KEY),$(st GOOGLE_GENAI_API_KEY) foo=$(st FOO_API_KEY) bar=$(st BAR_API_KEY) child=$(st AW_AGY_REVIEW_CHILD)" >>"$AGY_JEV_LOG"',
25
26
  'exec "$AGY_JEV_FAKE" "$@"',
26
27
  '',
27
28
  ].join('\n');
@@ -43,9 +44,13 @@ const drive = (sb, wrapper, args, env = {}) => {
43
44
  for (const name of ['jev-log', 'jev-argv']) rmSync(cap(name), { force: true });
44
45
  const r = spawnSync('bash', [wrapper, ...args], {
45
46
  cwd: sb.repo, input: '', encoding: 'utf8', timeout: 60000,
46
- env: { HOME: sb.home, PATH: `${sb.bin}:${farmFor(['agy', 'agy-run'])}`, TMPDIR: process.env.TMPDIR ?? '/tmp',
47
- AGY_JEV_LOG: cap('jev-log'), AGY_JEV_FAKE: cap('agy-fake'), AGY_FAKE_ARGV: cap('jev-argv'), ...env },
47
+ env: { ...stripGitLocationEnv({ PATH: `${sb.bin}:${farmFor(['agy', 'agy-run'])}`, TMPDIR: process.env.TMPDIR ?? '/tmp',
48
+ AGY_JEV_LOG: cap('jev-log'), AGY_JEV_FAKE: cap('agy-fake'), AGY_FAKE_ARGV: cap('jev-argv'), ...env }),
49
+ HOME: sb.home, XDG_CONFIG_HOME: join(sb.home, '.config'), LC_ALL: 'C', GIT_CONFIG_GLOBAL: '/dev/null',
50
+ GIT_CONFIG_SYSTEM: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', GIT_ATTR_NOSYSTEM: '1' },
48
51
  });
52
+ assert.ifError(r.error);
53
+ assert.equal(r.signal, null, r.stderr);
49
54
  const read = (name) => (existsSync(cap(name)) ? readFileSync(cap(name), 'utf8') : '');
50
55
  const spawns = read('jev-log').split('\n').filter(Boolean).map((line) => [line.slice(0, line.indexOf(' ')), line.slice(line.indexOf(' ') + 1)]);
51
56
  return { status: r.status, stdout: r.stdout, stderr: r.stderr, spawns, argv: read('jev-argv').split('\n').slice(0, -1) };
@@ -53,7 +58,7 @@ const drive = (sb, wrapper, args, env = {}) => {
53
58
  const runDirect = (sb, env, extra = []) => drive(sb, AGY_RUN, ['a probe prompt', ...extra], env);
54
59
  const keysOf = (env) => env.split(' child=')[0];
55
60
  const runSpawn = (r) => (r.spawns.find(([kind]) => kind === 'run') ?? [])[1] ?? '';
56
- const limitLines = (r) => r.stderr.split('\n').filter((line) => line.startsWith('jev:'));
61
+ const limitLines = (r) => r.stderr.split('\n').filter((line) => /^(?:jev:|passed variables:)/.test(line));
57
62
 
58
63
  describe('agy-run and agy-review pass the key and unset the rest — spec:jev-every-run/S4', () => {
59
64
  for (const [label, wrapper, args] of [['agy-run', AGY_RUN, ['a probe prompt']], ['agy-review plan', REVIEW, ['plan', 'plan.md']]]) {
@@ -63,9 +68,53 @@ describe('agy-run and agy-review pass the key and unset the rest — spec:jev-ev
63
68
  assert.ok(r.spawns.some(([kind]) => kind === 'run'), 'agy ran');
64
69
  for (const [kind, env] of r.spawns) assert.equal(keysOf(env), PASSED, `${kind} spawn`);
65
70
  });
71
+ it(`${label}: the facts read leaves the user's exported HOST to every spawn of agy`, () => {
72
+ const sb = sandbox();
73
+ writeFileSync(join(sb.bin, 'agy'), RECORDER.replace('child=$(st AW_AGY_REVIEW_CHILD)', '$& host=$(st HOST)'), { mode: 0o755 });
74
+ const r = drive(sb, wrapper, args, { HOST: 'user-box' });
75
+ assert.equal(r.status, 0, r.stderr);
76
+ assert.ok(r.spawns.length > 0, 'agy ran');
77
+ for (const [kind, env] of r.spawns) assert.match(env, / host=\[user-box\]$/, `${kind} spawn`);
78
+ });
66
79
  }
67
80
  });
68
81
 
82
+ const copyBridge = (sb) => {
83
+ const directory = join(sb.home, 'bridge');
84
+ cpSync(HERE, join(directory, 'bin'), { recursive: true });
85
+ cpSync(join(HERE, '..', 'capability.json'), join(directory, 'capability.json'));
86
+ const lines = readFileSync(join(HERE, '..', 'service-facts.txt'), 'utf8').trimEnd().split('\n');
87
+ writeFileSync(join(directory, 'service-facts.txt'), [lines[0], 'HOST=a.example', 'HOST=b.example', 'RUN_HOST=a.example', 'RUN_HOST=b.example', lines.find((line) => line.startsWith('WRITABLE_DIR=')), 'PASSED_VARIABLE=FOO_API_KEY', 'PASSED_VARIABLE=BAR_API_KEY', ''].join('\n'));
88
+ for (const name of ['agy.sh', 'agy-review.sh']) symlinkSync(name, join(directory, 'bin', `linked-${name}`));
89
+ return directory;
90
+ };
91
+ describe('injected facts through symlinks — spec:jev-every-run/S26', () => {
92
+ it('agy-run passes FOO_API_KEY and empty BAR_API_KEY and names only the non-empty passed variable', () => {
93
+ const sb = sandbox();
94
+ const directory = copyBridge(sb);
95
+ const result = drive(sb, join(directory, 'bin', 'linked-agy.sh'), ['a probe prompt'], { ...KEYS, BAR_API_KEY: '' });
96
+ assert.equal(result.status, 0, result.stderr);
97
+ assert.ok(result.spawns.some(([kind]) => kind === 'run'), result.stderr);
98
+ for (const [kind, keys] of result.spawns) assert.equal(keysOf(keys), 'key=unset google=unset,unset,unset,unset foo=[foo] bar=[]', kind);
99
+ const expected = LIMIT.replace('TYPESAFE_API_KEY', 'FOO_API_KEY');
100
+ assert.deepEqual(limitLines(result), [expected]);
101
+ assert.ok(result.stderr.indexOf(expected) < result.stderr.indexOf('STUB-DISPATCH'), result.stderr);
102
+ });
103
+ it('agy-review runs its copied sibling with the same keys, ignoring a foreign agy-run on PATH and printing no limit', () => {
104
+ const sb = sandbox();
105
+ const directory = copyBridge(sb);
106
+ const sentinel = join(sb.home, 'foreign-invoked');
107
+ writeFileSync(join(sb.bin, 'agy-run'), `#!/usr/bin/env bash\nprintf invoked > '${sentinel}'\nexit 0\n`, { mode: 0o755 });
108
+ const result = drive(sb, join(directory, 'bin', 'linked-agy-review.sh'), ['plan', 'plan.md'], { ...KEYS, BAR_API_KEY: '' });
109
+ assert.equal(existsSync(sentinel), false, result.stderr);
110
+ assert.equal(result.status, 0, result.stderr);
111
+ assert.ok(result.spawns.some(([kind]) => kind === 'run'), result.stderr);
112
+ assert.equal(runSpawn(result), 'key=unset google=unset,unset,unset,unset foo=[foo] bar=[] child=[1]');
113
+ for (const [kind, keys] of result.spawns) assert.equal(keysOf(keys), 'key=unset google=unset,unset,unset,unset foo=[foo] bar=[]', kind);
114
+ assert.deepEqual(limitLines(result), []);
115
+ });
116
+ });
117
+
69
118
  describe('the agy half of S5: an empty key and an unset key on agy-run', () => {
70
119
  it('an empty TYPESAFE_API_KEY reaches agy empty, an unset one stays unset, and the argv is the same with the key set', () => {
71
120
  const runs = ['jev-key', '', undefined].map((value) => runDirect(sandbox(), { TYPESAFE_API_KEY: value }));
@@ -54,6 +54,76 @@
54
54
  # disagreeing flag+env pair refuses pre-spend)
55
55
  set -euo pipefail
56
56
 
57
+ aw_script_dir() {
58
+ local src="${BASH_SOURCE[0]}" dir hops=0 max_hops=16
59
+ while :; do
60
+ case "$src" in */*) dir="${src%/*}"; dir="${dir:-/}" ;; *) dir=. ;; esac
61
+ dir="$(CDPATH= builtin cd -P -- "$dir" 2>/dev/null && builtin pwd -P)" || break
62
+ [[ -L "$src" ]] || { printf '%s\n' "$dir"; return 0; }
63
+ if (( hops >= max_hops )); then
64
+ printf 'error: exceeded %s symlink hops; could not resolve its OWN directory\n' "$max_hops" >&2
65
+ return 127
66
+ fi
67
+ hops=$((hops + 1))
68
+ src="$(command readlink -- "$src" 2>/dev/null)" || break
69
+ case "$src" in /*) ;; *) src="$dir/$src" ;; esac
70
+ done
71
+ printf 'error: could not resolve its OWN directory\n' >&2
72
+ return 127
73
+ }
74
+ aw_read_service_facts() {
75
+ local path="${1%/*}/service-facts.txt" line key value entry number=0 bad=0 valid seen=() run_lines=()
76
+ local host_re='^(\*\.)?[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?(\.[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?)+$'
77
+ local variable_re='^[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*$'
78
+ local command_re='^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-]* \*$'
79
+ local env directory segments LC_ALL=C
80
+ AW_FACT_HOST=() AW_FACT_RUN_HOST=() AW_FACT_PASSED_VARIABLE=()
81
+ if [[ -f "$path" && -r "$path" ]]; then
82
+ while IFS= read -r line; do
83
+ number=$((number + 1)); valid=1
84
+ if (( number == 1 )); then
85
+ [[ "$line" == "# generated from the kit's service fragments (agent-workflow-kit/tools/services/); do not edit" ]] || bad=1
86
+ continue
87
+ fi
88
+ key="${line%%=*}"; value="${line#*=}"
89
+ [[ "$line" == *=* ]] || valid=0
90
+ case "$key" in
91
+ HOST|RUN_HOST) [[ "$value" =~ $host_re ]] || valid=0
92
+ if [[ "$key" == RUN_HOST && "$value" == '*.'* ]]; then valid=0; fi ;;
93
+ PASSED_VARIABLE) [[ "$value" =~ $variable_re && "$value" != OPENAI_BASE_URL ]] || valid=0 ;;
94
+ EXCLUDED_COMMAND) [[ "$value" =~ $command_re ]] || valid=0 ;;
95
+ WRITABLE_DIR)
96
+ env="${value%%:*}"; directory="${value#*:}"; segments="/${directory//\\//}/"
97
+ [[ "$value" == *:* && ( -z "$env" || "$env" =~ $variable_re ) &&
98
+ ( "$directory" == '~/'* || "$directory" == /* ) && "$directory" != */ &&
99
+ "$directory" != *[\*\?\[\]]* && ! "$directory" =~ [[:cntrl:]] && "$segments" != */../* ]] || valid=0 ;;
100
+ *) valid=0 ;;
101
+ esac
102
+ for entry in ${seen[@]+"${seen[@]}"}; do [[ "$entry" != "$line" ]] || valid=0; done
103
+ if (( ! valid )); then (( bad )) || bad=$number; continue; fi
104
+ seen+=("$line")
105
+ case "$key" in
106
+ HOST) AW_FACT_HOST+=("$value") ;; RUN_HOST) AW_FACT_RUN_HOST+=("$value"); run_lines+=("$number") ;;
107
+ PASSED_VARIABLE) AW_FACT_PASSED_VARIABLE+=("$value") ;;
108
+ esac
109
+ done <"$path"
110
+ if (( ! number )); then bad=1; fi
111
+ if [[ -n "$line" ]] && (( ! bad )); then bad=$((number + 1)); fi
112
+ for ((number=0; number<${#AW_FACT_RUN_HOST[@]}; number++)); do
113
+ valid=0
114
+ for entry in ${AW_FACT_HOST[@]+"${AW_FACT_HOST[@]}"}; do [[ "$entry" != "${AW_FACT_RUN_HOST[number]}" ]] || valid=1; done
115
+ if (( ! valid && (! bad || run_lines[number] < bad) )); then bad=${run_lines[number]}; fi
116
+ done
117
+ (( bad )) || return 0
118
+ printf 'error: %s: invalid facts at line %s; remove whatever is at that path and run /agent-workflow-kit upgrade to write it again\n' "$path" "$bad" >&2
119
+ else
120
+ printf 'error: %s: not a readable regular file; remove whatever is at that path and run /agent-workflow-kit upgrade to write it again\n' "$path" >&2
121
+ fi
122
+ exit 127
123
+ }
124
+ HERE="$(aw_script_dir)" || exit 127
125
+ aw_read_service_facts "$HERE"
126
+
57
127
  # --- --help / -h (pre-preflight: no agy, no login, no git tree needed) ---------
58
128
  # Keyed ONLY on the FIRST argument — never a scan of all args (uniform rule across
59
129
  # the four wrappers). Drift-guarded against capability.json roles.review.contract.
@@ -373,15 +443,15 @@ aw_resolve_timeout_bin() {
373
443
  printf '%s' "$bin"
374
444
  }
375
445
  aw_scrub_billing_keys() {
376
- # The one key rule (spec jev-every-run): OPENAI_BASE_URL and every *_API_KEY are unset, so a stray key can never
377
- # switch a run to paid billing; TYPESAFE_API_KEY is neither read nor set, so it reaches the CLI exactly as given.
378
- local name
446
+ local name passed keep
379
447
  unset OPENAI_BASE_URL 2>/dev/null || true
380
448
  for name in $(compgen -v); do
381
- case "$name" in
382
- TYPESAFE_API_KEY) ;;
383
- *_API_KEY) unset "$name" 2>/dev/null || true ;;
384
- esac
449
+ [[ "$name" == *_API_KEY ]] || continue
450
+ keep=0
451
+ for passed in ${AW_FACT_PASSED_VARIABLE[@]+"${AW_FACT_PASSED_VARIABLE[@]}"}; do
452
+ [[ "$name" != "$passed" ]] || keep=1
453
+ done
454
+ if (( ! keep )); then unset "$name" 2>/dev/null || true; fi
385
455
  done
386
456
  return 0
387
457
  }
@@ -389,7 +459,7 @@ aw_scrub_billing_keys() {
389
459
  # Review-receipt identity (AD-038). AW_BRIDGE_VERSION mirrors this bridge's SKILL.md/capability.json
390
460
  # version (drift-guarded by agy-review.test.mjs against capability.json).
391
461
  AW_RECEIPT_BACKEND="agy"
392
- AW_BRIDGE_VERSION="7.1.0" # aw-version-anchor
462
+ AW_BRIDGE_VERSION="8.0.0" # aw-version-anchor
393
463
  # D5 control-byte screen — IMMEDIATELY after resolution, BEFORE any interpolation can echo raw
394
464
  # newline/ESC bytes into stderr/the terminal (round-2 fold).
395
465
  if [[ "$AGY_MODEL" == *[$'\x01'-$'\x1f'$'\x7f']* ]]; then
@@ -513,41 +583,6 @@ FED_ECHO_MAX_BYTES=200
513
583
  # address nobody requested and FAILS the proof, rather than vanishing from the check entirely.
514
584
  FED_PROOF_ADDRESS_MAX=1000000000
515
585
 
516
- # This wrapper's REAL directory, symlinks RESOLVED. The managed install puts a symlink on PATH
517
- # (~/.local/bin/agy-review -> <placed skill>/bin/agy-review.sh), so an unresolved BASH_SOURCE names
518
- # the LINK's directory — and every sibling payload below, the envelope reader most of all, would be
519
- # looked for beside the link instead of beside the script. `readlink -f` is GNU-only (macOS ships
520
- # BSD readlink), so the chain is walked by hand; `cd -P` resolves a symlinked directory too.
521
- # The walk is HOP-BOUNDED with a loud refusal, never an unbounded loop. A symlink CYCLE cannot be
522
- # reached by construction — the kernel already resolved this path to exec the script and would have
523
- # failed with ELOOP — but it becomes reachable if a link is rewritten in the window between exec and
524
- # this walk, and an unbounded `while` would then spin until something killed it. Past the bound the
525
- # wrapper refuses BY NAME rather than guessing at a directory: a wrong answer here sends every
526
- # sibling lookup somewhere arbitrary. 16 is far above any managed install (which uses ONE hop) and
527
- # below the kernel's own chain limit, so it never truncates a real chain.
528
- AW_SCRIPT_LINK_MAX_HOPS=16
529
- aw_script_dir() {
530
- local src="${BASH_SOURCE[0]}" dir hops=0
531
- while [[ -L "$src" ]]; do
532
- if (( hops >= AW_SCRIPT_LINK_MAX_HOPS )); then
533
- echo "error: resolving this wrapper's own path exceeded ${AW_SCRIPT_LINK_MAX_HOPS} symlink hops at" >&2
534
- echo " '$src' — a symlink cycle, or an absurd chain." >&2
535
- return 1
536
- fi
537
- hops=$(( hops + 1 ))
538
- dir="$(cd -P "$(dirname "$src")" && pwd)" || return 1
539
- src="$(readlink "$src")" || return 1
540
- case "$src" in /*) ;; *) src="$dir/$src" ;; esac
541
- done
542
- ( cd -P "$(dirname "$src")" && pwd )
543
- }
544
- if ! HERE="$(aw_script_dir)"; then
545
- echo "error: this wrapper could not resolve its OWN directory, so the sibling payload every review" >&2
546
- echo " depends on cannot be located. Refusing before anything is spent — repair the link, or" >&2
547
- echo " invoke the real script path." >&2
548
- exit 127
549
- fi
550
-
551
586
  # --- The dispatch transport (AGY-1.1.13, Decision 1) ---------------------------
552
587
  # EVERY review dispatch runs `--output-format json`: the CLI then answers with ONE envelope whose
553
588
  # `response` carries the model's Markdown VERBATIM, so the wrapper reads a NAMED FIELD instead of
@@ -597,23 +632,7 @@ if [[ -z "$aw_review_timeout_bin" ]]; then
597
632
  exit 127
598
633
  fi
599
634
  export AGY_REQUIRE_TIMEOUT_BIN=1
600
- # Delegate execution to agy-run (the single home of the timeout + subscription + byte-ceiling guards);
601
- # fall back to the sibling agy.sh on a fresh checkout / hermetic test where agy-run is not yet linked.
602
- if command -v agy-run >/dev/null 2>&1; then
603
- AGY_RUN="agy-run"
604
- else
605
- AGY_RUN="$HERE/agy.sh"
606
- fi
607
- # The seam is a guarantee only when the RESOLVED child honors it: a stale installed agy-run that
608
- # never reads AGY_REQUIRE_TIMEOUT_BIN would keep its uncapped lane past the parent preflight —
609
- # refuse loudly and name the refresh recovery instead of dispatching on a hope.
610
- aw_child_path="$(command -v "$AGY_RUN" 2>/dev/null || printf '%s' "$AGY_RUN")"
611
- if ! grep -q "AGY_REQUIRE_TIMEOUT_BIN" "$aw_child_path" 2>/dev/null; then
612
- echo "error: the resolved agy-run child ($aw_child_path) does not honor the AGY_REQUIRE_TIMEOUT_BIN seam —" >&2
613
- echo " a stale bridge install could run uncapped past the parent preflight. Refresh the placed" >&2
614
- echo " bridges (/agent-workflow-kit setup --refresh-placed), then re-run." >&2
615
- exit 127
616
- fi
635
+ AGY_RUN="$HERE/agy.sh"
617
636
 
618
637
  # --- Pre-spend capability door (AGY-1.1.13, Decision 2) ------------------------
619
638
  # This wrapper drives the CLI in `--output-format json`, passes --disable-slash-commands, and reads
@@ -774,8 +793,7 @@ aw_agy_catalog_check() {
774
793
  }
775
794
  export AW_AGY_CATALOG_READ=1
776
795
  # Every child agy-run is this review's (spec jev-every-run): its prompts forbid every tool, so a review whose model
777
- # obeys them sends no request to api.typesafe.ai (an advisory prohibition, not a sandbox), and the child prints no
778
- # TYPESAFE_API_KEY limit line.
796
+ # obeys them sends no request (an advisory prohibition, not a sandbox), and the child prints no limit line.
779
797
  export AW_AGY_REVIEW_CHILD=1
780
798
  if [[ -n "$AGY_MODEL" ]]; then aw_agy_catalog_check "$aw_review_timeout_bin" "$DEFAULT_AGY_REVIEW_MODEL"; fi
781
799
  if [[ "$AGY_MODEL" != "$HOST_AGY_MODEL" && "$AGY_PROBE" != "1" ]]; then
@@ -2834,27 +2834,6 @@ describe('agy-review.sh — dispatch-posture labeling (D5)', { concurrency: 2 },
2834
2834
  assert.match(r.stderr, /control/i);
2835
2835
  });
2836
2836
 
2837
- // The two-stage cap guarantee: the parent preflight fails closed, and the seam
2838
- // (AGY_REQUIRE_TIMEOUT_BIN=1) makes the CHILD's missing-binary lane refuse too — but only a
2839
- // child that HONORS the seam. A stale installed agy-run that never reads it could run uncapped
2840
- // past the parent preflight, so the parent verifies the resolved child carries the seam token
2841
- // and refuses loudly naming the refresh recovery otherwise.
2842
- it('a STALE agy-run child that does not honor the timeout seam refuses fail-closed (never a silently uncapped dispatch)', async () => {
2843
- const sb = makeSandbox();
2844
- const staleDir = join(sb.home, 'stale-bin');
2845
- mkdirSync(staleDir, { recursive: true });
2846
- writeFileSync(join(staleDir, 'agy-run'), '#!/usr/bin/env bash\nprintf "FAKE_AGY_REVIEW_OUTPUT\\n### Verdict\\nSHIP\\n"\n', { mode: 0o755 });
2847
- const r = await run(sb, {
2848
- args: ['code', '--facts', 'a tiny fact'],
2849
- env: { PATH: `${staleDir}:${sb.bin}:${farmFor(['agy-run'])}` },
2850
- });
2851
- const receipts = readReceipts(sb.repo);
2852
- rmSync(sb.home, { recursive: true, force: true });
2853
- assert.equal(r.status, 127, 'a seam-blind child is a stale bridge install — refuse, never dispatch uncapped');
2854
- assert.match(r.stderr, /does not honor the AGY_REQUIRE_TIMEOUT_BIN seam/);
2855
- assert.equal(receipts.length, 0, 'no dispatch, no receipt');
2856
- });
2857
-
2858
2837
  // Flow-orchestration Phase 4.2 (#26): the uncapped lane is CLOSED — without a capping binary the
2859
2838
  // preflight refuses by name BEFORE any CLI run (the pre-fix wrapper printed timeout=uncapped and
2860
2839
  // ran anyway). The shadow-proof resolver discipline now surfaces as the REFUSAL, not a banner.