diff --git a/core/agent/agent_test.go b/core/agent/agent_test.go
index d8b8b1b5..ec66de2e 100644
--- a/core/agent/agent_test.go
+++ b/core/agent/agent_test.go
@@ -29,6 +29,9 @@ func TestArgv(t *testing.T) {
{"omp", Launch{SkipPermissions: true, Continue: true}, []string{"omp", "--continue", "--auto-approve"}},
{"omp", Launch{Prompt: "test", Resume: "sess-123"}, []string{"omp", "--resume", "sess-123"}},
{"omp", Launch{Continue: true, SessionDir: "/s/1"}, []string{"omp", "--continue", "--session-dir", "/s/1"}},
+ {"antigravity", Launch{Prompt: "hi", SkipPermissions: true}, []string{"agy", "--dangerously-skip-permissions", "--prompt-interactive", "hi"}},
+ {"antigravity", Launch{SkipPermissions: true, Continue: true}, []string{"agy", "--continue", "--dangerously-skip-permissions"}},
+ {"antigravity", Launch{Prompt: "test", Resume: "uuid-123"}, []string{"agy", "--conversation", "uuid-123"}},
// An agent without a folder of its own for them keeps its own.
{"pi", Launch{SessionDir: "/s/1"}, []string{"pi"}},
}
diff --git a/core/agent/inject_test.go b/core/agent/inject_test.go
index 3bebad5c..91ebcbbc 100644
--- a/core/agent/inject_test.go
+++ b/core/agent/inject_test.go
@@ -120,8 +120,10 @@ func TestProjectBlockKeepsTheUsersTextAndDoesntDouble(t *testing.T) {
if strings.Count(string(data), projectBlockStart) != 1 || strings.Contains(string(data), "older words") || !strings.HasSuffix(string(data), mine) {
t.Fatalf("%q", data)
}
- if info, _ := os.Stat(path); info.Mode().Perm() != 0o640 {
- t.Fatalf("mode %v", info.Mode())
+ if runtime.GOOS != "windows" {
+ if info, _ := os.Stat(path); info.Mode().Perm() != 0o640 {
+ t.Fatalf("mode %v", info.Mode())
+ }
}
// Off: as it was before.
if err := RemoveProjectBlock(dir); err != nil {
diff --git a/core/agent/presets.go b/core/agent/presets.go
index c6a2513b..c1c95e3a 100644
--- a/core/agent/presets.go
+++ b/core/agent/presets.go
@@ -187,6 +187,8 @@ var Presets = []Preset{
ID: "antigravity", Name: "Antigravity", Command: "agy",
PromptFlag: []string{"--prompt-interactive"},
SkipPermissions: []string{"--dangerously-skip-permissions"},
+ Continue: []string{"--continue"},
+ Resume: []string{"--conversation"},
Homepage: "https://antigravity.google/docs/cli-overview",
},
{
diff --git a/core/transcript/agents.go b/core/transcript/agents.go
index 2fb69045..9ce5bcc2 100644
--- a/core/transcript/agents.go
+++ b/core/transcript/agents.go
@@ -30,6 +30,7 @@ var readers = map[string]struct {
"claude-agent-teams": {claudeFound, NewClaudeReader, claudeID},
"codex": {CodexFiles, NewCodexReader, codexID},
"omp": {OMPFiles, NewOMPReader, OMPConversationID},
+ "antigravity": {AntigravityFiles, NewAntigravityReader, AntigravityConversationID},
record.AgentID: {PlatformFiles, NewPlatformReader, claudeID},
}
diff --git a/core/transcript/antigravity.go b/core/transcript/antigravity.go
new file mode 100644
index 00000000..ce78a18e
--- /dev/null
+++ b/core/transcript/antigravity.go
@@ -0,0 +1,138 @@
+package transcript
+
+import (
+ "bufio"
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "regexp"
+ "slices"
+ "strings"
+ "time"
+
+ "github.com/enowx/enowx/proto"
+)
+
+var (
+ antigravityUUIDRegex = regexp.MustCompile(`([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})`)
+ userReqOpen = ""
+ userReqClose = ""
+)
+
+// AntigravityFiles returns the transcripts Antigravity keeps for sessions in dir, newest first.
+// Only conversations recorded in history.jsonl matching the session's folder are returned.
+func AntigravityFiles(home, dir string) []Found {
+ cleanDir := filepath.Clean(dir)
+ var all []Found
+ seen := map[string]bool{}
+
+ historyPath := filepath.Join(home, ".gemini", "antigravity-cli", "history.jsonl")
+ if f, err := os.Open(historyPath); err == nil {
+ scanner := bufio.NewScanner(f)
+ for scanner.Scan() {
+ var rec struct {
+ Workspace string `json:"workspace"`
+ ConversationID string `json:"conversationId"`
+ }
+ if json.Unmarshal(scanner.Bytes(), &rec) == nil && rec.ConversationID != "" {
+ if strings.EqualFold(filepath.Clean(rec.Workspace), cleanDir) {
+ tPath := filepath.Join(home, ".gemini", "antigravity-cli", "brain", rec.ConversationID, ".system_generated", "logs", "transcript.jsonl")
+ if info, err := os.Stat(tPath); err == nil && !seen[tPath] {
+ seen[tPath] = true
+ all = append(all, Found{Path: tPath, Changed: info.ModTime()})
+ }
+ }
+ }
+ }
+ _ = f.Close()
+ }
+
+ slices.SortFunc(all, func(a, b Found) int {
+ return b.Changed.Compare(a.Changed)
+ })
+ return all
+}
+
+// AntigravityConversationID extracts the conversation UUID from an Antigravity transcript path.
+func AntigravityConversationID(path string) string {
+ if m := antigravityUUIDRegex.FindStringSubmatch(path); len(m) > 1 {
+ return m[1]
+ }
+ return ""
+}
+
+// NewAntigravityReader creates a reader following an Antigravity transcript.jsonl.
+func NewAntigravityReader(path string) *Reader {
+ return newReader(path, &antigravityParser{})
+}
+
+type antigravityParser struct{}
+
+func (*antigravityParser) fresh() parser { return &antigravityParser{} }
+
+type antigravityToolCall struct {
+ Name string `json:"name"`
+ Args json.RawMessage `json:"args"`
+}
+
+type antigravityRecord struct {
+ StepIndex int `json:"step_index"`
+ Source string `json:"source"`
+ Type string `json:"type"`
+ Status string `json:"status"`
+ CreatedAt time.Time `json:"created_at"`
+ Content string `json:"content"`
+ InputTokens int64 `json:"input_tokens"`
+ OutputTokens int64 `json:"output_tokens"`
+ CacheReadTokens int64 `json:"cache_read_tokens"`
+ ToolCalls []antigravityToolCall `json:"tool_calls"`
+}
+
+func (p *antigravityParser) parse(line []byte, r *Reader) {
+ var rec antigravityRecord
+ if json.Unmarshal(line, &rec) != nil {
+ return
+ }
+
+ if rec.InputTokens > 0 || rec.OutputTokens > 0 {
+ r.Context = rec.InputTokens + rec.OutputTokens
+ }
+
+ switch rec.Type {
+ case "USER_INPUT":
+ content := extractUserContent(rec.Content)
+ if content != "" {
+ r.add(proto.TranscriptEntry{
+ Kind: proto.TranscriptUser,
+ Time: rec.CreatedAt,
+ Text: content,
+ })
+ }
+ case "PLANNER_RESPONSE":
+ if rec.Content != "" {
+ r.add(proto.TranscriptEntry{
+ Kind: proto.TranscriptAssistant,
+ Time: rec.CreatedAt,
+ Text: rec.Content,
+ })
+ }
+ for _, tc := range rec.ToolCalls {
+ r.add(proto.TranscriptEntry{
+ Kind: proto.TranscriptTool,
+ Time: rec.CreatedAt,
+ Text: tc.Name,
+ Detail: string(tc.Args),
+ })
+ }
+ }
+}
+
+func extractUserContent(raw string) string {
+ raw = strings.TrimSpace(raw)
+ start := strings.Index(raw, userReqOpen)
+ end := strings.Index(raw, userReqClose)
+ if start >= 0 && end > start {
+ return strings.TrimSpace(raw[start+len(userReqOpen) : end])
+ }
+ return raw
+}
diff --git a/core/transcript/antigravity_test.go b/core/transcript/antigravity_test.go
new file mode 100644
index 00000000..0dfa02f4
--- /dev/null
+++ b/core/transcript/antigravity_test.go
@@ -0,0 +1,147 @@
+package transcript
+
+import (
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/enowx/enowx/proto"
+)
+
+func TestAntigravityConversationID(t *testing.T) {
+ cases := []struct {
+ path string
+ want string
+ }{
+ {
+ path: "C:\\Users\\test\\.gemini\\antigravity-cli\\brain\\95f17248-01cd-432c-8dcd-ac35f2180110\\.system_generated\\logs\\transcript.jsonl",
+ want: "95f17248-01cd-432c-8dcd-ac35f2180110",
+ },
+ {
+ path: "/home/user/.gemini/antigravity-cli/brain/12345678-1234-1234-1234-123456789abc/.system_generated/logs/transcript.jsonl",
+ want: "12345678-1234-1234-1234-123456789abc",
+ },
+ {
+ path: "invalid/path/without/uuid.jsonl",
+ want: "",
+ },
+ }
+
+ for _, tc := range cases {
+ got := AntigravityConversationID(tc.path)
+ if got != tc.want {
+ t.Errorf("AntigravityConversationID(%q) = %q, want %q", tc.path, got, tc.want)
+ }
+ }
+}
+
+func TestAntigravityReaderParsing(t *testing.T) {
+ dir := t.TempDir()
+ logPath := filepath.Join(dir, "transcript.jsonl")
+
+ content := `{"step_index":0,"source":"USER_EXPLICIT","type":"USER_INPUT","status":"DONE","created_at":"2026-11-10T03:30:38Z","content":"\ngit pull\n\n\ninfo\n"}
+{"step_index":1,"source":"MODEL","type":"PLANNER_RESPONSE","status":"DONE","created_at":"2026-11-10T03:30:39Z","input_tokens":100,"output_tokens":50,"tool_calls":[{"name":"run_command","args":{"CommandLine":"git pull"}}]}
+{"step_index":2,"source":"MODEL","type":"PLANNER_RESPONSE","status":"DONE","created_at":"2026-11-10T03:30:44Z","content":"Pull completed successfully"}
+`
+ if err := os.WriteFile(logPath, []byte(content), 0o600); err != nil {
+ t.Fatal(err)
+ }
+
+ reader := NewAntigravityReader(logPath)
+ if err := reader.Update(); err != nil {
+ t.Fatalf("Update failed: %v", err)
+ }
+ entries, _ := reader.Since(0)
+
+ if len(entries) < 3 {
+ t.Fatalf("expected at least 3 entries, got %d: %+v", len(entries), entries)
+ }
+
+ // Verify User input extraction
+ if entries[0].Kind != proto.TranscriptUser || entries[0].Text != "git pull" {
+ t.Errorf("entry 0: kind=%v text=%q", entries[0].Kind, entries[0].Text)
+ }
+
+ // Verify Assistant Tool Call
+ if entries[1].Kind != proto.TranscriptTool || entries[1].Text != "run_command" {
+ t.Errorf("entry 1: kind=%v text=%q", entries[1].Kind, entries[1].Text)
+ }
+
+ // Verify Assistant Message
+ if entries[2].Kind != proto.TranscriptAssistant || entries[2].Text != "Pull completed successfully" {
+ t.Errorf("entry 2: kind=%v text=%q", entries[2].Kind, entries[2].Text)
+ }
+
+ // Verify Token calculation
+ if reader.Context != 150 {
+ t.Errorf("reader.Context = %d, want 150", reader.Context)
+ }
+}
+
+func TestAntigravityReaderToleratesCorruptedTrailingLine(t *testing.T) {
+ dir := t.TempDir()
+ logPath := filepath.Join(dir, "transcript.jsonl")
+
+ // Corrupted line at the end (simulating abrupt kill mid-write)
+ content := `{"step_index":0,"source":"USER_EXPLICIT","type":"USER_INPUT","status":"DONE","created_at":"2026-11-10T03:30:38Z","content":"\ncheck status\n"}
+{"step_index":1,"source":"MODEL","type":"PLANNER_RESPONSE","status":"DO
+`
+ if err := os.WriteFile(logPath, []byte(content), 0o600); err != nil {
+ t.Fatal(err)
+ }
+
+ reader := NewAntigravityReader(logPath)
+ if err := reader.Update(); err != nil {
+ t.Fatalf("Update failed: %v", err)
+ }
+ entries, _ := reader.Since(0)
+
+ if len(entries) != 1 {
+ t.Fatalf("expected 1 valid entry despite corrupted EOF line, got %d", len(entries))
+ }
+ if entries[0].Text != "check status" {
+ t.Errorf("expected text 'check status', got %q", entries[0].Text)
+ }
+}
+
+func TestAntigravityFilesDiscovery(t *testing.T) {
+ home := t.TempDir()
+ geminiDir := filepath.Join(home, ".gemini", "antigravity-cli")
+ _ = os.MkdirAll(geminiDir, 0o700)
+
+ convoID := "88888888-4444-4444-4444-121212121212"
+ brainLogDir := filepath.Join(geminiDir, "brain", convoID, ".system_generated", "logs")
+ _ = os.MkdirAll(brainLogDir, 0o700)
+ tFile := filepath.Join(brainLogDir, "transcript.jsonl")
+ _ = os.WriteFile(tFile, []byte("{}\n"), 0o600)
+
+ otherConvoID := "99999999-4444-4444-4444-121212121212"
+ otherLogDir := filepath.Join(geminiDir, "brain", otherConvoID, ".system_generated", "logs")
+ _ = os.MkdirAll(otherLogDir, 0o700)
+ otherTFile := filepath.Join(otherLogDir, "transcript.jsonl")
+ _ = os.WriteFile(otherTFile, []byte("{}\n"), 0o600)
+
+ ws := filepath.Join(home, "myproject")
+ otherWs := filepath.Join(home, "otherproject")
+
+ rec1, _ := json.Marshal(map[string]any{"workspace": ws, "conversationId": convoID})
+ rec2, _ := json.Marshal(map[string]any{"workspace": otherWs, "conversationId": otherConvoID})
+ _ = os.WriteFile(filepath.Join(geminiDir, "history.jsonl"), []byte(string(rec1)+"\n"+string(rec2)+"\n"), 0o600)
+
+ // Matching workspace returns its transcript
+ found := AntigravityFiles(home, ws)
+ if len(found) != 1 {
+ t.Fatalf("expected 1 found transcript for matching workspace, got %d", len(found))
+ }
+ if found[0].Path != tFile {
+ t.Errorf("found path = %q, want %q", found[0].Path, tFile)
+ }
+
+ // Non-matching workspace returns empty
+ emptyWs := filepath.Join(home, "nonexistent")
+ foundEmpty := AntigravityFiles(home, emptyWs)
+ if len(foundEmpty) != 0 {
+ t.Fatalf("expected 0 transcripts for nonexistent workspace, got %d", len(foundEmpty))
+ }
+}
diff --git a/daemon/persist.go b/daemon/persist.go
index 54416540..a597db89 100644
--- a/daemon/persist.go
+++ b/daemon/persist.go
@@ -266,17 +266,18 @@ func equalRecords(a, b record) bool {
// continue their last conversation), the others as they ended.
func (s *Server) restore() {
for _, r := range s.persist.saved() {
+ relaunch := r.Relaunch || (r.Agent == "antigravity" && !r.Exited)
spec := session.Spec{
ID: r.ID, Dir: r.Dir, Created: r.Created, History: s.persist.loadHistory(r.ID), Env: s.hostEnvFor(r.Member),
Meta: session.Meta{
FinishedAt: r.Finished,
Name: r.Name, Prompt: r.Prompt, Project: r.Project, Agent: r.Agent, Branch: r.Branch,
- Worktree: r.Worktree, SkipPermissions: r.Skip, SkipUnheard: r.Unheard, Model: r.Model, Effort: r.Effort, Mode: r.Mode, ModelStarted: r.Started, ModelMoved: r.Moved, Conversation: r.Convo, ConvoSince: r.Since, Relaunch: r.Relaunch, Restart: r.Restart, Restored: true,
+ Worktree: r.Worktree, SkipPermissions: r.Skip, SkipUnheard: r.Unheard, Model: r.Model, Effort: r.Effort, Mode: r.Mode, ModelStarted: r.Started, ModelMoved: r.Moved, Conversation: r.Convo, ConvoSince: r.Since, Relaunch: relaunch, Restart: r.Restart, Restored: true,
Budget: time.Duration(r.Budget) * time.Second, Parent: r.Parent, Note: r.Note, Group: r.Group, Account: r.Account, Config: r.Config, Member: r.Member, Private: r.Private, NotesFor: r.NotesFor, CanvasFor: r.Canvas, GOA: r.GOA, GOAWorker: r.GOAWorker, Features: r.Features, Creds: r.Creds,
Hibernated: r.Hibernated, HibernatedByHand: r.HibernatedByHand, HibernatedAt: r.HibernatedAt, NoAutoHibernate: r.NoAutoHibernate, Rules: r.Rules,
},
}
- if r.Relaunch {
+ if relaunch {
keepBypass(&spec.Meta)
}
for _, what := range r.Lost {
@@ -435,7 +436,11 @@ func (s *Server) resumeSessionIn(id, convo, mode string) (*session.Session, erro
return nil, fmt.Errorf("it ended right after starting %d times in a row, so enowX won't start it again by itself: %s", quickExitsMax, info.ExitWhy)
}
if !meta.Relaunch {
- return nil, errors.New("this session's command can't be continued: start it again in a new session")
+ if meta.Agent == "antigravity" {
+ meta.Relaunch = true
+ } else {
+ return nil, errors.New("this session's command can't be continued: start it again in a new session")
+ }
}
command, restart := meta.Restart, meta.Restart
run, err := s.configRunFor(id, meta) // its config, as it starts again
diff --git a/docs/agents.md b/docs/agents.md
index 086b047f..be218e05 100644
--- a/docs/agents.md
+++ b/docs/agents.md
@@ -31,7 +31,7 @@ More agents, started the same way; their flags are those their documentation giv
| Pi | `pi` | last argument | — | — | [docs](https://pi.dev) |
| OMP | `omp` | last argument | `--auto-approve` | `--continue` | [docs](https://omp.sh) |
| Prime Agent | `prime-agent` | `--` | — | — | [docs](https://github.com/PrimeIntellect-ai/prime-agent) |
-| Antigravity | `agy` | `--prompt-interactive` | `--dangerously-skip-permissions` | — | [docs](https://antigravity.google/docs/cli-overview) |
+| Antigravity | `agy` | `--prompt-interactive` | `--dangerously-skip-permissions` | `--continue`, `--conversation ID` | [docs](https://antigravity.google/docs/cli-overview) |
| Aider | `aider` | typed in once it shows its input | `--yes-always` | — | [docs](https://aider.chat/docs/) |
| Goose | `goose --version` | typed in once it shows its input | `GOOSE_MODE=auto` in its environment · always `GOOSE_MODE=auto` | — | [docs](https://block.github.io/goose/docs/quickstart/) |
| Amp | `amp` | typed in once it shows its input | `--dangerously-allow-all` | — | [docs](https://ampcode.com/manual#install) |