Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

kleisli-io/kli

Event-sourced task graphs, pattern learning, and swarm coordination for Claude Code

kleisli-io/kli.json
{
"createdAt": "2026-02-11T14:18:56Z",
"defaultBranch": "main",
"description": "Event-sourced task graphs, pattern learning, and swarm coordination for Claude Code",
"fullName": "kleisli-io/kli",
"homepage": "https://kli.kleisli.io",
"language": "Common Lisp",
"name": "kli",
"pushedAt": "2026-03-01T15:39:59Z",
"stargazersCount": 10,
"topics": [],
"updatedAt": "2026-03-09T13:11:36Z",
"url": "https://github.com/kleisli-io/kli"
}

[License: MIT]!(LICENSE)

Event-sourced task orchestration for Claude Code. kli adds a typed task graph, multi-agent coordination via CRDTs, and structured development workflows. An MCP server and hooks work in the background alongside vanilla Claude Code and Agent teams. Or drive it directly: /kli:research -> /kli:plan -> /kli:implement -> /kli:reflect.

![kli dashboard — task graph from a live project with 500+ tasks across multiple architecturally different projects]!(docs/images/dashboard.png)

  • [Quick Start]!(#quick-start)
  • [What kli Does]!(#what-kli-does)
  • [Landscape]!(#landscape)
  • [Installation]!(#installation)
  • [Architecture]!(#architecture)
  • [What kli Is Not]!(#what-kli-is-not)
Terminal window
curl -fsSL https://kli.kleisli.io/install | sh

Then, in any project:

Terminal window
kli init

This configures the MCP server, hooks, skills, agents, and commands. Claude Code queries the task graph through TQ, a composable pipeline language:

;; "Show me the most active tasks"
(-> (active) :enrich (:sort :obs-count) (:take 3) (:select :display-name :obs-count))
kli-landing-page-prototype 47 observations
fix-tq-core-bugs 23 observations
add-spread-activation 12 observations

Full documentation at docs.kleisli.io/kli.

A single binary. The MCP server and hooks handle task tracking and agent coordination in the background; skills provide structured workflows when you want them.

An MCP server that Claude Code calls as it works:

Task graph — Every mutation is an immutable event in an append-only log. When concurrent agents write to the same task, CRDTs merge their changes — no writes lost, no coordination protocol needed. Claude Code queries the graph through TQ, a composable pipeline language for filtering, sorting, grouping, set operations, and mutations.

Pattern learning — Each pattern carries helpful and harmful feedback counters ranked by Bayesian scoring. New patterns start uncertain; evidence moves them toward proven or demoted. During task bootstrap, retrieval combines feedback scores with embedding similarity and graph-based spread activation to surface what’s relevant.

Lifecycle hooks that fire during Claude Code sessions:

  • Session start/leave — initializes task context, detects parallel sessions, registers with the MCP server
  • Tool call tracking — records file touches, builds session fingerprints, feeds the co-application graph
  • File conflict detection — warns before concurrent edits to the same file

kli init installs Claude Code extensions:

  • Skills — structured workflows for a full development cycle:
    • /kli:research — codebase exploration with observation capture
    • /kli:plan — iterative planning with phase decomposition
    • /kli:implement — TDD with verification gates
    • /kli:reflect — pattern extraction from experience
  • Agents — subagents for parallel work (codebase analysis, web research, graph queries, design research)
  • Commands/kli:commit (conventional commits with task integration), /kli:create-task, /kli:handoff (creates handoff-document which embeds events tracked from current session), /kli:resume_handoff (complementary to handoff command for when you resume work)

When multiple Claude Code sessions work on the same codebase:

  • File conflict detection — surfaces concurrent edits before they collide
  • Session fingerprinting — tracks which files and tools each session touches
  • Orphan phase pickup — detects when a session exits mid-task so another can continue

Web UI for the task graph, activity timeline, plan DAGs, topic clusters, and health diagnostics:

Terminal window
kli dashboard # starts on http://localhost:9091

8 views including a WebGL force-directed graph, frontier board, Markov cluster analysis, and per-task plan visualization.

There are a lot of context persistence and task tracking tools in the current landscape. Here is a short comparison which should help you understand if kli is for you or not. In the end, you should pick the workflow that works for you and makes you as productive as possible.

PlanningPersistenceMulti-agentPattern learningQuery language
BMADFull SDLC with role personasSkill/template .md in gitRole personas, collaborative Party ModeNoNo
GSDSpec-first, fresh context per taskROADMAP/STATE/PLAN.mdWave-based parallel executionNoNo
OpenSpecPer-feature spec foldersSpec folders in repoNoneNoNo
Task MasterPRD parsing → tasks.taskmaster/ JSONOrchestrator/executor/checkerNoNo
BeadsDependency graph, hierarchical tasksDolt + JSONL + gitHash-based collision avoidance, Dolt branchingNoNo
claude-flowAuto-decomposition, queen hierarchySQLiteSwarm topologies (mesh, hierarchical, ring, star)Self-learning (v3, nascent)No
kliRPIR workflow, concrete task DAGs with objectives and acceptance criteria, reorganizable via TQAppend-only event logs, CRDT state replayStigmergy — session fingerprints, file conflicts, orphan pickupBayesian scoring + embeddings + graph spread activationTQ + PQ — composable S-expression pipelines

Other differences: Among these tools, kli is the only one with event sourcing (immutable events, no state mutation), a dashboard (8-view web UI with WebGL graph), and stigmergic coordination. On the other hand, it only works with Claude Code — BMAD, GSD, and OpenSpec support multiple IDEs. And it is pre-1.0; the others have larger communities.

What distinguishes kli is the trace: the complete, structured record of what happened, why, and how it relates to everything else. Most tools in this space optimize for planning or execution. kli records both — and makes the record queryable, traversable, and learnable.

Coordination is stigmergic: agents deposit traces in the shared task graph and discover what others have done — indirect coordination, like termite colonies building without a foreman. Session fingerprints mark territory, file conflict detection prevents collisions, orphan phase pickup lets agents continue abandoned work. In practice, adding agents doesn’t increase coordination overhead — no message routing, no broker.

Terminal window
curl -fsSL https://kli.kleisli.io/install | sh
kli init # in any project where you want to use it

Linux (x86_64, aarch64) and macOS (x86_64, Apple Silicon). Downloads a pre-built binary from GitHub releases. kli init configures the current project. One external dependency: a local embedding model (ollama) for observation search and pattern retrieval.

Terminal window
nix build # produces result/bin/kli
nix run # run directly
nix flake check # run test suites (CRDT, task, playbook, hooks)

Requires SBCL and Quicklisp:

(asdf:load-system :kli)
(kli:main)

Single Common Lisp binary (SBCL). MCP server, hook dispatch, dashboard, and project init in one process.

Claude Code <--http--> kli serve task graph + pattern learning
Claude Code ---calls--> kli hook <event> session, tool, conflict hooks
Browser <--http--> kli dashboard web UI on :9091
Developer ---runs---> kli init project setup

Each task is an append-only event log (events.jsonl). State is computed by replaying events through CRDT merge functions — vector clocks for future causal analysis, OR-Sets and LWW-Registers for concurrent writes. Over time, the structured log becomes a complete trace of agent reasoning, decisions, and outcomes. That data compounds.

TQ and PQ are S-expression pipeline languages for querying tasks and patterns respectively. Both are pure parsers — no eval, no code execution, no injection surface. Claude Code composes arbitrarily complex queries safely, and honestly, the queries get more useful as the graph grows.

;; Scaffold a plan with objectives and dependencies
(scaffold-plan!
(p1 "Design schema" :objective "Normalize user tables"
:acceptance "Migration passes, tables exist")
(p2 "Implement API" :after p1)
(p3 "Write tests" :after p2))
;; Find ready phases in the current plan
(-> (query "plan-ready") (:select :display-name :objective))
;; Reorganize: sever a phase, relink dependencies — one expression
(-> (node "my-task:phase-2") (:sever-from-parent! :phase-of))
;; Traverse the graph: what depends on the auth task?
(-> (node "auth-refactor") (:back :depends-on) :ids)
;; PQ: surface patterns that helped with similar work before
(-> (activate "CRDT conflict resolution") (:take 3))

See full architecture docs for CRDT details, library breakdown, and query language reference.

kli is not a project management tool and does not replace GitHub Issues, Linear, or Jira. It is a task orchestration layer for multi-session work where task structure, agent coordination, and development workflows matter.

[MIT]!(LICENSE)


Built by Kleisli.IO in Tromso, Norway.