Every prompt you run with LLM is automatically saved — along with the model’s response, token counts, conversation ID, and any attachments or fragments — to a local SQLite database. This lets you search your history, resume conversations, audit costs, and export data for further analysis.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/simonw/LLM/llms.txt
Use this file to discover all available pages before exploring further.
Log Database Location
Controlling Logging
| Command | Effect |
|---|---|
llm logs off | Disable logging for all future prompts |
llm logs on | Re-enable logging |
llm logs status | Show current status and database statistics |
llm 'prompt' -n / --no-log | Skip logging for a single prompt |
llm 'prompt' --log | Force logging for a single prompt (when logging is off) |
Viewing Logs
-n to change the count:
Output Formats
| Flag | Output |
|---|---|
| (default) | Markdown with prompt and response |
-r / --response | Most recent response only, as plain text |
-x / --extract | First fenced code block from selected entries |
--xl / --extract-last | Last fenced code block |
--json | Full JSON array |
-t / --truncate | Truncate long prompts and responses |
-u / --usage | Include token usage information |
Short Mode
-s / --short prints a compact YAML summary with truncated prompts and no response text — useful for a quick overview:
--usage to include token counts:
Filtering Logs
By Conversation
View all logs for the most recent conversation:By Search Term
Full-text search across prompts and responses (most relevant first):By Model
Filter to logs for a specific model or alias:Past a Specific ID
Retrieve every log recorded after a known response ID (useful for incremental processing):By Fragment
Filter for logs that used a specific fragment (accepts hash, alias, URL, or file path):-f options return only responses that used all of the specified fragments.
By Tool
Filter for responses that involved a result from a specific tool:--functions):
By Schema
Filter responses that used a specific schema (any format accepted by--schema):
--data, --data-array, and --data-key to extract the raw JSON. See the schemas documentation for details.
Browsing Logs with Datasette
Datasette provides a browser-based SQL interface over the logs database:http://localhost:8001 where you can run SQL queries, explore tables, and export data.
Backing Up Your Database
SQL Schema
Thelogs.db database contains the following tables:
View full SQL schema
View full SQL schema
Key tables
| Table | Description |
|---|---|
conversations | One row per conversation (id, name, model) |
responses | Every prompt/response pair, linked to a conversation |
responses_fts | Full-text search index over prompt and response |
fragments | Deduplicated fragment content (hash, source, content) |
fragment_aliases | Named aliases pointing to fragment IDs |
prompt_fragments | Join table: which fragments were used in which responses |
system_fragments | Join table: system-prompt fragments per response |
attachments | Binary or URL-based attachments |
schemas | JSON schemas referenced by responses |
tools | Tool definitions used in prompts |
tool_calls | Individual tool invocations by the model |
tool_results | Outputs returned by each tool call |
responses_fts uses SQLite FTS5 for fast full-text search across prompts and responses.