Skip to content

[Feature] Add /status command to show session state and token usage #46

@Prodesire

Description

@Prodesire

Problem or Motivation

There is no single command to view the current session state. Users need to run /model, /auth, and mentally track token consumption separately. Key information like cumulative token usage, active provider, default region, session ID, and working directory are scattered or unavailable.

This is especially useful for:

  • Monitoring costs during long sessions
  • Debugging provider/model configuration issues
  • Quickly verifying which credentials and region are active before a deployment

Proposed Solution

Add a /status command that displays a concise overview of the current session:

╭─ Session Status ─────────────────────────────────────────────╮
│  Session:   e91c5730 (resumed)                               │
│  Provider:  DashScope (qwen3.7-max)                          │
│  Region:    cn-beijing                                       │
│  CWD:      /Users/dev/infra                                  │
│                                                              │
│  Token Usage (this session):                                 │
│    Input:   12,450 tokens                                    │
│    Output:   3,280 tokens                                    │
│    Cache:    8,200 tokens (read)                              │
│    Total:   15,730 tokens                                    │
│                                                              │
│  Turns:     7 / 100                                          │
│  Context:   45% used (58k / 128k)                            │
╰──────────────────────────────────────────────────────────────╯

Key fields:

  • Session ID and whether it was resumed
  • Provider + model currently active
  • Default region for cloud operations
  • Cumulative token usage (input, output, cache read/create) for the session
  • Turn count vs max turns
  • Context window utilization (current tokens / window size)

Related Area

CLI / Interactive Mode

Additional Context

The renderer already tracks per-message token usage (_format_token_count in renderer.py), and ContextManager.get_usage() provides context utilization data. The main work is accumulating session-level totals and wiring them into a new slash command.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions