antigravity-cloak 0.1.2: Hermes Agent's earlier persona is broken too

Antigravity answers "Hermes Agent, an intelligent AI assistant created by
Nous Research" (Hermes' earlier default SOUL.md, which a SOUL.md the user
edited keeps) with the same fake 429 "Resource has been exhausted" (zgoodz
on X, 10-27: "antigravity在Hermes里一样429"). Hermes' current default
persona goes through. The line joins the words broken with a zero-width
space, after its H: "Y​ou are Hermes Agent, an intelligent ..." still
fails on a real account, while "H​ermes Agent, an intelligent ..."
goes through.

magpie v0.1.1641 breaks the same lines on an Antigravity account by
itself (`magpie provider set antigravity prompt=as-written` turns it off);
the README says so, and that this middleware then adds only extraWords.

Run:
- bun test packages/antigravity-cloak: 15 pass, 0 fail (new case: Hermes'
  old persona in a chat system message, broken after its H; the current
  "You are Hermes Agent, built by Nous Research." stays). With the word
  taken out: 14 pass, 1 fail.
- bun test scripts/check.test.mjs: 3 pass.
- Real Antigravity account through a sandbox magpie: the line whole is
  refused; broken after its H, 200; real Hermes Agent with the old persona
  answered through magpie's own break (magpie-side, same rule).
Not tried: this plugin installed in a running magpie on a real account.
This commit is contained in:
yetone
2026-10-27 04:17:17 +08:00
parent a52d1b370b
commit ac11dcbb92
4 changed files with 11 additions and 5 deletions
+6 -3
View File
@@ -6,12 +6,15 @@ Antigravity answers a request whose system prompt reads as Claude Code's or the
- Claude Code's billing line, `x-anthropic-billing-header: …`; - Claude Code's billing line, `x-anthropic-billing-header: …`;
- `You are a Claude agent, built on Anthropic's Claude Agent SDK`; - `You are a Claude agent, built on Anthropic's Claude Agent SDK`;
- Codex's own prompt for its GPT-5 models, `You are Codex, an agent based on GPT-5` or `You are Codex, a coding agent based on GPT-5`. A Codex chat begun on a GPT model keeps it after `/model` or a fork onto an Antigravity model, so that chat 429s while a new one works. - Codex's own prompt for its GPT-5 models, `You are Codex, an agent based on GPT-5` or `You are Codex, a coding agent based on GPT-5`. A Codex chat begun on a GPT model keeps it after `/model` or a fork onto an Antigravity model, so that chat 429s while a new one works;
- Hermes Agent's earlier default persona, `Hermes Agent, an intelligent AI assistant created by Nous Research`, which a SOUL.md the user edited keeps (Hermes' current default goes through). Breaking it after `You` doesn't help; it is broken after the `H`.
The same prompt goes through when each has a zero-width space (U+200B) inside it. This middleware puts one after the first letter of `x-anthropic-billing-header`, `Claude Agent SDK` and those two Codex lines, in the system prompt only, and only in what an Antigravity account is sent. Every other provider, a Claude subscription above all, gets the prompt as the agent wrote it, even in a routing group that tries Antigravity first. The model reads the words as before. The same prompt goes through when each has a zero-width space (U+200B) inside it. This middleware puts one after the first letter of `x-anthropic-billing-header`, `Claude Agent SDK`, those two Codex lines and Hermes' line, in the system prompt only, and only in what an Antigravity account is sent. Every other provider, a Claude subscription above all, gets the prompt as the agent wrote it, even in a routing group that tries Antigravity first. The model reads the words as before.
It needs a magpie with the `onProvider` hook (v0.1.1283 or later): an older magpie loads it and never calls it, so requests go as they came. It needs a magpie with the `onProvider` hook (v0.1.1283 or later): an older magpie loads it and never calls it, so requests go as they came.
magpie v0.1.1641 and later break these same lines on an Antigravity account by themselves (`magpie provider set antigravity prompt=as-written` turns that off), so there this middleware adds only `extraWords`.
Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @magpie-community/middleware-antigravity-cloak`. Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @magpie-community/middleware-antigravity-cloak`.
## Before you turn it on ## Before you turn it on
@@ -29,6 +32,6 @@ Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @m
- `accounts`: the subscriptions it acts on, by kind. `antigravity` is the default. - `accounts`: the subscriptions it acts on, by kind. `antigravity` is the default.
- `off`: leave every request as it came. - `off`: leave every request as it came.
中文:Antigravity 看到 Claude Code / Claude Agent SDK / Codex GPT-5 的系统提示词会回一个假的 429。这个中间件只在发给 Antigravity 账号的请求里,往 `x-anthropic-billing-header`、`Claude Agent SDK` 和 Codex 给 GPT-5 模型的身份行(在 GPT 模型上开始、再切到 Antigravity 模型的 Codex 对话会带着它)里插一个零宽空格,其他供应商(尤其是 Claude 订阅)收到的提示词不变。这样做可能违反 Antigravity 的条款,账号有被封的风险,请只用在可以承受损失的账号上。需要 magpie v0.1.1283 或更新版本。 中文:Antigravity 看到 Claude Code / Claude Agent SDK / Codex GPT-5 / Hermes Agent 旧版默认人设的系统提示词会回一个假的 429。这个中间件只在发给 Antigravity 账号的请求里,往 `x-anthropic-billing-header`、`Claude Agent SDK` 和 Codex 给 GPT-5 模型的身份行(在 GPT 模型上开始、再切到 Antigravity 模型的 Codex 对话会带着它),以及 Hermes Agent 旧版默认人设(SOUL.md)那句里插一个零宽空格,其他供应商(尤其是 Claude 订阅)收到的提示词不变。这样做可能违反 Antigravity 的条款,账号有被封的风险,请只用在可以承受损失的账号上。需要 magpie v0.1.1283 或更新版本。
After [hexiaolv/magpie-antigravity-cloak](https://github.com/hexiaolv/magpie-antigravity-cloak) (MIT), which breaks a longer list of words in every request, whatever provider it goes to. After [hexiaolv/magpie-antigravity-cloak](https://github.com/hexiaolv/magpie-antigravity-cloak) (MIT), which breaks a longer list of words in every request, whatever provider it goes to.
@@ -7,6 +7,8 @@
// "You are a Claude agent, built on Anthropic's Claude Agent SDK" // "You are a Claude agent, built on Anthropic's Claude Agent SDK"
// "You are Codex, an agent based on GPT-5" Codex's own prompt // "You are Codex, an agent based on GPT-5" Codex's own prompt
// "You are Codex, a coding agent based on GPT-5" for its GPT-5 models // "You are Codex, a coding agent based on GPT-5" for its GPT-5 models
// "Hermes Agent, an intelligent AI assistant created by Nous Research"
// Hermes Agent's earlier default persona (its SOUL.md)
// //
// (a Codex thread begun on a GPT model keeps its prompt after /model or a // (a Codex thread begun on a GPT model keeps its prompt after /model or a
// fork onto an Antigravity one) // fork onto an Antigravity one)
@@ -24,7 +26,7 @@
// After hexiaolv's magpie-antigravity-cloak (MIT), which does the same to // After hexiaolv's magpie-antigravity-cloak (MIT), which does the same to
// every request whatever provider it goes to. // every request whatever provider it goes to.
export const words = ["x-anthropic-billing-header", "Claude Agent SDK", "You are Codex, an agent based on GPT-5", "You are Codex, a coding agent based on GPT-5"] export const words = ["x-anthropic-billing-header", "Claude Agent SDK", "You are Codex, an agent based on GPT-5", "You are Codex, a coding agent based on GPT-5", "Hermes Agent, an intelligent AI assistant created by Nous Research"]
const zwsp = "​" const zwsp = "​"
+1
View File
@@ -8,6 +8,7 @@
{"name": "Responses: instructions and a system input item", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "instructions": "You are a Claude agent, built on Anthropic's Claude Agent SDK.", "input": [{"role": "system", "content": [{"type": "input_text", "text": "x-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": [{"type": "input_text", "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]}, "expect_request": {"model": "m", "instructions": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK.", "input": [{"role": "system", "content": [{"type": "input_text", "text": "x\u200b-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": [{"type": "input_text", "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]}}, {"name": "Responses: instructions and a system input item", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "instructions": "You are a Claude agent, built on Anthropic's Claude Agent SDK.", "input": [{"role": "system", "content": [{"type": "input_text", "text": "x-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": [{"type": "input_text", "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]}, "expect_request": {"model": "m", "instructions": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK.", "input": [{"role": "system", "content": [{"type": "input_text", "text": "x\u200b-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": [{"type": "input_text", "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]}},
{"name": "Responses: Codex's GPT-5 prompt kept after a switch to an Antigravity model", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "claude-opus-5-5"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5. You and the user share one workspace."}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "hi"}]}, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "<model_switch>\nThe user was previously using a different model.\n</model_switch>"}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5."}]}]}, "expect_request": {"model": "m", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "Y\u200bou are Codex, an agent based on GPT-5. You and the user share one workspace."}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "hi"}]}, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "<model_switch>\nThe user was previously using a different model.\n</model_switch>"}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5."}]}]}}, {"name": "Responses: Codex's GPT-5 prompt kept after a switch to an Antigravity model", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "claude-opus-5-5"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5. You and the user share one workspace."}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "hi"}]}, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "<model_switch>\nThe user was previously using a different model.\n</model_switch>"}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5."}]}]}, "expect_request": {"model": "m", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "Y\u200bou are Codex, an agent based on GPT-5. You and the user share one workspace."}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "hi"}]}, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "<model_switch>\nThe user was previously using a different model.\n</model_switch>"}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5."}]}]}},
{"name": "Responses: the coding agent wording, any case; magpie's own Codex prompt stays", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "claude-opus-5-5"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "instructions": "you are codex, a coding agent based on gpt-5.", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]}, "expect_request": {"model": "m", "instructions": "y\u200bou are codex, a coding agent based on gpt-5.", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]}}, {"name": "Responses: the coding agent wording, any case; magpie's own Codex prompt stays", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "claude-opus-5-5"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "instructions": "you are codex, a coding agent based on gpt-5.", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]}, "expect_request": {"model": "m", "instructions": "y\u200bou are codex, a coding agent based on gpt-5.", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]}},
{"name": "Chat: Hermes Agent's earlier persona, broken after its H", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "chat"}, "request": {"model": "m", "messages": [{"role": "system", "content": "You are Hermes Agent, an intelligent AI assistant created by Nous Research. You are helpful, knowledgeable, and direct.\n\nYou are Hermes Agent, built by Nous Research."}, {"role": "user", "content": "hi"}]}, "expect_request": {"model": "m", "messages": [{"role": "system", "content": "You are H\u200bermes Agent, an intelligent AI assistant created by Nous Research. You are helpful, knowledgeable, and direct.\n\nYou are Hermes Agent, built by Nous Research."}, {"role": "user", "content": "hi"}]}},
{"name": "Gemini: systemInstruction", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "gemini"}, "request": {"systemInstruction": {"parts": [{"text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}, "contents": []}, "expect_request": {"systemInstruction": {"parts": [{"text": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK."}]}, "contents": []}}, {"name": "Gemini: systemInstruction", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "gemini"}, "request": {"systemInstruction": {"parts": [{"text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}, "contents": []}, "expect_request": {"systemInstruction": {"parts": [{"text": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK."}]}, "contents": []}},
{"name": "extraWords are broken too", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "options": {"extraWords": ["Claude Code"]}, "request": {"model": "m", "system": "You are Claude Code."}, "expect_request": {"model": "m", "system": "You are C\u200blaude Code."}}, {"name": "extraWords are broken too", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "options": {"extraWords": ["Claude Code"]}, "request": {"model": "m", "system": "You are Claude Code."}, "expect_request": {"model": "m", "system": "You are C\u200blaude Code."}},
{"name": "accounts says which subscriptions", "provider": {"id": "g", "name": "Gemini", "account": "gemini", "model": "m"}, "options": {"accounts": ["gemini"]}, "request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}, "expect_request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK."}}, {"name": "accounts says which subscriptions", "provider": {"id": "g", "name": "Gemini", "account": "gemini", "model": "m"}, "options": {"accounts": ["gemini"]}, "request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}, "expect_request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK."}},
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@magpie-community/middleware-antigravity-cloak", "name": "@magpie-community/middleware-antigravity-cloak",
"version": "0.1.1", "version": "0.1.2",
"description": "magpie gateway middleware: Antigravity stops turning Claude Code's and the Claude Agent SDK's system prompts away, and no other provider's request is changed", "description": "magpie gateway middleware: Antigravity stops turning Claude Code's and the Claude Agent SDK's system prompts away, and no other provider's request is changed",
"type": "module", "type": "module",
"files": ["antigravity-cloak.middleware.js", "README.md"], "files": ["antigravity-cloak.middleware.js", "README.md"],