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
- 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.
- 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.
- 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
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
src/terminal_agent/cli/commands/chat.py):terminal-agent chat(or bareterminal-agentin interactive terminals).SessionStateand message history across turns./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./exitor/quit: Cleanly finalize and save session state.prompt_toolkitorrich.promptwith 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(Registerchatcommand 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 chatlaunches an interactive multi-turn session./diff,/verify,/checkpoint,/status) execute correctly without interrupting session state..terminal_agent/sessions/<id>.jsonon exit and can be resumed viaterminal-agent resume <id>.