Skip to content

feat(cli): add /history [N] to print the last N messages of the given conversation in-terminal #1745

@cip8

Description

@cip8

Problem

A quick in-terminal recap of a given context can be useful for various workflows.

Currently there is no built-in way to print conversation history inline:

  • /conversation focuses a session but does not display prior messages
  • /dump exports to JSON/HTML, which requires leaving the CLI to review.

Proposal

Introduce new command which prints last N messages for the given conversation:

/history [UUID] [N|full] [--role user|assistant|tool|system]

Usage examples

/history               # default number of messages for current conversation
/history full          # all messages
/history UUID 42       # up to 42 messages for conversation ID
/history --role user   # default number of messages posted by user

Output example

[assistant] Summarized prior step...
---
[user] Please refactor X and add tests for Y.
---
[assistant] Plan: 1) Modify foo.ts... 2) Add jest tests...

Options / configuration

  • history.defaultCount (default 20)
  • history.maxCount hard cap (default 200) to protect latency
  • history.includeToolByDefault (default false)

Behavior details

  • Works with any conversation ID (defaults to current).
  • Warning displayed if none is focused (“No active conversation. Use /conversation to select one.”)
  • If N > total messages, print all available (bounded by maxCount?)
  • Role defaults to all (colorized role headers?)
  • When the history is compacted via /compact, /history prints the post-compaction content
  • Never execute tools or replays messages: read-only rendering

Limits & truncation

  • Truncate single message body if greater history.truncateChars with [...]
  • Tool payloads default to stubs

Security & privacy

  • Do not include secrets from env masking or provider keys (same masking rules as /info)

Complementary with #1557

  • /history provides on-demand inline review at any time for various UUID
  • Handy for quickly comparing different work sessions
  • Usable in scripts and CI logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featureBrand new functionality, features, pages, workflows, endpoints, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions