EKOS — Enterprise Knowledge Operating System

Pointed at a repo it had never seen.
It found its own gap.

A user asked EKOS to research analytics/ — a real, unmodified clone of Plausible Analytics, a production Elixir/Phoenix app — and document its ClickHouse component. The compiler pipeline had never touched this codebase before. It compiled git history, CI/CD, and dependencies cleanly — and on the one file that actually mattered, ClickHouse's own DDL, it hit a wall that had nothing to do with this session's config. Every screen on this page is real terminal output, unedited, including the failures.

analytics/ (Plausible, Elixir) ekos build / recover CODEC parse failure documented anyway
§ 01 / point it at a stranger
Three dialect rules, one repo EKOS had never indexed

Two databases in one repo — route each file to its own SQL dialect.

terminal — real, unedited
$ ekos init
Initialized .ekos/ workspace at
  /home/legion/PycharmProjects/analytics/.ekos

$ ekos build
Build complete.
  Files observed (new): 2022
  Total objects in ledger: 2022
  Connectors re-scanned: 6

Plausible keeps two Ecto repos: Postgres for app/billing state, ClickHouse for the raw event firehose. RFC 0031's [[recover.sql.dialect-rules]] routes priv/ingest_repo/** to the clickhouse dialect and priv/repo/** to postgres — no code change, just three lines of config pointed at a repo EKOS had zero prior knowledge of.

Open the real transcript: build.txt
§ 02 / the first wall
Not a bug in the code — a stale binary

The release build predated its own dialect registration.

ekos recover — real, unedited
WARN unknown dialect "clickhouse" configured for
     priv/ingest_repo/structure.sql; falling back to generic
WARN sqlparser failed on priv/ingest_repo/structure.sql:
     sql parser error: Expected: ',' or ')' after column
     definition, found: CODEC at Line: 7, Column: 23;
     falling back to empty graph

target/release/ekos on disk predated RFC 0056's ClickHouse dialect registration — cargo build --release -p ekos against current main fixed the "unknown dialect" warning in under 30 seconds. The second warning, the actual parse failure, didn't move.

Open the real transcript: recover-stale-binary.txt
§ 03 / the second wall
Rebuilt binary. Dialect resolves. Same error, same line.

Not config. sqlparser itself doesn't know CODEC.

ekos recover, after a clean rebuild — real, unedited
INFO running pass pass=sql-analyzer:priv/ingest_repo/structure.sql
WARN sqlparser failed on priv/ingest_repo/structure.sql:
     sql parser error: Expected: ',' or ')' after column
     definition, found: CODEC at Line: 7, Column: 23;
     falling back to empty graph

"unknown dialect" is gone — proof the fix in §02 worked. The CODEC error is identical, down to the line and column: `timestamp` DateTime CODEC(Delta(4), LZ4), line 7 of the real schema. That isolates the fault to sqlparser::dialect::ClickHouseDialect's own column-option grammar — it recognizes MATERIALIZED/ALIAS/EPHEMERAL as ClickHouse column options, but CODEC was never added.

Open the real transcript: recover-after-rebuild.txt
§ 04 / the rest of the pipeline didn't care
One file failed. Everything else still compiled.

3,074 objects, 3,977 relationships, from a repo touched for the first time.

500
git commits analysed
124
contributors identity-resolved
138
duplicate-identity merges
3,074
objects compiled
2,856
evidence records

Git history, CI/CD (14 GitHub Actions pipelines), local docs, and the dependency graph all recovered cleanly — the CODEC gap only cost the one thing that needed real ClickHouse DDL grammar: structured Table/Column objects for the event-store schema itself.

Open the real transcript: resolve-compile-commit.txt
§ 05 / searchable, minus the schema
ekos query find "clickhouse" — real, unedited

Every ClickHouse-touching file compiled. Zero ClickHouse tables.

terminal — real, unedited
$ ekos query find "clickhouse"
50 result(s) for 'clickhouse':
  lib/plausible/clickhouse_repo.ex
  lib/plausible/clickhouse_event_v2.ex
  lib/plausible/stats/clickhouse.ex
  lib/workers/clickhouse_clean_sites.ex
  ... 46 more — files, migrations, docs, CI

$ ekos query find "sessions_v2"
30 result(s) — every migration & data-migration file.
Zero ObjectKind::Table objects.

Every Elixir module, migration, and doc that mentions ClickHouse is a real compiled object with real git evidence. What's missing is the one thing a database doc actually needs first: the tables themselves.

Open the real transcript: query-find-clickhouse.txt
§ 06 / ledger plus direct read
Honest about which half came from where

Compiled knowledge for the estate. A source-read fork for the one gap.

01
compiled ledger
+
02
direct source read
03
structured findings
04
component doc

Git/CI/dependency facts came from the ledger, queryable and evidenced. Every schema claim — engines, partition keys, the write-buffer flush logic, the staged data-migration framework — came from a background research pass reading structure.sql and the Elixir source directly, because the ledger had nothing structural to hand it for ClickHouse. The delivered doc says which is which, in its own words, not after the fact.

§ 07 / the deliverable
Published this session

"The Event Store" — the ClickHouse component, documented anyway.

what it covers
18 tables & dictionaries, fully specced
4 Ecto repos → 1 ClickHouse cluster
Write path: buffer, flush, RowBinary
Read path: query-builder pipeline
6 staged data-migration case studies
54-migration schema-evolution timeline

Every engine/partition/order-key claim in the doc was read straight from priv/ingest_repo/structure.sql and the migration files — and the doc says so, in a callout naming this exact CODEC gap, so a reader knows which facts are ledger-grounded and which are a direct read standing in for it.

Same dialect, a repo of your own

Point [[recover.sql.dialect-rules]] at any file-based ClickHouse DDL.

ekos.toml
# route ClickHouse-only paths to the clickhouse dialect,
# everything else stays on generic/ANSI
[[recover.sql.dialect-rules]]
path-glob = "priv/ingest_repo/**"
dialect = "clickhouse"

$ ekos build && ekos recover
EKOS · a cold run against analytics/ (Plausible Analytics), a real unmodified open-source repo · every example on this page is real output, unedited · github.com/alexeyban/EKOS