Files
Claude-Code-Workflow/.claude/commands/codex/chat.md
catlog22 d0b08794ca refactor: Reorganize workflow documentation structure and eliminate redundancy
## Major Changes
- **Replace 3 documents with 2**: Consolidate 655 lines to ~550 lines (40% reduction)
- **New Structure**:
  - `intelligent-tools-strategy.md` (strategic layer)
  - `tools-implementation-guide.md` (implementation layer)
- **Remove old files**: `intelligent-tools.md`, `gemini-unified.md`, `codex-unified.md`

## Content Improvements
- **Quick Start section**: Essential commands for immediate use
- **Strategic guidance**: Tool selection matrix and decision framework
- **Implementation details**: Part A (shared), Part B (Gemini), Part C (Codex)
- **Eliminate duplicates**: Template system, file patterns, execution settings

## Reference Updates
- **Agent files**: Update to new document paths (3 files)
- **Command files**: Batch update all references (12 files)
- **README files**: Update English and Chinese versions
- **Workflow files**: Update plan.md reference

## Benefits
- 40% content reduction while preserving all unique information
- Clear layer separation: strategy vs implementation
- Improved navigation and maintainability
- Enhanced quick reference capabilities

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 20:59:15 +08:00

6.3 KiB

name, description, usage, argument-hint, examples, allowed-tools, model
name description usage argument-hint examples allowed-tools model
chat Simple Codex CLI interaction command for direct codebase analysis and development /codex:chat "inquiry" your question or development request
/codex:chat "analyze the authentication flow"
/codex:chat "how can I optimize this React component performance?"
/codex:chat "implement user profile editing functionality"
Bash(codex:*) sonnet

🚀 Command Overview: /codex:chat

  • Type: Basic Codex CLI Wrapper
  • Purpose: Direct interaction with the codex CLI for simple codebase analysis and development
  • Core Tool: Bash(codex:*) - Executes the external Codex CLI tool

⚠️ Critical Difference: Codex has NO --all-files flag - you MUST use @ patterns to reference files.

📥 Parameters & Usage

  • <inquiry> (Required): Your question or development request
  • @{patterns} (Required): File patterns must be explicitly specified
  • --save-session (Optional): Saves the interaction to current workflow session directory
  • --full-auto (Optional): Enable autonomous development mode

🔄 Execution Workflow

Parse Input -> Infer File Patterns -> Construct Prompt -> Execute Codex CLI -> (Optional) Save Session

📚 Context Assembly

Context is gathered from:

  1. Project Guidelines: Always includes @{CLAUDE.md,**/*CLAUDE.md}
  2. Inferred Patterns: Auto-detects relevant files based on inquiry keywords
  3. Comprehensive Fallback: Uses @{**/*} when pattern inference unclear

📝 Prompt Format

=== CONTEXT ===
@{CLAUDE.md,**/*CLAUDE.md} [Project guidelines]
@{inferred_patterns} [Auto-detected or comprehensive patterns]

=== USER INPUT ===
[The user inquiry text]

⚙️ Execution Implementation

FUNCTION execute_codex_chat(user_inquiry, flags):
  // Always include project guidelines
  patterns = "@{CLAUDE.md,**/*CLAUDE.md}"
  
  // Infer relevant file patterns from inquiry keywords
  inferred_patterns = infer_file_patterns(user_inquiry)
  IF inferred_patterns:
    patterns += "," + inferred_patterns
  ELSE:
    patterns += ",@{**/*}"  // Fallback to all files
  
  // Construct prompt
  prompt = "=== CONTEXT ===\n" + patterns + "\n"
  prompt += "\n=== USER INPUT ===\n" + user_inquiry
  
  // Execute codex CLI
  IF flags contain "--full-auto":
    result = execute_tool("Bash(codex:*)", "--full-auto", prompt)
  ELSE:
    result = execute_tool("Bash(codex:*)", "exec", prompt)
  
  // Save session if requested
  IF flags contain "--save-session":
    save_chat_session(user_inquiry, patterns, result)
  
  RETURN result
END FUNCTION

🎯 Pattern Inference Logic

Auto-detects file patterns based on keywords:

Keywords Inferred Pattern Purpose
"auth", "login", "user" @{**/*auth*,**/*user*} Authentication code
"React", "component" @{src/**/*.{jsx,tsx}} React components
"API", "endpoint", "route" @{**/api/**/*,**/routes/**/*} API code
"test", "spec" @{test/**/*,**/*.test.*,**/*.spec.*} Test files
"config", "setup" @{*.config.*,package.json} Configuration
"database", "db", "model" @{**/models/**/*,**/db/**/*} Database code
"style", "css" @{**/*.{css,scss,sass}} Styling files

Fallback: If no keywords match, uses @{**/*} for comprehensive analysis.

💾 Session Persistence

When --save-session flag is used:

  • Check for existing active session (.workflow/.active-* markers)
  • Save to existing session's .chat/ directory or create new session
  • File format: chat-YYYYMMDD-HHMMSS.md
  • Include query, context patterns, and response in saved file

Session Template:

# Chat Session: [Timestamp]

## Query
[Original user inquiry]

## Context Patterns
[File patterns used in analysis]

## Codex Response
[Complete response from Codex CLI]

## Pattern Inference
[How file patterns were determined]

🔧 Usage Examples

Basic Development Chat

/codex:chat "implement password reset functionality"
# Executes: codex exec "@{CLAUDE.md,**/*CLAUDE.md,**/*auth*,**/*user*} implement password reset functionality"

Architecture Discussion

/codex:chat "how should I structure the user management module?"
# Executes: codex exec "@{CLAUDE.md,**/*CLAUDE.md,**/*user*,src/**/*} how should I structure the user management module?"

Performance Optimization

/codex:chat "optimize React component rendering performance"
# Executes: codex exec "@{CLAUDE.md,**/*CLAUDE.md,src/**/*.{jsx,tsx}} optimize React component rendering performance"

Full Auto Mode

/codex:chat "create a complete user dashboard with charts" --full-auto
# Executes: codex --full-auto "@{CLAUDE.md,**/*CLAUDE.md,**/*user*,**/*dashboard*} create a complete user dashboard with charts"

⚠️ Error Prevention

  • Pattern validation: Ensures @ patterns match existing files
  • Fallback patterns: Uses comprehensive @{**/*} when inference fails
  • Context verification: Always includes project guidelines
  • Session handling: Graceful handling of missing workflow directories

📊 Codex vs Gemini Chat

Feature Codex Chat Gemini Chat
File Loading @ patterns required --all-files available
Pattern Inference Automatic keyword-based Manual or --all-files
Development Focus Code generation & implementation Analysis & exploration
Automation --full-auto mode available Interactive only
Command Structure codex exec "@{patterns}" gemini --all-files -p

🚀 Advanced Features

Multi-Pattern Inference

/codex:chat "implement React authentication with API integration"
# Infers: @{CLAUDE.md,**/*CLAUDE.md,src/**/*.{jsx,tsx},**/*auth*,**/api/**/*}

Context-Aware Development

/codex:chat "add unit tests for the payment processing module"
# Infers: @{CLAUDE.md,**/*CLAUDE.md,**/*payment*,test/**/*,**/*.test.*}

Configuration Analysis

/codex:chat "review and optimize build configuration"
# Infers: @{CLAUDE.md,**/*CLAUDE.md,*.config.*,package.json,webpack.*,vite.*}

For detailed syntax, patterns, and advanced usage see: @~/.claude/workflows/tools-implementation-guide.md