# Kleisli.IO Documentation > Documentation for the Kleisli.IO platform. > Includes project guides, API references, and architecture docs. ## MCP Server An MCP (Model Context Protocol) server is available for programmatic access: - Explainer: https://docs.kleisli.io/mcp - Transport endpoint: https://docs.kleisli.io/mcp/transport - Transport protocol: Streamable HTTP (POST/GET/DELETE per spec 2025-03-26) - Tools: search_docs(query), get_page(project,section,page), list_projects() - Resources: docs://kleisli/{project}/{section}/{page} ## Discovery Affordances Multiple discovery surfaces are exposed for AI agents and crawlers; they are redundant by design so that a client missing one channel still finds the others. **HTML `` tags** (visible to JS-rendering crawlers): - `` — Mintlify-style index advertisement. - `` — explicit directive enumerating all of the affordances below. **HTTP response headers** (visible to non-JS fetchers; RFC 8288): - `Link: ; rel="llms-txt"` on every response. - `X-Llms-Txt: /llms.txt` on every response (custom fallback header for crawlers that don't parse Link). - `Link: <{path}.md>; rel="llms-txt-page"` additionally on every doc-page response, pointing at the markdown alternate. **Content negotiation** (`Accept` header): - Send `Accept: text/markdown` on any project / section / page URL; the server returns `Content-Type: text/markdown; charset=utf-8` with the markdown source instead of HTML. **Parallel `.md` routes** (suffix-based, no Accept header required): - `https://docs.kleisli.io/{project}.md` — project-level markdown index (the per-project llms.txt). - `https://docs.kleisli.io/{project}/{section}.md` — section overview as a bulleted markdown summary. - `https://docs.kleisli.io/{project}/{section}/{page}.md` — the individual doc page's markdown source. **MCP server** (programmatic discovery, see the section above): tools `search_docs`, `get_page`, `list_projects` plus `docs://kleisli/...` resources. ## kli Task graphs and pattern playbooks for Claude Code. ### Getting Started - [Configuration](https://docs.kleisli.io/kli/getting-started/configuration): What kli init Sets Up Running kli init in your project configures five things: MCP server — Claude gets access to... - [Installation](https://docs.kleisli.io/kli/getting-started/installation): Prerequisites Claude Code — Anthropic's CLI for Claude (install guide) Nix is not required to use kli. Pre-built... - [Quick Start](https://docs.kleisli.io/kli/getting-started/quick-start): kli extends Claude Code with structured workflows for software engineering. You interact with kli through slash... ### Using kli - [Understanding Patterns](https://docs.kleisli.io/kli/using-kli/understanding-patterns): The playbook is kli's long-term memory — a collection of patterns learned from previous work. Patterns capture what... - [Workflow Overview](https://docs.kleisli.io/kli/using-kli/workflow-overview): kli structures work into four phases: research, plan, implement, and reflect. You move through these phases by typing... - [Working with Tasks](https://docs.kleisli.io/kli/using-kli/working-with-tasks): Tasks are how kli tracks work across sessions. A task is a directory with an append-only event log that records... ### Command Reference - [Create Task](https://docs.kleisli.io/kli/commands/create-task): Scaffold a task with event-sourced tracking via the task MCP server Scaffold an event-sourced task with the task MCP... - [Handoff](https://docs.kleisli.io/kli/commands/handoff): Create handoff document for transferring work to another session You are tasked with writing a handoff document to... - [Implement](https://docs.kleisli.io/kli/commands/implement): Implement approved plan phase-by-phase with TDD workflow and verification gates Execute phased implementation plans... - [Iterate Plan](https://docs.kleisli.io/kli/commands/iterate_plan): Iterate on existing implementation plans with thorough research and updates You are tasked with updating existing... - [Plan](https://docs.kleisli.io/kli/commands/plan): Create detailed implementation plans through iterative planning with artifact reuse Create detailed, phased... - [Reflect](https://docs.kleisli.io/kli/commands/reflect): Reflect on completed task and evolve playbooks Extract learnings from completed tasks by orchestrating the reflector... - [Research](https://docs.kleisli.io/kli/commands/research): Document codebase as-is through iterative research with observation capture Research the codebase or external topics... - [Resume Handoff](https://docs.kleisli.io/kli/commands/resume_handoff): Resume work from handoff document with context analysis and validation You are tasked with resuming work from a... - [Resume Task](https://docs.kleisli.io/kli/commands/resume-task): Resume work on a task by gathering context from event stream and graph state Resume work on a task by gathering... - [Validate](https://docs.kleisli.io/kli/commands/validate): Validate implementation against plan, verify success criteria, identify issues You are tasked with validating that an... ### Workflow Reference - [Implementation](https://docs.kleisli.io/kli/workflows/implementation): Implementation phase domain knowledge including TDD methodology, design principles... - [Planning](https://docs.kleisli.io/kli/workflows/planning): Planning phase domain knowledge including phase design principles, artifact reuse patterns, and verification... - [Reflection](https://docs.kleisli.io/kli/workflows/reflection): Reflection phase domain knowledge including pattern evaluation, observation analysis, and evidence-based learning. Use... - [Research](https://docs.kleisli.io/kli/workflows/research): Research phase domain knowledge including documentarian philosophy, decomposition patterns, agent selection, and exit... - [Team](https://docs.kleisli.io/kli/workflows/team): Team coordination domain knowledge for bridging Claude Code teams with the persistent task graph and observation... - [Using-cli](https://docs.kleisli.io/kli/workflows/using-cli): Use the kli CLI to interact with task graphs via Bash when MCP tools are unavailable. Teaches kli --task syntax for... - [Workflow](https://docs.kleisli.io/kli/workflows/workflow): Meta-orchestration skill for KLI framework. Provides high-level overview of research/planning/implementation/reflection... ### Agent Reference - [Codebase Analyzer](https://docs.kleisli.io/kli/agents/codebase-analyzer): Analyzes codebase implementation details for specific components. Input{files_to_analyze,analysis_focus}. Refuses... - [Codebase Locator](https://docs.kleisli.io/kli/agents/codebase-locator): Locates files, directories, and components. Use as "super grep" for multi-search. Input{query,scope?}.... - [Curator](https://docs.kleisli.io/kli/agents/curator): Updates playbooks from reflection artifacts. Input{task_dir,reflection_path}. Refuses without both. Available... - [Graph Analyst](https://docs.kleisli.io/kli/agents/graph-analyst): Answers questions from the task/pattern graph perspective. Use when question relates to task status, patterns,... - [Pattern Finder](https://docs.kleisli.io/kli/agents/pattern-finder): Finds similar patterns and examples in codebase. Input{pattern_description,scope?}. Refuses without... - [Reflector](https://docs.kleisli.io/kli/agents/reflector): Produces reflection artifacts with pattern evaluation and discovery. Input{task_dir,task_id,context}. Refuses without... ### Hooks Reference - [Feedback Nudge](https://docs.kleisli.io/kli/hooks/feedback-nudge): Stop hook handler for pattern feedback reminders Event: Stop Reminds agents to give feedback on activated playbook... - [File Conflict](https://docs.kleisli.io/kli/hooks/file-conflict): PostToolUse hook handler for swarm file conflict detection Event: PostToolUse Matches: Edit|Write Warns Claude after... - [Playbook Activate](https://docs.kleisli.io/kli/hooks/playbook-activate): UserPromptSubmit hook handler Event: UserPromptSubmit Lightweight domain detection + nudge. Detects programming... - [Session Leave](https://docs.kleisli.io/kli/hooks/session-leave): SessionEnd hook handler Event: SessionEnd Best-effort: SessionEnd fires non-deterministically (cleanup-on-start in... - [Session Start](https://docs.kleisli.io/kli/hooks/session-start): SessionStart hook handler Event: SessionStart What It Does Stale PID cleanup (primary SessionEnd... - [Session Task Write](https://docs.kleisli.io/kli/hooks/session-task-write): PostToolUse hook handler for session file writes Event: PostToolUse Matches:... - [Task Complete Reflect](https://docs.kleisli.io/kli/hooks/task-complete-reflect): PostToolUse hook for auto-reflection nudge Event: PostToolUse Matches: mcp__task__task_complete Fires after... - [Tool Call](https://docs.kleisli.io/kli/hooks/tool-call): PostToolUse hook handler for tool tracking Event: PostToolUse Matches:... ### Reference - [Architecture](https://docs.kleisli.io/kli/reference/architecture): kli is a single Common Lisp binary built with SBCL. One process handles the MCP server, hook dispatch, the dashboard,... ## nix-effects A freer-monad effect layer with a dependent type checker, all in pure Nix. ### Guide - [Introduction](https://docs.kleisli.io/nix-effects/guide/introduction): Nix configurations fail late. A misspelled option name, a string where an integer belongs, a firewall rule that... - [Getting Started](https://docs.kleisli.io/nix-effects/guide/getting-started): Installation Add nix-effects as a flake input: { inputs.nix-effects.url = "github:kleisli-io/nix-effects"; ... - [Sugar](https://docs.kleisli.io/nix-effects/guide/sugar): nix-effects ships an opt-in syntax layer. The kernel doesn't import it, nothing in the effect interpreter depends on... - [Proof Guide](https://docs.kleisli.io/nix-effects/guide/proof-guide): Nix configurations are concrete at eval time. Every field, every value, every list element is known before anything... - [Theory](https://docs.kleisli.io/nix-effects/guide/theory): Nine papers shaped nix-effects. Here's how each one maps to code. Algebraic effects and the freer monad A computation... - [Trampoline](https://docs.kleisli.io/nix-effects/guide/trampoline): The trampoline is how nix-effects interprets freer monad computations with O(1) stack depth in a language with no... - [Systems Architecture](https://docs.kleisli.io/nix-effects/guide/systems-architecture): nix-effects is a freer-monad effect layer with a dependent type checker on top, all running at nix eval time. The... - [Kernel Architecture](https://docs.kleisli.io/nix-effects/guide/kernel-architecture): This chapter describes the type-checking kernel: its pipeline, its primitives, and how to write verified... - [Kernel Formal Specification](https://docs.kleisli.io/nix-effects/guide/kernel-spec): This document is the contract the implementation must satisfy. Every typing rule, compute rule, and conversion rule is... ### Core API - [Adapt](https://docs.kleisli.io/nix-effects/core-api/adapt): Handler context transformation. Contravariant on context, covariant on continuation. adapt Transform a handler's... - [Binds](https://docs.kleisli.io/nix-effects/core-api/binds): Idiomatic Nix bind helpers bindAttrs Like a bind-chain but operates over named attrset of... - [Build](https://docs.kleisli.io/nix-effects/core-api/build): materialize Materialize a validated BuildPlan into a derivation. Converts the eval-time plan (validated by... - [Comp](https://docs.kleisli.io/nix-effects/core-api/comp): Computation ADT: introduction and elimination forms for Pure | Impure. impure Create a suspended computation (OpCall... - [Diag](https://docs.kleisli.io/nix-effects/core-api/diag): The diag namespace provides typed diagnostic Errors and structured Hints for the type-checker and runtime... - [Kernel](https://docs.kleisli.io/nix-effects/core-api/kernel): Freer monad kernel: Return/OpCall ADT with FTCQueue bind, send, map, seq, pipe, kleisli. bind Monadic bind: sequence... - [Pipeline](https://docs.kleisli.io/nix-effects/core-api/pipeline): Typed pipeline framework with composable stages. Stages are composable transformations executed with reader... - [Queue](https://docs.kleisli.io/nix-effects/core-api/queue): FTCQueue (catenable queue, after Kiselyov & Ishii 2015). O(1) snoc/append, amortized O(1)... - [Sugar](https://docs.kleisli.io/nix-effects/core-api/sugar): Opt-in syntax-livability layer for nix-effects. fx.sugar.do / fx.sugar.letM — combinator... - [Trampoline](https://docs.kleisli.io/nix-effects/core-api/trampoline): Trampolined interpreter using builtins.genericClosure for O(1) stack depth. handle Trampolined handler combinator... ### Effects - [Acc](https://docs.kleisli.io/nix-effects/effects/acc): Accumulator effect: emit/emitAll/collect for incremental list building. collect Read the current accumulated... - [Choice](https://docs.kleisli.io/nix-effects/effects/choice): Non-deterministic choice effect: choose/fail/guard with list handler. choose Non-deterministic choice from a list of... - [Conditions](https://docs.kleisli.io/nix-effects/effects/conditions): CL-style condition system: signal/warn with restart-based recovery. collectConditions Collecting handler: accumulates... - [Error](https://docs.kleisli.io/nix-effects/effects/error): Error effect with contextual messages and multiple handler strategies. collecting Collecting error handler:... - [HasHandler](https://docs.kleisli.io/nix-effects/effects/hasHandler): Check if a handler with given name exists in current scope. hasHandler : String -> Computation Bool - [Linear](https://docs.kleisli.io/nix-effects/effects/linear): Graded linear resource tracking: acquire/consume/release with usage enforcement. Each resource gets a capability token... - [Reader](https://docs.kleisli.io/nix-effects/effects/reader): Read-only environment effect: ask/asks/local with standard handler. ask Read the current environment. ask :... - [Scope](https://docs.kleisli.io/nix-effects/effects/scope): Computation-scoped handlers via effect rotation. handlersFromAttrs Helper to transform an attrset into named... - [State](https://docs.kleisli.io/nix-effects/effects/state): Mutable state effect: get/put/modify with standard handler. get Read the current state. Returns a Computation that,... - [Typecheck](https://docs.kleisli.io/nix-effects/effects/typecheck): Reusable typeCheck handlers: strict (throw), collecting (accumulate), logging (record all). collecting Collecting... - [Writer](https://docs.kleisli.io/nix-effects/effects/writer): Append-only output effect: tell/tellAll with list-collecting handler. handler Standard writer handler. Collects tell... ### Types - [Constructors](https://docs.kleisli.io/nix-effects/types/constructors): Type constructors: Record, ListOf, Maybe, Either, Variant. Either Tagged union of two types. Accepts { _tag =... - [Dependent](https://docs.kleisli.io/nix-effects/types/dependent): Dependent contracts: Pi (Π), Sigma (Σ), Certified, Vector, DepRecord. Grounded in Martin-Löf (1984)... - [Foundation](https://docs.kleisli.io/nix-effects/types/foundation): Type system foundation: Type constructor, check, validate, make, refine. check Check whether a value inhabits a type.... - [Linear](https://docs.kleisli.io/nix-effects/types/linear): Linear type constructors: structural guards for capability tokens. Pure type predicates that check token structure... - [Primitives](https://docs.kleisli.io/nix-effects/types/primitives): Primitive types: String, Int, Bool, Float, Attrs, Path, Function, Null, Unit, Any. Any Top type. Every value inhabits... - [Refinement](https://docs.kleisli.io/nix-effects/types/refinement): Refinement types and predicate combinators. Grounded in Freeman & Pfenning (1991) and Rondon et al.... - [Universe](https://docs.kleisli.io/nix-effects/types/universe): Universe hierarchy: Type_0 : Type_1 : Type_2 : ... Lazy infinite tower. level Get the universe level of a... ### Streams - [Combine](https://docs.kleisli.io/nix-effects/streams/combine): Stream combination: concat, interleave, zip, zipWith. concat Concatenate two streams: all elements of the first, then... - [Core](https://docs.kleisli.io/nix-effects/streams/core): Stream primitives: done/more/fromList/iterate/range/replicate. done Terminate a stream with a final value. done : a... - [Limit](https://docs.kleisli.io/nix-effects/streams/limit): Stream limiting: take, takeWhile, drop. drop Skip the first n elements of a stream. drop : int -> Computation... - [Reduce](https://docs.kleisli.io/nix-effects/streams/reduce): Stream reduction: fold, toList, length, sum, any, all. all Check if all elements satisfy a predicate. all : (a ->... - [Transform](https://docs.kleisli.io/nix-effects/streams/transform): Stream transformations: map, filter, scanl. filter Keep only elements satisfying a predicate. sfilter : (a ->... ### Type Checker - [Check](https://docs.kleisli.io/nix-effects/type-checker/check): Semi-trusted (Layer 1): uses the TCB (eval/quote/conv) and reports type errors via send "typeError". Bugs... - [Conv](https://docs.kleisli.io/nix-effects/type-checker/conv): Checks whether two values are definitionally equal at a given binding depth. Purely structural — no type information... - [Elaborate](https://docs.kleisli.io/nix-effects/type-checker/elaborate): Bridges the fx.types layer to the kernel's term representation via the HOAS combinator layer. Provides the Nix ↔ kernel... - [Eval](https://docs.kleisli.io/nix-effects/type-checker/eval): Pure evaluator: interprets kernel terms in an environment of values. Zero effect system imports — part of the trusted... - [Hoas](https://docs.kleisli.io/nix-effects/type-checker/hoas): Higher-Order Abstract Syntax layer that lets you write kernel terms using Nix lambdas for variable binding. The... - [Quote](https://docs.kleisli.io/nix-effects/type-checker/quote): Converts values back to terms, translating de Bruijn levels to indices. Pure function — part of the TCB. Spec... - [Term](https://docs.kleisli.io/nix-effects/type-checker/term): Syntax of the kernel's term language. All 48 constructors produce attrsets with a tag field (not _tag, to distinguish... - [Value](https://docs.kleisli.io/nix-effects/type-checker/value): Values are the semantic domain produced by evaluation. They use de Bruijn levels (counting outward from the top of the... - [Verified](https://docs.kleisli.io/nix-effects/type-checker/verified): High-level combinators for writing kernel-checked implementations. Write programs with these combinators, then call...