DevSQL
Code Mode for observing AI coding history, shell history, macOS Unified Logs, Git repositories, and source code. Code Mode is the primary agent interface; the direct SQL CLI remains available for humans and scripts.
DevSQL loads data from Claude Code, Codex CLI, shell history, macOS Unified Logs, Git and your source tree into SQLite so you can join, filter, and aggregate across all of them with standard SQL. Most providers load into memory on demand. Unified Logs stream through a bounded virtual table rather than being materialized. Codex rollout journals use a rebuildable incremental cache so compressed conversation history does not need to be reparsed for every query.
Primary agent interface: Code Mode
Run devsql --mcp and connect it as an stdio MCP server. Agents see five stable lifecycle tools instead of a wide direct-tool surface:
| Tool | Purpose |
|---|
codemode_search | Discover typed devsql.* methods and saved snippets |
codemode_execute | Start JavaScript that can compose multiple DevSQL calls |
codemode_execution | Inspect a durable execution or fetch one artifact |
codemode_decide | Approve or reject a pending write |
codemode_cancel | Cancel a running or paused execution |
For example, an agent can execute:
const recent = await devsql.query({
query: "SELECT source, timestamp, command FROM shell_history ORDER BY timestamp DESC LIMIT 20"
});
recent
Read-only methods run without approval. Use direct devsql commands when working interactively in a terminal or writing a shell script.
Overview
~/.claude/ --+
~/.codex/ --+
shell histories --+
macOS logs --+--> SQLite --> SQL queries / JSON / CSV
.git/ --+
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 --format json "<SQL>" # JSON output
devsql --format csv "<SQL>" # CSV output
devsql query "<SQL>" # Named form for MCP and scripts
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 |
devsql recall <terms> | Load prior work (Claude sessions, Codex threads, commits, prompts, shell commands, and agent-issued commands) ranked by term-match count then recency |
devsql gather <terms> | Run prior_work, repo_state, code_search, symbols, excerpts, and activity concurrently and return one token-budgeted bundle |
Common options: --repo / -r (default .), --data-dir / -d (default ~/.claude). gather also takes --budget (default 8000 tokens; lowest-ranked rows are dropped round-robin per section, never mid-row, until the bundle fits).
Code Mode server
Run devsql --mcp to start the primary agent interface described above. Direct commands remain the explicit CLI fallback.
Shared history over Tailscale
Choose one machine as the shared host. Install this version of DevSQL, Tailscale,
SSH, and rsync on every participating machine. Each client must be able to use
noninteractive SSH to the host, with its host key already trusted. The host must
have devsql in ~/.cargo/bin, ~/.local/bin, or its SSH command PATH.
On each participating machine, including the host, publish its local history:
devsql shared sync HOST