From f426df5b427daddbec13e8399fb05d9207cdffd2 Mon Sep 17 00:00:00 2001 From: Kimi Agent Date: Sat, 14 Mar 2026 16:05:00 -0400 Subject: [PATCH] feat: add --session-id option to timmy chat CLI Allows specifying a named session for conversation persistence. Use cases: - Autonomous loops can have their own session (e.g. --session-id loop) - Multiple users/agents can maintain separate conversations - Testing different conversation threads without polluting the default Precedence: --session-id > --new > default 'cli' session --- src/timmy/cli.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/timmy/cli.py b/src/timmy/cli.py index 676a49a2..92886242 100644 --- a/src/timmy/cli.py +++ b/src/timmy/cli.py @@ -128,14 +128,25 @@ def chat( "-n", help="Start a fresh conversation (ignore prior context)", ), + session_id: str | None = typer.Option( + None, + "--session-id", + help="Use a specific session ID for this conversation", + ), ): """Send a message to Timmy. - Conversation history persists across invocations. Use --new to start fresh. + Conversation history persists across invocations. Use --new to start fresh, + or --session-id to use a specific session. """ import uuid - session_id = str(uuid.uuid4()) if new_session else _CLI_SESSION_ID + if session_id is not None: + pass # use the provided value + elif new_session: + session_id = str(uuid.uuid4()) + else: + session_id = _CLI_SESSION_ID timmy = create_timmy(backend=backend, model_size=model_size) # Use agent.run() so we can intercept paused runs for tool confirmation.