diff --git a/aider/coders/editblock_coder.py b/aider/coders/editblock_coder.py index f96c29ad1..1b4f634b2 100644 --- a/aider/coders/editblock_coder.py +++ b/aider/coders/editblock_coder.py @@ -50,6 +50,8 @@ class EditBlockCoder(Coder): self.io.tool_output(f"{edit.strip()}", bold=True) if self.io.confirm_ask("Do you want to run this suggested shell command?"): try: + # Add the command to input history + self.io.add_to_input_history(f"/run {edit.strip()}") self.run_interactive_subprocess(edit.split()) except Exception as e: self.io.tool_error(str(e)) diff --git a/aider/io.py b/aider/io.py index f4e3c2eb2..852cfaa5e 100644 --- a/aider/io.py +++ b/aider/io.py @@ -311,6 +311,9 @@ class InputOutput: if not self.input_history_file: return FileHistory(self.input_history_file).append_string(inp) + # Also add to the in-memory history if it exists + if hasattr(self, 'session') and hasattr(self.session, 'history'): + self.session.history.append_string(inp) def get_input_history(self): if not self.input_history_file: