Skip to content

P5: centralize agent type aliases into single source of truth #401

@rsnodgrass

Description

@rsnodgrass

Parent Epic

Part of #396 (unify agent abstraction layer)

Problem

Agent type alias resolution exists in 3 separate places:

  1. internal/prime/agent_type.go:CanonicalAgentType() — maps "claude"→"claude-code", "gemini-cli"→"gemini", etc.
  2. internal/session/adapters/*.go:init() — each adapter registers with aliases
  3. cmd/ox/agent_hook.go:resolveAgentType() — another alias resolution for hook context

These can drift out of sync. When adding a new agent, all 3 must be updated.

Proposed Solution

Define aliases in agent metadata (from P1). Then:

  • CanonicalAgentType() iterates registry metadata to find matching alias
  • Adapter Register() calls use aliases from metadata
  • resolveAgentType() delegates to CanonicalAgentType()

Single source of truth: Agent.Metadata().Aliases.

Dependency

Depends on P1 (Agent.Metadata() interface).

Files to Change

  • internal/prime/agent_type.go — simplify using registry aliases
  • cmd/ox/agent_hook.go — delete resolveAgentType(), use canonical function
  • internal/session/adapters/*.go — derive aliases from metadata (or keep init() but validate against metadata)

Risk

  • Blast radius: Small (2-3 files)
  • Behavior change: None — alias resolution is centralized

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt requiring cleanup or refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions