Alexeyprompts banner
ClickHouse ClickHouse

Alexeyprompts

Development community

Description

A viewer for Claude Code history with ClickHouse backend

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Read the blog: [https://clickhouse.com/blog/agentic-coding](https://clickhouse.com/blog/agentic-coding)

Alexey Prompts

A viewer of Claude Code sessions with ClickHouse backend.

![Alexey Prompts](screenshot.png)

How to use

Create the database and tables. The `raw` table uses JSON type hints plus a few materialized columns and a text index so the UI's queries stay fast (see `schema.sql` for the full definition and the reasoning):

clickhouse-client < schema.sql

CREATE TABLE IF NOT EXISTS claude_code.classification
(
    data JSON
)
ENGINE = ReplacingMergeTree
ORDER BY data.session_id::String;

Upload your sessions:

clickhouse-local -q "
    SELECT _path AS path, json AS data
    FROM file('$HOME/.claude/projects/*/*.jsonl', 'JSONAsString')
    WHERE isValidJSON(json)
    SETTINGS input_format_allow_errors_ratio=0.1
    FORMAT Native
" | clickhouse-client --host '...' --password '...' -q "INSERT INTO claude_code.raw FORMAT Native"

This is likely optional:

clickhouse-local -q "
    SELECT _path AS path, json AS data
    FROM file('$HOME/.claude/history.jsonl', 'JSONAsString')
    WHERE isValidJSON(json)
    SETTINGS input_format_allow_errors_ratio=0.1
    FORMAT Native
" | clickhouse-client --host '...' --password '...'  -q "INSERT INTO claude_code.raw FORMAT Native"

Uploading only new data (incremental updates)

After the first upload, you don't need to re-send everything. Re-running the commands above is always *safe* (the `raw` table is a `ReplacingMergeTree`, so duplicates collapse), but it re-reads and re-sends every session each time.

Use `upload_incremental.sh` to upload only **new sessions** and **new entries appended to existing sessions**:

CH_HOST='...' CH_USER='...' CH_PASSWORD='...' ./upload_incremental.sh

On each run it uploads the union of two sets:

  1. Sessions ClickHouse doesn't have yet — it asks the raw table which paths are already loaded and uploads any local .jsonl that's miss