@sabaiway/agent-workflow-kit 1.6.0 → 1.8.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.
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: antigravity-cli-bridge
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 no-JSON headless behaviour.
4
+ metadata:
5
+ version: '1.0.0'
6
+ ---
7
+
8
+ # antigravity-cli-bridge
9
+
10
+ Bridges the main agent to **Antigravity CLI** (`agy`), Google's successor to Gemini CLI. As of
11
+ 2026-06-18 the old Gemini CLI stopped serving Google AI Pro / Ultra / free tiers; terminal access to
12
+ Google's models moved to `agy`. This is a **delegated-execution backend** beside Codex: the main
13
+ agent stays the orchestrator — owning decisions, edits, verification, and user-facing claims — and
14
+ hands `agy` a bounded, self-contained sub-task answered from the **subscription** quota (no
15
+ pay-as-you-go billing). `agy` reaches Gemini, Claude, and GPT-OSS through one subscription, so it
16
+ serves as both a cheap probe engine (Flash) and a strong second opinion (Pro / Claude Thinking).
17
+
18
+ ## Overview / when to use
19
+
20
+ Use this skill when the user wants to:
21
+
22
+ - Delegate a focused prompt to `agy` in headless mode.
23
+ - Use Gemini, Claude, or GPT-OSS access available through a Google AI Pro/Ultra subscription.
24
+ - Ask a second model to review a plan, summarise project context, or critique a diff supplied in the
25
+ prompt.
26
+ - Install, authenticate, smoke-test, or troubleshoot `agy`, or understand its models/flags/quota.
27
+
28
+ Do **not** use it to bundle secrets, bypass subscription auth, or hand uncontrolled repository
29
+ mutations to `agy`.
30
+
31
+ ## Install
32
+
33
+ Clean-machine setup is in [`setup/README.md`](setup/README.md). In short: the binary is **`agy`**
34
+ (not `antigravity`), installs to `~/.local/bin/agy`, and must be on `PATH`; expose this skill's
35
+ wrapper [`bin/agy.sh`](bin/agy.sh) on `PATH` as `agy-run`.
36
+
37
+ ## Auth — subscription only (invariant)
38
+
39
+ `agy` authenticates with a cached **OAuth token** from a **Google AI Pro/Ultra** sign-in:
40
+
41
+ ```text
42
+ ~/.gemini/antigravity-cli/antigravity-oauth-token
43
+ ```
44
+
45
+ Never read, print, copy, commit, or package that token — it is personal and is **never bundled** with
46
+ this skill. The wrapper [`bin/agy.sh`](bin/agy.sh) **unsets every `*_API_KEY`** (`ANTIGRAVITY_API_KEY`,
47
+ `GEMINI_API_KEY`, `GOOGLE_API_KEY`, `GOOGLE_GENAI_API_KEY`) before invoking `agy`, so a stray key can
48
+ never silently switch you to pay-as-you-go billing.
49
+
50
+ **Caveat:** the subscription has a finite quota. Prefer the cheapest model that fits the task, and
51
+ keep probes short (see *How the main agent drives agy*).
52
+
53
+ ## Models
54
+
55
+ Pass the **exact display string** to `--model` (or set `AGY_MODEL`). The wrapper defaults to
56
+ `Gemini 3.1 Pro (High)`. Run `agy models` for the live list — if it differs from this table, the live
57
+ list wins.
58
+
59
+ | Model string | Use it for |
60
+ |---|---|
61
+ | `Gemini 3.5 Flash (Low)` | cheapest; reachability checks, smoke tests, simple transforms |
62
+ | `Gemini 3.5 Flash (Medium)` | cheap probes, context-reachability checks, quick summaries |
63
+ | `Gemini 3.5 Flash (High)` | fast drafting / review when a little more effort helps |
64
+ | `Gemini 3.1 Pro (Low)` | cheaper Pro pass for medium reasoning |
65
+ | `Gemini 3.1 Pro (High)` | wrapper default; hard reasoning, plan critique, architecture review |
66
+ | `Claude Sonnet 4.6 (Thinking)` | a Claude second opinion through the same subscription |
67
+ | `Claude Opus 4.6 (Thinking)` | strongest Claude reasoning available via `agy` |
68
+ | `GPT-OSS 120B (Medium)` | an open-weights cross-check / diversity pass |
69
+
70
+ ## Usage
71
+
72
+ Drive `agy` only through the wrapper [`bin/agy.sh`](bin/agy.sh) (installed on `PATH` as `agy-run`):
73
+
74
+ ```bash
75
+ agy-run "your prompt" # prompt as an argument
76
+ echo "your prompt" | agy-run - # prompt from stdin
77
+ agy-run @path/to/prompt.md # prompt from a file
78
+ AGY_MODEL="Claude Opus 4.6 (Thinking)" agy-run "..." # pick a model
79
+ AGY_TIMEOUT=10m agy-run "..." # agy's soft --print-timeout
80
+ AGY_HARD_TIMEOUT=8m agy-run "..." # hard wall-clock cap via timeout(1)
81
+ agy-run "..." -- --add-dir . --dangerously-skip-permissions # passthrough agy flags
82
+ ```
83
+
84
+ `agy` is **headless-only** here (`-p`/`--print`) and there is **no JSON output mode** in v1.0.10 — you
85
+ get plain text. If you need structure, ask for Markdown with explicit headings and validate it
86
+ yourself. Wrapper inputs: first argument is the prompt (`text`, `-` for stdin, or `@file`);
87
+ `AGY_MODEL` (default `Gemini 3.1 Pro (High)`); `AGY_TIMEOUT` → `--print-timeout` (default `5m`);
88
+ `AGY_HARD_TIMEOUT` → hard `timeout(1)` wall-clock cap (default = `AGY_TIMEOUT`); extra `agy` flags
89
+ after `--`. Full detail: [`references/models-and-flags.md`](references/models-and-flags.md).
90
+
91
+ ## Project context (how `agy` sees the repo)
92
+
93
+ From its **current working directory** `agy` reads one root context file by priority, plus
94
+ per-workspace skills:
95
+
96
+ ```text
97
+ .antigravity.md > GEMINI.md > AGENTS.md
98
+ .agents/skills/
99
+ ```
100
+
101
+ So when you run `agy-run` from a project root, `agy` loads the **highest-priority context file that
102
+ exists** — in most repos that is `AGENTS.md`, so its Hard Constraints are available — plus the
103
+ project's `.agents/skills/`, with no wiring needed. **A `.antigravity.md` or `GEMINI.md`, if present,
104
+ shadows `AGENTS.md`** (only the winning file is read), so put cross-cutting rules in whichever file
105
+ wins, or include them in the prompt. Probe results in a real repo confirmed `agy` read the root
106
+ `AGENTS.md` (returning the dialogue language + a Hard Constraint) and cited
107
+ `.agents/skills/<skill>/SKILL.md` by path.
108
+
109
+ **Honest scope:** these probes prove *reachability* — `agy` surfaces the cwd context file and
110
+ per-workspace skills by directory scan. In testing it also **named a project-specific skill without
111
+ being pointed at any file** (auto-discovery), but that is `agy`'s own mechanism, not a guaranteed
112
+ Claude-style description-dispatch engine; don't promise more than the probe shows in a given repo.
113
+ Re-runnable from a project root (use a cheap model):
114
+
115
+ ```bash
116
+ AGY_MODEL="Gemini 3.5 Flash (Low)" agy-run \
117
+ "Read the cwd context file and state the dialogue language plus one Hard Constraint, in two lines."
118
+ AGY_MODEL="Gemini 3.5 Flash (Low)" agy-run \
119
+ "Without me pointing you at any file, name a project-specific skill under .agents/skills/ here and cite its path."
120
+ ```
121
+
122
+ ## How the main agent drives `agy` efficiently
123
+
124
+ See [`references/driving-agy.md`](references/driving-agy.md) for the full playbook (delegation
125
+ checklist, prompt templates, output handling). Essentials:
126
+
127
+ - **Pick the cheapest model that fits.** Flash (Low/Medium) for reachability/probes; Pro (High) for
128
+ reasoning; `Claude Sonnet 4.6 (Thinking)`, `Claude Opus 4.6 (Thinking)`, or `GPT-OSS 120B (Medium)`
129
+ for a different engine's opinion (exact strings — see the Models table) — all on the same
130
+ subscription. Quota is finite, so don't reach for Pro by reflex.
131
+ - **Hand `agy` a self-contained prompt.** It cannot see your conversation — embed the goal,
132
+ constraints, relevant excerpts, and the expected output shape; nothing more.
133
+ - **Continue a thread** with `-- --continue` (most recent) or `-- --conversation <id>` (by id) instead
134
+ of re-sending context.
135
+ - **Treat output as advisory** and verify before acting — check claims against local files, re-run
136
+ tests/linters yourself, reject advice that conflicts with user instructions or repo rules.
137
+ - **Escalations are done by hand, not by `agy`.** The wrapper passes no `--add-dir`, no
138
+ `--dangerously-skip-permissions`, and no `--sandbox` — but that is a **policy boundary you state in
139
+ the prompt, not an enforced sandbox**. Keep repo edits, new dependencies/network installs, and git
140
+ writes (branch/add/commit/stash/reset/rewrite) with the orchestrator, and tell `agy` in the prompt
141
+ to return findings only. Add `-- --sandbox` when delegating anything that could trigger
142
+ terminal/tool work; opt into `-- --add-dir . --dangerously-skip-permissions` only for a flow that
143
+ genuinely needs writes, then review the diff afterwards.
144
+
145
+ ## Complementary skills (optional, standalone-first)
146
+
147
+ `agy-run` works in any directory where `agy` is installed and authenticated. The two skills below are
148
+ **not required** to use `agy` — surface them only when they actually help.
149
+
150
+ - **`agent-workflow-memory`** (family **context provider**) — if the current project has **no**
151
+ `AGENTS.md` + `docs/ai/`, `agy` has no per-workspace context to read. The memory substrate creates
152
+ it. Soft-recommend it (only when the user wants the memory workflow):
153
+ `npx @sabaiway/agent-workflow-memory@latest init`, then `/agent-workflow-memory` in the project — or
154
+ bootstrap the whole family via the **`agent-workflow-kit`** orchestrator
155
+ (`npx @sabaiway/agent-workflow-kit@latest init`), which delegates substrate deployment to memory. Never a
156
+ prerequisite for using `agy`.
157
+ - **`codex-cli-bridge`** (sibling backend, OpenAI Codex) — recommend **by actual presence**: if
158
+ `~/.claude/skills/codex-cli-bridge/` exists you have a **second delegated engine** (Codex for
159
+ sandboxed repo edits with gates; `agy` for subscription-quota Gemini/Claude reasoning). If it is
160
+ **not** installed, treat it as a **planned sibling** — don't assume it exists.
161
+
162
+ ## Known limitations
163
+
164
+ - Subdirectory `CLAUDE.md` files are **not** auto-loaded by `agy` (only the cwd context file +
165
+ `.agents/skills/`). Put cross-cutting rules in the root context file, or include local rules in the
166
+ prompt when they matter.
167
+ - **No JSON output** and **no `agy inspect`** in v1.0.10 — parse text; there is no machine-readable
168
+ introspection.
169
+ - Model names must match the `agy models` display strings **exactly**.
170
+ - **Quota is finite.** Heavy use of Pro/Claude models can exhaust the subscription; prefer Flash for
171
+ cheap work.
172
+ - **A run can't hang forever.** The wrapper caps `agy` with `timeout(1)` (`AGY_HARD_TIMEOUT`,
173
+ default = `AGY_TIMEOUT`) because `agy`'s own `--print-timeout` is **not** a reliable wall-clock
174
+ kill (a run was seen surviving 32 min past a 10m `--print-timeout`). A heavy `--add-dir` agentic
175
+ prompt on the slowest model (`Gemini 3.1 Pro (High)`) can run unbounded — prefer a faster model or
176
+ a **self-contained prompt** (no `--add-dir`); an "exceeded the hard cap" error is the guard firing.
177
+ - `agy` output is plain text and may be incomplete or out of date — treat it as advisory until the
178
+ main agent verifies it.
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env bash
2
+ # Universal, neutral wrapper around Google's Antigravity CLI (`agy`).
3
+ #
4
+ # Antigravity CLI is the successor to Gemini CLI: as of 2026-06-18 the old
5
+ # Gemini CLI stopped serving Google AI Pro / Ultra / free tiers, and access to
6
+ # Google's models from the terminal moved to `agy`. This wrapper is the single
7
+ # entry point so callers never have to remember the flag spelling.
8
+ #
9
+ # Auth: SUBSCRIPTION ONLY. We use the cached OAuth token at
10
+ # ~/.gemini/antigravity-cli/antigravity-oauth-token (Google AI Pro) and the
11
+ # quota that comes with it. To make that guarantee hard, the wrapper unsets any
12
+ # API-key env var so a stray key can never silently switch us to paid
13
+ # pay-as-you-go billing.
14
+ #
15
+ # This is a THIN, FLOW-AGNOSTIC wrapper on purpose: it just runs one headless
16
+ # prompt and prints the text response. It does NOT encode any orchestration
17
+ # policy (no plan contract, no auto-approve, no workspace edits) — that is left
18
+ # to whatever flow we design later, which can opt in via passthrough flags.
19
+ #
20
+ # Models (pass the exact display string from `agy models`, or set AGY_MODEL):
21
+ # Gemini 3.5 Flash (Low|Medium|High), Gemini 3.1 Pro (Low|High),
22
+ # Claude Sonnet 4.6 (Thinking), Claude Opus 4.6 (Thinking), GPT-OSS 120B (Medium)
23
+ #
24
+ # Usage (installed on PATH as `agy-run`):
25
+ # agy-run "your prompt" # prompt as an argument
26
+ # echo "your prompt" | agy-run - # prompt from stdin
27
+ # agy-run @path/to/prompt.md # prompt from a file
28
+ # AGY_MODEL="Claude Opus 4.6 (Thinking)" agy-run "..." # pick a model
29
+ # AGY_TIMEOUT=10m agy-run "..." # override print timeout (agy's soft bound)
30
+ # AGY_HARD_TIMEOUT=8m agy-run "..." # override the hard wall-clock cap (timeout(1))
31
+ # agy-run "..." -- --add-dir . --dangerously-skip-permissions
32
+ # # passthrough agy flags (future flows)
33
+ set -euo pipefail
34
+
35
+ # 1. Make `agy` findable even when ~/.bashrc was not sourced.
36
+ export PATH="$HOME/.local/bin:$PATH"
37
+
38
+ # 2. Force the subscription path: never let an API key hijack billing. Unset EVERY *_API_KEY for the
39
+ # agy subprocess — the explicit Google/Antigravity ones first, then any other *_API_KEY that may
40
+ # have been added later (`compgen` is a bash builtin; the shebang guarantees bash).
41
+ unset ANTIGRAVITY_API_KEY GEMINI_API_KEY GOOGLE_API_KEY GOOGLE_GENAI_API_KEY 2>/dev/null || true
42
+ while IFS= read -r _api_key_var; do
43
+ unset "$_api_key_var" 2>/dev/null || true
44
+ done < <(compgen -v 2>/dev/null | grep '_API_KEY$' || true)
45
+
46
+ if ! command -v agy >/dev/null 2>&1; then
47
+ echo "error: 'agy' (Antigravity CLI) not found on PATH. Install it and run 'agy' once to sign in." >&2
48
+ exit 127
49
+ fi
50
+
51
+ # `-` (empty) => skip --model and let agy use settings.json; default to Pro.
52
+ AGY_MODEL="${AGY_MODEL-Gemini 3.1 Pro (High)}"
53
+ AGY_TIMEOUT="${AGY_TIMEOUT:-5m}"
54
+ # Hard wall-clock cap (defaults to AGY_TIMEOUT). agy's own --print-timeout is NOT a reliable
55
+ # wall-clock kill — a run was observed surviving 32 min past a 10m --print-timeout — so we also wrap
56
+ # agy in timeout(1). A heavy `--add-dir` agentic prompt on the slowest model can otherwise run
57
+ # unbounded, and once a caller backgrounds it nothing kills it. Raise only for a known-healthy run.
58
+ AGY_HARD_TIMEOUT="${AGY_HARD_TIMEOUT:-$AGY_TIMEOUT}"
59
+
60
+ if [[ $# -lt 1 ]]; then
61
+ echo "usage: $0 <prompt | - | @file> [-- extra agy flags...]" >&2
62
+ exit 2
63
+ fi
64
+
65
+ prompt_src="$1"; shift
66
+
67
+ # Split off any passthrough flags after a literal `--`. Extra args WITHOUT the `--` separator are a
68
+ # mistake — they would be silently dropped, so fail loudly instead (no silent failures).
69
+ passthrough=()
70
+ if [[ $# -gt 0 ]]; then
71
+ if [[ "$1" == "--" ]]; then
72
+ shift
73
+ passthrough=("$@")
74
+ else
75
+ echo "error: unexpected argument '$1'. Pass extra agy flags after a literal '--':" >&2
76
+ echo " $0 <prompt | - | @file> -- <agy flags...>" >&2
77
+ exit 2
78
+ fi
79
+ fi
80
+
81
+ if [[ "$prompt_src" == "-" ]]; then
82
+ prompt="$(cat)"
83
+ elif [[ "${prompt_src:0:1}" == "@" ]]; then
84
+ file="${prompt_src:1}"
85
+ if [[ ! -f "$file" ]]; then
86
+ echo "error: prompt file '$file' not found" >&2
87
+ exit 2
88
+ fi
89
+ prompt="$(cat "$file")"
90
+ else
91
+ prompt="$prompt_src"
92
+ fi
93
+
94
+ if [[ -z "${prompt// }" ]]; then
95
+ echo "error: empty prompt" >&2
96
+ exit 2
97
+ fi
98
+
99
+ model_flag=()
100
+ if [[ -n "$AGY_MODEL" ]]; then
101
+ model_flag=(--model "$AGY_MODEL")
102
+ fi
103
+
104
+ agy_cmd=(agy "${model_flag[@]}" --print-timeout "$AGY_TIMEOUT" "${passthrough[@]}" -p "$prompt")
105
+
106
+ # Hard wall-clock cap via timeout(1) (GNU `timeout` on Linux, `gtimeout` from coreutils on macOS).
107
+ # This is the real guard — a backgrounded, hung agy survives its own --print-timeout otherwise.
108
+ timeout_bin=""
109
+ if command -v timeout >/dev/null 2>&1; then
110
+ timeout_bin="timeout"
111
+ elif command -v gtimeout >/dev/null 2>&1; then
112
+ timeout_bin="gtimeout"
113
+ fi
114
+
115
+ if [[ -z "$timeout_bin" ]]; then
116
+ echo "warning: no 'timeout'/'gtimeout' on PATH — running agy WITHOUT a hard wall-clock cap" >&2
117
+ echo " (install coreutils to enable AGY_HARD_TIMEOUT=$AGY_HARD_TIMEOUT)." >&2
118
+ exec "${agy_cmd[@]}"
119
+ fi
120
+
121
+ # --kill-after: if agy ignores the initial TERM, SIGKILL it 10s later. Capture rc (don't `exec`) so
122
+ # we can turn a timeout into an explicit, actionable error instead of a silent non-zero.
123
+ set +e
124
+ "$timeout_bin" --kill-after=10s "$AGY_HARD_TIMEOUT" "${agy_cmd[@]}"
125
+ rc=$?
126
+ set -e
127
+ if [[ $rc -eq 124 || $rc -eq 137 ]]; then
128
+ echo "error: agy exceeded the hard cap AGY_HARD_TIMEOUT=$AGY_HARD_TIMEOUT and was terminated." >&2
129
+ echo " This usually means a heavy '--add-dir' agentic run, or the slowest model looping." >&2
130
+ echo " Retry with a faster model (e.g. AGY_MODEL='Gemini 3.5 Flash (High)') or a" >&2
131
+ echo " self-contained prompt without --add-dir. Raise AGY_HARD_TIMEOUT only if the run is healthy." >&2
132
+ fi
133
+ exit $rc
@@ -0,0 +1,59 @@
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { mkdtempSync, mkdirSync, writeFileSync, chmodSync, rmSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { join, dirname } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { spawnSync } from 'node:child_process';
8
+
9
+ const HERE = dirname(fileURLToPath(import.meta.url));
10
+ const WRAPPER = join(HERE, 'agy.sh');
11
+
12
+ // Build a sandbox HOME whose ~/.local/bin holds a STUB `agy`. The wrapper prepends
13
+ // "$HOME/.local/bin" to PATH, so it resolves our stub instead of the real binary — no network,
14
+ // no real subscription CLI, fully hermetic.
15
+ const makeSandbox = (stubBody) => {
16
+ const home = mkdtempSync(join(tmpdir(), 'agy-wrapper-test-'));
17
+ const bin = join(home, '.local', 'bin');
18
+ mkdirSync(bin, { recursive: true });
19
+ const stub = join(bin, 'agy');
20
+ writeFileSync(stub, stubBody, { mode: 0o755 });
21
+ chmodSync(stub, 0o755);
22
+ return home;
23
+ };
24
+
25
+ const runWrapper = (home, env, prompt = 'hello') =>
26
+ spawnSync('bash', [WRAPPER, prompt], {
27
+ env: { HOME: home, PATH: `${join(home, '.local', 'bin')}:${process.env.PATH}`, ...env },
28
+ encoding: 'utf8',
29
+ timeout: 20000,
30
+ });
31
+
32
+ describe('agy.sh — hard wall-clock cap (timeout(1))', () => {
33
+ it('kills a hung agy at AGY_HARD_TIMEOUT and reports it (non-zero + actionable guidance)', () => {
34
+ const home = makeSandbox('#!/usr/bin/env bash\nsleep 30\n');
35
+ const started = Date.now();
36
+ const r = runWrapper(home, { AGY_HARD_TIMEOUT: '2s', AGY_TIMEOUT: '2s', AGY_MODEL: '' });
37
+ const elapsed = Date.now() - started;
38
+ rmSync(home, { recursive: true, force: true });
39
+ assert.ok(elapsed < 13000, `wrapper must return well under the kill-after window, took ${elapsed}ms`);
40
+ assert.notEqual(r.status, 0, 'a timed-out run must exit non-zero');
41
+ assert.match(r.stderr, /exceeded the hard cap/, 'must explain the hard-cap kill');
42
+ });
43
+
44
+ it('passes a fast agy run through unchanged (exit 0, stdout preserved)', () => {
45
+ const home = makeSandbox('#!/usr/bin/env bash\necho "OK reply"\nexit 0\n');
46
+ const r = runWrapper(home, { AGY_HARD_TIMEOUT: '10s', AGY_TIMEOUT: '10s', AGY_MODEL: '' });
47
+ rmSync(home, { recursive: true, force: true });
48
+ assert.equal(r.status, 0, `expected clean exit, got ${r.status}; stderr=${r.stderr}`);
49
+ assert.match(r.stdout, /OK reply/);
50
+ });
51
+
52
+ it('propagates a non-timeout agy failure code verbatim (no false hard-cap message)', () => {
53
+ const home = makeSandbox('#!/usr/bin/env bash\necho "boom" >&2\nexit 3\n');
54
+ const r = runWrapper(home, { AGY_HARD_TIMEOUT: '10s', AGY_TIMEOUT: '10s', AGY_MODEL: '' });
55
+ rmSync(home, { recursive: true, force: true });
56
+ assert.equal(r.status, 3, 'a genuine agy failure code must pass through');
57
+ assert.doesNotMatch(r.stderr, /exceeded the hard cap/, 'must not mislabel a non-timeout failure');
58
+ });
59
+ });
@@ -0,0 +1,22 @@
1
+ {
2
+ "family": "agent-workflow",
3
+ "schema": 1,
4
+ "name": "antigravity-cli-bridge",
5
+ "kind": "execution-backend",
6
+ "version": "1.0.0",
7
+ "provides": ["review", "probe"],
8
+ "roles": {
9
+ "review": { "cmd": "agy-run", "source": "bin/agy.sh", "template": "references/review-prompt.md", "output": "advisory" },
10
+ "probe": { "cmd": "agy-run", "source": "bin/agy.sh", "output": "advisory" }
11
+ },
12
+ "detect": {
13
+ "installed": {
14
+ "env": "ANTIGRAVITY_CLI_BRIDGE_DIR",
15
+ "default": "~/.claude/skills/antigravity-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,108 @@
1
+ # How the main agent drives `agy`
2
+
3
+ `agy` is a **delegated-execution backend**: the main agent stays the orchestrator and hands `agy` a
4
+ bounded, self-contained sub-task. `agy` answers from the **subscription** quota, so the goal is
5
+ maximum useful output per token of that quota. Treat its output as **advisory** — the main agent owns
6
+ edits, verification, and final judgment.
7
+
8
+ ## Delegation checklist
9
+
10
+ 1. Pick the narrowest useful question.
11
+ 2. Choose the cheapest model that can answer it.
12
+ 3. Include only the relevant excerpts, paths, constraints, and the expected output shape.
13
+ 4. State permission boundaries in the prompt (no edits, no git writes).
14
+ 5. Run `agy-run` headlessly.
15
+ 6. Treat the response as advisory and verify before acting.
16
+
17
+ ## Model selection
18
+
19
+ | Task | Model |
20
+ |---|---|
21
+ | Reachability / smoke / "is it wired?" | `Gemini 3.5 Flash (Low)` |
22
+ | Cheap probes, summaries | `Gemini 3.5 Flash (Medium)` |
23
+ | Quick review with a little more effort | `Gemini 3.5 Flash (High)` |
24
+ | Reasoning, plan critique, careful drafting | `Gemini 3.1 Pro (High)` (wrapper default) |
25
+ | Same reasoning, lower quota cost | `Gemini 3.1 Pro (Low)` |
26
+ | A different engine's opinion | `Claude Sonnet 4.6 (Thinking)`, `Claude Opus 4.6 (Thinking)`, or `GPT-OSS 120B (Medium)` |
27
+
28
+ Don't reach for Pro by reflex — Flash answers most reachability/probe questions for a fraction of the
29
+ quota.
30
+
31
+ ## Quota economy
32
+
33
+ Subscription quota is finite. Prefer:
34
+
35
+ - A short probe on Flash before a large Pro run.
36
+ - One sharp question over broad "review everything" prompts.
37
+ - Prompt files with trimmed excerpts instead of whole repositories.
38
+ - `AGY_TIMEOUT=2m` for probes, longer timeouts only for deep reviews.
39
+ - Reusing a conversation with `--continue` when the context is already loaded.
40
+
41
+ ## Continue vs. fresh
42
+
43
+ ```bash
44
+ # Continue the most recent conversation (cheaper than re-sending context):
45
+ agy-run "Given your previous review, list only the top three risks." -- --continue
46
+
47
+ # Resume a specific conversation by id:
48
+ agy-run "Continue from the prior architecture critique; focus on test gaps." -- --conversation <id>
49
+ ```
50
+
51
+ Use conversation state only when it saves quota or preserves useful context. For auditable decisions,
52
+ prefer self-contained prompts.
53
+
54
+ ## Escalation policy (edits, network, git)
55
+
56
+ The wrapper passes no `--add-dir`, no `--dangerously-skip-permissions`, and no `--sandbox`. Treat this
57
+ as a **policy boundary you enforce in the prompt, not an enforced sandbox** — so prompt `agy` as a
58
+ read-only reviewer, and reach for `-- --sandbox` for anything that might trigger terminal/tool work:
59
+
60
+ ```text
61
+ Do not edit files. Do not run git write commands. Do not branch, add, commit, stash, reset, or
62
+ rewrite history. Return findings and suggested changes only.
63
+ ```
64
+
65
+ - **Repo edits** stay with the orchestrator. If a flow truly needs `agy` to write files, opt in
66
+ explicitly — `agy-run "..." -- --add-dir . --dangerously-skip-permissions` — and review the diff.
67
+ - **New dependencies / network installs** are done by hand, not by `agy`.
68
+ - **Git writes** (branch/commit) are never delegated — the orchestrator commits after review.
69
+ - Prefer `-- --sandbox` for any prompt that might trigger terminal work.
70
+
71
+ ## Project-context prompts
72
+
73
+ Probe reachability from a project root (cheap model):
74
+
75
+ ```bash
76
+ AGY_MODEL="Gemini 3.5 Flash (Low)" agy-run \
77
+ "Read the cwd context file and report the dialogue language plus one Hard Constraint."
78
+ AGY_MODEL="Gemini 3.5 Flash (Low)" agy-run \
79
+ "Without using a file pointer, is there a project-specific planning skill in this repo? Name it and cite its path."
80
+ ```
81
+
82
+ Plan-review prompt shape:
83
+
84
+ ```text
85
+ You are reviewing the plan below from the current repository root.
86
+ Use the root context file and per-workspace skills if they are reachable.
87
+ Do not edit files. Do not run git write commands.
88
+ Return: 1) blocking issues 2) non-blocking risks 3) missing verification 4) a concise recommendation.
89
+ The implementation plan text follows in this same prompt.
90
+ ```
91
+
92
+ Diff/code-review prompt shape (provide the diff as text):
93
+
94
+ ```text
95
+ Review this diff against the stated constraints.
96
+ Focus on bugs, behavioural regressions, missing tests, and violations of the project rules.
97
+ Cite file paths and line hints from the diff where possible. Do not summarise unless there are no findings.
98
+ The project constraints and diff text follow in this same prompt.
99
+ ```
100
+
101
+ ## Handling output
102
+
103
+ `agy` returns plain text. Do not assume it is complete, current, or machine-valid. Before acting:
104
+
105
+ - Check claims against local files or primary sources available to the main agent.
106
+ - Re-run local tests and linters yourself.
107
+ - Reject advice that conflicts with user instructions, repository rules, or security boundaries.
108
+ - Summarise uncertainty clearly when reporting back to the user.
@@ -0,0 +1,93 @@
1
+ # `agy` models & flags (reference)
2
+
3
+ The source of truth is the live binary: `agy --version`, `agy --help`, `agy models`. The tables below
4
+ were captured from **v1.0.10**; if the binary disagrees, the binary wins. The wrapper command is
5
+ `agy-run`, backed by `bin/agy.sh`.
6
+
7
+ ## Headless behaviour
8
+
9
+ Use `-p`, `--print`, or `--prompt` to run one non-interactive prompt and print the text response. The
10
+ wrapper always uses headless `-p`. **There is no JSON output mode in v1.0.10** — ask for Markdown,
11
+ bullets, tables, or fenced blocks when the caller needs structure, then validate the text yourself.
12
+
13
+ ## Wrapper contract
14
+
15
+ ```bash
16
+ agy-run <prompt | - | @file> [-- extra agy flags...]
17
+ ```
18
+
19
+ Inputs:
20
+
21
+ - Prompt text: `agy-run "say OK"`.
22
+ - Stdin: `echo "say OK" | agy-run -`.
23
+ - Prompt file: `agy-run @prompt.md`.
24
+ - Extra `agy` flags after `--`: `agy-run @prompt.md -- --add-dir . --continue`. Extra args **without**
25
+ the `--` separator are rejected with a usage error (they are never silently dropped).
26
+ - A literal prompt that **begins with `@`** is read as a file path. Pass such prompts via stdin
27
+ instead: `printf '%s' '@handle, review this' | agy-run -`.
28
+
29
+ Environment:
30
+
31
+ | Var | Default | Effect |
32
+ |---|---|---|
33
+ | `AGY_MODEL` | `Gemini 3.1 Pro (High)` | model display string; set empty (`AGY_MODEL=`) to drop `--model` and let `agy` use `settings.json` |
34
+ | `AGY_TIMEOUT` | `5m` | value passed to `--print-timeout` |
35
+
36
+ Subscription invariant: the wrapper prepends `$HOME/.local/bin` to `PATH` and clears
37
+ `ANTIGRAVITY_API_KEY` / `GEMINI_API_KEY` / `GOOGLE_API_KEY` / `GOOGLE_GENAI_API_KEY` before execution.
38
+ Auth comes from the user's cached OAuth token, never from bundled credentials.
39
+
40
+ ## Models
41
+
42
+ Pass the **exact display string** from `agy models`, or set `AGY_MODEL`.
43
+
44
+ | Model string | Practical use |
45
+ |---|---|
46
+ | `Gemini 3.5 Flash (Low)` | lowest-cost smoke tests and simple rewrites |
47
+ | `Gemini 3.5 Flash (Medium)` | cheap probes, fast summaries, context-reachability checks |
48
+ | `Gemini 3.5 Flash (High)` | fast review when a little more reasoning effort is useful |
49
+ | `Gemini 3.1 Pro (Low)` | cheaper Pro pass for medium reasoning |
50
+ | `Gemini 3.1 Pro (High)` | wrapper default; hard reasoning, plan critique, architecture review |
51
+ | `Claude Sonnet 4.6 (Thinking)` | cross-vendor reasoning comparison |
52
+ | `Claude Opus 4.6 (Thinking)` | expensive deep critique when the user wants another high-end pass |
53
+ | `GPT-OSS 120B (Medium)` | open-weights-style comparison / diversity pass |
54
+
55
+ Examples:
56
+
57
+ ```bash
58
+ AGY_MODEL="Gemini 3.5 Flash (Medium)" agy-run "Read AGENTS.md and report one Hard Constraint."
59
+ AGY_MODEL="Claude Sonnet 4.6 (Thinking)" AGY_TIMEOUT=10m agy-run @review-prompt.md
60
+ ```
61
+
62
+ ## Flags (from `agy --help`, v1.0.10)
63
+
64
+ | Flag | Meaning | Notes |
65
+ |---|---|---|
66
+ | `-p`, `--print`, `--prompt` | run one headless prompt and print the text response | the wrapper uses `-p` |
67
+ | `--print-timeout <dur>` | cap headless wait time | CLI default `5m0s`; wrapper default `5m` via `AGY_TIMEOUT` |
68
+ | `--model <string>` | select a model | must match an `agy models` display string exactly |
69
+ | `-i`, `--prompt-interactive` | run an initial prompt, then continue interactively | not used by the wrapper |
70
+ | `-c`, `--continue` | continue the most recent conversation | pass after the wrapper's `--` |
71
+ | `--conversation <id>` | resume a specific conversation by id | use only when the user provides/records the id |
72
+ | `--add-dir <dir>` | add a directory to the workspace | repeatable; for explicit extra context |
73
+ | `--dangerously-skip-permissions` | auto-approve all tool permissions | avoid by default; use only with explicit user approval |
74
+ | `--sandbox` | run with terminal restrictions enabled | prefer when delegating a prompt that might trigger tool/terminal work |
75
+ | `--log-file <path>` | override the CLI log-file path | keep logs secret-free and out of committed artifacts |
76
+
77
+ ## Subcommands (v1.0.10)
78
+
79
+ `changelog`, `help`, `install`, `models`, `plugin` / `plugins`, `update`.
80
+
81
+ **Not available in v1.0.10:** any JSON output mode, and any `agy inspect`. Output is plain text.
82
+
83
+ ## Project-context flags
84
+
85
+ `agy` reads context from its current working directory:
86
+
87
+ ```text
88
+ .antigravity.md > GEMINI.md > AGENTS.md
89
+ .agents/skills/
90
+ ```
91
+
92
+ Use `--add-dir` for extra directories not already reachable from cwd. Subdirectory `CLAUDE.md` files
93
+ are **not** auto-loaded — include those local rules manually in the prompt when they matter.
@@ -0,0 +1,51 @@
1
+ # Review prompt template — `agy-run` (review role)
2
+
3
+ The `review` role of `antigravity-cli-bridge` delegates a **read-only second opinion** to `agy`.
4
+ `agy` cannot see the conversation and (in v1.0.10) has no JSON output, so the prompt must be
5
+ **self-contained** and ask for **plain-Markdown findings only** — no repo edits, no git writes.
6
+ Fill the `{{…}}` slots, pipe it to `agy-run`, then verify every finding locally before acting.
7
+
8
+ ```text
9
+ You are a meticulous staff-level reviewer giving a SECOND OPINION. You are read-only:
10
+ do not propose to edit files, run commands, or make git changes — return findings only.
11
+
12
+ ## What to review
13
+ {{TARGET}} # e.g. "the implementation plan below" or "the working-tree diff below"
14
+
15
+ ## Project rules
16
+ Read the repo's root AGENTS.md (your cwd) and obey its Hard Constraints and conventions.
17
+ If AGENTS.md declares a verification/gate set, judge the change against it; if it declares
18
+ none, say so — do NOT invent checks.
19
+
20
+ ## Material
21
+ {{CONTENT}} # paste the plan text, or the unified diff, or the file excerpts under review
22
+
23
+ ## Focus (optional)
24
+ {{FOCUS}} # e.g. "correctness of the new reducer", "backward-compat of the stamp takeover"
25
+
26
+ ## Output — Markdown, this exact shape, nothing else
27
+ ### Verdict
28
+ One line: SHIP / SHIP WITH NITS / REWORK, plus a one-sentence reason.
29
+ ### Blocking
30
+ Numbered. Correctness bugs, contract violations, data loss, security. Cite file:line.
31
+ Empty? write "none".
32
+ ### Non-blocking
33
+ Numbered. Simplifications, reuse, naming, missing tests. Cite file:line.
34
+ ### Questions
35
+ Anything ambiguous that changes your verdict if answered.
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```bash
41
+ # critique a plan
42
+ AGY_MODEL="Gemini 3.1 Pro (High)" agy-run @/tmp/review-prompt.filled.md
43
+
44
+ # critique the current diff (build the prompt with the diff pasted into {{CONTENT}})
45
+ git diff | ... # assemble the filled prompt, then:
46
+ agy-run @/tmp/review-prompt.filled.md
47
+ ```
48
+
49
+ Treat the result as **advisory** — `agy` output may be incomplete or out of date. The orchestrator
50
+ re-runs the project's real gates and owns every accepted change. See
51
+ [`driving-agy.md`](./driving-agy.md).