Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Agy Cli Runtime?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/okisdev-agy-cli-runtime)
---
name: agy-cli-runtime
description: Internal helper contract for calling the agy-companion runtime from Claude Code
user-invocable: false
---
# Antigravity runtime
Primary helper:
- `node "${CLAUDE_PLUGIN_ROOT}/scripts/agy-companion.mjs" <subcommand> [flags]`
Subcommand surface:
- `task [--write] [--model <id>] [--effort <effort>] [--resume <session-id>|--resume-last|--fresh] [--background] [--cwd <dir>] [--json] [--] [prompt]`
- `review [--scope <auto|working-tree|branch>] [--base <ref>] [--focus <text>] [--model <id>] [--effort <effort>] [--cwd <dir>] [--background] [--json]`
- `status [job-id] [--all] [--cwd <dir>] [--json]`
- `result <job-id> [--wait] [--cwd <dir>] [--json]`
- `cancel <job-id> [--cwd <dir>] [--json]`
- `history [--all] [--limit <n>] [--cwd <dir>] [--json]`
- `models [--refresh] [--json]`
- `setup [--json]`
- `record-acceptance --job-id <id> --acceptance <accepted|rejected|unverified> [--reason <text>] [--failure-kind <kind>] [--source <collector|main-loop|stats>] [--accept-failed-transport] [--json]`
- `transport-create` and `transport-discard --raw-args-token <token>`
- `task-worker` and `review-worker` are internal background workers that the helper never invokes directly.
Execution rules:
- Slash commands stage their complete raw arguments through `transport-create`, one Read of the allocated empty file, Write to that same file, and a fixed `--raw-args-token` invocation. The token transport applies to task, review, status, history, result, cancel, and setup. Raw request bytes never enter Bash, shell arguments, environment variables, redirections, substitutions, encoded literals, or heredocs. A transport is private, bounded, validated, and consumed once. Never delete, rename, recreate, or change the permissions of the transport file; use `transport-discard` when Read or Write fails or when the allocated file is not empty.
- Place every task option before the prompt, and put `--` before a prompt that begins with an option shaped token. The prompt text may also arrive on stdin.
- The companion resolves the CLI as `agy` on `PATH`, with `AGY_BIN` overriding the path. Preflight runs `agy --version` and every job records `agyVersion` and `agyBuildPath`.
- The tested interval runs from 1.5 to before 1.6 by major and minor version. `agy --version` prints a bare version. Older or unparseable builds fail preflight as `setup`; newer builds run with verification advice.
- Every run executes `agy acp --disable-telemetry --include-default-customizations=false --sandbox --gemini-dir <data>/gemini --app-data-dir agy` in the workspace. It sends `initialize`, `session/new` or `session/load`, `session/set_mode`, then configuration for `model` and `thought_level`, verifying every selected current value before `session/prompt`. The brief appears only in that prompt message.
- Consult and review use mode `default` and allow `read_file`, `search_web`, `run_command`, and `update_steps`. Write uses `accept-edits` and additionally allows `edit_file` and `write_file`. The tool name comes from `name`. An unlisted tool or `run_command` with `rawInput.BypassSandbox: true` terminates the process group as `policy`.
- Permission requests select `allow_once` by kind only for a `run_command` passing the companion's read only command check with no sandbox bypass, or a `read_file` whose absolute `Path` exists and resolves outside the sensitive home locations Devin also denies (credentials, agent and cloud configuration, keychains). All other requests select `reject_once` by kind, or cancel if it is absent. The job counts `permissionsAllowed` and `permissionsRejected`. File writes outside the workspace remain refused; write delegations are bounded file edits.
- The command check permits one simple command using `ls`, `pwd`, `cat`, `head`, `tail`, `wc`, `file`, `stat`, `tree`, `grep`, `rg`, `find`, or the contract's read only Git subcommands and flags. It rejects shell composition, substitutions, redirections, escapes, mutating find actions, Git output flags, and `rg --pre`. Approved commands still run in the CLI sandbox, which blocks credential directories but does not confine writes.
- HOME is inherited so login keychain authentication works. Before every launch the companion atomically replaces `<data>/gemini/agy/settings.json` with `{}` and `<data>/gemini/config/mcp_config.json` with `{"mcpServers":{}}`. Only the contract allowlist plus HOME reaches the child. Every `GEMINI_*`, `GOOGLE_*`, `ANTIGRAVITY_*`, `AGY_*`, and `CLOUDSDK_*` variable is dropped.
- Workspace `AGENTS.md`, `GEMINI.md`, `.gemini`, and `.agents` instructions may still load; setup and task warn for those directories. Approved Git commands honor repository configuration, including executable helpers; delegate only trusted repositories. Prompts, workspace content, and results pass through Google's backend, so never delegate secrets or credentials.
- A direct call defaults to `gemini-4-neon`. Only offered Google `gemini-` models are accepted, and `gemini-pro-orchestrator-*` is refused because it cannot pin the serving model. Non Google models fail as `input`; unavailable Google models fail as `setup`, listing usable models. A trailing `-low`, `-medium`, `-high`, or `-xhigh` supplies effort only when no explicit effort was requested.
- Effort is `thought_level`, with `low`, `medium`, `high`, and `xhigh` validated against session options. `default` keeps the session's level. Records carry requested and resolved model and effort plus `effortApplied`. `billingPool` is always `subscription`.
- `models --json` discovers the session's `model` values through ACP `session/new` and caches them for one hour at `<data>/models-cache.json`; `--refresh` bypasses the cache. Setup always checks a new session and reminds the user to set Antigravity overage to never.
- ACP stdout carries JSON-RPC responses, `session/update`, and permission requests. Message chunks before `session/prompt` are replay and ignored. Success requires a prompt result with `stopReason: "end_turn"`; exit status is never success evidence. Usage is preserved as reported without filling missing values or reporting cost. Malformed lines, unknown response ids, a missing session id, or exit before the prompt result fail as `protocol`.
- The native CLI starts in its own process group. After the prompt result, the companion closes stdin and waits up to `AGY_COMPANION_EXIT_GRACE_MS` (default 15000) before terminating the group and recording `late_close`. The run timeout is `AGY_COMPANION_TIMEOUT_MS` (default 540000 for direct foreground calls). `AGY_COMPANION_WAIT_TIMEOUT_MS`, `AGY_COMPANION_WAIT_POLL_MS`, and `AGY_COMPANION_PIDLESS_RUNNING_GRACE_MS` use the companion defaults.
- A forwarder agent runs the companion in one background shell: a Bash call with `run_in_background: true`, which returns at once with a background id and the path of the output file. It then runs `node "${CLAUDE_PLUGIN_ROOT}/scripts/agy-companion.mjs" await-output --file "PATH"` in a foreground Bash call with `timeout: 120000` and repeats that call while it prints exactly `await-output: pending`; any other output is the complete stdout of the launched operation. The harness delivers one report per agent, so a forwarder never ends its turn or writes a waiting line while the await operation prints pending. The rescue wrapper adds the fixed option `--transport-background-shell` to its task launch for a 900000ms default execution budget. Direct foreground tasks keep their 540000ms default, and `AGY_COMPANION_TIMEOUT_MS` overrides either budget. Background mode belongs to that Bash call alone and is neither the Agent's own background mode nor the companion's `--background`. A companion run directly by the main session through a slash command, with no forwarder agent, is a foreground `Bash` call with `timeout: 600000`.
- Ordinary delegations use one helper call. Only an explicit incoming user `--background` detaches a task or review into an internal worker and creates a manual receipt; the helper prints the job id plus `/agy:status` and `/agy:result` hints. Never add `--background` because a task appears large or slow, and never confuse a background shell with that option. `result --wait` blocks while a job is running, and when its bounded wait budget elapses first it returns output ending in `state: running`.
- A user asking to resume maps to `--resume <session-id>` or `--resume-last`; these and `--fresh` are alternatives. Only a terminal job in the same workspace and mode is resumable. The shared private Gemini directory lets a later job use ACP `session/load` on its UUID; a resumed session keeps its model unless a new model is named. `--fresh` ignores continuity. A terminal job's config directory is removed, and a periodic sweep removes orphan run directories older than one hour.
- `history` exposes a safe metadata projection with resumable session ids. It defaults to the current workspace, `--all` includes every recorded workspace, and `--limit` caps the number of jobs shown.
- `--cwd` selects the workspace for task, review, status, history, result, and cancel. Status, result, and cancel search all recorded workspaces by job id when `--cwd` is omitted. A bad working directory, or an implicit task or review working directory below its Git repository root, fails before a job record is created. Worktree isolation means creating a real Git worktree before launch and supplying that path as the actual `--cwd`.
- Review collects the working tree diff or a branch range, interpolates it into `${CLAUDE_PLUGIN_ROOT}/prompts/review.md`, and runs a review mode job. The reply must contain one JSON object with `verdict` (`approve` or `request_changes`), `summary`, and `findings` (each with `severity`, `file`, `line`, `title`, and `body`). The companion extracts the first JSON object from the result text and validates it, and a missing or invalid object fails the review as `error` instead of falling back to prose.
- Typed failure kinds are `missing_cli`, `setup`, `auth`, `quota`, `rate_limited`, `network`, `policy`, `refused`, `protocol`, `timeout`, `process`, `cancelled`, `died`, `input`, `resource`, and `error`. Quota and rate limit failures carry `billingPool`; authentication, missing CLI, setup, protocol, and policy failures are engine wide.
- Outcomes end with the shared footer block: `agy-session: <session-id>` when a resumable session exists, then `job:`, `sandbox:`, `delivery:`, `semantic:`, any adapter `warning:` lines, `state:`, and `failure:` for error and cancelled outcomes.
- Job records live at `<data>/state/<workspace>/jobs/<id>.json`, where `<data>` is `AGY_COMPANION_DATA` or `~/.claude/plugins/data/agy-claude-code-fusion`. They carry `engine: "agy"` plus `agyVersion`, `agyBuildPath`, `sessionId`, `requestedModel`, `resolvedModel`, `requestedEffort`, `resolvedEffort`, `effortApplied`, `billingPool`, `mode`, `role`, `usage`, `stopReason`, `permissionsAllowed`, `permissionsRejected`, and `warnings`.
- `scripts/session-end-hook.mjs` runs at Claude Code SessionEnd, performs verified cleanup of this session's running jobs, and removes unused raw transports.
- Return the helper output exactly as received, whether the Bash tool reports it from stdout or stderr.
- If the Bash call fails or Antigravity cannot be invoked, surface the failure instead of hiding it; the agy-rescue agent returns exactly one `agy unavailable: <reason>` line for the orchestrator's circuit breaker.