Skip to content

Document the ! command for searching conversation history #207

@exedev-shelley

Description

@exedev-shelley

Author: nhkhang
Channel: #shelley
Link: https://discord.com/channels/1405685085923049482/1450334528210993295/1502232107500699710


Issue

The ! command for querying conversation history from the SQLite database is not documented in the official docs, only mentioned in Discord.

Context

User asked about searching old threads efficiently without wasting tokens. @ohAitch mentioned that the ! command capability exists per the system prompt and can run SQLite queries:

# List recent conversations:
sqlite3 "/home/exedev/.config/shelley/shelley.db" "SELECT conversation_id, slug, datetime(created_at, 'localtime') as created, datetime(updated_at, 'localtime') as updated FROM conversations ORDER BY updated_at DESC LIMIT 20;"

# Get user/agent messages from a conversation (replace CONVERSATION_ID):
sqlite3 "/home/exedev/.config/shelley/shelley.db" "SELECT CASE type WHEN 'user' THEN 'User' ELSE 'Agent' END, substr(json_extract(llm_data, '$.Content[0].Text'), 1, 500) FROM messages WHERE conversation_id='CONVERSATION_ID' AND type IN ('user', 'agent') AND json_extract(llm_data, '$.Content[0].Type') = 2 AND json_extract(llm_data, '$.Content[0].Text') != '' ORDER BY sequence_id;"

# Search conversations by slug:
sqlite3 "/home/exedev/.config/shelley/shelley.db" "SELECT conversation_id, slug FROM conversations WHERE slug LIKE '%SEARCH_TERM%';"

However, this functionality is only mentioned on Discord and not in the official documentation.

Request

Add documentation for the ! command and how to query conversation history from the SQLite database. This is particularly important for mobile users who want friction-free search capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions