Open source · MIT · Python 3.10+

Knowledge Space Theory.
In Python.

Derive knowledge structures from prerequisites. Estimate what a learner knows. Identify what to study next.

Get started
$ pip install knowledgespaces

Structures

Build knowledge spaces from surmise relations or skill maps. Compute atoms, bases, fringes, and learning paths over arbitrary domains.

Assessment

Estimate a learner's knowledge state via Bayesian inference. Adaptive item selection minimizes the number of questions needed.

Estimation

Fit BLIM parameters with the EM algorithm. Multi-restart optimization, goodness-of-fit via G², AIC, and BIC.

Integration

Command-line interface, MCP server for LLM-based workflows, and CSV/JSON I/O compatible with R packages.

Quickstart

From prerequisites to assessment in five lines.

quickstart.py
import knowledgespaces as ks

structure = ks.space_from_prerequisites(
    ["add", "sub", "mul"],
    [("add", "sub"), ("sub", "mul")],
)

result = ks.assess(
    structure,
    {"add": True, "sub": True, "mul": False}
)

Structure

4 valid knowledge states identified from 8 possible subsets. Union-closed.

n_states = 4 | is_learning_space = True

Assessment

Most likely knowledge state and the recommended next topic.

state = {add, sub} | outer_fringe = {mul}
MCP Server

Talk to your data.

Your AI assistant becomes a KST expert. Build structures, run assessments, and explore learning paths through natural conversation.

7 tools · 13 resources · 4 prompts

AI Assistant
Marco knows addition and multiplication, but fails subtraction and division. What should I teach him next?
assess_student

Marco's estimated knowledge state is {add, mul}. His outer fringe contains sub, which depends only on add (already mastered). Recommended next topic: subtraction.

state = {add, mul} fringe = {sub} path: sub → div
Ask about your knowledge structure…

Start building knowledge structures.