Concepts
The architectural ideas behind KAOS.
Six load-bearing decisions that shape every package — how documents are typed, how source provenance survives a language-model call, how plans are written and re-used, how memory is partitioned, and which package can import which.
Six decisions, one architecture
Each concept feeds the others. The protocol-as-type-system shapes the runtime; the runtime is what carries the typed document tree; the document tree is what makes provenance survive an LLM call; the LLM call is what a recipe structures; recipes load into typed memory sections; and the layering law is what keeps every package above from leaking into every package below.
-
MCP-native architecture
Tools, resources, and prompts in KAOS are Model Context Protocol types from the first import. No adapter layer between your class and the wire.
-
The ContentDocument AST
One typed document tree — paragraphs, headings, tables, footnotes — that every PDF, DOCX, HTML, and EDGAR extractor produces, and every retriever and LLM call reads.
-
Provenance and grounding
Source page, bounding box, character offsets, and extractor confidence ride on every parsed element and survive into the typed answer the LLM returns.
-
Planning + extraction recipes
Reusable plans named for the legal work they do: merger-agreement extraction, share-purchase deal points, lease review, court-opinion analysis, privilege classification.
-
Session memory model
Typed sections — messages, documents, findings, audit trail — each with its own token budget, eviction rule, and persistence mode. BM25 search over the searchable ones.
-
Dependency layering
A small core, a document model on top, then extractors, then language-model programs, then agents. Lower layers never import upper ones; siblings never import each other.