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
This commit is contained in:
2026-03-14 16:05:00 -04:00
parent bef4fc1024
commit f426df5b42

View File

@@ -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.