Skip to content

feat(cli): rich table formatting for list, select preview, consistent color theming #773

Closed

Description

@Sinity

Current state:

  • show uses rich with role colors, thinking blocks, panels — well-implemented
  • stats uses rich tables — well-implemented
  • list is plain text (no rich formatting, no column alignment)
  • select uses fzf but no preview window showing conv details
  • tags output is plain
  • Completions exist for providers/actions but don't cover all dynamic values
  • Color theme exists at polylogue/ui/theme.py but not consistently applied

Acceptance:

  • list uses rich table with aligned columns, provider color dots
  • select has fzf preview showing title/date/provider/message count
  • tags output is a rich table
  • Completions cover tags, repos, message types
  • All verbs use consistent polylogue/ui/theme.py coloring

Activity

  1. Sinity commented on May 3, 2026

    @Sinity
    OwnerAuthor

    Found during reverse-chrono audit

    Polylogue cannot efficiently search within conversations — only at the conversation level. This blocked the reverse-chronological design spec audit:

    • FTS ranking is dominated by the current/largest session (recency+size bias)
    • No --conversation filter flag on list/search to narrow to a specific conv
    • messages command only paginates sequentially — no in-conversation text search
    • 2s+ per query even on simple terms
    • Had to fall back to raw grep on JSONL files

    These gaps should be tracked as part of the CLI/query UX work.

  2. Sinity commented on May 3, 2026

    @Sinity
    OwnerAuthor

    Corrected findings after deep investigation

    What actually works

    • --id flag filters by conversation ID prefix ✅
    • --id + search terms narrows to matching conversations ✅
    • FTS5 indexes message text with unicode61 tokenizer ✅
    • snippet() function exists in query_builders.py ✅
    • SearchResult.snippet field populated but not shown in CLI output ⚠️

    Real gaps

    1. FTS snippets not surfaced: polylogue list shows conversation titles, not WHERE the search term matched. The snippet data is computed (see query_builders.py:66) but discarded by CLI output formatting.
    2. No within-conversation text search: polylogue messages has role/type filters but no text search. To find specific terms within a conversation, you must paginate through all messages.
    3. No message search highlight: Even polylogue show renders full text without highlighting matched terms.
    4. MCP doesn't expose conversation_id filter: MCPConversationQueryRequest lacks conversation_id field even though the Python API has it.
    5. Slow FTS on large archives: 2s+ per query on 3M messages. The covering index exists but hot-readiness checks may still run exact counts.

    Fix candidates

    • A: Show FTS snippet in list output (1-2 lines, ~20 lines of code)
    • B: Add --search / --query option to messages for within-conversation text filtering
    • C: Highlight matched terms in show output
    • D: Add conversation_id to MCP query request dataclass
    • E: Move exact FTS readiness counts off hot search path (performance)
  3. Sinity commented on May 3, 2026

    @Sinity
    OwnerAuthor

    Root cause analysis

    Investigation traced the missing FTS snippets to a 42% FTS index gap:

    • Messages: 3,351,380
    • FTS indexed: 1,945,629
    • Gap: 1,405,751 (41.9%)

    The readiness check at polylogue/storage/fts/fts_lifecycle.py:check_fts_readiness() correctly blocks the FTS snippet path when the gap exceeds the 1% threshold. But the failure is silent — search falls back to attachment-only path, returning results without message-level match evidence.

    Why the gap exists

    The FTS index wasn't fully rebuilt after the schema v3→v5 migration. The timer service (polylogue-run.timer) runs polylogue --plain run acquire parse materialize render index hourly, but it hadn't fired since the DB was rebuilt.

    Fix applied

    Running polylogue run index to rebuild the FTS index. After rebuild, the snippet path should work for all search queries.

    Remaining improvements

  4. Sinity commented on May 4, 2026

    @Sinity
    OwnerAuthor

    Resolved by PR #795. Tags uses rich Table, select has fzf --preview. List output already used rich/tables.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions