ag-session 0.18.0

Agentty is an ADE (Agentic Development Environment) for structured, controllable AI-assisted software development.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
use std::fmt;
use std::str::FromStr;

use ag_contracts::{ReasoningLevel, SpeedMode};

/// Supported agent provider families.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AgentKind {
    /// Google Antigravity CLI/backend.
    Antigravity,
    /// Google Gemini CLI/backend.
    Gemini,
    /// Anthropic Claude Code CLI/backend.
    Claude,
    /// `OpenAI` Codex CLI/backend.
    Codex,
    /// Native in-process `ag-harness` backend, which has no CLI executable.
    Harness,
}

// Generate typed identities, exhaustive metadata, and ordered provider lists
// from the same declaration so adding a model cannot omit one of those
// surfaces.
macro_rules! define_model_catalog {
    ($($provider:ident { $(
        $(#[$attribute:meta])*
        $model:ident = $discriminant:literal => {
            id: $id:literal,
            description: $description:literal,
            fast: $fast:literal,
        },
    )* })*) => {
        /// Supported agent model names across all providers.
        ///
        /// Gemini ids are shared by Gemini and Antigravity; provider ownership
        /// lives on [`AgentSelection`]. Removing a variant is a Rust source API
        /// change even when [`AgentModel::retired_replacement`] preserves saved ids.
        #[derive(Debug, Clone, Copy, PartialEq, Eq)]
        pub enum AgentModel {
            $($( $(#[$attribute])* $model = $discriminant, )*)*
        }

        impl AgentModel {
            /// All selectable models, grouped in catalog provider order.
            pub const ALL: &[Self] = &[$($(Self::$model,)*)*];

            const fn descriptor(self) -> ModelDescriptor {
                match self {
                    $($(Self::$model => ModelDescriptor {
                        description: $description,
                        id: $id,
                        supports_fast_mode: $fast,
                    },)*)*
                }
            }
        }

        impl AgentKind {
            /// Returns this provider's models in their catalog display order.
            pub fn models(self) -> &'static [AgentModel] {
                match self {
                    Self::Antigravity => Self::Gemini.models(),
                    $(Self::$provider => &[$(AgentModel::$model,)*],)*
                }
            }
        }
    };
}

define_model_catalog! {
    Gemini {
        /// Gemini Argon model backed by `gemini-4-argon`.
        Gemini4Argon = 17 => {
            id: "gemini-4-argon",
            description: "Gemini 4 Argon model.",
            fast: false,
        },
        /// Higher-quality Gemini preview model backed by `gemini-3.1-pro-preview`.
        Gemini31Pro = 6 => {
            id: "gemini-3.1-pro-preview",
            description: "Higher-quality Gemini model for deeper reasoning.",
            fast: false,
        },
        /// Fast Gemini model backed by `gemini-3.8-flash`.
        Gemini38Flash = 4 => {
            id: "gemini-3.8-flash",
            description: "Fast Gemini model for agentic and multimodal tasks.",
            fast: false,
        },
        /// Lightweight Gemini model backed by `gemini-3.5-flash-lite`.
        Gemini35FlashLite = 5 => {
            id: "gemini-3.5-flash-lite",
            description: "Lightweight Gemini model for fast, cost-conscious workloads.",
            fast: false,
        },
    }
    Claude {
        /// Claude Fable model backed by `claude-fable-5-1`.
        ClaudeFable51 = 10 => {
            id: "claude-fable-5-1",
            description: "Claude Fable model for creative, narrative-heavy tasks.",
            fast: false,
        },
        /// Claude Opus model backed by `claude-opus-5-5`.
        ClaudeOpus55 = 8 => {
            id: "claude-opus-5-5",
            description: "Latest Claude Opus model for complex agentic tasks.",
            fast: true,
        },
        /// Claude Sonnet model backed by `claude-sonnet-5-5`.
        ClaudeSonnet55 = 9 => {
            id: "claude-sonnet-5-5",
            description: "Balanced Claude model for quality and latency.",
            fast: false,
        },
        /// Claude Haiku model backed by `claude-haiku-4-5-20251001`.
        ClaudeHaiku4520251001 = 11 => {
            id: "claude-haiku-4-5-20251001",
            description: "Fast Claude model for lighter tasks.",
            fast: false,
        },
    }
    Codex {
        /// Codex Astra model backed by `gpt-6-astra`.
        Gpt6Astra = 0 => {
            id: "gpt-6-astra",
            description: "Most capable Codex model for the hardest end-to-end work.",
            fast: true,
        },
        /// Codex Sol model backed by `gpt-6.1-sol`.
        Gpt61Sol = 1 => {
            id: "gpt-6.1-sol",
            description: "Near-Astra Codex model for complex work at a lower cost.",
            fast: true,
        },
        /// Codex Luna model backed by `gpt-6-luna`.
        Gpt6Luna = 2 => {
            id: "gpt-6-luna",
            description: "Efficient Codex model for focused, high-volume tasks.",
            fast: true,
        },
        /// Codex Terra model backed by `gpt-5.6-terra`.
        Gpt56Terra = 3 => {
            id: "gpt-5.6-terra",
            description: "Current Codex model for balanced coding performance.",
            fast: true,
        },
        /// Codex spark model backed by `gpt-5.3-codex-spark`.
        Gpt53CodexSpark = 7 => {
            id: "gpt-5.3-codex-spark",
            description: "Codex spark model for quick coding iterations.",
            fast: false,
        },
    }
    Harness {
        /// Muse model backed by `muse-spark-1.3`.
        MuseSpark13 = 12 => {
            id: "muse-spark-1.3",
            description: "Muse Spark model served through the native harness.",
            fast: false,
        },
        /// Kimi model backed by `kimi-k3`.
        KimiK3 = 13 => {
            id: "kimi-k3",
            description: "Latest Kimi model served through the native harness.",
            fast: false,
        },
        /// Kimi model backed by `kimi-k2.6`.
        KimiK26 = 14 => {
            id: "kimi-k2.6",
            description: "Previous Kimi model served through the native harness.",
            fast: false,
        },
        /// Qwen model backed by `qwen3.8-max`.
        Qwen38Max = 15 => {
            id: "qwen3.8-max",
            description: "Most capable Qwen model served through the native harness.",
            fast: false,
        },
        /// Qwen model backed by `qwen-plus`.
        QwenPlus = 16 => {
            id: "qwen-plus",
            description: "Balanced Qwen model served through the native harness.",
            fast: false,
        },
    }
}

struct ModelDescriptor {
    description: &'static str,
    id: &'static str,
    supports_fast_mode: bool,
}

/// Session-level agent selection that keeps provider kind and model together.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct AgentSelection {
    kind: AgentKind,
    model: AgentModel,
}

impl AgentSelection {
    /// Creates a coherent session agent selection.
    ///
    /// If `model` is not supported by `kind`, the provider's default model is
    /// used so the selection never carries unrelated provider/model values.
    #[must_use]
    pub fn new(kind: AgentKind, model: AgentModel) -> Self {
        let model = if kind.supports_model(model) {
            model
        } else {
            kind.default_model()
        };

        Self { kind, model }
    }

    /// Returns the selected agent provider kind.
    #[must_use]
    pub fn kind(self) -> AgentKind {
        self.kind
    }

    /// Returns the selected agent model.
    #[must_use]
    pub fn model(self) -> AgentModel {
        self.model
    }

    /// Returns whether this exact provider/model pair supports Fast mode.
    #[must_use]
    pub fn supports_fast_mode(self) -> bool {
        self.model.descriptor().supports_fast_mode
    }

    /// Returns the compatible provider/model pair for one speed preference.
    ///
    /// Fast Claude requests require Opus, while incompatible Codex models move
    /// to the provider's default model. Providers without a speed control and
    /// already compatible selections remain unchanged.
    #[must_use]
    pub fn compatible_with_speed_mode(self, speed_mode: SpeedMode) -> Self {
        if speed_mode == SpeedMode::Normal || self.supports_fast_mode() {
            return self;
        }

        match self.kind {
            AgentKind::Claude => Self::new(AgentKind::Claude, AgentModel::ClaudeOpus55),
            AgentKind::Codex => Self::new(AgentKind::Codex, AgentKind::Codex.default_model()),
            AgentKind::Antigravity | AgentKind::Gemini | AgentKind::Harness => self,
        }
    }
}

/// Human-readable metadata for slash-menu selectable items.
pub trait AgentSelectionMetadata {
    /// Returns a stable item name shown in menus.
    fn name(&self) -> &'static str;

    /// Returns a short descriptive subtitle shown in menus.
    fn description(&self) -> &'static str;
}

impl AgentModel {
    /// Returns the stable wire/model identifier used in persistence and CLI
    /// invocations.
    pub const fn as_str(self) -> &'static str {
        self.descriptor().id
    }

    /// Returns the model identifier passed to provider transports.
    ///
    /// Antigravity and Gemini use the same raw Gemini CLI model ids; callers
    /// route those ids through the provider stored on [`AgentSelection`].
    pub fn provider_model_str(self) -> &'static str {
        self.as_str()
    }

    /// Parses one persisted model identifier and upgrades retired ids to
    /// their replacement models.
    ///
    /// Stored retired Gemini, Claude, and Codex ids are migrated forward
    /// through [`AgentModel::retired_replacement`] so existing projects and
    /// sessions continue loading after model retirements.
    /// Raw `gemini-*` ids parse to shared Gemini model variants; persisted
    /// session agents decide whether Gemini or Antigravity owns the session.
    ///
    /// # Errors
    /// Returns an error when `value` is not a known current or retired model
    /// identifier.
    pub fn parse_persisted(value: &str) -> Result<Self, String> {
        if let Some(replacement) = Self::retired_replacement(value) {
            return Ok(replacement);
        }

        value.parse()
    }

    /// Returns the current replacement model for a retired persisted model
    /// id, or `None` when `value` is not a retired id.
    ///
    /// This registry is the single source of truth for model retirement.
    /// Retiring a model means removing its selectable [`AgentModel`] variant
    /// and mapping its persisted id to the replacement model here. Retired
    /// ids never appear in selectable model lists. Persisted selections resolve
    /// to the replacement, and sessions that are still active are switched to
    /// it automatically. Database migrations may also normalize saved ids.
    #[must_use]
    pub fn retired_replacement(value: &str) -> Option<Self> {
        const RETIRED_MODEL_REPLACEMENTS: &[(&str, AgentModel)] = &[
            ("gemini-3-pro-preview", AgentModel::Gemini31Pro),
            ("gemini-3.1-pro", AgentModel::Gemini31Pro),
            ("gemini-3-flash-preview", AgentModel::Gemini38Flash),
            ("gemini-3.7-flash", AgentModel::Gemini38Flash),
            ("gemini-3.6-flash", AgentModel::Gemini38Flash),
            ("gemini-3.5-flash", AgentModel::Gemini35FlashLite),
            (
                "gemini-3.1-flash-lite-preview",
                AgentModel::Gemini35FlashLite,
            ),
            ("claude-fable-5", AgentModel::ClaudeFable51),
            ("claude-opus-5", AgentModel::ClaudeOpus55),
            ("gpt-6-sol", AgentModel::Gpt61Sol),
            ("gpt-5.6-sol", AgentModel::Gpt61Sol),
            ("gpt-5.6-luna", AgentModel::Gpt6Luna),
            ("claude-opus-4-8", AgentModel::ClaudeOpus55),
            ("claude-opus-4-6", AgentModel::ClaudeOpus55),
            ("claude-opus-4-7", AgentModel::ClaudeOpus55),
            ("claude-sonnet-4-6", AgentModel::ClaudeSonnet55),
            ("claude-sonnet-5", AgentModel::ClaudeSonnet55),
            ("gpt-5.5", AgentModel::Gpt61Sol),
            ("gpt-5.4-mini", AgentModel::Gpt6Luna),
            ("gpt-5.4", AgentModel::Gpt61Sol),
            ("gpt-5.3-codex", AgentModel::Gpt61Sol),
            ("gpt-5.2-codex", AgentModel::Gpt53CodexSpark),
        ];

        RETIRED_MODEL_REPLACEMENTS
            .iter()
            .find(|(retired_id, _)| *retired_id == value)
            .map(|(_, replacement)| *replacement)
    }
}

/// Parses one persisted session agent/model pair without deriving the agent
/// from the model when the saved agent kind is available.
///
/// Existing databases did not persist `agent`, so rows with a missing or
/// invalid agent value fall back to a compatibility provider inferred from
/// the persisted model string. Ambiguous raw `gemini-*` rows default to
/// Antigravity because direct Gemini support had been removed before the new
/// `agent` column was introduced.
pub fn parse_persisted_session_agent_model(
    agent_value: Option<&str>,
    model_value: &str,
) -> AgentSelection {
    let parsed_agent = agent_value
        .filter(|value| !value.trim().is_empty())
        .and_then(|value| value.parse::<AgentKind>().ok());

    if let Some(agent_kind) = parsed_agent {
        return parse_model_for_persisted_agent(agent_kind, model_value);
    }

    let model = AgentModel::parse_persisted(model_value)
        .unwrap_or_else(|_| AgentKind::Antigravity.default_model());
    let agent_kind = legacy_agent_kind_for_model_value(model_value, model);

    AgentSelection::new(agent_kind, model)
}

/// Parses a persisted model using the already persisted agent kind as the
/// source of truth for provider ownership.
fn parse_model_for_persisted_agent(agent_kind: AgentKind, model_value: &str) -> AgentSelection {
    if let Some(model) = agent_kind.parse_model(model_value) {
        return AgentSelection::new(agent_kind, model);
    }

    if let Ok(model) = AgentModel::parse_persisted(model_value)
        && agent_kind.supports_model(model)
    {
        return AgentSelection::new(agent_kind, model);
    }

    AgentSelection::new(agent_kind, agent_kind.default_model())
}

/// Returns the provider used for legacy rows that predate explicit session
/// agent persistence.
fn legacy_agent_kind_for_model_value(model_value: &str, model: AgentModel) -> AgentKind {
    if model_value.starts_with("claude-") {
        return AgentKind::Claude;
    }

    if model_value.starts_with("gpt-") {
        return AgentKind::Codex;
    }

    if model_value.starts_with("gemini-") {
        return AgentKind::Antigravity;
    }

    AgentKind::ALL
        .iter()
        .copied()
        .chain([AgentKind::Harness])
        .find(|agent_kind| agent_kind.supports_model(model))
        .unwrap_or(AgentKind::Antigravity)
}

/// Returns all selectable models owned by the provided agent kinds in stable
/// settings and slash-menu order.
#[must_use]
pub fn selectable_models_for_agent_kinds(agent_kinds: &[AgentKind]) -> Vec<AgentModel> {
    let mut models = Vec::new();
    for model in agent_kinds
        .iter()
        .flat_map(|agent_kind| agent_kind.models())
        .copied()
    {
        if !models.contains(&model) {
            models.push(model);
        }
    }

    models
}

/// Resolves one model against the currently available agent kinds.
///
/// When `model` is unsupported by every available provider, this prefers
/// `fallback_model` when any available provider supports it and otherwise falls
/// back to the first available provider default in `agent_kinds`. When no
/// providers are available, it returns `fallback_model` unchanged.
#[must_use]
pub fn resolve_model_for_available_agent_kinds(
    model: AgentModel,
    agent_kinds: &[AgentKind],
    fallback_model: AgentModel,
) -> AgentModel {
    if agent_kinds
        .iter()
        .any(|agent_kind| agent_kind.supports_model(model))
    {
        return model;
    }

    if agent_kinds
        .iter()
        .any(|agent_kind| agent_kind.supports_model(fallback_model))
    {
        return fallback_model;
    }

    agent_kinds
        .first()
        .copied()
        .map_or(fallback_model, AgentKind::default_model)
}

/// Resolves a provider kind that can run `model` from the available provider
/// list.
///
/// Shared Gemini model ids can be run by both Gemini and Antigravity. This
/// helper uses the order of `agent_kinds` as the tie-breaker and returns
/// `fallback_agent_kind` when no available provider supports `model`.
#[must_use]
pub fn resolve_agent_kind_for_model(
    model: AgentModel,
    agent_kinds: &[AgentKind],
    fallback_agent_kind: AgentKind,
) -> AgentKind {
    agent_kinds
        .iter()
        .copied()
        .find(|agent_kind| agent_kind.supports_model(model))
        .unwrap_or(fallback_agent_kind)
}

/// Resolves an [`AgentSelection`] for a model-only setting.
///
/// `preferred_agent_kind` is kept when it can run `model`, which preserves the
/// current session provider for shared Gemini model ids. Otherwise the
/// available provider order decides the owning provider, falling back to
/// `preferred_agent_kind` when no available provider supports the model.
#[must_use]
pub fn resolve_agent_selection_for_model(
    model: AgentModel,
    preferred_agent_kind: AgentKind,
    agent_kinds: &[AgentKind],
) -> AgentSelection {
    let agent_kind = if preferred_agent_kind.supports_model(model) {
        preferred_agent_kind
    } else {
        resolve_agent_kind_for_model(model, agent_kinds, preferred_agent_kind)
    };

    AgentSelection::new(agent_kind, model)
}

/// Resolves the agent kind used for prompt-side `/model` selection.
///
/// This preserves `session_agent_kind` when that backend is still available
/// and otherwise falls back to the first available backend. When no backends
/// are available, it returns `None`.
#[must_use]
pub fn resolve_prompt_model_agent_kind(
    session_agent_kind: AgentKind,
    agent_kinds: &[AgentKind],
) -> Option<AgentKind> {
    if agent_kinds.contains(&session_agent_kind) {
        return Some(session_agent_kind);
    }

    agent_kinds.first().copied()
}

impl FromStr for AgentModel {
    type Err = String;

    fn from_str(value: &str) -> Result<Self, Self::Err> {
        Self::ALL
            .iter()
            .copied()
            .find(|model| model.as_str() == value)
            .ok_or_else(|| format!("unknown model: {value}"))
    }
}

impl AgentSelectionMetadata for AgentModel {
    fn name(&self) -> &'static str {
        (*self).provider_model_str()
    }

    fn description(&self) -> &'static str {
        self.descriptor().description
    }
}

impl AgentKind {
    /// All CLI-backed agent kinds, in display order.
    ///
    /// [`AgentKind::Harness`] runs in process, so it is never discovered from
    /// `PATH` and stays out of this list.
    pub const ALL: &[AgentKind] = &[
        AgentKind::Gemini,
        AgentKind::Antigravity,
        AgentKind::Claude,
        AgentKind::Codex,
    ];

    /// Returns the provider CLI executable name, or `None` for the in-process
    /// harness.
    pub fn executable_name(self) -> Option<&'static str> {
        match self {
            Self::Antigravity => Some("agy"),
            Self::Gemini => Some("gemini"),
            Self::Claude => Some("claude"),
            Self::Codex => Some("codex"),
            Self::Harness => None,
        }
    }

    /// Returns the default model for this agent kind.
    pub fn default_model(self) -> AgentModel {
        match self {
            Self::Antigravity | Self::Gemini => AgentModel::Gemini31Pro,
            Self::Claude => AgentModel::ClaudeFable51,
            Self::Codex => AgentModel::Gpt61Sol,
            Self::Harness => AgentModel::MuseSpark13,
        }
    }

    /// Returns the model string when it belongs to this agent kind.
    pub fn model_str(self, model: AgentModel) -> Option<&'static str> {
        if !self.supports_model(model) {
            return None;
        }

        Some(model.as_str())
    }

    /// Parses a provider-specific model string for this agent kind.
    pub fn parse_model(self, value: &str) -> Option<AgentModel> {
        let model = value.parse::<AgentModel>().ok()?;
        if !self.supports_model(model) {
            return None;
        }

        Some(model)
    }

    /// Returns whether this provider can run the given model.
    pub fn supports_model(self, model: AgentModel) -> bool {
        self.models().contains(&model)
    }

    /// Returns whether this provider exposes a response-speed control.
    ///
    /// Claude and Codex accept a per-turn speed selection, so `/speed` offers
    /// the picker and session surfaces display the active [`SpeedMode`].
    /// Gemini and Antigravity have no equivalent control, so neither the
    /// command nor the speed display is offered for them.
    ///
    /// [`SpeedMode`]: ag_contracts::SpeedMode
    pub fn supports_speed_mode(self) -> bool {
        matches!(self, Self::Claude | Self::Codex)
    }
}

impl AgentSelectionMetadata for AgentKind {
    fn name(&self) -> &'static str {
        match self {
            Self::Antigravity => "antigravity",
            Self::Gemini => "gemini",
            Self::Claude => "claude",
            Self::Codex => "codex",
            Self::Harness => "harness",
        }
    }

    fn description(&self) -> &'static str {
        match self {
            Self::Antigravity => "Google Antigravity CLI agent.",
            Self::Gemini => "Google Gemini CLI agent.",
            Self::Claude => "Anthropic Claude Code agent.",
            Self::Codex => "OpenAI Codex CLI agent.",
            Self::Harness => "Native Agentty harness agent.",
        }
    }
}

impl AgentSelectionMetadata for ReasoningLevel {
    fn name(&self) -> &'static str {
        (*self).as_str()
    }

    fn description(&self) -> &'static str {
        (*self).description()
    }
}

impl fmt::Display for AgentKind {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.name())
    }
}

impl FromStr for AgentKind {
    type Err = String;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "antigravity" | "agy" => Ok(Self::Antigravity),
            "gemini" => Ok(Self::Gemini),
            "claude" => Ok(Self::Claude),
            "codex" => Ok(Self::Codex),
            "harness" => Ok(Self::Harness),
            other => Err(format!("unknown agent kind: {other}")),
        }
    }
}

#[cfg(test)]
#[path = "agent_test.rs"]
mod tests;