Skip to content

Add per-message timings#25

Merged
tigy32 merged 1 commit intotigy32:mainfrom
brandonpike:timing
Nov 28, 2025
Merged

Add per-message timings#25
tigy32 merged 1 commit intotigy32:mainfrom
brandonpike:timing

Conversation

@brandonpike
Copy link
Contributor

Introduce the /timing local command for CLI.

I found myself curious how long a specific message was taking to process, so I added a way for users to get this information out at the end of each user message.

If enabled, the /timing command enables you to get timings out at the end of each message. The aggregates still apply on /cost.

Example:

> can you just give me a one sentence summary of everything?
...
[System] Task completed [success=true]: Provided a single sentence summary of tycode-core: It is the core engine for an AI coding assistant that orchestrates Claude conversations through specialized agents, executes tools (file ops, builds, type analysis, sub-agents), manages workspaces with security, persists sessions, and integrates with MCP servers.

> /timing
[System] Timings: enabled

> can you just give me a one sentence summary of everything?
...
[System] Task completed [success=true]: Provided one sentence summary of tycode-core.
[System] Timing => Human: 6.6s, AI: 8.5s, Tools: 0.0s, Total: 15.1s

> /cost
[System] === Session Cost Summary ===
...
Time Spent:
  Waiting for human:   67.4s
  AI processing:      198.8s
  Tool execution:       0.1s
  Total session:      266.2s

Introduce the /timing local command for CLI.

If enabled, the /timing command enables you to get timings out at the
end of each message. The aggregates still apply on /cost.
@@ -14,6 +14,19 @@ pub enum LocalCommandResult {

pub fn handle_local_command(state: &mut State, input: &str) -> LocalCommandResult {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated: I noticed local commands don't show up in /help. I started fixing it, but not relevant for this PR.

}

#[derive(Debug, Clone)]
pub struct TimingStats {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A thought about naming:

Could rename this to Timing and rename TimingStat to TimingStats. Fits a bit better, as current_state and state_start aren't really fitting to be under a name TimingStats.

@tigy32 tigy32 merged commit 8c5307a into tigy32:main Nov 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants