Skip to main content
Glama
README.md
# Steelmoth AGY Agent

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Node.js](https://img.shields.io/badge/Node.js-22%2B-339933.svg)](https://nodejs.org/)
[![Dependencies](https://img.shields.io/badge/runtime%20deps-0-brightgreen.svg)](package.json)
[![MCP](https://img.shields.io/badge/MCP-2025--06--18-6E56CF.svg)](https://modelcontextprotocol.io/)

Lightweight companion plugin for **Steelmoth** that runs strictly inside your isolated **Agent VM**, allowing your everyday Steelmoth agents (Mistral, OpenAI, Grok, Claude, or local models) to delegate self-contained coding, architecture, or deep-research tasks to the unmodified Google Antigravity CLI (`agy acp --stdio --sandbox`) over **Streamable HTTP MCP (`2025-06-18`)**.

> **Choosing between the two Antigravity plugins:**
> - Use **Steelmoth AGY Agent** (this repo, port `8096`) when you want your regular Steelmoth model to stay in charge of conversation, Memory, Skills, scheduled routines, and connected apps (like Notion) while calling Antigravity only for heavy coding/research.
> - Use **[Steelmoth Full Antigravity Support](https://github.com/canarybuilds/Steelmoth-Antigravity-Full)** (port `8097`) when you want to select Google Antigravity directly as an agent's main chat brain.

---

## Table of Contents

- [Why Use Steelmoth AGY Agent](#why-use-steelmoth-agy-agent)
- [Architecture](#architecture)
- [Prerequisites](#prerequisites)
- [Quick Start (Inside Your Agent VM)](#quick-start-inside-your-agent-vm)
- [Connecting to Steelmoth](#connecting-to-steelmoth)
- [How Notion & Connected Apps Work Without App Sharing](#how-notion--connected-apps-work-without-app-sharing)
- [Configuration Reference](#configuration-reference)
- [HTTP Endpoints & MCP Tools](#http-endpoints--mcp-tools)
- [Security & Compliance Guarantees](#security--compliance-guarantees)
- [Guides](#guides)
- [Troubleshooting & Operations](#troubleshooting--operations)
- [Development & Testing](#development--testing)
- [Contributing & License](#contributing--license)

---

## Why Use Steelmoth AGY Agent

- **Zero Google quota on everyday chat:** Your primary Steelmoth model handles routine replies, scheduling, memory, and connected apps — Antigravity wakes up only when `agy_ask_specialist` is called.
- **Keeps all Steelmoth features active:** Scheduled routines, Memory, Skills, and connected apps continue working normally with your primary model.
- **Zero idle RAM overhead:** Starts with **0** running `agy` processes and automatically puts the warm worker (~385 MB RSS) back to sleep after 10 minutes of inactivity.
- **Zero runtime dependencies:** Built purely on Node.js 22+ built-in modules.

---

## Architecture

```text
Steelmoth Server VM / Host (Vault, Memory, Connected Apps like Notion)
        │
        │  Loopback / Agent VM private link (Bearer auth, zero vault secrets)
        ▼
┌────────────────────────────────────────────────────────────────────┐
│ Isolated Steelmoth Agent VM (one-way firewall, revoked sudo)       │
│                                                                    │
│  steelmoth-agy-agent (:8096)                                       │
│    • GET  /plugin.json   (Steelmoth Plugin Manifest)               │
│    • GET  /health        (Awake/sleeping, RSS MB, Google tier)     │
│    • POST /sleep         (Immediate sleep to free ~400 MB RAM)     │
│    • POST /mcp           (agy_ask_specialist, agy_status, sleep)   │
│          │                                                         │
│          ▼  (allowlist-only scrubbed env, detached process group)  │
│  agy acp --stdio --sandbox   (unmodified Google Antigravity CLI)   │
└────────────────────────────────────────────────────────────────────┘
```

---

## Prerequisites

- **Steelmoth v0.1.0+** running with a hardware-isolated **Agent VM** (Single Host + Agent VM or Two Separate VMs)
- Inside your **Agent VM**:
  - **Node.js 22+**
  - Unmodified **Google Antigravity CLI (`agy`)**, signed in directly inside the Agent VM (`agy acp --login`) or configured with a `GEMINI_API_KEY`

---

## Quick Start (Inside Your Agent VM)

### 1. Run the installer inside the Agent VM

```bash
curl -fsSL https://raw.githubusercontent.com/canarybuilds/Steelmoth-AGY-Agent/main/install.sh | bash
```

### 2. Start the plugin server

```bash
AGY_AGENT_SECRET="$(cat ~/.config/steelmoth-agy-agent/secret)" \
  node ~/.local/share/steelmoth-agy-agent/src/server.mjs
```

See [docs/setup-and-workflows.md](docs/setup-and-workflows.md) for a ready-to-use `systemd --user` service unit so the plugin starts automatically when your Agent VM boots.

### 3. Verify health

```bash
curl -fsS http://127.0.0.1:8096/health
```

---

## Connecting to Steelmoth

1. Open **Steelmoth → Settings → Connections → Plugins**.
2. Select **Steelmoth AGY Agent**.
3. Enter your **Bridge URL** (e.g. `http://127.0.0.1:8096` or your Agent VM private address) and the **Shared Secret** from `~/.config/steelmoth-agy-agent/secret`.
4. Click **Detect** and **Install Plugin**.
5. Monitor awake/sleeping status, memory usage, and sleep controls anytime in **Steelmoth → Settings → Google**.

---

## How Notion & Connected Apps Work Without App Sharing

Even when every app-sharing toggle in **Settings → Google** is **off**:
1. You ask your normal Steelmoth agent (for example Mistral or OpenAI): *"Read my coding plan from Notion and implement it."*
2. Your Steelmoth agent reads Notion (and Memory) using Steelmoth's native connectors.
3. Your Steelmoth agent passes the extracted plan text in the `context` argument of `agy_ask_specialist`.
4. Antigravity works strictly inside the Agent VM workspace using only the text you passed — never touching your Notion credentials or Steelmoth Vault.

---

## Configuration Reference

See [.env.example](.env.example).

| Variable | Default | Description |
| --- | --- | --- |
| `HOST` | `127.0.0.1` | Bind address inside the Agent VM |
| `PORT` | `8096` | HTTP listening port |
| `AGY_AGENT_SECRET` | *(required)* | Bearer token verified with constant-time comparison (`crypto.timingSafeEqual`) |
| `AGY_BIN` | `agy` | Path to the unmodified Google Antigravity CLI binary |
| `AGY_WORKSPACE` | `process.cwd()` | Working directory exposed to Antigravity inside the Agent VM |
| `GEMINI_API_KEY` | *(empty)* | Optional API key when using `gemini-api-key` mode instead of personal Google sign-in |

---

## HTTP Endpoints & MCP Tools

### HTTP Endpoints

| Method & Path | Auth | Description |
| --- | --- | --- |
| `GET /plugin.json` | Public | Read-only Steelmoth Runtime Plugin manifest |
| `GET /health` | Optional Bearer | Returns awake/sleeping state, PID, RSS MB, Google tier, idle seconds, and auth mode |
| `POST /sleep` | Bearer | Immediately shuts down the warm `agy acp` process group to free Agent VM memory |
| `POST /mcp` | Bearer | Streamable HTTP MCP (`2025-06-18`) endpoint |

### MCP Tools (`POST /mcp`)

| Tool | Description |
| --- | --- |
| `agy_ask_specialist` | Delegates a coding, architecture, or research task (`task`, optional `context`, optional Gemini `modelId`) to Antigravity |
| `agy_status` | Reports whether the Antigravity worker is awake or sleeping inside the Agent VM |
| `agy_sleep` | Puts the Antigravity worker to sleep immediately to reclaim ~400 MB RAM |

---

## Security & Compliance Guarantees

- **Strict Agent VM isolation:** Never install on your Server Machine. Runs exclusively inside your isolated Agent VM with one-way firewall protection.
- **Scrubbed child environment:** `buildScrubbedAgyEnv()` forwards only safe POSIX variables (`PATH`, `HOME`, `USER`, `LANG`, `TERM`, `TMPDIR`, `XDG_*`) so Steelmoth Vault secrets, database URLs, and API keys are never visible in `/proc/<pid>/environ`.
- **Unmodified CLI & zero token extraction:** Launches `agy acp --stdio --sandbox` directly, sends honest `clientInfo: { name: "steelmoth" }`, and never reads or stores Google OAuth tokens.
- **Gemini-only filtering:** Blocks non-Gemini third-party models (`claude-*`) so consumer Google sign-in stays within Gemini boundaries.
- **Fail-closed safety guards:** Zero-retry circuit breaker on account restriction messages, fail-closed abort if `gemini-api-key` mode silently falls back to a consumer `g1-*` tier, and an 8 MiB hard cap per stdout JSON-RPC frame to prevent memory exhaustion.

---

## Guides

- **[Agent VM Setup & Workflows Guide](docs/setup-and-workflows.md)** — `systemd --user` setup, Two-VM port binding, and Notion/Memory handoff examples.
- **[Security, Isolation & ToS Compliance Guide](docs/security-and-compliance.md)** — Deep dive on env scrubbing, sandboxing, tier checks, and resource management.

---

## Troubleshooting & Operations

- **Antigravity binary not found:** Verify `which agy` inside the Agent VM and set `AGY_BIN` if installed outside default `PATH`.
- **Signed out / account warning:** Run `agy acp --login` interactively inside the Agent VM. If an account restriction warning occurs, the plugin stops immediately with zero retries.
- **Free Agent VM RAM immediately:** Click **Sleep now** in **Steelmoth → Settings → Google**, call `agy_sleep`, or send `POST /sleep`.

---

## Development & Testing

Zero external dependencies — run the built-in Node.js test suite directly:

```bash
npm test
```

---

## Contributing & License

Contributions and bug reports are welcome — please read [CONTRIBUTING.md](CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) first.

Licensed under the [MIT License](LICENSE).