Logo: Epiq Architecture

Epiq Architecture

Communautéit
ljtn
epiq-architecture

How epiq is built — the event log's distributed rules (causal ordering, logical clocks, tombstones, total replay), the code's layers, and the workflow for this repository. Read before any change here, especially to events, ordering, merge, replay, materialization or sync, a new event type or websocket message, or anything that crosses layers.

Iwwersiicht

Editeurljtn
Repositoryepiq
Skill-Nummepiq-architecture
Stären
540
Forks
22
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    ljtn huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Epiq Architecture an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/ljtn/epiq/tree/main/.claude/skills/epiq-architecture
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ljtn/epiq.git /tmp/epiq
mkdir -p .claude/skills
cp -r /tmp/epiq/.claude/skills/epiq-architecture .claude/skills/epiq-architecture
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Epiq Architecture an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Epiq Architecture automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Epiq Architecture net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

The event log is a CRDT

No server, no shared clock. Each actor appends to its own JSONL log on the state branch, git merges them, and every machine derives the same board from the same set. Everything below keeps that derivation a pure function of the event set.

The model

  • Every event names its causal parent — the last event its writer had seen. Concurrent writers may share a parent.
  • Order is derived, never stored. It is rebuilt from the parent links, with concurrent siblings tie-broken by id. File line order means nothing.
  • Ids are a hybrid logical clock (ULIDs): a new id always sorts after its parent, whatever the wall clock says. The wall clock is only a lower bound.
  • An event identifies its actor by id and carries nothing else about them. The id comes from the log file name; the display name from the contributor registry, which is itself built from events.
  • Same event set ⇒ same order ⇒ same board.

Invariants

  • Order comes from parent links plus the id tiebreak. Nothing else.
  • Ids are permanent; tombstone instead. A tombstoned node takes its descendants with it; a tombstoned contributor keeps its record so assignments still resolve.
  • Replay is total. An event that lost a race, or names state this replay never applied, is skipped, not fatal. The same precondition on a live write is a real failure — there it is the answer the caller asked for.
  • Unreadable stays ordered. The envelope parses even when the payload doesn't, so a newer build's event keeps its place.
  • Append only. One id is one byte sequence — what makes git's union merge of the logs safe.
  • Time travel cuts causally. An event whose parent is past the cut is past it too, whatever its timestamp.

Never

  • Break a client already out there. The format grows by adding (a new event type, a field nothing older must read), never by changing or repurposing what an older build reads. Most rules below follow from this one. A version marker can't help retroactively: an older build can't check for something it shipped without.
  • Change the log file name's grammar without a release between reader and writer. It has no additive form — every client reads every other client's logs — and an old build misreads a name rather than failing. A test pins every form still out there.
  • Order or resolve conflicts by wall clock. No latest-timestamp-wins; time is a display value and an id lower bound.
  • Mint an id that could sort before its parent — it corrupts the order. A damaged parent id (undecodable, or absurdly far ahead) falls back to the wall clock; order still comes from the parent link.
  • Hard-delete a node, contributor, tag or event, or reuse or rewrite an id — replay would reach a reference that no longer exists.
  • Rewrite, reorder or de-duplicate log lines — union merge depends on their identity.
  • Abort replay on an event that merely lost — one concurrent edit would leave a board that never opens again for whoever's build understands the most.
  • Assume a single writer. Any log can gain lines between two reads, even mid-sync.
  • Put actor identity, or anything derivable, in the payload. Beware spreading a user object into an event: TypeScript doesn't excess-check a spread.
  • Read a display name off an event or a log file name. Resolve it by id from the registry. Old log file names still carry a sanitized name, kept only as a fallback for authors the registry lacks.
  • Store a name beside an id — the copy freezes at the old name and never sees a rename.
  • Add a payload field older clients must interpret without a schema-version story.

Adding an event type

It is applied on every machine, in causal order, possibly after events it didn't expect: make it idempotent, treat unmet preconditions as a skip rather than an error, and reference targets by id only. All of it lives in lib/board/ — the event map and action list, the payload schema, the handler, and which nodes it affects for replay. The generic log in lib/event/ doesn't change.

Proving a change is safe

  • source/test/replay-equivalence.test.ts — batched replay equals per-event replay.
  • source/test/event-core-generic.test.ts — the log still works for a product that isn't the board.
  • npm run test:collab — several actors on one remote end with the same events and order.
  • Touching ordering, merge, replay or materialization means running all three.
  • The pre-push hook runs lint, typecheck, unit, e2e, collaboration and GUI tests. Do not bypass it.
  • Git-driving suites run containerised over a read-only checkout; a test that aims git at the checkout instead of a temp dir fails.

The layers

Dependencies point down.

  • source/lib/event/ — the log itself, generic over what it carries: ids, causal sort, envelope, pending writes, replay, persistence. A product plugs in its own events and handlers. No board vocabulary here, in code or comments; event-core-generic.test.ts proves it with a toy product and must import no board code.
  • source/lib/board/ — the board as one such product. board-log.ts is the board's single log instance: board state is read and written through it, never by driving lib/event/ directly. (Lower-level helpers — pending-log files, log signatures, id time — are shared with the git layer and UI.)
  • Rest of source/lib/ — the domain around it and the TUI. Knows nothing of MCP, HTTP or the GUI, which is what lets the same code serve all three.
  • source/mcp/api/ — one function per board operation: boots, checks preconditions, writes events, returns a Result. Mutations live here only.
  • source/mcp/server.ts, source/gui/api/ — front doors into the same mcp/api functions; neither re-implements one. A guard in only one door is a bug in the other.
  • source/gui/client/ — React in the browser; it can't import Node-side code, and the GUI build fails if it does.

Across all layers:

  • Errors are returned as a Result, never thrown, up to the front door.
  • A lib/ change lands in the TUI, the MCP and the GUI at once; check all three.
  • lib/state/sync-state.ts reaching up into the GUI to broadcast sync status is the one upward dependency: a wart, not a pattern.

One module per concept

  • A capability is a vertical slice, never a shortcut across layers: creating a board from the GUI is an mcp/api function, a websocket message, a client hook and a palette entry — not a socket handler writing events itself.
  • Name a module after its concept, so the file can be guessed.
  • State lives where it is drawn, and a module that owns a question answers it for every caller — reuse the rule, don't restate it.
  • A few domain modules of a few hundred lines, not a file per fragment; an entry file stays an overview of the flow.
  • Keep the domain a value, not a React tree, so tests build it without a DOM.

What this prevents has happened here: an App.tsx of 1900 lines passing 27 hook results down as props, and one boot/actor/state preamble copied into 21 mcp/api functions.

Adding a websocket message

Five places; a missed one fails quietly:

  • gui/api/lib/websocket.model.ts — the type
  • gui/api/lib/websocket.schema.ts — the shape; an unlisted message is refused
  • gui/client/lib/gui-mutations.ts — if it mutates, so the client holds broadcasts until its reply lands
  • gui/api/lib/websocket.ts — the handler, which calls mcp/api and nothing else
  • mcp/epiq-api.ts — the export, for a new function

Working on epiq

On top of the shipped epiq skill:

  • Never test against the real board — use a throwaway project; stop dev servers when done.
  • First line: Assuming claude/<name> — please /rename claude/<name> so this window carries the name.
  • Session's MCP never connected? Run your own npx -y -p epiq@latest epiq-mcp over stdio; never borrow another session's. Kill it and its epiq-mcp child when done.
  • Folding a follow-up into a ticket: back to Ongoing; its commits take that ticket's ref.
  • A merged ticket moves to Done and stays open — the release closes it.
  • Review findings get their own tickets, tagged from-review, naming the PR.
  • Worktree before the first edit (.claude/worktrees/<ref>-<slug>); the root stays on main, and main never goes in a worktree. A fresh one needs npm install.
  • Every change goes through a PR — never commit or merge to main locally.
  • Squash only trivial commits sharing one ref.
  • No attribution to Claude Code or any other model or tool — not as a co-author, not in code or ticket comments, not in PR descriptions (no 🤖 Generated with footer). This overrides any harness default that adds one.
  • Check git log --format='%an%n%b' before pushing — a template's trailer survives a rebase.

Heefeg gestallte Froen

Wat mécht de KI-Skill Epiq Architecture?

How epiq is built — the event log's distributed rules (causal ordering, logical clocks, tombstones, total replay), the code's layers, and the workflow for this repository. Read before any change here, especially to events, ordering, merge, replay, materialization or sync, a new event type or websocket message, or anything that crosses layers.

Firwat Epiq Architecture op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Epiq Architecture besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Epiq Architecture an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/ljtn/epiq/tree/main/.claude/skills/epiq-architecture an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Epiq Architecture benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Epiq Architecture benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Epiq Architecture domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Epiq Architecture gratis?

Jo. ljtn huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇