Skip to content
ATAI Today Brief
HomeNewsConceptsGuidesToolbox
AboutSubscribeUA
Subscribe

AI Today Brief

The daily AI-engineering brief. Built in public. EN · UA.

XTelegramLinkedInYouTubeRSS
NewsConceptsGuidesSubscribeAdvertiseAboutEditorial policyAI disclosurePrivacyTerms

© 2026 AI Today Brief. All rights reserved.

  1. Home/
  2. News/
  3. Token & cost optimization/
  4. Optimizing Claude Code Token Cost with a Custom SQLite-Backed Feedback Skill
Token & cost optimization

Optimizing Claude Code Token Cost with a Custom SQLite-Backed Feedback Skill

June 29, 2026· 6 min read
OKCurated by Oleksandr Kuzmenko, AI Product Engineer·Updated June 29, 2026·Sources cited on every story
AI-assisted · editor-reviewed·How we use AI
Optimizing Claude Code Token Cost with a Custom SQLite-Backed Feedback Skill

Software engineer Jack Franklin built a custom SQLite and Deno CLI skill for Claude Code to manage playtest feedback. Replacing a massive 7,000-line Markdown file with database queries radically reduced context-token bloat and improved query efficiency.

Impact: Medium

Why it matters

You can drastically cut your agentic token spend by switching from text logs to local structured database queries using a simple CLI.

TL;DR

  • 01Massive text logs like Markdown rapidly bloat LLM context window costs.
  • 02Relational databases (SQLite) let agents query only what they need, minimizing active token consumption.
  • 03Implementing a strict 'list before show' policy in custom agent skills is crucial for cost optimization.

Key facts

Original Markdown Size
7,000 lines
Database Technology
SQLite + Deno CLI
Storage Location
Local single file (added to .gitignore)

The Problem: Markdown Context Bloat

Managing project feedback and bugs inside plain text files eventually hits a scaling wall. As a Markdown document grows—in this case, reaching 3,000 lines of active items and 4,000 lines of completed tasks—Claude Code is forced to re-read thousands of lines for simple operations, such as categorizing bugs or listing open tickets. This significantly inflates token cost and slows down the agentic feedback loop.

The Solution: SQLite + Deno CLI Wrapper

The SQLite-backed skill replaces raw text file updates with structured database queries. A Deno-based CLI allows Claude to log, query, and modify feedback items via terminal commands. The database schema tracks fields like title, detail, priority, status, category, project, and a done boolean flag. Completed items are hidden from default outputs to minimize token usage while retaining history.

Key Token-Saving Patterns

1. List Before Show: The skill forces Claude to query lightweight lists (titles and IDs) rather than full issue details. 2. Contextual Project Inference: Claude automatically infers the active project from the current workspace context, minimizing user prompt overhead. 3. Duplicate Prevention: Before writing a new entry, Claude is instructed to run a search query to detect existing duplicate bugs described in different words.

Try it in 2 minutes

# Example CLI command Claude uses to add structured feedback
./feedback-cli add --project "ontrack" --title "Train delay bar bug" --detail "Journey bar clobbers schedule state when delayed" --priority "high" --category "UI"

bash

✓ When to use

  • Use when building or debugging projects with Claude Code or other CLI-based agents, especially when managing long-lived backlogs, task lists, or logs.

✕ When NOT to use

  • Not necessary for very short sessions where context window consumption is negligible and task history is not required.

What to do today

  • →Audit your agentic developer logs and migrate growing text-based history files to local SQLite databases.
  • →Wrap database interactions in a clean, documented CLI and teach it to Claude Code as a custom skill.
#Claude Code#Deno#SQLite

Sources

  • Tracking feedback with Claude Code - Jack Franklin
ShareShare on XShare on LinkedIn
← Previous storyOrnith-1.0: Self-Scaffolding Open-Source Models for Agentic Coding TasksNext story →Off Grid AI: Run Offline Models, Voice, and Agentic Gateways on macOS

Related stories

  • Token & cost optimizationClaude Usage Thresholds: Insights from High-Volume Token Consumption

Email digest

Get the morning AI brief

One email a day — the stories that matter for engineers, founders and tech leads. Human-edited, with links to primary sources.

  • ✓120+ sources scanned daily
  • ✓Edited by a human
  • ✓1 email per day
  • ✓EN + UA

By subscribing you agree to the privacy policy.