Skip to main content
K

kition-sdk

kitionai/kition-sdk

The Kition kits in DeepSeek Harness: each kit file opens in its own Kition editor in the right sidebar, an agent’s edits appear there live, and agents get the kits’ KHP tools, an editing skill per kit and the person’s draft review.

Install

dsh plugin --profile web add github:kitionai/kition-sdk

README

Embed a kit's editor in your app over your storage and users; agents edit the same file over MCP; build your own kit on the same engine.

Kition SDK

Real document editors in your app, and the same documents for your AI agents.

Embed a kit's editor in your page with @kition/sdk/embed, or by signed iframe URL with @kition/sdk/embed/server.
Your storage, your users; agents edit the same files with the same engine.

Kition · Developer docs · Embed guide · SDK guide · Platform contracts · Kition Note · Kition Tessera · KHP

License: Apache-2.0 npm: @kition/sdk npm: @kition/cli KHP 1.0

Kition is 16 professional editors, called kits. The same kit and the same engine serve a person (the editor), an AI agent (commands) and a program (code). A kit is everything one kind of document needs: an engine that opens, edits, renders and saves it, the editor people work in, and the commands agents and programs call. The Kition SDK puts kits in your product: embed a kit's editor in your app, let your agents work on the same files, run kits on your servers, or build a kit of your own. The SDK guide lays out the ways in. Kition is built on it. Kits follow the Kit Harness Protocol (KHP), so any host that speaks it can run them.

Embed a kit's editor in your app

The embed example: a file list on the left, and the Note editor in a pane of the page, on a launch plan. The same page after Run script: the note gained a Q3 Quarterly review section with its task checked off.

Two ways in, both free and with no license key:

  • In your page: @kition/sdk/embed. Mount a kit's editor in an element of your page. It runs from its own origin in a sandboxed frame; files stay in your storage, people come from your identity system, and you decide who may edit, comment or view. A write carries the version it read, so an edit made elsewhere is never written over.
  • By URL: @kition/sdk/embed/server. For pages that cannot run a module: your server signs a URL for one person and one file, your page frames it, and the embed server shows the editor and reads and writes the file through HTTP callbacks to your server (guide, examples/url-embed).
import { KitionEmbed } from '@kition/sdk/embed'

const editor = await KitionEmbed.mount(element, {
  kit: { id: 'kit.note', url: 'https://kits.example.com/note-ui/' }, // the kit package you host
  file: { id: 'plan-2026', name: 'Plan.md' },
  storage,  // yours: read, stamp, write (versioned), create
  identity, // yours: user, users, permissions
})

examples/embed-app is a page with its own file list that embeds the Note editor (above); its Run script button edits the open note through the object model (right). The full guide is docs/sdk/embed.md.

Kits

Every kit embeds the same way. Each picture below is the kit's editor running embedded, with @kition/sdk/embed, in a plain page of "your app".

Motion: available now

The Motion editor embedded in a page: a 1920 by 1080 title composition, Launch Day over a purple gradient with a glow, a timeline with three layers, and the title layer's transform.

Motion graphics and video: compositions, layers, keyframes, effects, text animation presets and MP4 rendering, with checks that point out what makes a frame look flat. Kition's most used kit. Published: Kition Motion; its self-contained editor package is @kition/motion on npm (the folder motion-ui/).

Note: available now

The Note editor embedded in a page: a launch plan with properties, a callout and a task list.

Markdown notes, Obsidian-flavoured, that keep the file byte for byte. Published: Kition Note; its self-contained editor package is @kition/note on npm (the folder note-ui/).

Each kit's headless engine is on npm too, for macOS, Linux and Windows (@kition/<kit>-<platform>); kition kit install <kit> installs it, checked against the size and integrity the kit index gives (cli, distribution).

Table: available now

The Table editor embedded in a page: a launch tracker with tasks, status labels, owners, due dates and a shipped checkbox.

Tables with typed fields, views (grid, kanban, gallery, calendar), filters, sorts, groups and dashboards. Published: Kition Table; its self-contained editor package is @kition/table on npm (the folder table-ui/).

HTML: available now

HTML pages (.html, .htm) with their CSS rendered and bounded JavaScript run, edited as source with undo and redo. Published: Kition HTML; its self-contained editor package is @kition/html on npm (the folder html-ui/).

Every other kit: available now

All 16 Kition kits are published, each from its own repository, which publishes its self-contained editor package on npm as @kition/<kit> (the folder <kit>-ui/) and its headless engine as @kition/<kit>-<platform>: Board (whiteboards), Doc (word-processing documents, .docx), Sheet (spreadsheets), Slide (presentations), PDF, Photo (layered images), Vector (vector drawings), Layout (page layouts), Design (interface designs), Film (video projects), CAD (.dxf drawings) and Scene (3D scenes).

Build your own kit

An agent session on the grid example kit: inspect with a preview, twelve grid.set steps, inspect again, and a check that finds nothing wrong; beside it, the kit's own previews before and after.

Implement KitDocument for your engine and export it with kition_kit::export_kit_document!. The SDK gives the rest: the WebAssembly exports for the page, the headless executable, the agent tools, and a contract check your tests run. examples/grid-kit is the smallest complete kit, a few hundred lines: above, an agent draws a cross on its 8 × 6 grid through the MCP tools the SDK made from its kit.json, and the previews are the kit's own rendering.

Agents over MCP

The agent example's output: it edits Notes.md over MCP, adding a section with a task, and note_check finds nothing wrong; then the file as saved.

kition mcp serves every kit in a folder as MCP tools (note_inspect, note_run, note_check, ...) for any MCP client. Agents edit the same files people do, with the same engine, and can ask the kit to check their own work. Edits can go to a draft that the person reviews and merges. examples/agent-mcp is the agent's side, in a few dozen lines. Connecting Claude Code, Claude Desktop, Cursor or Codex: docs/sdk/agent.md.

kition mcp is a command of kition, the command line, which comes without the kits and downloads each kit the first time an agent opens a file of it. It works like a container tool: a kit is an image, kition kit install is docker pull, and kition mcp, kition serve and kition gateway run the kits on a workspace folder. With Node.js 20 or later, from npm:

npm install -g @kition/cli
kition agent add claude          # in your project folder; or codex, cursor
# or, without installing: claude mcp add kition -- npx -y @kition/cli mcp --workspace "$PWD"

Without Node.js, the same kition from npm (registry.npmjs.org, else its mirror registry.npmmirror.com):

curl -fsSL https://unpkg.com/@kition/cli/dist/install.sh | sh
~/.kition/bin/kition agent add claude

On Windows, irm https://unpkg.com/@kition/cli/dist/install.ps1 | iex. See docs/sdk/cli.md.

Scripts and extensions

The script example's output: a review section added, its heading renamed and its task checked, then saved and reopened; and the title-case extension changing two headings.

@kition/sdk/script reads and edits documents through a typed object model, in a page or in Node, on the engine in the page, in a kit package, or on a headless kit. One script runs unchanged in all three: examples/sdk-scripts. Extensions (@kition/sdk/extensions) add commands and panels to a kit, each in a sandbox with only the permissions it declares; examples/extensions/title-case title-cases a note's headings.

Safe concurrent edits

An agent reads a note, the person changes a table date, the agent's write to that cell is refused as a conflict, and its write to a property goes through.

People and agents edit the same file at the same time. Every write says which version it read. When someone else has since changed the thing a write is about, the write is refused, nothing is lost, and the writer is told what changed so it can decide again. A write about something else goes through. Above: the person moves a date while an agent is working; the agent's edit to that date is refused, and its edit to the note's status is applied.

Packages

The packages share one version, the SDK's (sdk.json), and are published under the @kition scope on npm, and the command line as @kition/cli.

PackageWhat
@kition/sdk/embedEmbed kit editors in any web page, over your storage and identity
@kition/sdk/embed/serverServe single-user kit editor pages for embedding by URL
@kition/cliThe kition command line from npm: npm install -g @kition/cli, or npx -y @kition/cli mcp --workspace <folder> for agents; it installs each kit on first use
@kition/sdk/scriptThe object model for scripts and extensions, in browsers and Node
@kition/sdk/extensionsThe extension host: manifests, sandboxed workers, declared permissions
@kition/sdk/syncClient for the open sync protocol kition-sync/1
@kition/sdk/kdmThe Kit Data Model, read-only: a kit document's typed objects as its engine writes them
@kition/sdk/editorBuild a kit's own editor: host connection, session, engine canvas, shared components
@kition/sdk/hostThe host's side of the Kit UI protocol
@kition/sdk/protocolKit UI protocol message types
@kition/sdk/dev-hostA development host to run a kit's editor without Kition

The Rust crates are used as git dependencies of this repository, pinned by commit (kition-kit = { git = "https://github.com/KitionAI/kition-sdk", rev = "<commit>" }):

CrateWhat
kition-kitThe KitDocument contract, WebAssembly exports, and contract checks
kition-kdmThe Kit Data Model
kition-headless, kition-kit-serverServe a KitDocument headless over the Kit Process Protocol
kition-kitsThe servers behind kition mcp and kition serve: kits as agent tools, drafts, guarded writes
kition-kit-host, kition-kit-process-protocolLaunch kit processes and speak their protocol
kition-convergence, kition-envPerformance suite; kits as training and evaluation environments

Quick start

Embed a kit in your app, from npm:

npm install @kition/sdk
# @kition/sdk/embed          the editor in your page
# @kition/sdk/embed/server   or: the editor by signed iframe URL, served by your server
# @kition/sdk/script         read and edit documents from code

The Note kit's editor package (editor, engine and fonts, self-contained) is @kition/note on npm. Put its note-ui/ folder where your kit origin serves it:

npm pack @kition/note                # kition-note-<version>.tgz
tar -xzf kition-note-<version>.tgz   # package/note-ui/
mv package/note-ui <kits>/           # <kits>/note-ui/

Run kits on a server, from any language (JSON lines on stdin and stdout, hosts):

npm install -g @kition/cli
kition kit install note
kition serve --workspace <folder>

Run the examples from a clone. The workspace links Kition Tessera, so clone it beside this repository:

git clone https://github.com/KitionAI/kition-tessera
git clone https://github.com/KitionAI/kition-sdk && cd kition-sdk
pnpm install

# A kit of your own: the grid example's contract tests, and its headless executable
cargo test -p grid-kit --test contract
cargo build -p grid-kit-headless

# The embed example, with the Note kit package unpacked into <kits>/note-ui/
KITION_KITS_DIR=<kits> pnpm example:embed              # http://127.0.0.1:5310

# Scripts on the Note kit package, in Node
KITION_KITS_DIR=<kits> pnpm test:sdk:example

# The agent example: kition-kits-mcp here, kition-note from a kition-note checkout
cargo build -p kition-kits --bin kition-kits-mcp
KITION_KIT_NOTE_BINARY=<kition-note>/target/debug/kition-note node examples/agent-mcp/run.mjs

The pictures in this README are made by tools/readme-shots.mjs from these examples, running; it is a tool, not a test.

Documentation

  • SDK guide: the Command API and the Script API; the ways in (embed, URL, server, the kition command line, collaboration); agents beside people; environments and distribution.
  • Platform contracts: the engine contract, the Kit UI and Kit Process protocols, the Kit Data Model, capability sets, and conformance levels. Start with the engine contract to write a kit.
  • Call context: how writes name what they rest on, and the refusals when it has changed.

Build and test

The workspace links Kition Tessera, so clone kition-tessera beside this repository first.

pnpm install --frozen-lockfile
cargo build -p kition-kit-mock   # host tests launch the mock kit's executable
cargo test
pnpm typecheck
pnpm test

CONTRIBUTING.md names the toolchain and the check every change passes; docs/development.md covers the npm packages, and docs/quality.md and features.yaml the tests. Changes are in CHANGELOG.md.

The Kition family

Kition is the open pro suite for AI: 16 kits, editors that people and AI agents use on the same files, and the products around them (all repositories).

ProductWhat it isLinks
Kition DesktopThe open pro suite for AI: 16 editors and an agent in one desktop appGitHub · kition.ai
Kition ShowcaseSample files for every kitGitHub · kition.ai/showcase
Kition SDKPut Kition's editors in your product, and give the same files to your AI agentGitHub · developer.kition.ai
kition command lineInstall kits on demand and run them for your agent: npx @kition/clideveloper.kition.ai · Guide
Kition OneA self-hosted team workspace built on Kition's kits, with real-time co-editingone.kition.ai
Kit Harness Protocol (KHP)The open protocol between a kit and its hostGitHub · kitharness.org
Kition TesseraThe design system for kitsGitHub · tessera.kition.ai
Kition UniverseA 3D map of the kits and what they makeGitHub · universe.kition.ai
Kition FontsThe open fonts the editors useGitHub
Product lineKits
OfficeNote · Table · Board · Doc · Sheet · Slide · PDF · HTML
DesignPhoto · Vector · Layout · Design
MediaFilm · Motion
EngineeringCAD · Scene

License

Apache-2.0; see LICENSE. Every part of the SDK is free to use, in development and in production, with no license key.

Related plugins