Skip to content

Subagent Support #2604

@bluxolguin

Description

@bluxolguin

What feature would you like to see?

Summary

Request for official subagent functionality to be implemented in codex.

Background

This codebase https://github.com/bluxolguin/codex.git branch bluxolguin/subagents currently has experimental agent management features (see commit a14a89b) that demonstrate the foundation for subagent functionality. This includes:

  • Agent storage system in codex-rs/core/src/agents_store.rs
  • TUI integration for agent creation
  • Basic prompt templating for agent definitions

Motivation

Subagents would provide several key benefits:

  1. Specialized Expertise: Different agents for different domains (frontend, backend, DevOps, etc.)
  2. Context Isolation: Separate concerns and maintain focused conversations
  3. Workflow Optimization: Task-specific agents can provide more targeted assistance
  4. User Productivity: Quick access to specialized knowledge without context switching

Proposed Implementation

Based on the existing experimental code, the feature should include:

Core Components

  • Agent registry and persistence (partially implemented in agents_store.rs)
  • Agent selection interface in TUI
  • Agent-specific prompt injection system
  • Context isolation between agents

User Interface

  • Agent creation workflow (basic version exists)
  • Agent switching within conversations
  • Agent management command (/agents)
  • Visual indicators showing active agent

Agent Types

Consider supporting common agent archetypes:

  • code-reviewer: Focuses on code quality and best practices
  • architect: System design and architectural guidance
  • debugger: Problem diagnosis and troubleshooting
  • documentation: Writing and maintaining documentation
  • test-writer: Test creation and coverage analysis

Technical Considerations

  • Agent definitions should be stored in ~/.codex/agents.json
  • Subagent prompts should augment, not replace, base codex instructions
  • Need clear boundaries between agent capabilities
  • Should integrate seamlessly with existing tool usage

Current Status

Experimental implementation exists on https://github.com/bluxolguin/codex.git branch bluxolguin/subagents with basic agent storage and creation capabilities. This provides a solid foundation for official implementation.

Success Criteria

  • Users can create custom agents with specific prompts
  • Agent switching is intuitive and fast
  • Agents maintain their specialized focus throughout conversations
  • Feature integrates seamlessly with existing codex workflows
  • Documentation and examples for creating effective agents

References

  • Existing implementation: codex-rs/core/src/agents_store.rs
  • TUI integration: codex-rs/tui/src/chatwidget.rs:882-984
  • Agent creation prompt: codex-rs/tui/prompt_for_agent_creation.md

Are you interested in implementing this feature?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsubagentIssues involving subagents or multi-agent features

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions