rtk-ai/rtk

Feature request: rtk wrapper for sqlite3

Open

#1 605 ouverte le 29 avr. 2026

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)Rust (2 914 forks)batch import
area:clieffort-mediumenhancementhelp wantedpriority:medium

Métriques du dépôt

Stars
 (48 085 stars)
Métriques de merge PR
 (Merge moyen 11j 1h) (45 PRs mergées en 30 j)

Description

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.

Guide contributeur