Skip to content

Refactor: Deduplicate agent creation logic with shared factory #635

@jkoelker

Description

@jkoelker

Problem

Agent creation code has significant duplication across multiple files:

  • Tool restrictions repeated in every agent
  • Temperature default (0.1) repeated
  • Agent factory pattern identical in each file
  • Metadata exports duplicated

Proposed Solution

Create shared utilities in :

    • Generic agent factory with shared logic
    • Centralize default models and temperatures
    • Unified metadata interface

Benefits

  • Single source of truth for agent configuration
  • Easier to test and maintain
  • Type-safe refactoring affects all agents uniformly
  • Reduces code duplication by ~60%

Tasks

  • Create shared agent factory
  • Extract constants to shared file
  • Create unified metadata interface
  • Refactor oracle.ts to use factory
  • Refactor librarian.ts to use factory
  • Refactor explore.ts to use factory
  • Refactor frontend-ui-ux-engineer.ts to use factory
  • Refactor document-writer.ts to use factory
  • Refactor multimodal-looker.ts to use factory
  • Update utils.ts exports
  • Update index.ts exports
  • Test thoroughly
  • Update documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions