Clickfuse is a Build Week prototype for the ClickHouse + Trigger.dev hackathon. It answers one SRE question:
“Why did checkout latency spike after the 14:32 deploy?”
Instead of returning a paragraph, it builds an evidence-backed incident board: anomaly timeline, service heatmap, before/after diff, suspect ladder, error-budget impact and a verdict card. Each panel has a “Show evidence” drawer with the ClickHouse query/window that produced it.
- Next.js incident board UI with progressive skeleton assembly.
- Deterministic fixture-mode investigation data for offline judging.
- ClickHouse schema with
MergeTreesource tables and anAggregatingMergeTreerollup usingquantileState,sumStateandcountState. - Window-function anomaly SQL, before/after span diff SQL and
quantileMergerollup proof againstlatency_rollup_1m. - Seed script for the demo incident:
payment-servicev2.4.1 changes retry timeout from3sto15sat14:32. - Trigger.dev chat agent with versioned prompt telemetry, task-backed tools, typed board parts and optional live streaming.
pnpm smokechecks that the demo story is visually obvious before recording.
Public fixture-mode demo:
Marketing landing page:
https://clickfuse.vercel.app/landing/index.html
Demo video:
pnpm install
pnpm smoke
pnpm devOpen the local Next.js URL and ask:
Why did checkout latency spike after the 14:32 deploy?
The app works in fixture mode without ClickHouse credentials so judges can inspect the product offline.
Fixture mode is the safe default. For the live demo path, configure Trigger.dev and OpenAI credentials, then opt into the transport:
TRIGGER_SECRET_KEY=
TRIGGER_PROJECT_ID=
OPENAI_API_KEY=
NEXT_PUBLIC_TRIGGER_CHAT_ENABLED=trueRun the Trigger worker and app in separate terminals:
pnpm trigger:dev
pnpm devIn live mode, the frontend uses useTriggerChatTransport, the server mints a session-scoped public access token, and trigger/incident-agent.ts returns an AI SDK streamText() result. The agent declares five task-backed tools with ai.toolExecute(), initializes run-scoped context with chat.local, and resolves the clickfuse-incident-investigator prompt with prompts.define() so the Trigger.dev dashboard can show generation telemetry. The Timeline panel is also sourced from an explicit queryLatencyTask.triggerAndWait() call, and the resulting Trigger.dev run id is stamped onto the Timeline evidence drawer.
When ClickHouse credentials are present, those task bodies execute the parameterized SQL in src/lib/queries.ts through the readonly ClickHouse client. Without credentials, they fall back to the deterministic fixture board so offline judging still works.
Create .env.local from .env.example:
cp .env.example .env.localSet:
CLICKHOUSE_HOST=
CLICKHOUSE_USERNAME=
CLICKHOUSE_PASSWORD=
CLICKHOUSE_DATABASE=Then create tables and seed the incident:
clickhouse client --queries-file clickhouse/schema.sql
pnpm seed:clickhouse
pnpm smokeThe ClickHouse client is configured with readonly=2 for query execution paths. The seed script is intentionally separate and should only run against a demo database.
The Trigger.dev agent lives in trigger/incident-agent.ts.
It models the investigation as separate schema tasks:
query-latencyquery-heatmapquery-diffrank-suspectscalculate-error-budget
Those tasks are the intended observability units in the Trigger.dev run trace. The demo should show the run trace after the board completes to prove orchestration, timings and task boundaries. In fixture mode, the same deterministic buildIncidentBoard() data powers the board without requiring credentials; in live mode, src/lib/live-clickhouse.ts uses ClickHouse query results for timeline, heatmap, diff, deploy marker and error budget panels.
The Timeline evidence drawer includes both the raw http_logs anomaly-band query and a soft-fail AggregatingMergeTree proof query using quantileMerge / countMerge against latency_rollup_1m. If the rollup table is unavailable or empty in a local demo database, the main incident board still renders and the evidence note explains the missing optional proof path.
pnpm smokeThe smoke suite checks:
- schema/query files exist;
- the 14:32 deploy marker is present;
- checkout latency spikes at least 2x baseline;
payment-serviceis visually dominant in the heatmap;payment-serviceis the top suspect;- before/after diff shows a 7–10x payment span amplification;
- error-budget burn is demo-visible;
- the AggregatingMergeTree State/Merge schema and
quantileMergeevidence path are present; - Trigger.dev live-agent wiring uses
prompts.define,chat.local,ai.toolExecute,queryLatencyTask.triggerAndWaitandstreamText; - live ClickHouse task path uses parameterized
client.querycalls for timeline, diff and rollup proof queries; - local secret files are not present.
Warnings are acceptable in offline fixture mode. Failures mean the demo story is not strong enough to record.
The frozen demo sentence is:
The agent found that the 14:32 payment deploy changed retry behavior, causing checkout latency to spike, and every visual is backed by ClickHouse evidence.
Suggested flow:
- Ask the incident question.
- Watch the board assemble.
- Point to the anomaly band breaking at 14:32.
- Open an evidence drawer and show the SQL.
- Click
payment-servicein the heatmap. - Show the before/after diff and suspect ladder.
- Show Trigger.dev run traces.
- Close with the verdict/action card.
This is a bounded Build Week prototype, not a general observability platform. The fixture mode is deterministic by design. The current implementation is optimized for one incident story and one supported board shape. It should not be described as autonomous root-cause proof for arbitrary production systems.
Clickfuse is released under the MIT License. See LICENSE.