[Feature]: Antigravity commits on every Stop; align with the threshold policy of the other hook hosts?
Summary
Antigravity commits the OpenViking session on every Stop that captured content, while most other hook hosts, and the Claude Code and Codex plugins, batch commits behind a threshold. This asks whether Antigravity should join the threshold family, and states the trade-off, because the current behaviour is documented as a deliberate "simplest exit behavior" choice. Everything below comes from reading the source and docs at main (1c25783ee), with no local measurements.
What the source shows
Commit policy per host, from each adapter or capture script:
| Host | When it commits on Stop |
Source |
|---|---|---|
| Claude Code | pending_tokens >= commitTokenThreshold |
examples/claude-code-memory-plugin/scripts/auto-capture.mjs:439 |
| Codex | pending_tokens >= commitTokenThreshold |
examples/codex-memory-plugin/scripts/auto-capture.mjs:74 |
| Cursor | capturedSinceCommit >= commitTurnThreshold |
examples/agent-hook-plugin/hosts/cursor.mjs:204 |
| Kimi Code, CodeBuddy Code, Qoder CLI | capturedSinceCommit >= commitTurnThreshold |
hosts/kimicode.mjs:79, hosts/codebuddy.mjs:87, hosts/qoder.mjs:83 |
| TRAE, TRAE CN | every Stop with captured content |
hosts/trae.mjs:50-52 |
| ZCode | every Stop with captured content |
hosts/zcode.mjs:52-55 |
| Antigravity | every Stop with captured content |
hosts/antigravity.mjs:170-171 |
commitTurnThreshold defaults to 8 (examples/memory-plugin-shared/lib/config-schema.mjs:160). The docs state the current split directly: "TRAE, TRAE CN, ZCode, and Antigravity have the simplest exit behavior because every turn commits, at the cost of a full archive and extraction on every Stop" (docs/en/agent-integrations/16-capability-reference.md:406), and "OPENVIKING_COMMIT_TURN_THRESHOLD: Cursor, Kimi Code, CodeBuddy Code, and Qoder CLI. TRAE, TRAE CN, ZCode, and Antigravity commit every turn" (:589).
So this is not a bug in one adapter. It is a policy split, and Antigravity sits on the every-turn side with TRAE and ZCode.
Trade-off
- Every-
Stopcommit means no exit hook is needed, because there is nothing left over. The docs record that Antigravity registers no exit hook (16-capability-reference.md:393). - A threshold lowers archive and extraction work per turn, but with no exit hook the tail below the threshold stays uncommitted until later messages arrive. The docs describe the same cost for Cursor: "Messages below the 8-message threshold wait for later messages in the same session" (
:387). - Codex avoids that cost with
SessionEnd,PreCompactand aSessionStartidle sweep (examples/codex-memory-plugin/scripts/session-start-commit.mjs:18-35). Antigravity has none of these hooks, so Cursor is the closer model than Codex.
Proposal
Reuse the existing shared helper shouldCommitCapture (hosts/incremental-turn-capture.mjs:162) and the capturedSinceCommit state field, as the Cursor, Kimi, CodeBuddy and Qoder adapters do, so Antigravity commits once commitTurnThreshold captured messages have accumulated. Keep a documented way to restore commit-every-Stop for users who prefer it. Antigravity's Stop payload also carries fullyIdle and terminationReason, which could later mark the end of a turn chain.
中文说明
概述
Antigravity 在每次捕获到内容的 Stop 上都会 commit OpenViking 会话,而多数其他 hook 宿主,以及 Claude Code 和 Codex 插件,都是攒到阈值才 commit。本 Issue 询问 Antigravity 是否应当并入「阈值批量」这一组,并写明取舍,因为目前的行为在文档里被明确写成有意为之的「最简单的退出行为」。以下内容全部来自对 main(1c25783ee)源码和文档的阅读,没有使用任何本机实测数据。
源码里看到的
各宿主在 Stop 时的 commit 条件,来自各适配器或捕获脚本:
| 宿主 | Stop 时何时 commit |
出处 |
|---|---|---|
| Claude Code | pending_tokens >= commitTokenThreshold |
examples/claude-code-memory-plugin/scripts/auto-capture.mjs:439 |
| Codex | pending_tokens >= commitTokenThreshold |
examples/codex-memory-plugin/scripts/auto-capture.mjs:74 |
| Cursor | capturedSinceCommit >= commitTurnThreshold |
examples/agent-hook-plugin/hosts/cursor.mjs:204 |
| Kimi Code、CodeBuddy Code、Qoder CLI | capturedSinceCommit >= commitTurnThreshold |
hosts/kimicode.mjs:79、hosts/codebuddy.mjs:87、hosts/qoder.mjs:83 |
| TRAE、TRAE CN | 每次捕获到内容的 Stop |
hosts/trae.mjs:50-52 |
| ZCode | 每次捕获到内容的 Stop |
hosts/zcode.mjs:52-55 |
| Antigravity | 每次捕获到内容的 Stop |
hosts/antigravity.mjs:170-171 |
commitTurnThreshold 默认值为 8(examples/memory-plugin-shared/lib/config-schema.mjs:160)。文档直接写明了现在的分法:「TRAE、TRAE CN、ZCode 和 Antigravity 的退出行为最简单,因为每一轮都 commit,代价是每次 Stop 都做一遍完整的归档和提取」(docs/en/agent-integrations/16-capability-reference.md:406),以及「OPENVIKING_COMMIT_TURN_THRESHOLD 只适用于 Cursor、Kimi Code、CodeBuddy Code 和 Qoder CLI,TRAE、TRAE CN、ZCode 和 Antigravity 每轮都 commit」(:589)。
所以这不是某一个适配器的 bug,而是一个策略分叉,Antigravity 和 TRAE、ZCode 站在「每轮 commit」这一边。
取舍
- 每次
Stop都 commit 就不需要退出钩子,因为不会有残留。文档记录 Antigravity 没有注册退出钩子(16-capability-reference.md:393)。 - 阈值方案能减少每轮的归档和提取,但没有退出钩子时,低于阈值的尾部要等后续消息到来才会提交。文档对 Cursor 描述了同样的代价:「低于 8 条阈值的消息要等同一会话后续消息」(
:387)。 - Codex 靠
SessionEnd、PreCompact和SessionStart空闲补扫避开这个代价(examples/codex-memory-plugin/scripts/session-start-commit.mjs:18-35)。Antigravity 一个都没有,所以 Cursor 才是更接近的参照,而不是 Codex。
建议
复用现有共享函数 shouldCommitCapture(hosts/incremental-turn-capture.mjs:162)和 capturedSinceCommit 状态字段,与 Cursor、Kimi、CodeBuddy、Qoder 适配器一致,让 Antigravity 在累计捕获 commitTurnThreshold 条消息后再 commit。同时保留一种有文档说明的方式,让偏好每次 Stop 都 commit 的用户可以恢复原行为。Antigravity 的 Stop 入参还带有 fullyIdle 和 terminationReason,以后可用来判断一串回合是否结束。
@fancyboi999 Hello, you can hold off on submitting the PR for now — I still have a few bugs under testing. It seems there may also be some issues with the submission threshold. Once I finish testing, I'll file an issue so we can discuss it together. I've also been using Antigravity recently, and I urgently need AGY to support the OV integration。thanks
Closing as not planned. Antigravity has no session-end or pre-compaction event, the same as TRAE and ZCode, and those hosts commit on every Stop too. Antigravity's current behaviour already matches them. The implementation attempt in #7800 is closed for the same reason.
中文说明
不做,关闭。Antigravity 和 TRAE、ZCode 一样没有会话结束或压缩前事件,而这两个宿主也是每个 Stop 都提交。Antigravity 现在的做法已经和它们一致。#7800 的实现也因同样的原因关闭。