Skip to content

feat(cli): add interactive multi-turn REPL mode ('terminal-agent chat') #10

Description

@Kaap10

Problem Statement

Currently, terminal-agent run <TASK> is a single-shot batch command that exits after completing or failing a task. Developers cannot converse with the agent, ask follow-up questions, request iterative refactors, or inspect intermediate plans in real-time.

Proposed Architecture & Solution

  1. Interactive REPL Command (src/terminal_agent/cli/commands/chat.py):
    • Create a dedicated interactive shell command terminal-agent chat (or bare terminal-agent in interactive terminals).
    • Maintain active SessionState and message history across turns.
  2. In-Session Slash Commands:
    • /diff: Display current git working tree diff.
    • /verify: Manually trigger the independent test verification suite.
    • /checkpoint [name]: Create a snapshot of current progress.
    • /rollback [id]: Restore files to a previous checkpoint.
    • /status: Show step count, failures, and modified files.
    • /exit or /quit: Cleanly finalize and save session state.
  3. Rich Terminal Interface:
    • Utilize prompt_toolkit or rich.prompt with command history, syntax highlighting, and auto-completion.

Files to Modify / Create

  • src/terminal_agent/cli/commands/chat.py (New)
  • src/terminal_agent/cli/main.py (Register chat command and interactive routing)
  • src/terminal_agent/agent/loop.py (Add step-by-step turn execution support)
  • tests/unit/test_chat_command.py (New)

Acceptance Criteria

  • terminal-agent chat launches an interactive multi-turn session.
  • Slash commands (/diff, /verify, /checkpoint, /status) execute correctly without interrupting session state.
  • Session is saved to .terminal_agent/sessions/<id>.json on exit and can be resumed via terminal-agent resume <id>.
  • Automated CLI invocation tests added.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions