Skip to content

History preview: count only user prompts in the "N messages" label #9

Description

@lowlorenz

Summary

In the session history preview, the N messages count should reflect only user prompts, not the total number of conversation entries.

Current behavior

The history list renders ${s.messageCount} messages for each session (chronos-vscode/webview/components/chronos-app.ts:460).

That messageCount is computed in chronos-vscode/src/panel/sessions.ts:56-60 by incrementing on every {"type":"message"} entry, regardless of role:

if (line.startsWith('{"type":"message"')) {
  messageCount++;
  ...
}

So it counts user prompts, assistant replies, and tool messages all together. For an agent like Chronos that fans out many tool/expert turns per prompt, this number is inflated and doesn't communicate anything useful about how much the user actually did in the session.

Proposed behavior

Count (and display) only user prompts in the preview — i.e. increment only when the entry's role is user (the code already detects '"role":"user"' on the adjacent line for firstUserMessage).

This makes the count a meaningful "how many turns did I drive" signal, and reads naturally next to the session name/first-prompt preview.

Notes

  • Roughly a one-line change in sessions.ts (gate the increment on the user role), plus the label in chronos-app.ts stays messages (or could become prompts for clarity).
  • messageCount is cached per file in sessionInfoCache — existing cached entries will recompute on the next mtime/size change, so no migration needed.
  • If a separate total-entry count is ever wanted elsewhere, keep it as a distinct field rather than overloading this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions