Skip to content

Add llm logs conversations command (#166) - #1833

Open
swayaam03 wants to merge 3 commits into
simonw:mainfrom
swayaam03:feature/logs-conversations
Open

swayaam03 wants to merge 3 commits into
simonw:mainfrom
swayaam03:feature/logs-conversations

Conversation

@swayaam03

Copy link
Copy Markdown

Summary

Fixes #166

Adds a dedicated llm logs conversations CLI command to list conversations recorded in the SQLite log database, including their IDs, titles, turn counts, model, and last active timestamp.

Previously, users could only view logs at the turn/response level using llm logs list. To resume an earlier conversation with llm -c <id>, users had to dig through response logs to find the conversation ID. This command provides a high-level summary view of conversations.

Features

  • Listing conversations: llm logs conversations displays conversation ID, timestamp, turn count, model, and conversation title/snippet.
  • Search filtering: -q / --query filters conversations by title, snippet, or ID.
  • Count limiting: -n / --count limits the number of conversations returned (default: 10, use 0 for all).
  • JSON output: --json returns the conversation list as a JSON array.
  • Truncation: -t / --truncate truncates long titles for cleaner terminal display.
  • Backwards compatibility: Handles both the current content-addressed store (threads and turns) and legacy tables (conversations and responses).

Example Usage

# List recent conversations
$ llm logs conversations
01k6c9t0w4ajm0qz8k5sx1rv2p  2025-10-15 12:00:00   2 turns  gpt-4o  Analyze financial report

# Search conversations
$ llm logs conversations -q "financial"

# Output as JSON
$ llm logs conversations --json

@connabyss

Copy link
Copy Markdown

Tested on Windows 11 (build 10.0.26300), Python 3.14.0, fresh logs folder, using the llm-echo plugin so no API key needed.

Made a 2-turn chat, then a 1-turn chat titled "café ☕ chat about cats". Then ran:
llm logs conversations
llm logs conversations -q cats
llm logs conversations -n 1
llm logs conversations --json

All four worked. The list showed the right turn counts (2 and 1), the search and -n 1 each returned just the cats chat, and the accent and emoji printed fine in Command Prompt.

Small thing: the docs example shows the time as "2025-10-15 12:00:00", but the real output has microseconds and a timezone, like "2026-10-28 23:37:01.405928+00:00".

(Claude helped me set up the test.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Idea: llm logs conversations

2 participants