Skip to main content

antigravity-wakeup

Wake an idle Antigravity CLI (agy) conversation from another process.

An MCP server cannot start a turn in agy. The only way is agy agentapi send-message, which needs ANTIGRAVITY_LS_ADDRESS and ANTIGRAVITY_CSRF_TOKEN. agy puts those (and ANTIGRAVITY_CONVERSATION_ID) only into its agent's shell tool, never into MCP servers or hook processes. This library works around that with a one-time "prime" step run from the agent's own shell.

How it works

  1. A host process (for example an MCP server running under agy) creates a Prime, builds a poker with prime.new_poker() and serves its control socket (poker.serve_control_socket(path), a 0600 Unix socket).
  2. The agent runs the command from prime.command() in its shell tool. That runs antigravity-wakeup --prime, which reads the ANTIGRAVITY_* environment, finds the host process under the same agy process and sends the endpoint to its control socket.
  3. The host calls poker.notify(sender) whenever something arrives. Notifications are debounced, then the poker runs agy agentapi send-message with text from your wake_text callback. A send counts as delivered only when agy's reply names the conversation (response.sendMessage.recipientId).
  4. A marker file records which host is primed for a conversation. The PreInvocation hook (antigravity-wakeup --prime-hook) reads it and, for an unprimed conversation, injects an ephemeralMessage telling the agent to run the prime command. After a failed attempt the hook waits 10 minutes before asking again.

The token is held in memory only and reaches the agy child through its environment, never argv, logs or disk. Only loopback addresses are accepted. Optional pin_agy_process=True also checks that the primed agy process (pid plus start time) is still the same one before each send.

Use

from antigravity_wakeup.prime import Prime

prime = Prime(
    script_name="my-tool",              # console script that runs --prime / --prime-hook
    module="my_tool.cli",               # fallback for `python -m` when the script is not found
    notice="...",                       # text injected by the hook for an unprimed conversation
    wake_text=lambda senders: "...",    # text sent on each wake; must not carry peer-written content
)
poker = prime.new_poker()
# in the host's event loop:  asyncio.create_task(poker.serve_control_socket(path))
# when something arrives:    poker.notify(sender)
# to tell the agent what to run: prime.command()

The antigravity-wakeup command exposes --prime and --prime-hook for a host that has no CLI of its own; antigravity_wakeup.cli.main(prime) takes a configured Prime.

Current limits

Several defaults still come from the project this was split out of: marker and stable-link directories under ~/.claude/chatter-*, and host discovery through Claude Code's ~/.claude/sessions files (messagingSocketPath). Making those pluggable is open work.

Development

make build
make lint
make test
make package

Everything runs in a throwaway container with its own $HOME.

License

MIT

Metadata

Release files for antigravity-wakeup 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for antigravity-wakeup 0.1.0
File Size Uploaded Provenance Actions
antigravity_wakeup-0.1.0.tar.gz 17.2 kB With provenance Details for antigravity_wakeup-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for antigravity-wakeup 0.1.0
File Interpreter ABI Platform Actions
antigravity_wakeup-0.1.0-py3-none-any.whl Python 3 none any Details for antigravity_wakeup-0.1.0-py3-none-any.whl

Total release size: 33.2 kB

Release files / antigravity_wakeup-0.1.0.tar.gz

Download URL antigravity_wakeup-0.1.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a61eb216fcc970591e435f02097a8cbae63c385a953a2b69f4d11724fd0eaf06
BLAKE2b-256 checksum
How to use checksums
fd5a01b314bed2128977526a77f3dc65f0ff8821d60d9da807d24556a53b39c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / antigravity_wakeup-0.1.0-py3-none-any.whl

Download URL antigravity_wakeup-0.1.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e760cb20040c19496ef44d8b96daf264bf9dcb6a31bdca4467c42837a678aad
BLAKE2b-256 checksum
How to use checksums
deb0e920657d5768f6d39f0a47c5dbc937d9179cb2dfd12a3b80d9e4cfd457e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for antigravity-wakeup 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for antigravity_wakeup-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page