#git #sql #claude #productivity

bin+lib devsql

Unified SQL queries across Claude Code + Git data

3 unstable releases

0.2.2 Apr 9, 2026
0.2.1 Apr 9, 2026
0.1.2 Feb 19, 2026

#171 in #productivity

MIT license

395KB
10K SLoC

DevSQL

Unified SQL interface across AI coding history, Git repositories, and source code.

DevSQL loads data from Claude Code, Codex CLI, Git, and your source tree into an in-memory SQLite database so you can join, filter, and aggregate across all of them with standard SQL.

Overview

~/.claude/    ─┐
~/.codex/     ─┤
.git/         ─┼──▶  SQLite (in-memory)  ──▶  SQL queries / JSON / CSV
src/**/*      ─┘

Three standalone tools, one unified interface:

Tool Data Source
ccql Claude Code + Codex CLI data (~/.claude/, ~/.codex/)
vcsql Git repositories (commits, branches, diffs)
devsql All of the above, plus source code analysis

DevSQL auto-detects which tables your query references and only loads the data it needs.

Installation

Homebrew

brew install douglance/tap/devsql

Claude Code Plugin

/plugin marketplace add douglance/devsql
/plugin install devsql@devsql

The plugin auto-installs the binary on first session start.

Direct Download

Prebuilt binaries for macOS and Linux are available from GitHub Releases.

From Source

git clone https://github.com/douglance/devsql.git
cd devsql && cargo install --path crates/devsql

To enable tree-sitter-based AST analysis (richer symbol extraction and import parsing):

cargo install --path crates/devsql --features tree-sitter-ast

Usage

SQL Queries

devsql "<SQL>"                # Default table output
devsql -f json "<SQL>"        # JSON output
devsql -f csv "<SQL>"         # CSV output

Commands

Structured commands that return JSON, designed for use by AI agents and scripts:

Command Description
devsql search <query> Find symbols by name across the codebase
devsql context <file> File metadata and symbols for a given path
devsql history <file> Git commit history for a specific file
devsql diff <base> <head> Compare two Git refs with file and symbol-level stats
devsql impact <file> Analyze exports and find potential dependents

Common options: --repo / -r (default .), --data-dir / -d (default ~/.claude).

Tables

AI History

Table Source Description
history ~/.claude/history.jsonl Claude Code prompts (timestamp, display, project)
transcripts ~/.claude/transcripts/*.jsonl Full conversations (type, content, tool_name, session_id)
todos ~/.claude/todos/*.json Task items (content, status)
jhistory ~/.codex/history.jsonl Codex CLI prompts (session_id, text, display, timestamp)
codex_history Alias for jhistory

Git

Table Description
commits id, message, summary, author_name, authored_at, short_id
branches name, is_head, commit_id
diffs Commit-level stats: commit_id, files_changed, insertions, deletions
diff_files Per-file stats: commit_id, path, status (A/D/M/R/C), insertions, deletions

Source Code

Table Description
source_files File inventory: path, name, extension, directory, size_bytes, line_count, modified_at, language
source_lines Line content: file_path, line_number, content, is_blank
symbols Definitions: file_path, name, kind, line_start, line_end, signature, visibility, parameters, return_type, language
imports* Import statements: file_path, line_number, module, name, alias, kind, is_default, is_wildcard
ast_nodes* Raw AST nodes

* Requires the tree-sitter-ast feature for full extraction. Without it, symbols falls back to regex-based extraction (Rust, TypeScript, JavaScript, Python, Go) and imports/ast_nodes are empty.

Examples

Join prompts with commits

SELECT
  date(c.authored_at) as day,
  COUNT(DISTINCT h.timestamp) as prompts,
  COUNT(DISTINCT c.id) as commits
FROM commits c
LEFT JOIN history h
  ON date(c.authored_at) = date(datetime(h.timestamp/1000, 'unixepoch'))
GROUP BY day
ORDER BY day DESC
LIMIT 14;

Find productive prompts

SELECT h.display as prompt, COUNT(c.id) as commits_after
FROM history h
JOIN commits c ON date(datetime(h.timestamp/1000, 'unixepoch')) = date(c.authored_at)
GROUP BY h.display
HAVING commits_after > 0
ORDER BY commits_after DESC
LIMIT 20;

Codebase overview by language

SELECT language, COUNT(*) as files, SUM(line_count) as total_lines
FROM source_files
GROUP BY language
ORDER BY total_lines DESC;

Hottest files (most commits + most symbols)

SELECT df.path,
  COUNT(DISTINCT df.commit_id) as commits,
  SUM(df.insertions) as lines_added,
  (SELECT COUNT(*) FROM symbols s WHERE s.file_path = df.path) as symbols
FROM diff_files df
GROUP BY df.path
ORDER BY commits DESC
LIMIT 10;

Search symbols

devsql search "parse"
devsql search "Error" --kind struct

Semantic diff between refs

devsql diff main~5 HEAD

File context and impact

devsql context src/engine.rs
devsql impact src/lib.rs
devsql history src/engine.rs

Notes

  • history.timestamp is in epoch milliseconds. Use datetime(timestamp/1000, 'unixepoch') to convert.
  • A custom DATE() function normalizes epoch ms, epoch seconds, and ISO strings.
  • Tables are loaded lazily — only those referenced in your query are populated.
  • The symbols table extracts functions, structs, enums, traits, types, classes, interfaces, and more depending on language.

License

MIT


lib.rs:

DevSQL - Unified SQL queries across Claude Code + Git data

This crate combines ccql (Claude Code data) and vcsql (Git data) into a unified query interface, enabling cross-database joins to analyze developer productivity patterns.

Dependencies

~135MB
~2.5M SLoC