rtk-ai/rtk

Feature request: rtk wrapper for sqlite3

Open

#1,605 建立於 2026年4月29日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Rust (2,914 fork)batch import
area:clieffort-mediumenhancementhelp wantedpriority:medium

倉庫指標

Star
 (48,085 star)
PR 合併指標
 (平均合併 11天 1小時) (30 天內合併 45 個 PR)

描述

Real-world numbers from rtk discover --all --since 30:

Command Calls (30d) Notes
sqlite3 470 top entry under "unhandled" commands

Use cases driving the call volume: querying local SQLite stores with frequent SELECT, .schema, .tables calls — patterns where an LLM iteratively explores or polls a small database.

Two main sources of per-call bloat:

  1. Default row dumps from SELECT: with wide TEXT columns, even a few dozen rows expand to several KB of context per call. Most of it is repeated padding/whitespace or long unreadable bodies.
  2. .schema output: full CREATE TABLE with all constraints, triggers, and index DDL — far more than an LLM typically needs, which is column names and types.

Suggested wrapper behavior:

  • For SELECT queries:
    • Apply a default row limit (e.g. 50) with a one-line truncation marker
    • Truncate long text cells to ~200 chars with a length marker (…(N chars))
    • Strip trailing whitespace/padding
  • For .schema / .tables:
    • One line per table: table_name(col1 type, col2 type, ...) with PK/FK markers, no constraint bodies
    • Index list summarised separately
  • For .dump and similar export commands: pass through unchanged (intent is the full payload)
  • Pass through unchanged when output is already short (e.g. < 5 lines)

Methodology: counts come from rtk discover --all --since 30 against the local Claude Code transcript directory. Token estimates use the 4-chars/token approximation.

貢獻者指南