Skip to content

Command history is lost after closing the terminal session #1

@ArthurDS-tech

Description

@ArthurDS-tech

Type: Bug / UX
Priority: Low
Area: CLI / Terminal
Related file: src/cli/terminal.ts

Description

The CLI command history is currently stored only in memory during an active session. When the terminal is closed and reopened, all previous command history is lost, reducing usability for users who frequently repeat commands.

Current behavior

Command history exists only during the current session.

Restarting the CLI clears all previous history.

Arrow key navigation (↑ ↓) cannot access commands from prior sessions.

Expected behavior

The command history should:

Persist between sessions.

Automatically save commands when executed.

Automatically load history when the CLI starts.

Allow navigation through previous commands across sessions.

Impact

Reduced productivity for frequent users.

Worse experience compared to standard shells (bash, zsh, PowerShell).

Inefficient workflows when repeating commands.

Suggested technical approach

Persist command history in a local file.

Example location:

~/.appname/history

or

.project/.cli-history

Suggested flow:

Load history file at CLI startup.

Append commands to in-memory history on execution.

Save history periodically or on exit.

Limit stored history size (e.g., last 1000 commands).

Implementation considerations:

Use os.homedir() for default location.

Use append or snapshot saving strategy.

Prevent unbounded file growth.

Acceptance criteria

Command history persists after restarting the CLI.

Arrow navigation works across sessions.

History size is limited.

No error occurs if history file does not yet exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions