Event-sourced task graphs and pattern playbooks for multi-agent coordination.
Written in Common Lisp. Built with itself.
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.
{type: session.join, sid: s-3979..}
{type: observe, text: "split graph.."}
{type: observe, text: "edge-map key.."}
{type: phase.link, edge: phase-of}
{type: task.complete}
{type: session.leave, sid: s-3979..}Document what exists. Explore with delegated agents. Capture observations as structured data.
Decompose into phase DAGs with dependencies. Each phase independently testable. Scaffold with TQ.
Execute phase-by-phase. Red, green, refactor. Hot-reload the running image. Verify at every gate.
Extract patterns from completed work. Bayesian feedback scores what helped. The playbook evolves.
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.
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
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.
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.
CRDTs merge concurrent writes automatically. The task graph grows richer with every session. File activity records build conflict awareness. Vector clocks establish causal order.
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.
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.
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.
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.
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.
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.
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