Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
},
"metadata": {
"description": "The Antigravity CLI (`agy`) plugin for Claude Code — ask, code review, adversarial review, delegate, rescue, web scrape and doc→Markdown from inside your editor. Read-only commands really are read-only (agy pinned to Default mode, outside your repo) + secret / SSRF / path guards, background job control. One std-only Rust binary, SHA-256 pinned; macOS / Linux / Windows.",
"version": "0.9.0"
"version": "0.9.1"
},
"plugins": [
{
"name": "agy",
"description": "Use the Google Antigravity CLI (`agy`) from Claude Code: /agy:ask, /agy:review, /agy:adversarial-review, /agy:scrape, /agy:doc-to-md (read-only: agy pinned to Default mode, outside your repo), /agy:rescue and /agy:image (write-capable, with rails), /agy:status, /agy:result, /agy:cancel, /agy:delegate, /agy:research, /agy:setup, /agy:help. Secret-scan + SSRF/path guards; per-call --model resolved against `agy models`. One std-only Rust binary, SHA-256 pinned.",
"version": "0.9.0",
"version": "0.9.1",
"author": {
"name": "limeflash",
"url": "https://github.com/limeflash"
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
> since been substantially rewritten and extended. The earlier entries below
> are the original upstream history, preserved for traceability.

## [0.9.1] - 2026-11-25 (limeflash)

Gemini 4 model aliases, and a rebuild from `main` so the released binaries
match the source again (0.9.0's binaries were built just before the Linux
fix below landed).

### Added
- **Gemini 4 and any future Gemini code name as `--model` aliases.** agy now
lists Gemini 4 Hydrogen (XHigh / High / Medium / Low), which no alias
reached. Gemini aliases are no longer a fixed list: every kind that
`agy models` lists (`hydrogen`, `flash`, `pro`, and the next code name) is
an alias, with an optional level suffix (`hydrogen-xhigh`, `flash-low`).
`gemini` (`gemini-xhigh`, …) is the newest Gemini of any kind; on a version
tie a big model beats Flash. `/agy:help` shows each kind with its levels.

### Changed
- The empty-`--model` error suggests `--model gemini` instead of `pro`,
which current agy accounts don't list.

### Fixed
- Linux: `/agy:cancel` treated an exited-but-not-yet-reaped worker (a
zombie) as alive and waited out its full grace period before giving up;
a zombie now counts as gone.
- Windows: two updates of the same job record at once (a background
worker finishing while `/agy:cancel` runs) could fail with "could not
lock the job record: Access is denied". Job records are now guarded by
an OS file lock instead of a create-and-delete lock file.

### Tests
- Windows CI: path, file-name and PowerShell 5.1 quirks in the test
harnesses (no change to the plugin's behaviour on Windows).

## [0.9.0] - 2026-11-24 (limeflash)

**Rewritten in Rust, and a read-only escape on agy 1.5.7+ closed.** One
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "agy-plugin"
version = "0.9.0"
version = "0.9.1"
edition = "2024"
description = "Claude Code plugin runtime for Google's Antigravity CLI (agy): read-only commands that stay read-only, plus background jobs."
license = "MIT"
Expand Down
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Ask questions, get a second opinion on your diff, hand off tasks, read web pages
|---|---|
| 🔒 **Read-only really means read-only** | Commands like `/agy:ask` and `/agy:review` can look, never touch: agy is explicitly forbidden to change files or run commands, and if that can't be guaranteed the plugin refuses to run. |
| 🛡️ **Nothing sensitive slips out** | Your diff is checked for API keys before it goes to Gemini; web addresses and file paths are checked so agy can't be pointed at your internal network or your `~/.ssh`. |
| 🎯 **Always the newest model** | `--model opus`, `pro`, `flash`, `sonnet` pick the latest model of that family that your account offers. |
| 🎯 **Always the newest model** | `--model gemini` picks the newest Gemini (Gemini 4 Hydrogen today); `hydrogen-xhigh`, `flash`, `opus`, `sonnet` pick the latest of that family your account offers. |
| ⏳ **Long jobs in the background** | Start a review or a task, keep working, check back with `/agy:status` and `/agy:result`. |
| 📦 **Tiny and self-contained** | One ~0.6 MB native program with zero third-party dependencies. No Node.js, no Python. Verified by checksum before it runs. |

Expand Down Expand Up @@ -97,18 +97,23 @@ It checks that `agy` is installed (and offers to install it), logged in, and new
## 🎯 Choosing a model

```text
/agy:ask --model opus "what's wrong with this regex?"
/agy:review --model flash
/agy:review --model gemini
/agy:ask --model hydrogen-xhigh "what's wrong with this regex?"
/agy:review --model flash-low
```

| Alias | Picks |
|---|---|
| `flash`, `flash-medium`, `flash-low` | newest Gemini Flash (High / Medium / Low) |
| `pro`, `pro-low` | newest Gemini Pro (High / Low) |
| `opus`, `sonnet` | newest Claude Opus / Sonnet (prefers *Thinking*) |
| `gpt-oss` | GPT-OSS 120B |
| Alias | Picks | Today¹ |
|---|---|---|
| `gemini` | newest Gemini of any kind | Gemini 4 Hydrogen (High) |
| `hydrogen` | newest Gemini Hydrogen | Gemini 4 Hydrogen (High) |
| `flash` | newest Gemini Flash | Gemini 3.8 Flash (High) |
| `pro`, `carbon`, … | **any** Gemini kind your account lists | — |
| `opus`, `sonnet` | newest Claude Opus / Sonnet (prefers *Thinking*) | Claude Opus 4.6 / Sonnet 4.6 |
| `gpt-oss` | GPT-OSS 120B | GPT-OSS 120B (Medium) |

**Levels:** add `-xhigh`, `-high` (default), `-medium` or `-low` to any Gemini alias — `hydrogen-xhigh`, `flash-low`, `gemini-medium`. When Google ships a new Gemini code name, its alias works right away, no plugin update.

Any exact model name or id from `agy models` works too. `/agy:help` shows what each alias points to right now. Without `--model`, agy uses its own default.
¹ What `agy models` listed on 2026-11-25; your account may differ. Any exact model name or id from `agy models` works too. `/agy:help` shows what each alias points to right now. Without `--model`, agy uses its own default.

---

Expand Down
2 changes: 1 addition & 1 deletion plugins/agy/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agy",
"version": "0.9.0",
"version": "0.9.1",
"description": "Use the Google Antigravity CLI (`agy`) from Claude Code: /agy:ask, /agy:review, /agy:adversarial-review, /agy:scrape, /agy:doc-to-md (read-only: agy pinned to Default mode, outside your repo), /agy:rescue and /agy:image (write-capable, with rails), /agy:status, /agy:result, /agy:cancel, /agy:delegate, /agy:research, /agy:setup, /agy:help. Secret-scan + SSRF/path guards; per-call --model resolved against `agy models`. One std-only Rust binary, SHA-256 pinned.",
"author": {
"name": "limeflash",
Expand Down
7 changes: 4 additions & 3 deletions plugins/agy/agents/runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ bash "${CLAUDE_PLUGIN_ROOT}/bin/agy-plugin" ask [--model <alias>] '<prompt>' [--
```
bash "${CLAUDE_PLUGIN_ROOT}/bin/agy-plugin" ask --model opus 'why does the pagination test flake?'
```
Aliases (`flash-low`, `flash-medium`, `flash`, `pro-low`, `pro`, `sonnet`,
`opus`, `gpt-oss`) resolve to the newest model of that family that
`agy models` lists; any id or display name from `agy models` is also
Aliases resolve to the newest model of that family that `agy models`
lists: `gemini` (newest Gemini of any kind), any Gemini kind it lists
(`hydrogen`, `flash`, `pro`, …) with an optional level (`hydrogen-xhigh`,
`flash-low`), `opus`, `sonnet`, `gpt-oss`; any id or display name from `agy models` is also
accepted. Unknown names fail with exit 64.
- If no `--model` was given, omit it; agy uses its current model.
- After the prompt, only `--print-timeout` and `--effort` are allowed; any
Expand Down
5 changes: 3 additions & 2 deletions plugins/agy/commands/ask.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ Only `--print-timeout <duration>` and `--effort <level>` may follow the
prompt argument; any other agy flag is refused (exit 64) because `ask` is
read-only.

`<alias>`: `flash-low`, `flash-medium`, `flash`, `pro-low`, `pro`, `sonnet`,
`opus`, `gpt-oss`. Aliases resolve to the newest model of that family that
`<alias>`: `gemini` (newest Gemini of any kind), any Gemini kind
`agy models` lists (`hydrogen`, `flash`, `pro`, …) with an optional level
(`hydrogen-xhigh`, `flash-low`), `opus`, `sonnet`, `gpt-oss`. Aliases resolve to the newest model of that family that
`agy models` lists; any id or display name from `agy models` is also
accepted. Unknown names fail with exit 64. Run `/agy:help` for the table.

Expand Down
5 changes: 3 additions & 2 deletions plugins/agy/commands/delegate.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ $ARGUMENTS
from the task text.
- If no model is given, agy uses whatever model it is currently set to.

`<alias>`: `flash-low`, `flash-medium`, `flash`, `pro-low`, `pro`, `sonnet`,
`opus`, `gpt-oss` — each resolves to the newest model of that family that
`<alias>`: `gemini` (newest Gemini of any kind), any Gemini kind
`agy models` lists (`hydrogen`, `flash`, `pro`, …) with an optional level
(`hydrogen-xhigh`, `flash-low`), `opus`, `sonnet`, `gpt-oss` — each resolves to the newest model of that family that
`agy models` lists. Any id or display name from `agy models` is also
accepted. Run `/agy:help` for the table.

Expand Down
5 changes: 3 additions & 2 deletions plugins/agy/commands/rescue.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ bash "${CLAUDE_PLUGIN_ROOT}/bin/agy-plugin" rescue --background --wait 'fix the
bash "${CLAUDE_PLUGIN_ROOT}/bin/agy-plugin" rescue --model opus --print-timeout 20m 'migrate the tests to vitest'
```

`<alias>`: `flash-low`, `flash-medium`, `flash`, `pro-low`, `pro`,
`sonnet`, `opus`, `gpt-oss` — resolved to the newest model of that
`<alias>`: `gemini` (newest Gemini of any kind), any Gemini kind
`agy models` lists (`hydrogen`, `flash`, `pro`, …) with an optional level
(`hydrogen-xhigh`, `flash-low`), `opus`, `sonnet`, `gpt-oss` — resolved to the newest model of that
family that `agy models` lists and passed to agy's `--model` for this
run only. Any id or display name from `agy models` is also accepted.

Expand Down
5 changes: 3 additions & 2 deletions plugins/agy/commands/research.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ Then invoke the `agy:runner` subagent with that prompt as
is given, agy uses whatever model it is currently set to (a
reasoning-strong model like `pro` or `opus` works well for research).

`<alias>`: `flash-low`, `flash-medium`, `flash`, `pro-low`, `pro`, `sonnet`,
`opus`, `gpt-oss` — each resolves to the newest model of that family that
`<alias>`: `gemini` (newest Gemini of any kind), any Gemini kind
`agy models` lists (`hydrogen`, `flash`, `pro`, …) with an optional level
(`hydrogen-xhigh`, `flash-low`), `opus`, `sonnet`, `gpt-oss` — each resolves to the newest model of that family that
`agy models` lists. Any id or display name from `agy models` is also
accepted. Run `/agy:help` for the table.

Expand Down
13 changes: 9 additions & 4 deletions plugins/agy/skills/antigravity-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ forwarding.

## Model aliases

`flash-low`, `flash-medium` (`flash-med`), `flash` (`flash-high`),
`pro-low`, `pro` (`pro-high`), `sonnet` (`claude-sonnet`),
`opus` (`claude-opus`), `gpt-oss` (`gpt-oss-120b`). Each resolves against
`agy models` to the newest model in its family. Any id or display name that
- `gemini` — the newest Gemini of any kind (Gemini 4 Hydrogen today).
- Any Gemini kind that `agy models` lists — `hydrogen`, `flash`, `pro`, and
whatever code name Google adds next — is an alias by itself.
- Add a level to either: `-xhigh`, `-high` (the default), `-medium`
(`-med`), `-low` — e.g. `hydrogen-xhigh`, `flash-low`, `gemini-medium`.
- `opus` (`claude-opus`), `sonnet` (`claude-sonnet`), `gpt-oss`
(`gpt-oss-120b`).

Each resolves against `agy models` to the newest model in its family. Any id or display name that
`agy models` lists is also accepted verbatim.

Run `bash "${CLAUDE_PLUGIN_ROOT}/bin/agy-plugin" help` for the
Expand Down
37 changes: 23 additions & 14 deletions scripts/test-launcher.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,34 @@ function Fail([string]$m) { [Console]::Error.WriteLine("FAIL: $m"); exit 1 }
# own native-argument boundary, which mangles embedded quotes and a
# trailing backslash before the launcher ever sees them — the test must
# exercise the launcher's quoting, not PowerShell's.
# - Under ErrorActionPreference=Stop, PS 5.1 turns any stderr line of a
# native program into a terminating NativeCommandError, and the launcher
# legitimately reports "downloading ..." on stderr: relax it for the call.
# - Start-Process with stdout/stderr redirected to files, not `& powershell
# 2>&1`: when one PowerShell runs another, the parent treats the child's
# stderr as serialized error records (CLIXML) and fails on the launcher's
# plain "checksum mismatch" lines ("Cannot process the XML from the
# 'Error' stream"); PS 5.1 also turns stderr lines into terminating
# NativeCommandErrors under ErrorActionPreference=Stop. Files sidestep both.
function Invoke-Launcher([string[]]$launcherArgs, [switch]$MergeStderr) {
$quoted = @($launcherArgs | ForEach-Object { "'" + ($_ -replace "'", "''") + "'" }) -join ' '
$script = "& '" + ($launcher -replace "'", "''") + "' $quoted; exit `$LASTEXITCODE"
$enc = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($script))
$old = $ErrorActionPreference
$ErrorActionPreference = 'Continue'
$outFile = Join-Path $work ("out-" + [Guid]::NewGuid() + ".txt")
$errFile = Join-Path $work ("err-" + [Guid]::NewGuid() + ".txt")
# Started from pwsh 7, Windows PowerShell inherits pwsh's PSModulePath and
# loads pwsh's modules (Get-FileHash & co. then fail); let it use its own.
$savedModulePath = $env:PSModulePath
$env:PSModulePath = $null
try {
if ($MergeStderr) {
$o = & powershell -NoProfile -ExecutionPolicy Bypass -EncodedCommand $enc 2>&1 | ForEach-Object { "$_" }
} else {
$o = & powershell -NoProfile -ExecutionPolicy Bypass -EncodedCommand $enc 2>$null
}
return @{ Out = ($o -join "`n"); Code = $LASTEXITCODE }
$p = Start-Process -FilePath 'powershell' -Wait -PassThru -NoNewWindow `
-ArgumentList @('-NoProfile', '-NonInteractive', '-OutputFormat', 'Text', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', $enc) `
-RedirectStandardOutput $outFile -RedirectStandardError $errFile
} finally {
$ErrorActionPreference = $old
$env:PSModulePath = $savedModulePath
}
$o = "$(Get-Content -Raw -LiteralPath $outFile)"
$e = "$(Get-Content -Raw -LiteralPath $errFile)"
if ($MergeStderr) { $o = "$o`n$e" }
Remove-Item -Force -LiteralPath $outFile, $errFile -ErrorAction SilentlyContinue
return @{ Out = $o; Err = $e; Code = $p.ExitCode }
}

$repo = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
Expand All @@ -53,7 +62,7 @@ try {
# 1. download + verify + exec, with an argument containing quotes and spaces.
$tricky = 'say "hi" to C:\path with spaces\'
$r = Invoke-Launcher @('ask', $tricky)
if ($r.Code -ne 0) { Fail "first run exit $($r.Code)" }
if ($r.Code -ne 0) { Fail "first run exit $($r.Code): $($r.Err)" }
if (-not ($r.Out -match 'hello from stub')) { Fail "unexpected output: $($r.Out)" }
$argv = ((Get-Content -Raw -LiteralPath "$work\record.txt").Split("`t")[1]).Split([char]0x1f)
if ($argv[0] -ne 'ask' -or $argv[1] -ne $tricky) { Fail "argv mangled: $($argv -join ' | ')" }
Expand All @@ -62,7 +71,7 @@ try {
# 2. tampered cache is not executed (re-downloaded instead).
Set-Content -LiteralPath "$work\cache\9.9.9\$asset" -Value 'garbage'
$r = Invoke-Launcher @('version')
if ($r.Code -ne 0) { Fail 're-download failed' }
if ($r.Code -ne 0) { Fail "re-download failed: $($r.Err)" }
if ((Get-FileHash -Algorithm SHA256 -LiteralPath "$work\cache\9.9.9\$asset").Hash.ToLowerInvariant() -ne $good) { Fail 'cache not repaired' }
Write-Output 'ok 2 tampered cache refused'

Expand Down
77 changes: 57 additions & 20 deletions src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,31 @@ pub(crate) fn write_atomic(path: &Path, data: &[u8]) -> std::io::Result<()> {
f.write_all(data)?;
f.sync_all()?;
drop(f);
std::fs::rename(&tmp, path)
rename_retrying(&tmp, path)
})();
if res.is_err() {
let _ = std::fs::remove_file(&tmp);
}
res
}

/// `rename`, retried briefly on Windows: replacing a file fails there while
/// anything (a concurrent reader, an antivirus scan of the fresh temp file)
/// has it open for a moment.
fn rename_retrying(from: &Path, to: &Path) -> std::io::Result<()> {
let mut tries = 0;
loop {
match std::fs::rename(from, to) {
Err(e) if cfg!(windows) && tries < 50 && from.exists() => {
let _ = e;
tries += 1;
std::thread::sleep(Duration::from_millis(10));
}
r => return r,
}
}
}

fn write_record(root: &Path, id: &str, rec: &Value) -> Result<(), Fail> {
let text = format!("{}\n", json::to_string_pretty(rec));
write_atomic(&record_path(root, id), text.as_bytes())
Expand Down Expand Up @@ -130,42 +147,62 @@ pub(crate) fn read_job(root: &Path, id: &str) -> Result<Option<Value>, Fail> {
.map_err(|e| Fail::runtime(format!("error: job {id} is unreadable: {e}")))
}

/// Run `f` while holding `runtime/<id>.lock` (create-exclusive). A lock
/// older than 30 s is from a crashed process and is broken.
/// Run `f` while holding an exclusive OS lock on `runtime/<id>.lock`. The
/// OS drops the lock when its holder exits, so a crashed process can't leave
/// a job locked; the file itself stays (deleting a lock file that another
/// process is opening races on Windows).
fn with_lock<T>(root: &Path, id: &str, f: impl FnOnce() -> Result<T, Fail>) -> Result<T, Fail> {
let lp = lock_path(root, id);
if let Some(d) = lp.parent() {
std::fs::create_dir_all(d).map_err(|e| io_fail("could not create the job state dir", e))?;
}
if std::fs::symlink_metadata(&lp).is_ok_and(|m| !m.is_file()) {
return Err(Fail::runtime(format!(
"error: refusing to use {}: not a regular file",
lp.display()
)));
}
let mut o = OpenOptions::new();
o.read(true).write(true).create(true).truncate(false);
#[cfg(unix)]
{
use std::os::unix::fs::OpenOptionsExt;
o.mode(0o600);
}
let start = Instant::now();
loop {
match OpenOptions::new().write(true).create_new(true).open(&lp) {
Ok(mut file) => {
let _ = write!(file, "{}", std::process::id());
break;
let file = loop {
match o.open(&lp) {
Ok(file) => break file,
// Windows: a 0.9.0 process deleting its lock file leaves it
// "delete pending" for a moment, which reads as access denied.
Err(e)
if cfg!(windows)
&& e.kind() == std::io::ErrorKind::PermissionDenied
&& start.elapsed() < Duration::from_secs(2) =>
{
std::thread::sleep(Duration::from_millis(15));
}
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => {
let stale = std::fs::metadata(&lp)
.and_then(|m| m.modified())
.ok()
.and_then(|t| t.elapsed().ok())
.is_some_and(|age| age > Duration::from_secs(30));
if stale {
let _ = std::fs::remove_file(&lp);
continue;
}
Err(e) => return Err(io_fail("could not lock the job record", e)),
}
};
loop {
match file.try_lock() {
Ok(()) => break,
Err(std::fs::TryLockError::WouldBlock) => {
if start.elapsed() > Duration::from_secs(10) {
return Err(Fail::runtime(format!(
"error: job {id} is locked by another process"
)));
}
std::thread::sleep(Duration::from_millis(15));
}
Err(e) => return Err(io_fail("could not lock the job record", e)),
Err(std::fs::TryLockError::Error(e)) => {
return Err(io_fail("could not lock the job record", e));
}
}
}
let res = f();
let _ = std::fs::remove_file(&lp);
let _ = file.unlock();
res
}

Expand Down
Loading
Loading