Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
feat: add /new command
worenidewen24a90af6d32f
diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.pyindex 2aa56887d..eb167825e 100644--- a/nanobot/cli/commands.py+++ b/nanobot/cli/commands.py@@ -28,6 +28,7 @@ app = typer.Typer(console = Console()EXIT_COMMANDS = {"exit", "quit", "/exit", "/quit", ":q"}+NEW_SESSION_COMMANDS = {"/new", "/reset"}# ---------------------------------------------------------------------------# CLI input: prompt_toolkit for editing, paste, history, and display@@ -111,6 +112,11 @@ def _is_exit_command(command: str) -> bool:return command.lower() in EXIT_COMMANDS+def _is_new_session_command(command: str) -> bool:+ """Return True when input should clear the session history."""+ return command.lower() in NEW_SESSION_COMMANDS++async def _read_interactive_input_async() -> str:"""Read user input using prompt_toolkit (handles paste, history, display).@@ -484,6 +490,15 @@ def agent(console.print("\nGoodbye!")break+ if _is_new_session_command(command):+ session = agent_loop.sessions.get_or_create(session_id)+ session.clear()+ agent_loop.sessions.save(session)+ console.print(+ f"\n[green]{__logo__} Started new session. History cleared.[/green]\n"+ )+ continue+with _thinking_ctx():response = await agent_loop.process_direct(user_input, session_id)_print_agent_response(response, render_markdown=markdown)