kli

Event-sourced task graphs and pattern playbooks for multi-agent coordination.

Written in Common Lisp. Built with itself.

>=>
what it is

The infrastructure layer for agentic workflows.

kli gives AI coding agents structured memory. Tasks are event-sourced — every mutation is an immutable event. State is computed, never stored. Multiple agents work the same task graph concurrently through CRDTs, coordinating through traces left in the environment.

Patterns emerge from implementation. A Bayesian feedback loop promotes what works and demotes what doesn't. The system learns from every session.

82nodes in this graph
9sessions built this page
0telemetry

the cycle

Research. Plan. Implement. Reflect.

01

research

Document what exists. Explore with delegated agents. Capture observations as structured data.

02

plan

Decompose into phase DAGs with dependencies. Each phase independently testable. Scaffold with TQ.

03

implement

Execute phase-by-phase. Red, green, refactor. Hot-reload the running image. Verify at every gate.

04

reflect

Extract patterns from completed work. Bayesian feedback scores what helped. The playbook evolves.


built with itself

The task graph that built kli.

Every node is a real task from kli's own development. Hub nodes are planning tasks; satellites are implementation phases. Hover to inspect. This graph was queried live from kli's task server.

hub
complete
active
phase-of
depends-on
related-to
topic

your control center

Not a viewer. A control surface.

One command launches a local dashboard. Browse the frontier, inspect computed plan DAGs, pin tasks for quick access, take notes in the scratchpad. Mutate task state directly — complete phases, add observations, sever edges.

Composition maps render the full graph with force-directed layout. Health diagnostics catch stale forks and orphaned phases. Topic clusters show emergent structure. Everything computes from events — no stale state.

$ kli serve

Dashboard listening on http://localhost:3456

Frontier: 676 ready / 950 total tasks
Health: no stale phases
Graph: 950 nodes, 8863 edges
Sessions: 3 active
frontier
plan
graph
health
clusters
MAHOGANY-LAYER-SHELL-PROTOCOL
4 phases · 2 ready · 12 observations
CREATE-CFFI-BINDINGS
done
↓ depends-on
IMPLEMENT-LAYER-SURFACE-LIFECYCLE
done
↓ depends-on
IMPLEMENT-SCENE-INTEGRATION
ready
↓ depends-on
INTEGRATION-TESTING
blocked
▸ expand◉ observe✓ complete✂ sever
scratchpad
Focus on scene integration next — CFFI layer verified, lifecycle callbacks working. Check wlr_scene_layer_surface_v1_create API...
core · 950 tasks · 4 pinnedlocalhost:3456

coordination without communication

Agents leave traces. Others adapt.

No message bus. No coordination protocol. Agents write events to a shared log. Other agents read those traces and adjust behavior. The same mechanism that lets termites build cathedrals.

01

Deposit

Every tool call, file edit, and observation is an event appended to the task log. Session fingerprints capture behavioral signatures — which tools, which files, what patterns.

{type: tool.call, tool: Edit,
file: state.lisp, sid: s-3979..}
02

Accumulate

CRDTs merge concurrent writes automatically. The task graph grows richer with every session. File activity records build conflict awareness. Vector clocks establish causal order.

G-Set
observations
OR-Set
edges
LWW
claims
03

Discover

A new session joins. Bootstrap surfaces swarm awareness: who's working nearby, which files were touched, which phases are orphaned. No one told them. They read the traces.

state.lisp edited by s-3979
task: FIX-TQ-CORE-BUGS
last: "refactored edge sever"

Five trace types enable this: event logs (append-only JSONL), session fingerprints (behavioral vectors), file activity records (edit history), active PID tracking (liveness), and departure events (orphan detection). The graph is the coordination medium. The traces are the protocol.


principled, not ad-hoc

Every guarantee is mathematical.

kli isn't held together by convention. It is held together by theorems. Convergence is proven, not hoped for. Coordination emerges from structure, not from protocols.

F(X) = (Q O) × (E X)

Coalgebraic state

State is defined by behavior, not history. A task is a coalgebra for a functor: given a query Q, you get an observation O. Given an event E, you get a new state. The event log is a trace of dynamics, not identity. Two different event sequences producing the same behavior are the same system.

merge(a, b) = merge(b, a)
merge(a, a) = a
merge(a, merge(b, c))
= merge(merge(a, b), c)

CRDT convergence

Commutativity, idempotence, associativity. These three properties guarantee that distributed sessions always converge to the same state regardless of event ordering. G-Sets grow monotonically. OR-Sets support removal via tombstones. LWW-Registers break ties by timestamp. No locks. No coordination. Proven correct.

f : Tasks Topics
[t] = f⁻¹(f(t))
Tasks/∼ ≅ Topics

Emergent topology

Topic clusters are not assigned — they are induced. A surjection from tasks to topics partitions the work into equivalence classes. Tasks sharing structure collapse into fibers. The quotient is computed from the graph, not declared by convention. Today this is the forward map. The target: a full adjunction between concept lattice and task lattice.

The coalgebraic model makes stigmergy possible. Because state is behavior — not history — agents don't need to replay event logs to coordinate. They observe the current graph, read the traces left by predecessors, and adapt. CRDTs guarantee their concurrent writes converge. The quotient topology reveals structure they collectively build. Mathematics is the coordination protocol.


install

One binary. Zero telemetry.

kli ships as a single native binary. No Python, no Node, no Docker. The Lisp runtime, compiler, and debugger ship inside — enabling hot-reload, evolving tools, and live introspection.

Your data stays local. Always.

$ curl -fsSL https://kli.kleisli.io/install | sh
$ cd my-project && kli init

Kleisli initialized in /home/user/my-project

Tasks: .kli/tasks/ event-sourced, CRDT merge-safe
Patterns: .kli/playbook.md Bayesian quality scoring
Dashboard: http://localhost:3456 task graph visualization
Embeddings: active ollama/nomic-embed-text

Claude Code: 5 skills, 10 commands, 5 hooks installed