Skip to content

Replay your coding agent sessions as a map and a timeline

feat: add Antigravity CLI parser

shubhook32b8e3bb93b7
diff --git a/README.md b/README.md
index c31d0e1..100a579 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
<a href="https://github.com/Entelligence-AI/agentplay/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/Entelligence-AI/agentplay?style=social"></a>
</p>
-**See what your coding agent actually did. Replay every session as a map and a timeline: what it read, what it edited, what failed, and what it shipped. Local, open source, works across Claude Code, Codex, Cursor, Copilot, OpenCode, Kiro and Gemini CLI.**
+**See what your coding agent actually did. Replay every session as a map and a timeline: what it read, what it edited, what failed, and what it shipped. Local, open source, works across Claude Code, Codex, Cursor, Copilot, OpenCode, Kiro, Gemini CLI and Antigravity CLI.**
```bash
uvx agentplay
@@ -141,6 +141,7 @@ Every view is a URL, so a link to a moment in a session reopens it for anyone wh
| **OpenCode** | `~/.local/share/opencode/opencode.db` | main lane only | per turn | SQLite, decoded locally |
| **Kiro** | `~/.kiro/sessions/*/*` | main lane only | per turn, where recorded | Sub-executions merged into the session |
| **Gemini CLI** | `~/.gemini/tmp/*/chats/session-*.jsonl` | main lane only | per turn | The project folder is read from the CLI's `.project_root` file |
+| **Antigravity CLI** (`agy`) | `~/.gemini/antigravity-cli/brain/*/.system_generated/logs/transcript_full.jsonl` | main lane only | per turn | Project folder and subagent links from `conversation_summaries.db`, copied and read locally, read-only. Subagents are listed as separate subagent sessions. Model not recorded yet |
"Main lane only" means the session's own tool calls are all there, but subagent work is not split out into separate lanes on the map.
@@ -275,6 +276,7 @@ All configuration is through environment variables. The examples in this README
| `AGENTPLAY_OPENCODE_HOMES` | `$XDG_DATA_HOME/opencode` | OpenCode data dirs |
| `AGENTPLAY_KIRO_HOMES` | `~/.kiro` | Kiro homes |
| `AGENTPLAY_GEMINI_HOMES` | `~/.gemini` | Gemini CLI homes |
+| `AGENTPLAY_ANTIGRAVITY_HOMES` | `~/.gemini/antigravity-cli` | Antigravity CLI homes |
| `AGENTPLAY_HMAC_KEY` | unset | key for `--path-mode hashed` |
| `DO_NOT_TRACK`, `AGENTPLAY_NO_NETWORK` | unset | set either to turn off the email signup and its one network call |
| `AGENTPLAY_SIGNUP_URL` | built in | where the signup sends an email (for testing; see [docs/signup-endpoint.md](docs/signup-endpoint.md)) |
diff --git a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/__init__.py b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/__init__.py
index 559071f..dc5c44c 100644
--- a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/__init__.py
+++ b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/__init__.py
@@ -16,6 +16,9 @@ returns the agent type by sniffing for marker lines:
- Kiro: synthesized header line with `type="kiro_session"`.
- Gemini CLI: header line with `sessionId` + `projectHash` and no `type`, or a
`type="gemini"` message (`~/.gemini/tmp/<project>/chats/session-*.jsonl`).
+- Antigravity CLI: step lines with an int `step_index`, a `source` and a step
+ `type` (`~/.gemini/antigravity-cli/brain/<uuid>/.system_generated/logs/
+ transcript_full.jsonl`).
- opencode: materialized records carrying a `message` object and a `parts` list.
Each parser exposes `parse_X(data, trace_id, user_id=None,
@@ -26,6 +29,7 @@ per-tool tool spans - so downstream code doesn't branch on agent.
from __future__ import annotations
+from agentplay._core.ingestion.coding_agent._sources.local.parsers.antigravity import parse_antigravity
from agentplay._core.ingestion.coding_agent._sources.local.parsers.base import (
AgentType,
detect_agent,
@@ -49,6 +53,7 @@ from agentplay._core.ingestion.coding_agent._sources.local.parsers.opencode impo
__all__ = [
"AgentType",
"detect_agent",
+ "parse_antigravity",
"parse_claude_code",
"parse_codex",
"parse_copilot",
diff --git a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/antigravity.py b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/antigravity.py
new file mode 100644
index 0000000..05c0366
--- /dev/null
+++ b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/antigravity.py
@@ -0,0 +1,403 @@
+"""Parse Antigravity CLI (`agy`) step logs into the universal SpanData shape.
+
+`agy` keeps each conversation under
+``~/.gemini/antigravity-cli/brain/<uuid>/.system_generated/logs/`` and writes
+one JSON line per step to ``transcript_full.jsonl``. (``transcript.jsonl`` holds
+the same steps with every tool arg stringified, so it is not read.) The shape
+below was read from real `agy` 1.4.6 sessions:
+
+ {"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT",
+ "status": "DONE", "created_at": <ISO>, "content": <wrapped prompt>}
+ {"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", ...,
+ "input_tokens", "cache_read_tokens", "output_tokens",
+ "thinking"?, "content"?, "tool_calls"?: [{"name", "args"}]}
+ {"step_index": 2, "source": "MODEL", "type": "GENERIC",
+ "status": "DONE" | "ERROR", "error"?: <text>, "content": <result text>}
+ {"step_index": n, "source": "SYSTEM", "type": "SYSTEM_MESSAGE", ...}
+
+# Turn boundaries
+
+A `USER_INPUT` opens a turn. Its `content` wraps the prompt in
+``<USER_REQUEST>`` and appends ``<ADDITIONAL_METADATA>`` (and sometimes
+``<USER_SETTINGS_CHANGE>``) blocks the CLI writes; only the request is the
+prompt. A subagent's conversation opens with a `SYSTEM_MESSAGE` (the delegated
+task) instead, which opens a turn with no prompt. Later `SYSTEM_MESSAGE` steps
+(a subagent reporting back, context after a resumed prompt) stay in the turn.
+
+# Pairing calls with results
+
+Tool calls carry no id. A planner step lists its calls in `tool_calls` (several
+when the model runs them in parallel), and the next `GENERIC` steps are their
+results, in the same order. A new planner step means the previous step's
+remaining calls never got a result: they are closed as UNSET.
+
+# Tool failures
+
+A failed edit and a denied permission are `GENERIC` steps with
+`status: "ERROR"` and an `error` text. A command that exits non-zero is still
+`DONE`; its result opens with a ``Command exited with code N.`` sentence (``The
+command exited ...`` in subagents), which is the failure signal. An ``Error:``
+line in the result is the program's own output, not a CLI label.
+
+# Tokens
+
+Per planner step: `input_tokens`, `cache_read_tokens`, `output_tokens`. No
+thinking count. Every captured session reported 0 cache reads, so whether input
+includes them is unconfirmed; this follows the Gemini CLI convention (cache
+reads are a subset of input).
+
+# Model
+
+The model is not in the step log, only in the conversation's protobuf
+`gen_metadata`, so it is left blank. TODO: read it once a stdlib-only decode of
+that blob is worth carrying.
+"""
+
+from __future__ import annotations
+
+from datetime import UTC, datetime
+import json
+import logging
+import re
+
+from agentplay._core.code_authorship import extract_edit_evidence
+from agentplay._core.ingestion.coding_agent._sources._jsonl_utils import (
+ as_count,
+ parse_jsonl_records,
+ safe_parse_dt,
+ source_attrs,
+)
+from agentplay._core.ingestion.coding_agent.spans import SpanData, TraceData
+from agentplay._core.ingestion.coding_agent.tool_taxonomy import aliases_for
+
+logger = logging.getLogger(__name__)
+
+# input.value / output.value truncation, matching every other local parser.
+_TRUNCATE = 2000
+
+# Raw -> canonical tool names live in the shared table (tool_taxonomy.py).
+_TOOL_ALIASES: dict[str, str] = aliases_for("antigravity-cli")
+
+_STEP_TYPES = ("USER_INPUT", "PLANNER_RESPONSE", "GENERIC", "SYSTEM_MESSAGE")
+
+# The only args that reach `input.value`, renamed to the canonical keys the map
+# builder reads. Everything else (`toolSummary`, `toolAction`, a subagent's
+# `Prompt`, `send_message`'s `Message`, line ranges, async flags) is dropped,
+# and so is every arg of a tool not listed here.
+_ARG_KEYS: dict[str, dict[str, str]] = {
+ "read_file": {"Path": "file_path"},
+ "view_file": {"AbsolutePath": "file_path"},
+ "write_file": {"Path": "file_path", "Content": "content"},
+ "edit_file": {"Path": "file_path", "Target": "old_string", "Replacement": "new_string"},
+ "run_command": {"CommandLine": "command", "Cwd": "workdir"},
+ "invoke_subagent": {"TypeName": "subagent_type", "Model": "model"},
+}
+
+_SHELL_TOOL = "run_command"
+
+_RE_USER_REQUEST = re.compile(r"<USER_REQUEST>\s*(.*?)\s*</USER_REQUEST>", re.DOTALL)
+_RE_EXIT_CODE = re.compile(r"^(?:The c|C)ommand exited with code (-?\d+)\.?\s*$")
+# Result labels after which the program's own output starts.
+_OUTPUT_LABELS = ("Command output:", "Output:", "Stdout:", "Stderr:")
+_RE_CREATED = re.compile(r"^Created At: (\S+)\s*$")
+_RE_COMPLETED = re.compile(r"^Completed At: (\S+)\s*$")
+
+
+def parse_antigravity(
+ data: bytes,
+ trace_id: str,
+ user_id: str | None = None,
+ project_name: str | None = None,
+) -> tuple[TraceData, list[SpanData]]:
+ """Parse an Antigravity CLI `transcript_full.jsonl` into a span tree.
+
+ Args:
+ data: raw JSONL bytes of one conversation's `transcript_full.jsonl`.
+ trace_id: the source-prefixed session id (`local:antigravity-cli:<uuid>`).
+ user_id: identifier to stash on the root span's `user.id`.
+ project_name: project name resolved by `LocalSource` from the
+ conversation's workspace in `conversation_summaries.db`. The step
+ log records no working directory.
+
+ Returns:
+ `(trace, all_spans)`; empty spans when the file holds no steps.
+ """
+ steps = _steps(parse_jsonl_records(data))
+ if not steps:
+ now = datetime.now(UTC)
+ return TraceData(trace_id=trace_id, start_time=now, end_time=now), []
+
+ times = [t for t in (safe_parse_dt(s.get("created_at")) for s in steps) if t is not None]
+ session_start = min(times) if times else datetime.now(UTC)
+ session_end = max(times) if times else session_start
+
+ root_id = f"{trace_id}:root"
+ all_spans: list[SpanData] = []
+ turn: dict | None = None
+ turn_num = 0
+ # Calls of the latest planner step still waiting for their `GENERIC` result.
+ pending: list[tuple[dict, dict, dict, int]] = []
+
+ def _open_turn(step: dict, prompt: str) -> dict:
+ nonlocal turn_num
+ turn_num += 1
+ ts = safe_parse_dt(step.get("created_at")) or session_start
+ return {
+ "span_id": f"{trace_id}:turn:{turn_num}",
+ "num": turn_num,
+ "_src": step,
+ "prompt": prompt,
+ "start": ts,
+ "end": ts,
+ "output": [],
+ "prompt_tokens": 0,
+ "completion_tokens": 0,
+ "cache_read": 0,
+ "cost_events": [],
+ "tools": [],
+ }
+
+ def _flush_pending() -> None:
+ for owner, planner, call, index in pending:
+ owner["tools"].append(_tool_span(trace_id, owner, planner, call, index, None))
+ pending.clear()
+
+ def _close_turn() -> None:
+ _flush_pending()
+ if turn is not None:
+ all_spans.append(_turn_span(trace_id, root_id, turn))
+ all_spans.extend(turn["tools"])
+
+ for step in steps:
+ stype = step.get("type")
+ ts = safe_parse_dt(step.get("created_at"))
+
+ if stype == "USER_INPUT":
+ _close_turn()
+ turn = _open_turn(step, _user_prompt(step.get("content")))
+ continue
+ if stype == "SYSTEM_MESSAGE":
+ if turn is None:
+ # A subagent's delegated task: a turn, but not a user prompt.
+ turn = _open_turn(step, "")
+ elif stype == "PLANNER_RESPONSE":
+ if turn is None:
+ turn = _open_turn(step, "")
+ _flush_pending()
+ text = step.get("content")
+ if isinstance(text, str) and text:
+ turn["output"].append(text)
+ _add_usage(turn, step)
+ pending.extend((turn, step, call, i) for i, call in enumerate(_tool_calls(step)))
+ elif stype == "GENERIC" and pending:
+ owner, planner, call, index = pending.pop(0)
+ owner["tools"].append(_tool_span(trace_id, owner, planner, call, index, step))
+
+ if turn is not None and ts is not None and ts > turn["end"]:
+ turn["end"] = ts
+ _close_turn()
+
+ root_span = SpanData(
+ span_id=root_id,
+ trace_id=trace_id,
+ parent_id=None,
+ name="Session",
+ span_kind="CHAIN",
+ status_code="OK",
+ start_time=session_start,
+ end_time=session_end,
+ attributes={
+ "user.id": user_id or "",
+ # Not in the step log (see the module docstring).
+ "llm.model_name": "",
+ "session.id": trace_id,
+ "project.name": project_name or "",
+ "harness.agent_session_id": trace_id.rsplit(":", 1)[-1],
+ "harness.agent_version": "",
+ },
+ )
+ all_spans.insert(0, root_span)
+ trace = TraceData(
+ trace_id=trace_id,
+ start_time=session_start,
+ end_time=session_end,
+ spans=all_spans,
+ )
+ return trace, all_spans
+
+
+def _steps(records: list[dict]) -> list[dict]:
+ """Known steps ordered by `step_index`, keeping the last copy of each index."""
+ latest: dict[int, dict] = {}
+ for record in records:
+ index = record.get("step_index")
+ if (
+ isinstance(index, int)
+ and not isinstance(index, bool)
+ and record.get("type") in _STEP_TYPES
+ ):
+ latest[index] = record
+ return [latest[i] for i in sorted(latest)]
+
+
+def _tool_calls(step: dict) -> list[dict]:
+ calls = step.get("tool_calls")
+ return [c for c in calls if isinstance(c, dict)] if isinstance(calls, list) else []
+
+
+def _user_prompt(content: object) -> str:
+ """The prompt inside the CLI's ``<USER_REQUEST>`` wrapper."""
+ if not isinstance(content, str):
+ return ""
+ match = _RE_USER_REQUEST.search(content)
+ return match.group(1) if match else content.strip()
+
+
+def _add_usage(turn: dict, step: dict) -> None:
+ """Fold one planner step's token counts into its turn."""
+ prompt = as_count(step.get("input_tokens"))
+ cache_read = min(as_count(step.get("cache_read_tokens")), prompt)
+ completion = as_count(step.get("output_tokens"))
+ if not prompt and not completion:
+ return
+ turn["prompt_tokens"] += prompt
+ turn["completion_tokens"] += completion
+ turn["cache_read"] += cache_read
+ created = step.get("created_at")
+ turn["cost_events"].append(
+ {
+ "timestamp": created if isinstance(created, str) else "",
+ "request_id": None,
+ "message_id": f"antigravity:{step.get('step_index')}",
+ "model": "",
+ "input_tokens": prompt - cache_read,
+ "cache_read_tokens": cache_read,
+ "cache_write_5m_tokens": 0,
+ "cache_write_1h_tokens": 0,
+ "output_tokens": completion,
+ "reasoning_tokens": 0,
+ "usage_basis": "message_tokens",
+ **source_attrs(step),
+ }
+ )
+
+
+def _turn_span(trace_id: str, root_id: str, turn: dict) -> SpanData:
+ prompt = turn["prompt_tokens"]
+ cache_read = turn["cache_read"]
+ span = SpanData(
+ span_id=turn["span_id"],
+ trace_id=trace_id,
+ parent_id=root_id,
+ name=f"Turn {turn['num']}",
+ span_kind="CHAIN",
+ status_code="OK",
+ start_time=turn["start"],
+ end_time=turn["end"],
+ attributes={
+ "input.value": turn["prompt"][:_TRUNCATE],
+ "output.value": "\n".join(turn["output"])[:_TRUNCATE],
+ # The step log records no working directory; LocalSource stamps
+ # the workspace it read from `conversation_summaries.db`.
+ "cwd": "",
+ "llm.token_count.prompt": prompt,
+ "llm.token_count.completion": turn["completion_tokens"],
+ "llm.token_count.reasoning": 0,
+ "llm.token_count.cache_read": cache_read,
+ "llm.token_count.cache_write": 0,
+ "llm.token_count.input_fresh": max(0, prompt - cache_read),
+ "llm.cost_events": turn["cost_events"],
+ "llm.model_name": "",
+ },
+ )
+ span.attributes.update(source_attrs(turn["_src"]))
+ return span
+
+
+def _tool_span(
+ trace_id: str,
+ turn: dict,
+ planner: dict,
+ call: dict,
+ index: int,
+ result: dict | None,
+) -> SpanData:
+ raw_name = call.get("name")
+ raw_name = raw_name if isinstance(raw_name, str) and raw_name else "unknown"
+ tool_name = _TOOL_ALIASES.get(raw_name, raw_name)
+ input_value = json.dumps(_normalized_args(raw_name, call.get("args")))
+
+ content = result.get("content") if result is not None else None
+ content = content if isinstance(content, str) else ""
+ if result is None:
+ status_code = "UNSET"
+ elif result.get("status") == "ERROR" or result.get("error"):
+ status_code = "ERROR"
+ elif raw_name == _SHELL_TOOL and _exit_code(content) not in (None, 0):
+ status_code = "ERROR"
+ else:
+ status_code = "OK"
+ # An error result repeats the `error` text, which can quote the command or
+ # the edit target; it is never kept.
+ output_value = content if status_code == "OK" else ""
+
+ start = _labelled_time(content, _RE_CREATED) or safe_parse_dt(planner.get("created_at"))
+ start = start or turn["start"]
+ end = _labelled_time(content, _RE_COMPLETED)
+ if end is None and result is not None:
+ end = safe_parse_dt(result.get("created_at"))
+ if end is None or end < start:
+ end = start
+
+ span = SpanData(
+ span_id=f"{trace_id}:tool:{planner.get('step_index')}:{index}",
+ trace_id=trace_id,
+ parent_id=turn["span_id"],
+ name=tool_name,
+ span_kind="CHAIN",
+ status_code=status_code,
+ start_time=start,
+ end_time=end,
+ attributes={
+ "tool.name": tool_name,
+ "cwd": "",
+ "input.value": input_value[:_TRUNCATE],
+ "output.value": output_value[:_TRUNCATE],
+ "code.edit_evidence": extract_edit_evidence(
+ tool_name, input_value, successful=status_code == "OK"
+ ),
+ },
+ )
+ span.attributes.update(source_attrs(result if result is not None else planner))
+ return span
+
+
+def _normalized_args(raw_name: str, args: object) -> dict[str, str]:
+ """The whitelisted string args of one call, under canonical key names."""
+ keys = _ARG_KEYS.get(raw_name, {})
+ if not isinstance(args, dict):
+ return {}
+ return {new: args[old] for old, new in keys.items() if isinstance(args.get(old), str)}
+
+
+def _exit_code(content: str) -> int | None:
+ """The CLI's exit-code sentence, read only before the program's output starts."""
+ for line in content.splitlines():
+ if line.strip() in _OUTPUT_LABELS:
+ return None
+ match = _RE_EXIT_CODE.match(line)
+ if match:
+ return int(match.group(1))
+ return None
+
+
+def _labelled_time(content: str, pattern: re.Pattern[str]) -> datetime | None:
+ """A ``Created At:`` / ``Completed At:`` timestamp from the result's header lines."""
+ for line in content.splitlines()[:2]:
+ match = pattern.match(line)
+ if match:
+ return safe_parse_dt(match.group(1))
+ return None
+
+
+__all__ = ["parse_antigravity"]
diff --git a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/base.py b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/base.py
index aabd8e0..a68691f 100644
--- a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/base.py
+++ b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/base.py
@@ -25,6 +25,10 @@ class AgentType(StrEnum):
CURSOR = "cursor"
KIRO = "kiro"
GEMINI_CLI = "gemini-cli"
+ ANTIGRAVITY_CLI = "antigravity-cli"
+
+
+_ANTIGRAVITY_STEP_TYPES = ("USER_INPUT", "PLANNER_RESPONSE", "GENERIC", "SYSTEM_MESSAGE")
def detect_agent(data: bytes) -> AgentType | None:
@@ -85,6 +89,17 @@ def detect_agent(data: bytes) -> AgentType | None:
if line_type == "gemini" and isinstance(obj.get("id"), str):
return AgentType.GEMINI_CLI
+ # Antigravity CLI (`agy`): every step-log line carries an int
+ # `step_index`, a `source` string and a step `type`. No other agent
+ # writes `step_index`, and these upper-case types are agy's own.
+ if (
+ line_type in _ANTIGRAVITY_STEP_TYPES
+ and isinstance(obj.get("step_index"), int)
+ and not isinstance(obj.get("step_index"), bool)
+ and isinstance(obj.get("source"), str)
+ ):
+ return AgentType.ANTIGRAVITY_CLI
+
# Codex: session_meta with codex originator.
if line_type == "session_meta":
payload = obj.get("payload")
diff --git a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py
index b081d43..702834d 100644
--- a/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py
+++ b/python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py
@@ -1,5 +1,7 @@
"""Local filesystem source — walks ~/.claude / ~/.codex / ~/.gemini / Copilot dirs.
+Also walks ~/.gemini/antigravity-cli (Antigravity CLI step logs).
+
Indexes JSONL session files under per-agent homes, detects the agent
from the file head, and emits the universal `SpanData` shape via the
matching parser. Multi-agent by design — drop a Codex session next to
@@ -17,7 +19,11 @@ import logging
import os
from pathlib import Path
import re
+import shutil
+import sqlite3
+import tempfile
from typing import Any
+from urllib.parse import unquote, urlsplit
from agentplay._core.ingestion.coding_agent._paths import to_posix
from agentplay._core.ingestion.coding_agent._sources._base import (
@@ -34,6 +40,7 @@ from agentplay._core.ingestion.coding_agent._sources.local.parsers import (
parse_copilot_vscode,
parse_cursor_agent_transcript,
parse_cursor_store,
+ parse_antigravity,
parse_gemini,
parse_kiro,
parse_opencode,
@@ -1192,6 +1199,87 @@ def _cwd_from_gemini_project(jsonl_file: Path, header: dict | None) -> str | Non
return root
+def _path_from_file_uri(uri: object) -> str | None:
+ """A local path from a ``file://`` URI, the same on every OS.
+
+ ``file:///Users/dev/project`` gives ``/Users/dev/project`` and
+ ``file:///C:/Users/dev/project`` gives ``C:/Users/dev/project`` (no leading
+ slash before a drive letter), whichever OS reads it: the session may have
+ been recorded on another machine. A host part (``file://server/share``) is
+ kept as a UNC-style ``//server/share`` prefix.
+ """
+ if not isinstance(uri, str) or not uri.startswith("file:"):
+ return None
+ parts = urlsplit(uri)
+ path = unquote(parts.path)
+ if re.match(r"^/[A-Za-z]:", path):
+ path = path[1:]
+ if parts.netloc and parts.netloc != "localhost":
+ path = f"//{parts.netloc}{path}"
+ return path or None
+
+
+@dataclass(frozen=True)
+class _AntigravitySummary:
+ """The structural columns of one `conversation_summaries` row."""
+
+ cwd: str | None
+ parent_id: str | None
+
+
+# Only structural columns. `title`, `preview` and `raw_summary` are prompt or
+# model text and are never selected.
+_ANTIGRAVITY_SUMMARY_SQL = (
+ "SELECT conversation_id, workspace_uris, parent_conversation_id FROM conversation_summaries"
+)
+
+
+def _antigravity_summaries(home: Path) -> dict[str, _AntigravitySummary]:
+ """cwd and parent conversation per conversation id, from `conversation_summaries.db`.
+
+ The live database is in WAL mode and may be open in `agy`, so it is copied
+ (with its `-wal` / `-shm` files when present) to a temporary directory and
+ opened read-only there. Missing or unreadable: an empty dict, and sessions
+ are indexed without a cwd.
+ """
+ db = home / "conversation_summaries.db"
+ if not db.is_file():
+ return {}
+ rows: list[tuple] = []
+ try:
+ with tempfile.TemporaryDirectory(prefix="agentplay-antigravity-") as tmp:
+ tmp_dir = Path(tmp)
+ for suffix in ("", "-wal", "-shm"):
+ src = db.with_name(db.name + suffix)
+ if src.is_file():
+ shutil.copyfile(src, tmp_dir / src.name)
+ conn = sqlite3.connect(f"{(tmp_dir / db.name).as_uri()}?mode=ro", uri=True)
+ try:
+ rows = conn.execute(_ANTIGRAVITY_SUMMARY_SQL).fetchall()
+ finally:
+ # Closed before the directory is removed: Windows cannot delete an open file.
+ conn.close()
+ except (OSError, sqlite3.Error) as exc:
+ logger.debug("antigravity-cli: conversation summaries unreadable: %s", exc)
+ return {}
+ out: dict[str, _AntigravitySummary] = {}
+ for conversation_id, workspace_uris, parent_id in rows:
+ if not isinstance(conversation_id, str) or not conversation_id:
+ continue
+ try:
+ uris = json.loads(workspace_uris) if isinstance(workspace_uris, str) else None
+ except ValueError:
+ uris = None
+ cwd = None
+ for uri in uris if isinstance(uris, list) else []:
+ cwd = _path_from_file_uri(uri)
+ if cwd:
+ break
+ parent = parent_id if isinstance(parent_id, str) and parent_id else None
+ out[conversation_id] = _AntigravitySummary(cwd=cwd, parent_id=parent)
+ return out
+
+
def _project_from_cwd(cwd: str) -> str | None:
"""Project name from the transcript's cwd.
@@ -1319,6 +1407,7 @@ class LocalSource:
copilot_homes: list[Path] | None = None,
copilot_vscode_homes: list[Path] | None = None,
gemini_homes: list[Path] | None = None,
+ antigravity_homes: list[Path] | None = None,
) -> None:
self.claude_code_homes = claude_code_homes
self.codex_homes = codex_homes
@@ -1355,6 +1444,11 @@ class LocalSource:
# comes from the header's `sessionId`, the cwd from the project
# folder's `.project_root` (see `_cwd_from_gemini_project`).
self.gemini_homes = gemini_homes or []
+ # Antigravity CLI keeps one step log per conversation:
+ # `<home>/brain/<uuid>/.system_generated/logs/transcript_full.jsonl`.
+ # cwd and subagent parent come from `<home>/conversation_summaries.db`
+ # (see `_antigravity_summaries`).
+ self.antigravity_homes = antigravity_homes or []
# Per-home identity stamp (`<home>/_manifest/*.json`). It carries a
# user_uuid/email/github_username used to detect duplicated sessions
# that belong to different owners. Missing manifest → empty dict.
@@ -1379,6 +1473,7 @@ class LocalSource:
*self.copilot_homes,
*self.copilot_vscode_homes,
*self.gemini_homes,
+ *self.antigravity_homes,
):
identity = _load_manifest_identity(home)
if identity is not None:
@@ -1595,6 +1690,21 @@ class LocalSource:
if ref:
_index_put(index, ref[0], ref[1], newest)
+ # Antigravity CLI: `<home>/brain/<uuid>/.system_generated/logs/transcript_full.jsonl`.
+ # Only `brain/` is walked, so Gemini CLI's `tmp/` (a sibling under
+ # `~/.gemini`) and the Antigravity IDE's `~/.gemini/antigravity/` are
+ # never reached; `detect_agent` rejects anything else.
+ for home in self.antigravity_homes:
+ brain_dir = home / "brain"
+ if not brain_dir.is_dir():
+ logger.debug("Skipping non-existent path: %s", brain_dir)
+ continue
+ summaries = _antigravity_summaries(home)
+ for jsonl_file in brain_dir.glob("*/.system_generated/logs/transcript_full.jsonl"):
+ ref = self._index_antigravity_file(jsonl_file, home=home, summaries=summaries)
+ if ref:
+ _index_put(index, ref[0], ref[1], newest)
+
_carry_collision_mtimes(index, newest)
self._file_index = index
logger.info(
@@ -1607,7 +1717,8 @@ class LocalSource:
+ len(self.kiro_homes)
+ len(self.copilot_homes)
+ len(self.copilot_vscode_homes)
- + len(self.gemini_homes),
+ + len(self.gemini_homes)
+ + len(self.antigravity_homes),
)
return index
@@ -1989,6 +2100,58 @@ class LocalSource:
home=home,
)
+ def _index_antigravity_file(
+ self,
+ jsonl_file: Path,
+ *,
+ home: Path,
+ summaries: dict[str, _AntigravitySummary],
+ ) -> tuple[str, _FileRef] | None:
+ """Index one Antigravity CLI `transcript_full.jsonl`."""
+ if not jsonl_file.is_file():
+ return None
+ size = jsonl_file.stat().st_size
+ if size == 0:
+ self._record_discovery("antigravity-cli", "empty_or_unreadable")
+ return None
+ try:
+ head = _read_head(jsonl_file, stop_when=_agent_detected)
+ except OSError:
+ self._record_discovery("antigravity-cli", "empty_or_unreadable")
+ return None
+
+ agent = detect_agent(head)
+ if agent is None:
+ logger.warning(
+ "agent detection failed for %s (%d bytes); session skipped",
+ jsonl_file,
+ size,
+ )
+ self._record_discovery("antigravity-cli", "detection_failed")
+ return None
+ if agent != AgentType.ANTIGRAVITY_CLI:
+ self._record_discovery("antigravity-cli", "different_agent")
+ return None
+
+ # brain/<uuid>/.system_generated/logs/transcript_full.jsonl
+ native_id = jsonl_file.parents[2].name
+ session_id = f"local:{agent}:{native_id}"
+ mtime = datetime.fromtimestamp(jsonl_file.stat().st_mtime, tz=UTC)
+ summary = summaries.get(native_id)
+ cwd = summary.cwd if summary else None
+ parent = summary.parent_id if summary else None
+
+ self._record_discovery("antigravity-cli", "indexed")
+ return session_id, _FileRef(
+ path=jsonl_file,
+ agent=agent,
+ mtime=mtime,
+ project_name=_project_from_cwd(cwd) if cwd else None,
+ cwd=cwd,
+ home=home,
+ parent_session_id=f"local:{agent}:{parent}" if parent else None,
+ )
+
def _index_copilot_file(
self,
jsonl_file: Path,
@@ -2401,6 +2564,7 @@ class LocalSource:
AgentType.CURSOR: parse_cursor_store,
AgentType.KIRO: parse_kiro,
AgentType.GEMINI_CLI: parse_gemini,
+ AgentType.ANTIGRAVITY_CLI: parse_antigravity,
}
# Cursor's `agent-transcripts` narrative shares the `cursor` agent label
@@ -2419,9 +2583,10 @@ class LocalSource:
user_id=user_id,
project_name=ref.project_name,
)
- if ref.agent == AgentType.GEMINI_CLI and ref.cwd:
- # Gemini CLI's transcript records no cwd; the indexer read the
- # project root from `.project_root`. Every call ran there.
+ if ref.agent in (AgentType.GEMINI_CLI, AgentType.ANTIGRAVITY_CLI) and ref.cwd:
+ # Neither transcript records a cwd; the indexer read the project
+ # root from Gemini's `.project_root` or Antigravity's
+ # `conversation_summaries.db`. Every call ran there.
for span in spans:
if span.parent_id is not None and not span.attributes.get("cwd"):
span.attributes["cwd"] = ref.cwd
@@ -2429,6 +2594,11 @@ class LocalSource:
root = next((span for span in spans if span.parent_id is None), None)
if root is not None:
root.attributes.update({"git.branch": branch, "git.branches": branches})
+ if ref.parent_session_id:
+ # A subagent's own conversation (Antigravity CLI): the map
+ # builder marks it a subagent session under its parent.
+ root.attributes["harness.session_role"] = "subagent"
+ root.attributes["harness.parent_session_id"] = ref.parent_session_id
# A cloud-run session stores selected-repository metadata in a sidecar
# beside the unmodified transcript, whose remote cwd may be absent.
repo = metadata.get("repo_name") if isinstance(metadata, dict) else None
@@ -2530,7 +2700,17 @@ class LocalSource:
class _FileRef:
"""Internal pointer: session_id → file path + index-time metadata."""
- __slots__ = ("agent", "branch", "cwd", "home", "mtime", "path", "project_name", "subformat")
+ __slots__ = (
+ "agent",
+ "branch",
+ "cwd",
+ "home",
+ "mtime",
+ "parent_session_id",
+ "path",
+ "project_name",
+ "subformat",
+ )
def __init__(
self,
@@ -2542,6 +2722,7 @@ class _FileRef:
branch: str | None = None,
home: Path | None = None,
subformat: str | None = None,
+ parent_session_id: str | None = None,
):
self.path = path
self.agent = agent
@@ -2562,6 +2743,9 @@ class _FileRef:
# The home dir under which this file was discovered — used to
# look up the manifest identity for that home.
self.home = home
+ # Session id of the conversation that spawned this one, for agents
+ # that store a subagent as its own conversation (Antigravity CLI).
+ self.parent_session_id = parent_session_id
__all__ = ["LocalSource", "ManifestIdentity"]
diff --git a/python/src/agentplay/_core/ingestion/coding_agent/tool_taxonomy.py b/python/src/agentplay/_core/ingestion/coding_agent/tool_taxonomy.py
index 7f1c640..e1b9ce6 100644
--- a/python/src/agentplay/_core/ingestion/coding_agent/tool_taxonomy.py
+++ b/python/src/agentplay/_core/ingestion/coding_agent/tool_taxonomy.py
@@ -246,7 +246,34 @@ _GEMINI_CLI: dict[str, str] = {
"invoke_agent": "Task",
}
+# Antigravity CLI (`agy`) built-in tool names. `read_file`, `view_file`,
+# `write_file`, `edit_file`, `run_command` and `invoke_subagent` were seen in
+# real agy 1.4.6 sessions (`view_file` in a subagent); `edit_file` is an
+# in-place Target/Replacement edit and `write_file` writes the whole file.
+# `write_to_file`, `replace_file_content`, `multi_replace_file_content`,
+# `grep_search`, `find_by_name`, `list_dir`, `search_web` and
+# `read_url_content` are names in the 1.4.6 binary that no captured session
+# used. `send_message` (a subagent reporting to its parent) and other meta
+# tools pass through unaliased.
+_ANTIGRAVITY_CLI: dict[str, str] = {
+ "run_command": "Bash",
+ "read_file": "Read",
+ "view_file": "Read",
+ "edit_file": "Edit",
+ "replace_file_content": "Edit",
+ "multi_replace_file_content": "Edit",
+ "write_file": "Write",
+ "write_to_file": "Write",
+ "grep_search": "Grep",
+ "find_by_name": "Glob",
+ "list_dir": "ListDir",
+ "search_web": "WebSearch",
+ "read_url_content": "WebFetch",
+ "invoke_subagent": "Task",
+}
+
TOOL_ALIASES: dict[str, dict[str, str]] = {
+ "antigravity-cli": _ANTIGRAVITY_CLI,
"codex": _CODEX,
"gemini-cli": _GEMINI_CLI,
"cursor": _CURSOR,
diff --git a/python/src/agentplay/discover.py b/python/src/agentplay/discover.py
index e021db5..bfacd84 100644
--- a/python/src/agentplay/discover.py
+++ b/python/src/agentplay/discover.py
@@ -14,6 +14,7 @@ Cursor ``~/.cursor`` agent transcripts, ``chats/*/store.db``, decod
OpenCode ``~/.local/share/opencode/opencode.db`` decoded
Kiro ``~/.kiro/sessions`` decoded
Gemini CLI ``~/.gemini/tmp/*/chats/session-*.jsonl`` file
+Antigravity CLI ``~/.gemini/antigravity-cli/brain/*`` step logs file
================= ===================================================== ===========
"Decoded" agents keep sessions in a database; :mod:`agentplay.materialize`
@@ -43,7 +44,17 @@ from ._util import captured
logger = logging.getLogger("agentplay.discover")
-AGENTS = ("claude-code", "codex", "cursor", "copilot", "copilot-vscode", "opencode", "kiro", "gemini-cli")
+AGENTS = (
+ "claude-code",
+ "codex",
+ "cursor",
+ "copilot",
+ "copilot-vscode",
+ "opencode",
+ "kiro",
+ "gemini-cli",
+ "antigravity-cli",
+)
# Transcripts above this size are skipped rather than parsed (a 20k-event map cap
# applies anyway; this keeps one pathological file from stalling a run).
@@ -86,6 +97,7 @@ class Homes:
opencode: list[Path]
kiro: list[Path]
gemini_cli: list[Path]
+ antigravity_cli: list[Path]
@classmethod
def default(cls) -> Homes:
@@ -99,6 +111,7 @@ class Homes:
opencode=_homes_from_env("AGENTPLAY_OPENCODE_HOMES", _opencode_data_dirs()),
kiro=_homes_from_env("AGENTPLAY_KIRO_HOMES", ["~/.kiro"]),
gemini_cli=_homes_from_env("AGENTPLAY_GEMINI_HOMES", ["~/.gemini"]),
+ antigravity_cli=_homes_from_env("AGENTPLAY_ANTIGRAVITY_HOMES", ["~/.gemini/antigravity-cli"]),
)
def present(self) -> dict[str, list[Path]]:
@@ -113,6 +126,7 @@ class Homes:
("opencode", self.opencode),
("kiro", self.kiro),
("gemini-cli", self.gemini_cli),
+ ("antigravity-cli", self.antigravity_cli),
):
found = [p for p in paths if p.is_dir()]
if found:
@@ -193,6 +207,7 @@ def local_source(homes: Homes, agents: set[str]) -> Any:
copilot_homes=pick("copilot", homes.copilot),
copilot_vscode_homes=pick("copilot-vscode", homes.copilot_vscode),
gemini_homes=pick("gemini-cli", homes.gemini_cli),
+ antigravity_homes=pick("antigravity-cli", homes.antigravity_cli),
)
@@ -268,6 +283,10 @@ def build_map(c: Candidate, source: Any, *, path_mode: str = "relative",
spans = source.get_spans_by_session(c.session_id)
if not spans:
raise SkipSession("no_spans")
+ # A subagent stored as its own conversation (Antigravity CLI) carries its
+ # role and parent on the root span.
+ root = next((s for s in spans if s.parent_id is None), None)
+ root_attrs = root.attributes if root is not None else {}
return builder.build_map_from_spans(
spans,
session_id=c.session_id,
@@ -275,6 +294,8 @@ def build_map(c: Candidate, source: Any, *, path_mode: str = "relative",
path_mode=path_mode,
hmac_key=hmac_key,
cli_version=version,
+ role=root_attrs.get("harness.session_role") or None,
+ parent_session_id=root_attrs.get("harness.parent_session_id") or None,
started_at_hint=c.mtime or None,
)
diff --git a/python/tests/core/fixtures/antigravity/create_file.jsonl b/python/tests/core/fixtures/antigravity/create_file.jsonl
new file mode 100644
index 0000000..efd50a6
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/create_file.jsonl
@@ -0,0 +1,32 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:19:18Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:18Z", "input_tokens": 6768, "cache_read_tokens": 0, "output_tokens": 212, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "ls ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-1"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:19:23Z", "content": "Created At: 2026-10-23T10:19:23+00:00\nCompleted At: 2026-10-23T10:19:24+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-2"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:24Z", "input_tokens": 7320, "cache_read_tokens": 0, "output_tokens": 68, "tool_calls": [{"name": "read_file", "args": {"EndLine": 50, "Path": "/Users/dev/project/file_1.js", "StartLine": 1}}]}
+{"step_index": 4, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:19:27Z", "content": "Created At: 2026-10-23T10:19:27+00:00\nCompleted At: 2026-10-23T10:19:27+00:00\nOUTPUT-PLACEHOLDER-3"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:27Z", "input_tokens": 7668, "cache_read_tokens": 0, "output_tokens": 714, "thinking": "THOUGHT-PLACEHOLDER-1", "tool_calls": [{"name": "run_command", "args": {"CommandLine": "git ARG-1 ARG-2 ARG-3 ARG-4", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-4"}}]}
+{"step_index": 6, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:19:36Z", "content": "Created At: 2026-10-23T10:19:36+00:00\nCompleted At: 2026-10-23T10:19:37+00:00\nCommand exited with code 128.\n\nCommand output:\nOUTPUT-PLACEHOLDER-5"}
+{"step_index": 7, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:37Z", "input_tokens": 8484, "cache_read_tokens": 0, "output_tokens": 44, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "git ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-6"}}]}
+{"step_index": 8, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:19:44Z", "content": "Created At: 2026-10-23T10:19:44+00:00\nCompleted At: 2026-10-23T10:19:44+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-7\n\nOUTPUT-PLACEHOLDER-8\n\nOUTPUT-PLACEHOLDER-9\n\nOUTPUT-PLACEHOLDER-10"}
+{"step_index": 9, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:44Z", "input_tokens": 8696, "cache_read_tokens": 0, "output_tokens": 84, "tool_calls": [{"name": "read_file", "args": {"EndLine": 50, "Path": "/Users/dev/project/file_2.md", "StartLine": 1}}]}
+{"step_index": 10, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:19:48Z", "content": "Created At: 2026-10-23T10:19:48+00:00\nCompleted At: 2026-10-23T10:19:49+00:00\nOUTPUT-PLACEHOLDER-11"}
+{"step_index": 11, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:49Z", "input_tokens": 8901, "cache_read_tokens": 0, "output_tokens": 60, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-12"}}]}
+{"step_index": 12, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:19:53Z", "content": "Created At: 2026-10-23T10:19:53+00:00\nCompleted At: 2026-10-23T10:19:53+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-13"}
+{"step_index": 13, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:53Z", "input_tokens": 9055, "cache_read_tokens": 0, "output_tokens": 378, "thinking": "THOUGHT-PLACEHOLDER-2", "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1 ARG-2 ARG-3 ARG-4 ARG-5 ARG-6 ARG-7 ARG-8 ARG-9", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-14"}}]}
+{"step_index": 14, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:19:59Z", "content": "Created At: 2026-10-23T10:19:59+00:00\nCompleted At: 2026-10-23T10:19:59+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-15"}
+{"step_index": 15, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:19:59Z", "input_tokens": 9523, "cache_read_tokens": 0, "output_tokens": 77, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1 ARG-2 ARG-3 ARG-4 ARG-5 ARG-6 ARG-7", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-16"}}]}
+{"step_index": 16, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:03Z", "content": "Created At: 2026-10-23T10:20:03+00:00\nCompleted At: 2026-10-23T10:20:04+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-17"}
+{"step_index": 17, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:04Z", "input_tokens": 9705, "cache_read_tokens": 0, "output_tokens": 381, "thinking": "THOUGHT-PLACEHOLDER-3", "tool_calls": [{"name": "run_command", "args": {"CommandLine": "find ARG-1 ARG-2 ARG-3", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-18"}}]}
+{"step_index": 18, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:10Z", "content": "Created At: 2026-10-23T10:20:10+00:00\nCompleted At: 2026-10-23T10:20:10+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-19"}
+{"step_index": 19, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:10Z", "input_tokens": 10249, "cache_read_tokens": 0, "output_tokens": 87, "tool_calls": [{"name": "read_file", "args": {"EndLine": 50, "Path": "/Users/dev/project/file_3.md", "StartLine": 1}}]}
+{"step_index": 20, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:14Z", "content": "Created At: 2026-10-23T10:20:14+00:00\nCompleted At: 2026-10-23T10:20:14+00:00\nOUTPUT-PLACEHOLDER-20"}
+{"step_index": 21, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:14Z", "input_tokens": 11336, "cache_read_tokens": 0, "output_tokens": 727, "thinking": "THOUGHT-PLACEHOLDER-4", "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1 ARG-2 ARG-3 ARG-4 ARG-5 ARG-6 ARG-7 ARG-8 ARG-9", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-21"}}]}
+{"step_index": 22, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:22Z", "content": "Created At: 2026-10-23T10:20:22+00:00\nCompleted At: 2026-10-23T10:20:23+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-22"}
+{"step_index": 23, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:23Z", "input_tokens": 12158, "cache_read_tokens": 0, "output_tokens": 110, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "rm ARG-1 ARG-2", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-23"}}]}
+{"step_index": 24, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:27Z", "content": "Created At: 2026-10-23T10:20:27+00:00\nCompleted At: 2026-10-23T10:20:27+00:00\nCommand exited with code 0.\n\nOUTPUT-PLACEHOLDER-24"}
+{"step_index": 25, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:27Z", "input_tokens": 12355, "cache_read_tokens": 0, "output_tokens": 635, "thinking": "THOUGHT-PLACEHOLDER-5", "tool_calls": [{"name": "write_file", "args": {"Content": "OUTPUT-PLACEHOLDER-25\nOUTPUT-PLACEHOLDER-25\nOUTPUT-PLACEHOLDER-25\nOUTPUT-PLACEHOLDER-25\nOUTPUT-PLACEHOLDER-25\nOUTPUT-PLACEHOLDER-25\n", "Path": "/Users/dev/project/file_4.js"}}]}
+{"step_index": 26, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:35Z", "content": "Created At: 2026-10-23T10:20:35+00:00\nCompleted At: 2026-10-23T10:20:36+00:00\nOUTPUT-PLACEHOLDER-26"}
+{"step_index": 27, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:36Z", "input_tokens": 13066, "cache_read_tokens": 0, "output_tokens": 72, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1 ARG-2 ARG-3 ARG-4 ARG-5 ARG-6 ARG-7 ARG-8", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-27"}}]}
+{"step_index": 28, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:41Z", "content": "Created At: 2026-10-23T10:20:41+00:00\nCompleted At: 2026-10-23T10:20:41+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-28"}
+{"step_index": 29, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:41Z", "input_tokens": 13228, "cache_read_tokens": 0, "output_tokens": 52, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "git ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-29"}}]}
+{"step_index": 30, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:20:46Z", "content": "Created At: 2026-10-23T10:20:46+00:00\nCompleted At: 2026-10-23T10:20:46+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-30\n\nOUTPUT-PLACEHOLDER-31\n\nOUTPUT-PLACEHOLDER-32\n\nOUTPUT-PLACEHOLDER-33"}
+{"step_index": 31, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:20:46Z", "input_tokens": 13453, "cache_read_tokens": 0, "output_tokens": 178, "content": "OUTPUT-PLACEHOLDER-34"}
diff --git a/python/tests/core/fixtures/antigravity/denied_command.jsonl b/python/tests/core/fixtures/antigravity/denied_command.jsonl
new file mode 100644
index 0000000..c87884c
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/denied_command.jsonl
@@ -0,0 +1,3 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:33:58Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:33:58Z", "input_tokens": 6753, "cache_read_tokens": 0, "output_tokens": 131, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "touch ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-1"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "ERROR", "error": "OUTPUT-PLACEHOLDER-2", "created_at": "2026-10-23T10:34:03Z", "content": "Created At: 2026-10-23T10:34:03+00:00\nCompleted At: 2026-10-23T10:34:05+00:00\nOUTPUT-PLACEHOLDER-3"}
diff --git a/python/tests/core/fixtures/antigravity/edit_and_run.jsonl b/python/tests/core/fixtures/antigravity/edit_and_run.jsonl
new file mode 100644
index 0000000..b1b9dfd
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/edit_and_run.jsonl
@@ -0,0 +1,10 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T07:36:59Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:36:59Z", "input_tokens": 6774, "cache_read_tokens": 0, "output_tokens": 149, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_1.js"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:37:03Z", "content": "Created At: 2026-10-23T07:37:03+00:00\nCompleted At: 2026-10-23T07:37:04+00:00\nOUTPUT-PLACEHOLDER-1"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:37:04Z", "input_tokens": 7130, "cache_read_tokens": 0, "output_tokens": 632, "thinking": "THOUGHT-PLACEHOLDER-1", "tool_calls": [{"name": "edit_file", "args": {"Path": "/Users/dev/project/file_1.js", "Replacement": "OUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2\nOUTPUT-PLACEHOLDER-2", "Target": "OUTPUT-PLACEHOLDER-3\nOUTPUT-PLACEHOLDER-3\nOUTPUT-PLACEHOLDER-3\nOUTPUT-PLACEHOLDER-3\nOUTPUT-PLACEHOLDER-3\nOUTPUT-PLACEHOLDER-3\nOUTPUT-PLACEHOLDER-3"}}]}
+{"step_index": 4, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:37:10Z", "content": "Created At: 2026-10-23T07:37:10+00:00\nCompleted At: 2026-10-23T07:37:10+00:00\nOUTPUT-PLACEHOLDER-4"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:37:10Z", "input_tokens": 7871, "cache_read_tokens": 0, "output_tokens": 46, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_1.js"}}]}
+{"step_index": 6, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:37:13Z", "content": "Created At: 2026-10-23T07:37:13+00:00\nCompleted At: 2026-10-23T07:37:13+00:00\nOUTPUT-PLACEHOLDER-5"}
+{"step_index": 7, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:37:13Z", "input_tokens": 8197, "cache_read_tokens": 0, "output_tokens": 56, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-6"}}]}
+{"step_index": 8, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:37:17Z", "content": "Created At: 2026-10-23T07:37:17+00:00\nCompleted At: 2026-10-23T07:37:17+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-7"}
+{"step_index": 9, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:37:17Z", "input_tokens": 8356, "cache_read_tokens": 0, "output_tokens": 369, "content": "OUTPUT-PLACEHOLDER-8"}
diff --git a/python/tests/core/fixtures/antigravity/failed_command.jsonl b/python/tests/core/fixtures/antigravity/failed_command.jsonl
new file mode 100644
index 0000000..777fc35
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/failed_command.jsonl
@@ -0,0 +1,6 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T07:37:33Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:37:33Z", "input_tokens": 6762, "cache_read_tokens": 0, "output_tokens": 117, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-1"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:37:38Z", "content": "Created At: 2026-10-23T07:37:38+00:00\nCompleted At: 2026-10-23T07:37:39+00:00\nCommand exited with code 1.\n\nCommand output:\nOUTPUT-PLACEHOLDER-2\n\nOUTPUT-PLACEHOLDER-3\n\nOUTPUT-PLACEHOLDER-4"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:37:39Z", "input_tokens": 7251, "cache_read_tokens": 0, "output_tokens": 47, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "node ARG-1", "WaitMsBeforeAsync": 5000, "toolSummary": "OUTPUT-PLACEHOLDER-5"}}]}
+{"step_index": 4, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:37:43Z", "content": "Created At: 2026-10-23T07:37:43+00:00\nCompleted At: 2026-10-23T07:37:43+00:00\nCommand exited with code 0.\n\nCommand output:\nOUTPUT-PLACEHOLDER-6"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:37:43Z", "input_tokens": 7401, "cache_read_tokens": 0, "output_tokens": 627, "content": "OUTPUT-PLACEHOLDER-7", "thinking": "THOUGHT-PLACEHOLDER-1"}
diff --git a/python/tests/core/fixtures/antigravity/failed_edit.jsonl b/python/tests/core/fixtures/antigravity/failed_edit.jsonl
new file mode 100644
index 0000000..ea35996
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/failed_edit.jsonl
@@ -0,0 +1,4 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:27:10Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:27:10Z", "input_tokens": 6800, "cache_read_tokens": 0, "output_tokens": 356, "thinking": "THOUGHT-PLACEHOLDER-1", "tool_calls": [{"name": "edit_file", "args": {"Path": "/Users/dev/project/file_1.js", "Replacement": "OUTPUT-PLACEHOLDER-1", "Target": "OUTPUT-PLACEHOLDER-2"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "ERROR", "error": "OUTPUT-PLACEHOLDER-3", "created_at": "2026-10-23T10:27:16Z", "content": "Created At: 2026-10-23T10:27:16+00:00\nCompleted At: 2026-10-23T10:27:16+00:00\nOUTPUT-PLACEHOLDER-4"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:27:16Z", "input_tokens": 7256, "cache_read_tokens": 0, "output_tokens": 130, "content": "OUTPUT-PLACEHOLDER-5"}
diff --git a/python/tests/core/fixtures/antigravity/multi_turn.jsonl b/python/tests/core/fixtures/antigravity/multi_turn.jsonl
new file mode 100644
index 0000000..ea05ee3
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/multi_turn.jsonl
@@ -0,0 +1,18 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:43:21Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:43:21Z", "input_tokens": 6759, "cache_read_tokens": 0, "output_tokens": 215, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_1.md"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:43:27Z", "content": "Created At: 2026-10-23T10:43:27+00:00\nCompleted At: 2026-10-23T10:43:27+00:00\nOUTPUT-PLACEHOLDER-1"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:43:27Z", "input_tokens": 7095, "cache_read_tokens": 0, "output_tokens": 48, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_2.js"}}]}
+{"step_index": 4, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:43:30Z", "content": "Created At: 2026-10-23T10:43:30+00:00\nCompleted At: 2026-10-23T10:43:30+00:00\nOUTPUT-PLACEHOLDER-2"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:43:30Z", "input_tokens": 7423, "cache_read_tokens": 0, "output_tokens": 41, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_3.js"}}]}
+{"step_index": 6, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:43:34Z", "content": "Created At: 2026-10-23T10:43:34+00:00\nCompleted At: 2026-10-23T10:43:34+00:00\nOUTPUT-PLACEHOLDER-3"}
+{"step_index": 7, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:43:34Z", "input_tokens": 7595, "cache_read_tokens": 0, "output_tokens": 656, "content": "OUTPUT-PLACEHOLDER-4", "thinking": "THOUGHT-PLACEHOLDER-1"}
+{"step_index": 8, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:43:53Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-2\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-3\n</ADDITIONAL_METADATA>"}
+{"step_index": 9, "source": "SYSTEM", "type": "SYSTEM_MESSAGE", "status": "DONE", "created_at": "2026-10-23T10:43:53Z", "content": "<SYSTEM_MESSAGE>\nPROMPT-PLACEHOLDER-3\n</SYSTEM_MESSAGE>"}
+{"step_index": 10, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:43:53Z", "input_tokens": 8483, "cache_read_tokens": 0, "output_tokens": 91, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_2.js"}}]}
+{"step_index": 11, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:43:57Z", "content": "Created At: 2026-10-23T10:43:57+00:00\nCompleted At: 2026-10-23T10:43:57+00:00\nOUTPUT-PLACEHOLDER-5"}
+{"step_index": 12, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:43:57Z", "input_tokens": 8854, "cache_read_tokens": 0, "output_tokens": 408, "content": "OUTPUT-PLACEHOLDER-6"}
+{"step_index": 13, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:44:12Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-4\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-4\n</ADDITIONAL_METADATA>"}
+{"step_index": 14, "source": "SYSTEM", "type": "SYSTEM_MESSAGE", "status": "DONE", "created_at": "2026-10-23T10:44:12Z", "content": "<SYSTEM_MESSAGE>\nPROMPT-PLACEHOLDER-5\n</SYSTEM_MESSAGE>"}
+{"step_index": 15, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:44:12Z", "input_tokens": 9481, "cache_read_tokens": 0, "output_tokens": 69, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_3.js"}}]}
+{"step_index": 16, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:44:17Z", "content": "Created At: 2026-10-23T10:44:17+00:00\nCompleted At: 2026-10-23T10:44:17+00:00\nOUTPUT-PLACEHOLDER-7"}
+{"step_index": 17, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:44:17Z", "input_tokens": 9681, "cache_read_tokens": 0, "output_tokens": 211, "content": "OUTPUT-PLACEHOLDER-8"}
diff --git a/python/tests/core/fixtures/antigravity/parallel_reads.jsonl b/python/tests/core/fixtures/antigravity/parallel_reads.jsonl
new file mode 100644
index 0000000..7280a63
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/parallel_reads.jsonl
@@ -0,0 +1,6 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:23:00Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:23:00Z", "input_tokens": 6771, "cache_read_tokens": 0, "output_tokens": 334, "thinking": "THOUGHT-PLACEHOLDER-1", "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_1.md"}}, {"name": "read_file", "args": {"Path": "/Users/dev/project/file_2.js"}}, {"name": "read_file", "args": {"Path": "/Users/dev/project/file_3.js"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:23:05Z", "content": "Created At: 2026-10-23T10:23:05+00:00\nCompleted At: 2026-10-23T10:23:06+00:00\nOUTPUT-PLACEHOLDER-1"}
+{"step_index": 3, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:23:05Z", "content": "Created At: 2026-10-23T10:23:05+00:00\nCompleted At: 2026-10-23T10:23:06+00:00\nOUTPUT-PLACEHOLDER-2"}
+{"step_index": 4, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:23:05Z", "content": "Created At: 2026-10-23T10:23:05+00:00\nCompleted At: 2026-10-23T10:23:06+00:00\nOUTPUT-PLACEHOLDER-3"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:23:06Z", "input_tokens": 7402, "cache_read_tokens": 0, "output_tokens": 525, "content": "OUTPUT-PLACEHOLDER-4", "thinking": "THOUGHT-PLACEHOLDER-2"}
diff --git a/python/tests/core/fixtures/antigravity/read_explain.jsonl b/python/tests/core/fixtures/antigravity/read_explain.jsonl
new file mode 100644
index 0000000..47375a7
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/read_explain.jsonl
@@ -0,0 +1,6 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T07:36:29Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:36:29Z", "input_tokens": 6759, "cache_read_tokens": 0, "output_tokens": 147, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_1.md"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:36:34Z", "content": "Created At: 2026-10-23T07:36:34+00:00\nCompleted At: 2026-10-23T07:36:34+00:00\nOUTPUT-PLACEHOLDER-1"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:36:34Z", "input_tokens": 7027, "cache_read_tokens": 0, "output_tokens": 46, "tool_calls": [{"name": "read_file", "args": {"Path": "/Users/dev/project/file_2.js"}}]}
+{"step_index": 4, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T07:36:38Z", "content": "Created At: 2026-10-23T07:36:38+00:00\nCompleted At: 2026-10-23T07:36:38+00:00\nOUTPUT-PLACEHOLDER-2"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T07:36:38Z", "input_tokens": 7280, "cache_read_tokens": 0, "output_tokens": 920, "content": "OUTPUT-PLACEHOLDER-3", "thinking": "THOUGHT-PLACEHOLDER-1"}
diff --git a/python/tests/core/fixtures/antigravity/subagent_child.jsonl b/python/tests/core/fixtures/antigravity/subagent_child.jsonl
new file mode 100644
index 0000000..4a2beba
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/subagent_child.jsonl
@@ -0,0 +1,28 @@
+{"step_index": 0, "source": "SYSTEM", "type": "SYSTEM_MESSAGE", "status": "DONE", "created_at": "2026-10-23T10:21:36Z", "content": "<SYSTEM_MESSAGE>\nPROMPT-PLACEHOLDER-1\n</SYSTEM_MESSAGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:21:36Z", "input_tokens": 5661, "cache_read_tokens": 0, "output_tokens": 628, "thinking": "THOUGHT-PLACEHOLDER-1", "tool_calls": [{"name": "run_command", "args": {"CommandLine": "grep ARG-1 ARG-2 ARG-3", "Cwd": "/Users/dev/project", "IsDaemon": false, "RunPersistent": false, "WaitMsBeforeAsync": 5000, "toolAction": "OUTPUT-PLACEHOLDER-1", "toolSummary": "OUTPUT-PLACEHOLDER-2"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:21:43Z", "content": "Created At: 2026-10-23T10:21:43+00:00\nCompleted At: 2026-10-23T10:21:43+00:00\n\nThe command exited with code 0.\nOutput:\nOUTPUT-PLACEHOLDER-3\n"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:21:43Z", "input_tokens": 6801, "cache_read_tokens": 0, "output_tokens": 253, "thinking": "THOUGHT-PLACEHOLDER-2", "tool_calls": [{"name": "run_command", "args": {"CommandLine": "grep ARG-1 ARG-2 ARG-3 ARG-4", "Cwd": "/Users/dev/project", "IsDaemon": false, "RunPersistent": false, "WaitMsBeforeAsync": 5000, "toolAction": "OUTPUT-PLACEHOLDER-4", "toolSummary": "OUTPUT-PLACEHOLDER-5"}}]}
+{"step_index": 4, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:21:47Z", "content": "Created At: 2026-10-23T10:21:47+00:00\nCompleted At: 2026-10-23T10:21:47+00:00\n\nThe command exited with code 0.\nOutput:\nOUTPUT-PLACEHOLDER-6\n"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:21:47Z", "input_tokens": 7531, "cache_read_tokens": 0, "output_tokens": 187, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "grep ARG-1 ARG-2 ARG-3 ARG-4", "Cwd": "/Users/dev/project", "IsDaemon": false, "RunPersistent": false, "WaitMsBeforeAsync": 5000, "toolAction": "OUTPUT-PLACEHOLDER-7", "toolSummary": "OUTPUT-PLACEHOLDER-8"}}]}
+{"step_index": 6, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:21:53Z", "content": "Created At: 2026-10-23T10:21:53+00:00\nCompleted At: 2026-10-23T10:21:53+00:00\n\nThe command exited with code 0.\nOutput:\nOUTPUT-PLACEHOLDER-9\n"}
+{"step_index": 7, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:21:53Z", "input_tokens": 8000, "cache_read_tokens": 0, "output_tokens": 211, "thinking": "THOUGHT-PLACEHOLDER-3", "tool_calls": [{"name": "view_file", "args": {"AbsolutePath": "/Users/dev/project/file_1.js", "toolAction": "OUTPUT-PLACEHOLDER-10", "toolSummary": "OUTPUT-PLACEHOLDER-11"}}]}
+{"step_index": 8, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:21:57Z", "content": "Created At: 2026-10-23T10:21:57+00:00\nCompleted At: 2026-10-23T10:21:57+00:00\nFile Path: `file:///Users/dev/project/file`\nTotal Lines: 1\nTotal Bytes: 1\nOUTPUT-PLACEHOLDER-12"}
+{"step_index": 9, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:21:57Z", "input_tokens": 8452, "cache_read_tokens": 0, "output_tokens": 63, "tool_calls": [{"name": "view_file", "args": {"AbsolutePath": "/Users/dev/project/file_2.js", "toolAction": "OUTPUT-PLACEHOLDER-13", "toolSummary": "OUTPUT-PLACEHOLDER-14"}}]}
+{"step_index": 10, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:01Z", "content": "Created At: 2026-10-23T10:22:01+00:00\nCompleted At: 2026-10-23T10:22:01+00:00\nFile Path: `file:///Users/dev/project/file`\nTotal Lines: 1\nTotal Bytes: 1\nOUTPUT-PLACEHOLDER-15"}
+{"step_index": 11, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:01Z", "input_tokens": 8907, "cache_read_tokens": 0, "output_tokens": 140, "tool_calls": [{"name": "view_file", "args": {"AbsolutePath": "/Users/dev/project/file_3.md", "EndLine": 45, "StartLine": 25, "toolAction": "OUTPUT-PLACEHOLDER-16", "toolSummary": "OUTPUT-PLACEHOLDER-17"}}]}
+{"step_index": 12, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:05Z", "content": "Created At: 2026-10-23T10:22:05+00:00\nCompleted At: 2026-10-23T10:22:05+00:00\nFile Path: `file:///Users/dev/project/file`\nTotal Lines: 1\nTotal Bytes: 1\nOUTPUT-PLACEHOLDER-18"}
+{"step_index": 13, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:05Z", "input_tokens": 9994, "cache_read_tokens": 0, "output_tokens": 105, "tool_calls": [{"name": "view_file", "args": {"AbsolutePath": "/Users/dev/project/file_3.md", "EndLine": 270, "StartLine": 210, "toolAction": "OUTPUT-PLACEHOLDER-19", "toolSummary": "OUTPUT-PLACEHOLDER-20"}}]}
+{"step_index": 14, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:09Z", "content": "Created At: 2026-10-23T10:22:09+00:00\nCompleted At: 2026-10-23T10:22:09+00:00\nFile Path: `file:///Users/dev/project/file`\nTotal Lines: 1\nTotal Bytes: 1\nOUTPUT-PLACEHOLDER-21"}
+{"step_index": 15, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:09Z", "input_tokens": 13262, "cache_read_tokens": 0, "output_tokens": 99, "tool_calls": [{"name": "view_file", "args": {"AbsolutePath": "/Users/dev/project/file_3.md", "EndLine": 400, "StartLine": 388, "toolAction": "OUTPUT-PLACEHOLDER-22", "toolSummary": "OUTPUT-PLACEHOLDER-23"}}]}
+{"step_index": 16, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:12Z", "content": "Created At: 2026-10-23T10:22:12+00:00\nCompleted At: 2026-10-23T10:22:12+00:00\nFile Path: `file:///Users/dev/project/file`\nTotal Lines: 1\nTotal Bytes: 1\nOUTPUT-PLACEHOLDER-24"}
+{"step_index": 17, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:12Z", "input_tokens": 14042, "cache_read_tokens": 0, "output_tokens": 92, "tool_calls": [{"name": "view_file", "args": {"AbsolutePath": "/Users/dev/project/file_3.md", "EndLine": 485, "StartLine": 475, "toolAction": "OUTPUT-PLACEHOLDER-25", "toolSummary": "OUTPUT-PLACEHOLDER-26"}}]}
+{"step_index": 18, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:16Z", "content": "Created At: 2026-10-23T10:22:16+00:00\nCompleted At: 2026-10-23T10:22:16+00:00\nFile Path: `file:///Users/dev/project/file`\nTotal Lines: 1\nTotal Bytes: 1\nOUTPUT-PLACEHOLDER-27"}
+{"step_index": 19, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:16Z", "input_tokens": 14640, "cache_read_tokens": 0, "output_tokens": 120, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "find ARG-1 ARG-2 ARG-3", "Cwd": "/Users/dev/project", "IsDaemon": false, "RunPersistent": false, "WaitMsBeforeAsync": 5000, "toolAction": "OUTPUT-PLACEHOLDER-28", "toolSummary": "OUTPUT-PLACEHOLDER-29"}}]}
+{"step_index": 20, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:20Z", "content": "Created At: 2026-10-23T10:22:20+00:00\nCompleted At: 2026-10-23T10:22:20+00:00\n\nThe command exited with code 0.\nOutput:\nOUTPUT-PLACEHOLDER-30\n"}
+{"step_index": 21, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:20Z", "input_tokens": 14928, "cache_read_tokens": 0, "output_tokens": 106, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "find ARG-1 ARG-2 ARG-3 ARG-4", "Cwd": "/Users/dev/project", "IsDaemon": false, "RunPersistent": false, "WaitMsBeforeAsync": 5000, "toolAction": "OUTPUT-PLACEHOLDER-31", "toolSummary": "OUTPUT-PLACEHOLDER-32"}}]}
+{"step_index": 22, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:24Z", "content": "Created At: 2026-10-23T10:22:24+00:00\nCompleted At: 2026-10-23T10:22:25+00:00\n\nThe command exited with code 0.\nOutput:\nOUTPUT-PLACEHOLDER-33\n"}
+{"step_index": 23, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:25Z", "input_tokens": 15156, "cache_read_tokens": 0, "output_tokens": 177, "tool_calls": [{"name": "run_command", "args": {"CommandLine": "grep ARG-1 ARG-2 ARG-3 ARG-4", "Cwd": "/Users/dev/project", "IsDaemon": false, "RunPersistent": false, "WaitMsBeforeAsync": 5000, "toolAction": "OUTPUT-PLACEHOLDER-34", "toolSummary": "OUTPUT-PLACEHOLDER-35"}}]}
+{"step_index": 24, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:29Z", "content": "Created At: 2026-10-23T10:22:29+00:00\nCompleted At: 2026-10-23T10:22:30+00:00\n\nThe command exited with code 1.\nStdout:\n\nStderr:\n"}
+{"step_index": 25, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:30Z", "input_tokens": 15421, "cache_read_tokens": 0, "output_tokens": 1397, "thinking": "THOUGHT-PLACEHOLDER-4", "tool_calls": [{"name": "send_message", "args": {"Message": "OUTPUT-PLACEHOLDER-36", "Recipient": "00000000-0000-4000-8000-000000000008", "toolAction": "OUTPUT-PLACEHOLDER-37", "toolSummary": "OUTPUT-PLACEHOLDER-38"}}]}
+{"step_index": 26, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:22:41Z", "content": "Created At: 2026-10-23T10:22:41+00:00\nCompleted At: 2026-10-23T10:22:41+00:00\nOUTPUT-PLACEHOLDER-39"}
+{"step_index": 27, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:41Z", "input_tokens": 16926, "cache_read_tokens": 0, "output_tokens": 38, "content": "OUTPUT-PLACEHOLDER-40"}
diff --git a/python/tests/core/fixtures/antigravity/subagent_parent.jsonl b/python/tests/core/fixtures/antigravity/subagent_parent.jsonl
new file mode 100644
index 0000000..2e06462
--- /dev/null
+++ b/python/tests/core/fixtures/antigravity/subagent_parent.jsonl
@@ -0,0 +1,6 @@
+{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE", "created_at": "2026-10-23T10:21:22Z", "content": "<USER_REQUEST>\nPROMPT-PLACEHOLDER-1\n</USER_REQUEST>\n<ADDITIONAL_METADATA>\nMETADATA-PLACEHOLDER-1\n</ADDITIONAL_METADATA>\n<USER_SETTINGS_CHANGE>\nMETADATA-PLACEHOLDER-2\n</USER_SETTINGS_CHANGE>"}
+{"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:21:22Z", "input_tokens": 6763, "cache_read_tokens": 0, "output_tokens": 1316, "thinking": "THOUGHT-PLACEHOLDER-1", "tool_calls": [{"name": "invoke_subagent", "args": {"Model": "inherit", "Prompt": "PROMPT-PLACEHOLDER-2", "Role": "OUTPUT-PLACEHOLDER-1", "TypeName": "research"}}]}
+{"step_index": 2, "source": "MODEL", "type": "GENERIC", "status": "DONE", "created_at": "2026-10-23T10:21:36Z", "content": "Created At: 2026-10-23T10:21:36+00:00\nCompleted At: 2026-10-23T10:21:36+00:00\nCreated the following subagent:\nOUTPUT-PLACEHOLDER-2"}
+{"step_index": 3, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:21:36Z", "input_tokens": 8336, "cache_read_tokens": 0, "output_tokens": 127, "content": "OUTPUT-PLACEHOLDER-3"}
+{"step_index": 4, "source": "SYSTEM", "type": "SYSTEM_MESSAGE", "status": "DONE", "created_at": "2026-10-23T10:22:41Z", "content": "<SYSTEM_MESSAGE>\nPROMPT-PLACEHOLDER-3\n</SYSTEM_MESSAGE>"}
+{"step_index": 5, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE", "created_at": "2026-10-23T10:22:41Z", "input_tokens": 9097, "cache_read_tokens": 0, "output_tokens": 1240, "content": "OUTPUT-PLACEHOLDER-4", "thinking": "THOUGHT-PLACEHOLDER-2"}
diff --git a/python/tests/core/test_antigravity_parser.py b/python/tests/core/test_antigravity_parser.py
new file mode 100644
index 0000000..3e8c6e0
--- /dev/null
+++ b/python/tests/core/test_antigravity_parser.py
@@ -0,0 +1,719 @@
+"""Antigravity CLI (`agy`) parser, detection and discovery.
+
+The fixtures under ``fixtures/antigravity/`` are real `agy` 1.4.6
+``transcript_full.jsonl`` step logs with every prompt, reply, thought, file
+content, tool summary, tool output, error text and command argument replaced
+by a placeholder, paths replaced by ``/Users/dev/project/file_N``, conversation
+ids renumbered and timestamps moved to UTC. What survives is the structure:
+step types and order, statuses, token counts, tool names, arg keys, result
+labels and exit codes.
+
+* ``read_explain``: reads two files and explains them.
+* ``edit_and_run``: reads a file, edits it, reads it again, runs it.
+* ``failed_command``: a command exits 1, the retry exits 0.
+* ``failed_edit``: an edit whose target text is not in the file.
+* ``denied_command``: the user denies a command; the log ends on the result.
+* ``parallel_reads``: one planner step with three `read_file` calls.
+* ``create_file``: writes a new file, with a git command that exits 128.
+* ``subagent_parent`` / ``subagent_child``: `invoke_subagent` and the child's
+ own conversation, which opens with a `SYSTEM_MESSAGE`.
+* ``multi_turn``: three prompts in one conversation (`--conversation`).
+
+The conversation index (`conversation_summaries.db`) is not a fixture: the
+tests build one from the real column schema with made-up rows.
+"""
+
+from __future__ import annotations
+
+import json
+import sqlite3
+from datetime import UTC, datetime
+from pathlib import Path
+
+import pytest
+
+from agentplay import builder, discover
+from agentplay._core.ingestion.coding_agent._sources.local.parsers import (
+ AgentType,
+ detect_agent,
+ parse_antigravity,
+)
+from agentplay._core.ingestion.coding_agent._sources.local.source import (
+ LocalSource,
+ _path_from_file_uri,
+)
+
+FIXTURES = Path(__file__).parent / "fixtures" / "antigravity"
+GEMINI_FIXTURES = Path(__file__).parent / "fixtures" / "gemini"
+FIXTURE_ROOT = "/Users/dev/project"
+NAMES = (
+ "read_explain",
+ "edit_and_run",
+ "failed_command",
+ "failed_edit",
+ "denied_command",
+ "parallel_reads",
+ "create_file",
+ "subagent_parent",
+ "subagent_child",
+ "multi_turn",
+)
+# The renumbered conversation id of each fixture (`brain/<id>/` on disk).
+IDS = {name: f"00000000-0000-4000-8000-{n:012d}" for n, name in enumerate(NAMES, 1)}
+
+# `conversation_summaries.db` exactly as agy 1.4.6 creates it.
+SUMMARIES_SCHEMA = (
+ "CREATE TABLE `conversation_summaries` (`conversation_id` text,`title` text NOT NULL DEFAULT \"\","
+ "`preview` text NOT NULL DEFAULT \"\",`step_count` integer NOT NULL DEFAULT 0,"
+ "`last_modified_time` datetime NOT NULL,`workspace_uris` text NOT NULL,"
+ "`status` text NOT NULL DEFAULT \"\",`source` text NOT NULL DEFAULT \"\","
+ "`project_id` text NOT NULL DEFAULT \"\",`agent_name` text NOT NULL DEFAULT \"\","
+ "`parent_conversation_id` text NOT NULL DEFAULT \"\",`nesting_depth` integer NOT NULL DEFAULT 0,"
+ "`battle_id` text NOT NULL DEFAULT \"\",`winning_conversation_id` text NOT NULL DEFAULT \"\","
+ "`not_fully_idle` numeric NOT NULL DEFAULT false,`killed` numeric NOT NULL DEFAULT false,"
+ "`last_user_input_time` datetime NOT NULL,`last_user_input_step_index` integer NOT NULL DEFAULT -1,"
+ "`app_data_dir` text NOT NULL DEFAULT \"\",`raw_summary` blob,`group_id` text NOT NULL DEFAULT \"\","
+ "PRIMARY KEY (`conversation_id`))"
+)
+
+
+def _fixture(name: str) -> bytes:
+ return (FIXTURES / f"{name}.jsonl").read_bytes()
+
+
+def _parse(name: str):
+ _, spans = parse_antigravity(_fixture(name), f"local:antigravity-cli:{IDS[name]}")
+ return spans
+
+
+def _turns(spans):
+ return [s for s in spans if s.name.startswith("Turn ")]
+
+
+def _tools(spans):
+ return [s for s in spans if ":tool:" in s.span_id]
+
+
+def _records(name: str) -> list[dict]:
+ return [json.loads(line) for line in _fixture(name).splitlines() if line.strip()]
+
+
+def _args(span) -> dict:
+ return json.loads(span.attributes["input.value"])
+
+
+# ---------------------------------------------------------------- detection
+
+
[email protected]("name", NAMES)
+def test_fixture_is_detected_as_antigravity_cli(name):
+ assert detect_agent(_fixture(name)) == AgentType.ANTIGRAVITY_CLI
+
+
[email protected]("name", ["read_explain", "edit_and_run", "failed_shell"])
+def test_gemini_cli_sessions_are_not_claimed(name):
+ assert detect_agent((GEMINI_FIXTURES / f"{name}.jsonl").read_bytes()) == AgentType.GEMINI_CLI
+
+
+def test_claude_code_records_are_not_claimed():
+ line = {"type": "user", "sessionId": "s1", "message": {"role": "user", "content": "hi"}}
+ assert detect_agent(json.dumps(line).encode()) == AgentType.CLAUDE_CODE
+
+
+ "line",
+ [
+ {"step_index": True, "source": "MODEL", "type": "GENERIC"}, # bool, not an index
+ {"step_index": "0", "source": "MODEL", "type": "GENERIC"},
+ {"step_index": 0, "type": "GENERIC"}, # no source
+ {"step_index": 0, "source": "MODEL", "type": "SOMETHING_ELSE"},
+ ],
+)
+def test_near_miss_lines_are_not_antigravity(line):
+ assert detect_agent(json.dumps(line).encode()) is None
+
+
+def test_a_later_step_alone_is_still_detected():
+ line = {"step_index": 7, "source": "MODEL", "type": "PLANNER_RESPONSE", "status": "DONE"}
+ assert detect_agent(json.dumps(line).encode()) == AgentType.ANTIGRAVITY_CLI
+
+
+# ---------------------------------------------------------------- span tree
+
+
+ ("name", "turns", "tools"),
+ [
+ ("read_explain", 1, ["Read", "Read"]),
+ ("edit_and_run", 1, ["Read", "Edit", "Read", "Bash"]),
+ ("failed_command", 1, ["Bash", "Bash"]),
+ ("failed_edit", 1, ["Edit"]),
+ ("denied_command", 1, ["Bash"]),
+ ("parallel_reads", 1, ["Read", "Read", "Read"]),
+ ("subagent_parent", 1, ["Task"]),
+ ("multi_turn", 3, ["Read", "Read", "Read", "Read", "Read"]),
+ ],
+)
+def test_turn_and_tool_counts(name, turns, tools):
+ spans = _parse(name)
+ assert spans[0].name == "Session" and spans[0].parent_id is None
+ assert len(_turns(spans)) == turns
+ assert [s.name for s in _tools(spans)] == tools
+ turn_ids = {t.span_id for t in _turns(spans)}
+ assert all(s.parent_id in turn_ids for s in _tools(spans))
+ assert all(s.attributes["tool.name"] == s.name for s in _tools(spans))
+
+
+def test_read_session_keeps_only_the_prompt_and_the_path():
+ spans = _parse("read_explain")
+ (turn,) = _turns(spans)
+ # Only the <USER_REQUEST> body; the CLI's metadata blocks are not the prompt.
+ assert turn.attributes["input.value"] == "PROMPT-PLACEHOLDER-1"
+ assert turn.attributes["output.value"] == "OUTPUT-PLACEHOLDER-3"
+ assert [_args(s) for s in _tools(spans)] == [
+ {"file_path": f"{FIXTURE_ROOT}/file_1.md"},
+ {"file_path": f"{FIXTURE_ROOT}/file_2.js"},
+ ]
+ assert {s.status_code for s in _tools(spans)} == {"OK"}
+ assert spans[0].attributes["harness.agent_session_id"] == IDS["read_explain"]
+ assert spans[0].attributes["llm.model_name"] == ""
+
+
+def test_edit_and_run_normalizes_args():
+ read, edit, _, run = _tools(_parse("edit_and_run"))
+ assert set(_args(edit)) == {"file_path", "old_string", "new_string"}
+ assert _args(edit)["old_string"].count("\n") == 6 # line count survives
+ assert _args(run) == {"command": "node ARG-1"} # WaitMsBeforeAsync / toolSummary dropped
+ assert {s.status_code for s in (read, edit, run)} == {"OK"}
+ assert edit.attributes["code.edit_evidence"]["status"] != "not_successful"
+ # Tool times come from the result's Created At / Completed At lines.
+ assert read.start_time == datetime(2026, 10, 23, 7, 37, 3, tzinfo=UTC)
+ assert read.end_time == datetime(2026, 10, 23, 7, 37, 4, tzinfo=UTC)
+
+
+def test_failed_command_is_an_error_and_the_retry_is_not():
+ failed, retry = _tools(_parse("failed_command"))
+ # agy records status DONE for both; the exit-code sentence is the signal.
+ assert failed.status_code == "ERROR"
+ assert retry.status_code == "OK"
+ assert failed.attributes["output.value"] == ""
+ assert "OUTPUT-PLACEHOLDER-6" in retry.attributes["output.value"]
+
+
+def test_failed_edit_is_an_error_without_its_text():
+ (edit,) = _tools(_parse("failed_edit"))
+ assert edit.status_code == "ERROR"
+ assert edit.attributes["output.value"] == ""
+ assert edit.attributes["code.edit_evidence"]["status"] == "not_successful"
+
+
+def test_denied_command_is_an_error_and_ends_the_session():
+ spans = _parse("denied_command")
+ (run,) = _tools(spans)
+ assert run.status_code == "ERROR"
+ assert run.attributes["output.value"] == ""
+ assert _records("denied_command")[-1]["type"] == "GENERIC"
+
+
+def test_parallel_calls_pair_with_results_in_order():
+ spans = _parse("parallel_reads")
+ tools = _tools(spans)
+ assert [s.span_id.rsplit(":tool:", 1)[1] for s in tools] == ["1:0", "1:1", "1:2"]
+ assert [_args(s)["file_path"] for s in tools] == [
+ f"{FIXTURE_ROOT}/file_1.md",
+ f"{FIXTURE_ROOT}/file_2.js",
+ f"{FIXTURE_ROOT}/file_3.js",
+ ]
+ assert [s.attributes["output.value"].splitlines()[-1] for s in tools] == [
+ "OUTPUT-PLACEHOLDER-1",
+ "OUTPUT-PLACEHOLDER-2",
+ "OUTPUT-PLACEHOLDER-3",
+ ]
+
+
+def test_create_file_writes_and_flags_the_non_zero_exit():
+ tools = _tools(_parse("create_file"))
+ write = next(s for s in tools if s.name == "Write")
+ assert set(_args(write)) == {"file_path", "content"}
+ assert write.status_code == "OK"
+ assert [s.status_code for s in tools].count("ERROR") == 1 # the exit-128 git call
+ read = next(s for s in tools if s.name == "Read")
+ assert _args(read) == {"file_path": f"{FIXTURE_ROOT}/file_1.js"} # StartLine/EndLine dropped
+
+
+def test_subagent_launch_keeps_type_and_model_only():
+ (task,) = _tools(_parse("subagent_parent"))
+ assert _args(task) == {"subagent_type": "research", "model": "inherit"}
+ # The child's report (a SYSTEM_MESSAGE) stays in the parent's one turn.
+ assert len(_turns(_parse("subagent_parent"))) == 1
+
+
+def test_subagent_conversation_opens_a_turn_without_a_prompt():
+ spans = _parse("subagent_child")
+ (turn,) = _turns(spans)
+ assert turn.attributes["input.value"] == ""
+ tools = _tools(spans)
+ assert [s.name for s in tools].count("Read") == 6 # view_file
+ assert _args(next(s for s in tools if s.name == "Read")) == {"file_path": f"{FIXTURE_ROOT}/file_1.js"}
+ bash = next(s for s in tools if s.name == "Bash")
+ assert _args(bash) == {"command": "grep ARG-1 ARG-2 ARG-3", "workdir": FIXTURE_ROOT}
+ # The subagent's last grep exits 1 ("The command exited with code 1.").
+ assert [s.status_code for s in tools if s.name == "Bash"][-1] == "ERROR"
+ send = tools[-1]
+ assert send.name == "send_message"
+ assert _args(send) == {}
+
+
+def test_multi_turn_splits_on_user_input_only():
+ turns = _turns(_parse("multi_turn"))
+ assert [t.attributes["input.value"] for t in turns] == [
+ "PROMPT-PLACEHOLDER-1",
+ "PROMPT-PLACEHOLDER-2",
+ "PROMPT-PLACEHOLDER-4",
+ ]
+ assert [len(t.attributes["llm.cost_events"]) for t in turns] == [4, 2, 2]
+
+
[email protected]("name", NAMES)
+def test_tokens_are_counted_once_per_planner_step(name):
+ planners = [r for r in _records(name) if r["type"] == "PLANNER_RESPONSE"]
+ turns = _turns(_parse(name))
+ assert sum(t.attributes["llm.token_count.prompt"] for t in turns) == sum(p["input_tokens"] for p in planners)
+ assert sum(t.attributes["llm.token_count.completion"] for t in turns) == sum(
+ p["output_tokens"] for p in planners
+ )
+ assert sum(len(t.attributes["llm.cost_events"]) for t in turns) == len(planners)
+ assert all(t.attributes["llm.token_count.reasoning"] == 0 for t in turns)
+
+
+# ---------------------------------------------------------------- synthetic step logs
+
+TS = "2026-10-23T10:00:{:02d}Z"
+
+
+def _log(*steps: dict) -> bytes:
+ lines = []
+ for i, step in enumerate(steps):
+ rec = {"step_index": i, "source": "MODEL", "status": "DONE", "created_at": TS.format(i), **step}
+ lines.append(json.dumps(rec).encode())
+ return b"\n".join(lines) + b"\n"
+
+
+def _prompt(text: str = "go") -> dict:
+ return {"type": "USER_INPUT", "source": "USER_EXPLICIT", "content": f"<USER_REQUEST>\n{text}\n</USER_REQUEST>"}
+
+
+def _planner(*calls: dict, **extra) -> dict:
+ step = {"type": "PLANNER_RESPONSE", "input_tokens": 10, "cache_read_tokens": 0, "output_tokens": 2, **extra}
+ if calls:
+ step["tool_calls"] = list(calls)
+ return step
+
+
+def _call(name: str, **args) -> dict:
+ return {"name": name, "args": args}
+
+
+def _result(content: str = "Created At: x\nCompleted At: y\nok", **extra) -> dict:
+ return {"type": "GENERIC", "content": content, **extra}
+
+
+def test_missing_result_between_planner_steps_is_unset():
+ data = _log(
+ _prompt(),
+ _planner(_call("read_file", Path="/p/a.py"), _call("read_file", Path="/p/b.py")),
+ _result(), # only the first call gets a result
+ _planner(_call("run_command", CommandLine="ls")),
+ _result("Command exited with code 0.\n\nCommand output:\nx"),
+ _planner(_call("read_file", Path="/p/c.py")), # log ends before this result
+ )
+ tools = _tools(parse_antigravity(data, "t")[1])
+ assert [(s.name, s.status_code) for s in tools] == [
+ ("Read", "OK"),
+ ("Read", "UNSET"),
+ ("Bash", "OK"),
+ ("Read", "UNSET"),
+ ]
+ # The new planner step closed the queue: its result did not go to the old call.
+ assert _args(tools[2]) == {"command": "ls"}
+ unset = tools[1]
+ assert unset.attributes["output.value"] == ""
+ assert unset.end_time == unset.start_time
+
+
+def test_result_without_a_pending_call_is_ignored():
+ data = _log(_prompt(), _result(), _planner(), _result())
+ _, spans = parse_antigravity(data, "t")
+ assert _tools(spans) == []
+ assert len(_turns(spans)) == 1
+
+
+ ("content", "status"),
+ [
+ ("Command exited with code 0.\n\nCommand output:\nError: printed by the program", "OK"),
+ # The program printing the CLI's own sentence after the output label.
+ ("Command exited with code 0.\n\nCommand output:\nCommand exited with code 3.", "OK"),
+ ("Command exited with code 2.\n\nCommand output:\n", "ERROR"),
+ ("\nThe command exited with code 1.\nStdout:\n\nStderr:\n", "ERROR"),
+ ("\nThe command exited with code 0.\nOutput:\nx\n", "OK"),
+ ("Command exited with code -9.\n", "ERROR"),
+ ("no exit line at all", "OK"),
+ ],
+)
+def test_exit_code_sentence_decides_command_status(content, status):
+ data = _log(_prompt(), _planner(_call("run_command", CommandLine="x")), _result(content))
+ (tool,) = _tools(parse_antigravity(data, "t")[1])
+ assert tool.status_code == status
+
+
+def test_exit_code_sentence_only_counts_for_commands():
+ data = _log(_prompt(), _planner(_call("read_file", Path="/p/a")), _result("Command exited with code 4."))
+ (tool,) = _tools(parse_antigravity(data, "t")[1])
+ assert tool.status_code == "OK"
+
+
+def test_error_status_or_error_field_marks_failure():
+ data = _log(
+ _prompt(),
+ _planner(_call("edit_file", Path="/p/a", Target="a", Replacement="b"), _call("write_file", Path="/p/b")),
+ _result(status="ERROR", error="target content not found"),
+ _result(error="something failed"),
+ )
+ assert [s.status_code for s in _tools(parse_antigravity(data, "t")[1])] == ["ERROR", "ERROR"]
+
+
+def test_cache_reads_are_a_subset_of_input():
+ data = _log(_prompt(), _planner(input_tokens=100, cache_read_tokens=40, output_tokens=5),
+ _planner(input_tokens=10, cache_read_tokens=99, output_tokens=1))
+ (turn,) = _turns(parse_antigravity(data, "t")[1])
+ attrs = turn.attributes
+ assert attrs["llm.token_count.prompt"] == 110
+ assert attrs["llm.token_count.cache_read"] == 50 # 40 + min(99, 10)
+ assert attrs["llm.token_count.input_fresh"] == 60
+ assert [e["input_tokens"] for e in attrs["llm.cost_events"]] == [60, 0]
+
+
+def test_unlisted_args_and_tools_carry_no_values():
+ data = _log(
+ _prompt(),
+ _planner(
+ _call("run_command", CommandLine="ls", toolSummary="SECRET-SUMMARY", toolAction="SECRET-ACTION"),
+ _call("invoke_subagent", Prompt="SECRET-PROMPT", Role="SECRET-ROLE", TypeName="research"),
+ _call("grep_search", Query="SECRET-QUERY", SearchPath="/p"),
+ _call("brand_new_tool", Anything="SECRET-ANY"),
+ _call("read_file", Path=["not", "a", "string"]),
+ ),
+ )
+ tools = _tools(parse_antigravity(data, "t")[1])
+ assert [s.name for s in tools] == ["Bash", "Task", "Grep", "brand_new_tool", "Read"]
+ assert [_args(s) for s in tools] == [{"command": "ls"}, {"subagent_type": "research"}, {}, {}, {}]
+ assert "SECRET" not in json.dumps([s.attributes for s in tools], default=str)
+
+
+def test_steps_are_ordered_and_deduplicated_by_index():
+ first = {"step_index": 1, "source": "MODEL", "type": "PLANNER_RESPONSE", "input_tokens": 1, "output_tokens": 1}
+ again = {**first, "input_tokens": 7}
+ prompt = {"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "content": "hi"}
+ data = b"\n".join(json.dumps(r).encode() for r in (first, prompt, again))
+ (turn,) = _turns(parse_antigravity(data, "t")[1])
+ assert turn.attributes["input.value"] == "hi" # no wrapper: the whole text
+ assert turn.attributes["llm.token_count.prompt"] == 7
+
+
+ "data",
+ [
+ b"",
+ b"not json at all\n",
+ b"[1, 2]\nnull\n",
+ _fixture("edit_and_run")[:-40], # last line cut mid-record
+ b'{"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT"',
+ _log({"type": "USER_INPUT", "content": 5, "created_at": "nope"}),
+ _log(_prompt(), {"type": "PLANNER_RESPONSE", "tool_calls": "x", "input_tokens": "many"}),
+ _log(_prompt(), _planner({"name": None, "args": []}, "not a dict"), {"type": "GENERIC", "content": None}),
+ _log({"type": "GENERIC", "status": "ERROR"}),
+ ],
+)
+def test_malformed_or_partial_input_does_not_crash(data):
+ trace, spans = parse_antigravity(data, "t")
+ assert trace.trace_id == "t"
+ assert isinstance(spans, list)
+
+
+def test_partial_last_line_keeps_the_earlier_steps():
+ data = _fixture("edit_and_run")
+ cut = data[: data.rindex(b"\n", 0, len(data) - 1) + 20] # last step half written
+ assert [s.name for s in _tools(parse_antigravity(cut, "t")[1])] == ["Read", "Edit", "Read", "Bash"]
+
+
+def test_empty_input_yields_no_spans():
+ assert parse_antigravity(b"", "t")[1] == []
+ assert parse_antigravity(b'{"step_index": 0}\n', "t")[1] == []
+
+
+# ---------------------------------------------------------------- file URIs
+
+
+ ("uri", "path"),
+ [
+ ("file:///Users/dev/project", "/Users/dev/project"),
+ ("file:///C:/Users/dev/project", "C:/Users/dev/project"),
+ ("file:///c%3A/Users/dev/my%20project", "c:/Users/dev/my project"),
+ ("file://server/share/project", "//server/share/project"),
+ ("file://localhost/Users/dev/project", "/Users/dev/project"),
+ ("https://example.com/x", None),
+ ("", None),
+ (None, None),
+ (5, None),
+ ],
+)
+def test_path_from_file_uri(uri, path):
+ assert _path_from_file_uri(uri) == path
+
+
+# ---------------------------------------------------------------- discovery
+
+
+def _write_summaries(home: Path, rows: list[tuple[str, str, str, int]]) -> None:
+ """Rows of (conversation_id, workspace_uris, parent_conversation_id, nesting_depth)."""
+ conn = sqlite3.connect(home / "conversation_summaries.db")
+ try:
+ conn.execute(SUMMARIES_SCHEMA)
+ conn.executemany(
+ "INSERT INTO conversation_summaries (conversation_id, title, preview, last_modified_time,"
+ " workspace_uris, parent_conversation_id, nesting_depth, last_user_input_time, raw_summary)"
+ " VALUES (?, 'TITLE-SECRET', 'PREVIEW-SECRET', '2026-10-23 10:00:00+00:00', ?, ?, ?,"
+ " '2026-10-23 10:00:00+00:00', X'00')",
+ rows,
+ )
+ conn.commit()
+ finally:
+ conn.close()
+
+
+def _antigravity_home(tmp_path: Path, uri: str = f"file://{FIXTURE_ROOT}", names=NAMES) -> Path:
+ home = tmp_path / ".gemini" / "antigravity-cli"
+ for name in names:
+ logs = home / "brain" / IDS[name] / ".system_generated" / "logs"
+ logs.mkdir(parents=True)
+ (logs / "transcript_full.jsonl").write_bytes(_fixture(name))
+ # The display-form log sits next to it and must not be indexed.
+ (logs / "transcript.jsonl").write_bytes(_fixture(name))
+ rows = [
+ (
+ IDS[name],
+ json.dumps([uri]),
+ IDS["subagent_parent"] if name == "subagent_child" else "",
+ 1 if name == "subagent_child" else 0,
+ )
+ for name in names
+ ]
+ _write_summaries(home, rows)
+ return home
+
+
+def test_local_source_indexes_antigravity_sessions(tmp_path):
+ source = LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[_antigravity_home(tmp_path)])
+ index = source._build_index()
+ assert sorted(index) == sorted(f"local:antigravity-cli:{IDS[n]}" for n in NAMES)
+ assert source.discovery_stats()["antigravity-cli"] == {"seen": len(NAMES), "indexed": len(NAMES), "skipped": {}}
+ sid = f"local:antigravity-cli:{IDS['edit_and_run']}"
+ assert source.get_cwd(sid) == FIXTURE_ROOT
+ assert source.get_project_name(sid) == "project"
+ spans = source.get_spans_by_session(sid)
+ assert {s.attributes["cwd"] for s in spans if s.parent_id is not None} == {FIXTURE_ROOT}
+ assert "harness.session_role" not in spans[0].attributes
+
+
+def test_subagent_conversation_links_to_its_parent(tmp_path):
+ source = LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[_antigravity_home(tmp_path)])
+ child = source.get_spans_by_session(f"local:antigravity-cli:{IDS['subagent_child']}")[0]
+ assert child.attributes["harness.session_role"] == "subagent"
+ assert child.attributes["harness.parent_session_id"] == f"local:antigravity-cli:{IDS['subagent_parent']}"
+ parent = source.get_spans_by_session(f"local:antigravity-cli:{IDS['subagent_parent']}")[0]
+ assert "harness.session_role" not in parent.attributes
+
+
+def test_windows_workspace_uri_gives_a_drive_path(tmp_path):
+ home = _antigravity_home(tmp_path, uri="file:///C:/Users/dev/project", names=("read_explain",))
+ source = LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[home])
+ sid = f"local:antigravity-cli:{IDS['read_explain']}"
+ source._build_index()
+ assert source.get_cwd(sid) == "C:/Users/dev/project"
+ assert source.get_project_name(sid) == "project"
+
+
+def test_missing_or_unusable_summaries_leave_cwd_empty(tmp_path):
+ home = _antigravity_home(tmp_path, names=("read_explain", "failed_edit"))
+ (home / "conversation_summaries.db").unlink()
+ source = LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[home])
+ assert len(source._build_index()) == 2
+ assert source.get_cwd(f"local:antigravity-cli:{IDS['read_explain']}") is None
+
+ _write_summaries(home, [(IDS["read_explain"], "not json", "", 0), (IDS["failed_edit"], "[]", "", 0)])
+ source = LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[home])
+ source._build_index()
+ assert source.get_cwd(f"local:antigravity-cli:{IDS['read_explain']}") is None
+ assert source.get_cwd(f"local:antigravity-cli:{IDS['failed_edit']}") is None
+
+ (home / "conversation_summaries.db").unlink()
+ (home / "conversation_summaries.db").write_bytes(b"not a database")
+ source = LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[home])
+ assert len(source._build_index()) == 2
+
+
+def test_summaries_db_is_never_written(tmp_path):
+ home = _antigravity_home(tmp_path, names=("read_explain",))
+ db = home / "conversation_summaries.db"
+ before = (db.read_bytes(), db.stat().st_mtime_ns)
+ LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[home])._build_index()
+ assert (db.read_bytes(), db.stat().st_mtime_ns) == before
+ assert sorted(p.name for p in home.iterdir()) == ["brain", "conversation_summaries.db"]
+
+
+def test_discovery_lists_antigravity_cli_with_env_override(tmp_path, monkeypatch):
+ assert "antigravity-cli" in discover.AGENTS
+ monkeypatch.setenv("AGENTPLAY_ANTIGRAVITY_HOMES", str(tmp_path))
+ homes = discover.Homes.default()
+ assert homes.antigravity_cli == [tmp_path]
+ assert homes.present()["antigravity-cli"] == [tmp_path]
+ monkeypatch.delenv("AGENTPLAY_ANTIGRAVITY_HOMES")
+ assert discover.Homes.default().antigravity_cli == [Path.home() / ".gemini" / "antigravity-cli"]
+
+
+def test_discovery_through_env_override_finds_the_sessions(tmp_path, monkeypatch):
+ home = _antigravity_home(tmp_path, names=("read_explain", "subagent_parent", "subagent_child"))
+ monkeypatch.setenv("AGENTPLAY_ANTIGRAVITY_HOMES", str(home))
+ source = discover.local_source(discover.Homes.default(), {"antigravity-cli"})
+ found = discover.candidates(source)
+ assert {c.agent for c in found} == {"antigravity-cli"}
+ assert len(found) == 3
+ child = next(c for c in found if c.session_id.endswith(IDS["subagent_child"]))
+ doc = discover.build_map(child, source)
+ assert doc["session"]["role"] == "subagent"
+ assert doc["session"]["parentSessionId"] == f"local:antigravity-cli:{IDS['subagent_parent']}"
+ parent = next(c for c in found if c.session_id.endswith(IDS["subagent_parent"]))
+ assert discover.build_map(parent, source)["session"]["role"] is None
+
+
+def _gemini_tree(gemini_home: Path) -> None:
+ """A Gemini CLI project folder next to the Antigravity CLI home, as on disk."""
+ chats = gemini_home / "tmp" / "project" / "chats"
+ chats.mkdir(parents=True)
+ (chats.parent / ".project_root").write_text(FIXTURE_ROOT, encoding="utf-8")
+ (chats / "session-2026-10-23T07-00-read.jsonl").write_bytes((GEMINI_FIXTURES / "read_explain.jsonl").read_bytes())
+
+
+def test_gemini_and_antigravity_homes_never_pick_up_each_other(tmp_path):
+ antigravity = _antigravity_home(tmp_path, names=("read_explain", "failed_edit"))
+ gemini = antigravity.parent # ~/.gemini: Gemini's home is Antigravity's parent
+ _gemini_tree(gemini)
+ # The Antigravity IDE's sibling folder has brain/ too but no step logs.
+ (gemini / "antigravity" / "brain" / IDS["read_explain"]).mkdir(parents=True)
+
+ both = LocalSource(claude_code_homes=[], codex_homes=[], gemini_homes=[gemini], antigravity_homes=[antigravity])
+ agents = {sid: ref.agent for sid, ref in both._build_index().items()}
+ assert sorted(agents.values()) == ["antigravity-cli", "antigravity-cli", "gemini-cli"]
+
+ gemini_only = LocalSource(claude_code_homes=[], codex_homes=[], gemini_homes=[gemini])
+ assert {r.agent for r in gemini_only._build_index().values()} == {AgentType.GEMINI_CLI}
+
+ antigravity_only = LocalSource(claude_code_homes=[], codex_homes=[], antigravity_homes=[antigravity])
+ assert {r.agent for r in antigravity_only._build_index().values()} == {AgentType.ANTIGRAVITY_CLI}
+
+ # Homes pointed at the wrong tree find nothing rather than misreading it.
+ swapped = LocalSource(claude_code_homes=[], codex_homes=[], gemini_homes=[antigravity], antigravity_homes=[gemini])
+ assert swapped._build_index() == {}
+
+
+def test_a_file_from_the_other_agent_in_the_right_place_is_rejected(tmp_path):
+ antigravity = _antigravity_home(tmp_path, names=("read_explain",))
+ gemini = antigravity.parent
+ _gemini_tree(gemini)
+ stray = gemini / "tmp" / "project" / "chats" / "session-2026-10-23T08-00-stray.jsonl"
+ stray.write_bytes(_fixture("failed_edit"))
+ logs = antigravity / "brain" / "00000000-0000-4000-8000-000000000099" / ".system_generated" / "logs"
+ logs.mkdir(parents=True)
+ (logs / "transcript_full.jsonl").write_bytes((GEMINI_FIXTURES / "failed_shell.jsonl").read_bytes())
+
+ source = LocalSource(claude_code_homes=[], codex_homes=[], gemini_homes=[gemini], antigravity_homes=[antigravity])
+ index = source._build_index()
+ assert len(index) == 2
+ stats = source.discovery_stats()
+ assert stats["gemini-cli"]["skipped"] == {"different_agent": 1}
+ assert stats["antigravity-cli"]["skipped"] == {"different_agent": 1}
+
+
+# ---------------------------------------------------------------- built maps
+
+
+def _map(name: str, **kwargs) -> dict:
+ sid = f"local:antigravity-cli:{IDS[name]}"
+ _, spans = parse_antigravity(_fixture(name), sid)
+ for span in spans:
+ if span.parent_id is not None:
+ span.attributes["cwd"] = FIXTURE_ROOT
+ return builder.build_map_from_spans(spans, session_id=sid, agent_tool="antigravity-cli", **kwargs)
+
+
+def _fixture_strings(name: str) -> set[str]:
+ out: set[str] = set()
+
+ def walk(value):
+ if isinstance(value, dict):
+ for v in value.values():
+ walk(v)
+ elif isinstance(value, list):
+ for v in value:
+ walk(v)
+ elif isinstance(value, str):
+ out.add(value)
+
+ for rec in _records(name):
+ walk(rec)
+ return out
+
+
[email protected]("name", NAMES)
+def test_built_map_never_leaks_fixture_text(name):
+ doc = _map(name)
+ raw = json.dumps(doc)
+ for text in _fixture_strings(name):
+ if "PLACEHOLDER" in text or "ARG-" in text:
+ # Prompts, metadata, thoughts, replies, file contents, tool
+ # summaries, tool output, error text and command arguments.
+ assert text not in raw, text
+ # Outside a git repository a path collapses to a bucket label, so neither
+ # the absolute path nor a file name may appear.
+ for part in ("PLACEHOLDER", "ARG-", "USER_REQUEST", "ADDITIONAL_METADATA", FIXTURE_ROOT, "file_1", "file_2"):
+ assert part not in raw, part
+ assert doc["session"]["agentTool"] == "antigravity-cli"
+
+
+def test_built_map_classifies_reads_edits_shell_failures_and_subagents():
+ def kinds(name: str) -> list[tuple]:
+ return [(e["kind"], e.get("verb"), e.get("err")) for e in _map(name)["events"] if e.get("tool")]
+
+ assert kinds("read_explain") == [("read", None, False), ("read", None, False)]
+ assert kinds("edit_and_run") == [
+ ("read", None, False),
+ ("edit", None, False),
+ ("read", None, False),
+ ("exec", "node", False),
+ ]
+ assert kinds("failed_command") == [("exec", "node", True), ("exec", "node", False)]
+ assert kinds("failed_edit") == [("edit", None, True)]
+ assert kinds("denied_command") == [("exec", "touch", True)]
+ assert kinds("parallel_reads") == [("read", None, False)] * 3
+ launch = next(e for e in _map("subagent_parent")["events"] if e.get("tool"))
+ assert (launch["kind"], launch["subagentType"], launch["model"]) == ("subagent", "research", "inherit")
+ assert _map("failed_command")["totals"]["errors"] == 1
+
+
+def test_built_map_of_a_subagent_records_its_parent():
+ parent = f"local:antigravity-cli:{IDS['subagent_parent']}"
+ doc = _map("subagent_child", role="subagent", parent_session_id=parent)
+ assert doc["session"]["role"] == "subagent"
+ assert doc["session"]["parentSessionId"] == parent
diff --git a/python/tests/core/test_parser_robustness.py b/python/tests/core/test_parser_robustness.py
index 35dafc5..5d87305 100644
--- a/python/tests/core/test_parser_robustness.py
+++ b/python/tests/core/test_parser_robustness.py
@@ -21,6 +21,7 @@ import logging
import pytest
from agentplay._core.ingestion.coding_agent._sources.local.parsers import (
+ parse_antigravity,
parse_claude_code,
parse_codex,
parse_copilot,
@@ -317,7 +318,24 @@ def _gemini() -> list[dict]:
]
+def _antigravity() -> list[dict]:
+ step = {"source": "MODEL", "status": "DONE", "created_at": TS.format(1)}
+ return [
+ {"step_index": 0, "source": "USER_EXPLICIT", "type": "USER_INPUT", "status": "DONE",
+ "created_at": TS.format(0), "content": "<USER_REQUEST>\nlist files\n</USER_REQUEST>"},
+ {**step, "step_index": 1, "type": "PLANNER_RESPONSE", "input_tokens": 10, "cache_read_tokens": 2,
+ "output_tokens": 5, "thinking": "t",
+ "tool_calls": [{"name": "run_command", "args": {"CommandLine": "ls", "WaitMsBeforeAsync": 5000}}]},
+ {**step, "step_index": 2, "type": "GENERIC",
+ "content": "Created At: 2026-09-14T10:00:02Z\nCompleted At: 2026-09-14T10:00:02Z\n"
+ "Command exited with code 0.\n\nCommand output:\nx"},
+ {**step, "step_index": 3, "type": "PLANNER_RESPONSE", "input_tokens": 12, "output_tokens": 3,
+ "content": "done"},
+ ]
+
+
PARSERS = {
+ "antigravity": (parse_antigravity, _antigravity),
"claude_code": (parse_claude_code, _claude),
"codex": (parse_codex, _codex),
"copilot": (parse_copilot, _copilot),
diff --git a/python/tests/core/test_tool_taxonomy.py b/python/tests/core/test_tool_taxonomy.py
index cd57e17..9bec41e 100644
--- a/python/tests/core/test_tool_taxonomy.py
+++ b/python/tests/core/test_tool_taxonomy.py
@@ -10,6 +10,7 @@ import pytest
from agentplay._core.ingestion.coding_agent import tool_taxonomy as tt
from agentplay._core.ingestion.coding_agent._sources.local.parsers import (
+ antigravity,
codex,
copilot,
cursor_agent_transcript,
@@ -23,6 +24,7 @@ from agentplay._core.ingestion.coding_agent._sources.local.parsers import (
@pytest.mark.parametrize(
("module", "agent"),
[
+ (antigravity, "antigravity-cli"),
(codex, "codex"),
(cursor_store, "cursor"),
(cursor_agent_transcript, "cursor"),
@@ -51,6 +53,12 @@ def test_every_parser_reads_the_shared_table(module, agent) -> None:
("gemini-cli", "read_file", "Read"),
("gemini-cli", "replace", "Edit"),
("gemini-cli", "write_file", "Write"),
+ ("antigravity-cli", "run_command", "Bash"),
+ ("antigravity-cli", "read_file", "Read"),
+ ("antigravity-cli", "view_file", "Read"),
+ ("antigravity-cli", "edit_file", "Edit"),
+ ("antigravity-cli", "write_file", "Write"),
+ ("antigravity-cli", "invoke_subagent", "Task"),
("kiro", "execute_bash", "Bash"),
("opencode", "todowrite", "TodoWrite"),
],
@@ -70,8 +78,10 @@ def test_unknown_and_claude_names_pass_through() -> None:
def test_table_sizes_are_pinned() -> None:
# These counts are pinned; a changed count means a row was added or dropped on purpose -- update here.
# copilot-vscode's 12 rows are pinned against real tool names; gemini-cli's
- # 12 against real sessions plus the 0.65 bundle's tool-name constants.
+ # 12 against real sessions plus the 0.65 bundle's tool-name constants; antigravity-cli's
+ # 14 against real agy 1.4.6 sessions plus tool names in the 1.4.6 binary.
assert {a: len(t) for a, t in tt.TOOL_ALIASES.items()} == {
+ "antigravity-cli": 14,
"codex": 7,
"cursor": 26,
"copilot": 23,