Skip to content

Feature: Support bypass-AI mode for custom commands to reduce token consumption #7985

@ShenWang96

Description

@ShenWang96

Problem

Currently, all custom commands defined in or must go through the AI model:

This consumes input/output tokens even for simple, deterministic commands like:

    • just runs a local script and returns output
    • displays system information
  • Custom info queries that don't need AI processing

Example Cost

A simple command consumes ~100-200 tokens just to:

  1. Parse the command
  2. Execute tool to run script
  3. Format the response

This adds up for frequently-used commands.

Proposed Solution

Add a flag (or similar mechanism) for custom commands:

When :

  1. Command is intercepted at gateway level (like native )
  2. Tool is executed directly
  3. Output is sent to user without entering AI session
  4. Zero tokens consumed for the command itself

Benefits

  • 💰 Significant cost savings for frequent info commands
  • ⚡ Faster response times (no model latency)
  • 🏗️ Clearer architecture: AI commands vs system commands
  • 🔄 Backward compatible (default )

Alternatives Considered

  • Keep current behavior (always through AI) - works but wasteful
  • Use hooks - not suitable for user-triggered commands
  • Separate command system - adds complexity

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions