Skip to content

feat(cli): /history shows recent user prompts in this session#209

Merged
emal-avala merged 1 commit intomainfrom
feat/history-command
Apr 23, 2026
Merged

feat(cli): /history shows recent user prompts in this session#209
emal-avala merged 1 commit intomainfrom
feat/history-command

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

Adds `/history` (alias `/hist`) — a numbered list of what you've typed in the current session, chronologically oldest→newest so the latest prompt sits near the cursor.

  • `/history` — last 10
  • `/history 25` — last 25
  • `/history all` (or `*`) — everything

Filters out tool_result blocks, compact-summary boundaries, and assistant responses, so the list only contains actual user-authored prompts. Each entry is clipped to ~100 chars on a single line (whitespace collapsed, ellipsis appended for longer ones).

Why

Useful for:

  • Jogging your memory about what you've tried when a session gets long
  • Finding the exact turn where something went sideways before using `/rewind`
  • Skimming recent context before running `/compact`

Test plan

  • `cargo fmt --all`
  • `cargo clippy -p agent-code --all-targets -- -D warnings`
  • `cargo test -p agent-code --bin agent` (103 passed)
  • New tests:
    • `preview_user_prompt_collapses_whitespace`
    • `preview_user_prompt_truncates_to_max_chars`
    • `preview_user_prompt_returns_placeholder_for_empty`
    • `parse_history_limit_defaults_to_ten`
    • `parse_history_limit_parses_positive_number`
    • `parse_history_limit_accepts_all`
    • `parse_history_limit_min_one`
    • `collect_user_prompts_skips_tool_results_and_compaction`
    • `collect_user_prompts_skips_whitespace_only`

Adds a /history command (alias /hist) that lists your recent
user-authored prompts in chronological order:

  /history          last 10
  /history 25       last 25
  /history all      everything

Skips tool_result messages, compact-summary boundaries, and the
assistant's responses, so the numbered list only shows what you
actually typed — useful for jogging your memory mid-session or
spotting the turn where things went sideways.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@emal-avala emal-avala merged commit 40b289b into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/history-command branch April 23, 2026 08:37
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.

1 participant