tok

io.github.tok-lang-bpm由 GitHub 账号 tok-lang-bpm 发布v1.0.3更新于 Nov 3, 2026

以文本方式建模BPMN流程和DMN决策:检查、导出、导入、模拟、评估。

AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。

原文描述

Model BPMN processes and DMN decisions as text: check, export, import, simulate, evaluate.

已验证STDIO仅桌面

概览

tok 的本地 MCP 服务;无需登录;STDIO;8 个工具。

暂无 AI 概览:以下信息来自注册中心条目和服务本身。

安装

在 SourceWeft 中

  1. 打开 控制台中的 tok,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

tok

tok is a plain-text language for process models. One short text file describes a BPMN 2.0 process — pools, lanes, events, tasks, gateways, flows and data — together with the DMN decisions it uses, the forms people fill in and the parameters needed to simulate it. The tok tool checks the model and turns it into everything else: BPMN 2.0 XML with an automatic diagram layout (opens in Camunda Modeler and bpmn.io), SVG pictures, DMN files, Camunda forms and simulation results.

The guide · Playground · Language on one page · BPMN symbols · Report an issue

tok 1.0 "Interlibrary loan"
pool library "University library"  lane reader "Reader"    start need "Book needed"    user order "Place an order"  lane librarian "Librarian"    user catalogues "Search the catalogues"    xor available "Available locally?"    user point "Point to the copy"    send request "Order from another library" message="Order"    end pointed "Copy pointed out"    end ordered "Order placed"
pool other "Lending library"
flow need -> order -> catalogues -> availableflow available -> point "yes"flow available -> request "no"flow point -> pointedflow request -> ordered
message request -> other "Order"

[The diagram tok draws from the model above]

Start here

You want toStart with
model processespip install tok-lang, then the chapters Getting started and Process basics of the guide; the playground needs no installation
learn BPMN with tok (students)the guide from the beginning, the symbol catalogue and the cheat sheet
run models on Camunda 8the chapter Executable models of the guide and docs/conformance-camunda.md
work with an AI agentthe agent bundle tok-lang-bpm/tok-agent (skill and MCP server), docs/mcp.md
check models in continuous integrationthe action tok-lang-bpm/setup-tok
use tok from Python, R, Julia, JavaScript or Cdocs/python.md, r/tokr, docs/julia.md, docs/playground.md, docs/c-api.md
implement or extend the languagedocs/spec.md, the conformance corpus conformance/, CONTRIBUTING.md

The tok project

RepositoryWhat it holds
tok-lang-bpm/tokthis repository: the language, the engine, every package, the editor support, the MCP server and the documentation
tok-lang-bpm/tok-agentthe agent bundle: the skills tok-modelling and bpmn-modelling and the MCP configuration, installable as a plugin
tok-lang-bpm/setup-tokGitHub Action: installs tok and checks the models of a repository
tok-lang-bpm/tok-lang-bpm.github.iothe guide (a book) and the playground at https://tok-lang-bpm.github.io/
tok-lang-bpm/tok-evidencethe data, scripts and results of the study of tok (size, fault detection, language models, performance, conformance, process mining), archived at Zenodo: 10.5281/zenodo.23881048

Packages: tok-lang (PyPI), tok-cli, tok-core, tok-bpmn, tok-sim, tok-lsp, tok-mcp (crates.io), tokr (CRAN, and R-universe), TokLang (Julia General registry), tok for VS Code (Visual Studio Marketplace and Open VSX).

Why a text language

  • Readable and reviewable. Every line starts with a keyword and describes one element. Changes show up as clear diffs in version control.
  • Made for people and for AI agents. The whole language fits on one page (tok cheatsheet). An agent can write a model, run tok check --json (or call the check tool of the MCP server, tok mcp), read the line-numbered diagnostics and fix them, without ever touching XML or coordinates.
  • Standards on the outside. tok is a notation for BPMN 2.0 and DMN, not a replacement. Everything you write is exported to the OMG formats that modelling tools and process engines read; tok import converts existing BPMN and DMN files back to text.
  • Executable and measurable. The same file can carry the details Camunda 8 needs to run the process, and the times, resources and probabilities a simulation needs to estimate cycle times and workloads.
  • Simple to implement. A line-based grammar with six token types. Python, Rust and Julia implementations pass the same conformance corpus byte for byte.

Install

The tok command is the Rust engine. It comes with the Python package tok-lang (Python 3.8 or newer; wheels for Windows x64, Linux x86_64 and aarch64, macOS; on Windows use py -m pip if pip is not on the path):

pip install tok-langtok --version

On a platform without a wheel pip builds the engine from the source archive, which needs Rust 1.99 or newer. The command alone, from crates.io or from a checkout of the repository:

cargo install tok-cli                 # the program tokcd rust && cargo build --release -p tok-cli      # target/release/tok

Every way reads every version of the language, 0.1 to 1.0. The package also keeps the pure-Python implementation frozen at language 0.3, the reference of the parity tests: TOK_ENGINE=python tok … runs it (docs/python.md).

The package also runs the MCP server for AI agents: tok mcp (docs/mcp.md). The R package tokr (install.packages("tokr")), the Julia package TokLang.jl (below), the language server tok-lsp and the MCP server as a program of its own (cargo install tok-lsp tok-mcp) and the VS Code extension tok are described under Tools.

Julia

TokLang.jl gives the whole language to Julia through the C interface of the engine, keeps an independent implementation of the core of the specification, and adds a native simulator for large experiments and the calibration of simulation parameters on event logs:

julia
using Pkg; Pkg.add(["TokLang", "tok_jll"])    # or Pkg.add(url="https://github.com/tok-lang-bpm/tok", subdir="julia/TokLang.jl")using TokLangtext = read("model.tok", String)TokLang.Engine.check(text)                                  # the engine: every layer of the languagem = TokLang.Sim.model(text)                                 # native simulation (julia -t auto)e = TokLang.Sim.experiment([m, TokLang.Sim.scenario(m; name="+1", resources=Dict("staff" => 3))]; replications=200)TokLang.Sim.summarize(e)f = TokLang.Fit.fit(text, TokLang.Fit.read_xes("log.xes"))  # calibration on an event logTokLang.Fit.apply(text, f)                                  # the document with the fitted parameters

The engine library is found through TOK_LIBTOK, the package tok_jll, or the repository build (cargo build --release -p tok-capi); see docs/julia.md.

Use

tok check model.tok              # diagnostics; --lang pl for Polish, --json for programstok fmt model.tok -w             # canonical formtok bpmn model.tok               # model.bpmn with diagram layouttok svg model.tok                # model.svgtok export model.tok -o out/     # BPMN, SVG, DMN and forms (executable models for Camunda 8)tok import diagram.bpmn          # BPMN 2.0 XML to toktok sim model.tok --seed 1       # simulation indicators; --log log.csv for the event logtok eval model.tok DECISION a=1  # evaluate a decision

Tools

ToolWhat it givesDocumentation
tokthe command line: check, format, export, import, simulate, evaluate; also check, lay out and draw BPMN 2.0 XML files from any modelling tooldocs/cli.md
tok-lsplanguage server (LSP 3.17) for any editor: diagnostics, formatting, go to definition, references, rename, outline, hover, completion, the diagramdocs/lsp.md
VS Code extensionsyntax highlighting, the language server, a live diagram preview, export of BPMN and every fileeditors/vscode
tok mcp, tok-mcpMCP server for AI agents: the tools check, check_bpmn (BPMN 2.0 XML), fmt, export, import, sim, eval and the language reference (tok mcp from the Python package, or the program tok-mcp)docs/mcp.md
playgroundthe engine in the browser (WebAssembly): editor, diagnostics, diagram, bpmn-js viewer, simulation, decisions, downloadsdocs/playground.md
Python, R, Juliatok-lang (Python), tokr (R), TokLang.jl (Julia) on the same enginedocs/julia.md, r/tokr
C librarytokengine with tok.h, for any language that calls Cdocs/c-api.md
cd rustcargo build --release -p tok-lsp -p tok-mcp      # target/release/tok-lsp, target/release/tok-mcpbash tools/playground.sh                          # the playground in rust/target/playground

Documentation

DocumentContents
docs/spec.mdthe language specification (normative)
docs/cheatsheet.mdthe language on one page
docs/symbols.mdevery BPMN symbol tok draws, with its tok statement and its support in Camunda 8 (tools/symbols.py)
docs/cli.mdcommand line reference
docs/diagnostics.mddiagnostic codes in English and Polish
docs/feel.mdFEEL: the subset of languages 0.1–0.6 and the full FEEL of language 0.7
docs/dmn-tck.mdDMN TCK conformance results
docs/conformance-camunda.mdevery BPMN, DMN and FEEL feature of Camunda 8.10, how tok expresses it, the case and the Camunda run that verify it
docs/conformance-bpmn.mdevery element of the BPMN 2.0.2 and DMN 1.5 metamodels: tok construct, export, import, MIWG and DMN TCK coverage
docs/simulation.mdsimulation semantics, distributions and outputs
docs/import.mdconverting BPMN and DMN XML to tok
docs/python.mdthe Python module tok.api
docs/julia.mdTokLang.jl: the engine in Julia, the independent core, native simulation, calibration
docs/calibration.mdthe fit layer: estimating simulation parameters from event logs
docs/c-api.mdthe C interface of the engine (library tokengine, header tok.h)
docs/lsp.mdthe language server tok-lsp and its use in VS Code, Neovim, Helix and Emacs
docs/mcp.mdthe MCP server tok-mcp: tools, resources, configuration of MCP clients
docs/playground.mdthe browser playground on the WebAssembly build of the engine
docs/fuzzing.mdthe fuzz targets of the engine, how to run them, what they found
docs/performance.mdbenchmarks on large generated models and their results
docs/design-1.0.mdlanguage 1.0: decisions, deprecations, the compatibility of 1.x (earlier versions: design-0.3.md to design-0.7.md)
docs/roadmap.mdthe releases from 0.1 to 1.0: full Camunda 8 and BPMN 2.0.2 coverage, Rust engine for Python and R, Julia standalone
docs/changelog.mdthe changes of every release
skills/tok-modellinga skill that teaches an AI agent to model in tok
skills/bpmn-modellinga skill that teaches an AI agent to write BPMN 2.0 XML from a process description, checked, laid out and drawn by the tok command
examples/example models

Repository

FolderContents
python/reference implementation (package tok-lang, command tok) and its tests
rust/Rust engine: tok-core, tok-bpmn (BPMN rules, layout, SVG), tok-sim (simulator), tok-cli (native tok), tok-py (Python bindings), tok-capi (C interface), tok-lsp (language server), tok-mcp (MCP server), tok-wasm (WebAssembly build), tok-bench (generated large models and benchmarks); rust/fuzz holds the fuzz targets (a cargo workspace of its own)
editors/vscodeVS Code extension: grammar, language client, diagram preview
playground/the page of the browser playground
r/tokrR package tokr on the Rust engine: diagnostics as data frames, diagrams in the viewer, knitr engine {tok}
julia/TokLang.jlJulia package: the engine through the C interface, the independent core, native simulation and calibration; julia/app (the tok application), julia/binarybuilder (the recipe of tok_jll)
conformance/shared test corpus: input documents and expected outputs for every implementation
docs/, examples/, skills/documentation, examples, agent skill

tools/check.sh runs every check of a release (Rust, Python, R and Julia tests, engine wheel and its parity with the Python implementation, the native tok program, the C library of the engine, the language and MCP servers, the VS Code extension and the playground) on Linux, macOS or Windows with Git Bash.

The BPMN validation comes from the bpmn.py validator used in the course Modelowanie procesów informacyjnych (Jagiellonian University), shipped here as tok.bpmnlib; its rule messages are in Polish and tok adds English equivalents. The diagram layout and SVG rendering started as a port of bpmn.py and, from 0.4, are developed in the Rust engine (rust/tok-bpmn), in the same style: left to right, pools stacked, lanes as rows.

Contributing and issues

Report problems and ideas in the issues of the GitHub repository. How to build, test and propose changes: CONTRIBUTING.md. Security problems: SECURITY.md. To cite tok, use CITATION.cff; the releases are archived on Zenodo, doi:10.5281/zenodo.23769633 (all versions). The language and its study are described in the preprint tok: a textual concrete syntax of BPMN and DMN for humans and AI agents (Marek Deja, 2026), hal-05848142.

License

GNU General Public License v3.0 or later, see LICENSE.

来源:README.md,提交 9de19bc

工具

8

check

Check a tok model

Check a tok document and list its diagnostics (code, severity, line, element, message), as `tok check --json`. Every layer is checked: tokens, statements, references, BPMN 2.0 rules, the Camunda 8 profile of executable documents, decisions, FEEL and simulation parameters. A document with errors is a successful call with errors > 0; fix the errors and check again. Codes are explained in the reference topic 'diagnostics'.

输入参数bpmnlangpathtextclasslevel

check_bpmn

Check a BPMN file

Check BPMN 2.0 XML, from tok or from any modelling tool, with the BPMN rules of the tok checker, as `tok check FILE.bpmn --json`: every finding has a code, a severity, the line and the id of its element and a message. steps requires every element name to start with the step number of a process description (K01); description, the text of that description, reports steps without an element and elements without a step (K02, K03); camunda adds the Camunda 8 profile of executable models (C codes; with path, forms and decisions are looked for in the file's folder). XML with errors is a successful call with errors > 0. Codes are explained in the reference topic 'diagnostics'.

输入参数xmllangpathstepscamundadescription

fmt

Format a tok model

Print a tok document in its canonical form, as `tok fmt`. The document must have no syntax errors. The result is the text only; write it to the file yourself.

输入参数langpathtext

export

Export a tok model

Export a checked tok document and return the contents of the files `tok export` writes: BPMN 2.0 XML with diagram layout (NAME.bpmn), its SVG picture (NAME.svg), DMN files of the decisions (with NAME.drd.svg pictures in languages 0.7 and 1.0) and Camunda form files (ID.form). With path, the layout sidecar FILE.tok.layout next to the file is used. A document with errors is a tool error listing them.

输入参数langnamepathtextformatssidecar

import

Import BPMN or DMN

Convert a BPMN 2.0 XML or DMN 1.1–1.5 file to a tok document, as `tok import`. Elements tok does not keep are listed in warnings. For BPMN the diagram of the file is returned as a layout sidecar: save it as FILE.tok.layout next to the document to keep the drawing.

输入参数xmlpathformatlayoutflow_ids

sim

Simulate a tok model

Run the discrete-event simulation of a tok document, as `tok sim`: indicators (cases per end event, cycle times, waiting and processing times, resource utilization) and the report text. The same seed gives the same run. The event log and the case table are large; ask for them only when needed.

输入参数csvlogxeslangpathseedtextcasescases_table

eval

Evaluate a decision

Evaluate a decision of a tok document for input values, as `tok eval`. In languages 0.7 and 1.0 the decision is evaluated with everything it requires and values are given by the FEEL names of input data; in earlier languages the decision table alone is evaluated over its input columns. Values are JSON (numbers, text, booleans, null, lists, objects as contexts).

输入参数langpathtextvaluesdecision必填

reference

tok language reference

The reference documentation of the tok language: 'cheatsheet' (the whole language on one page; read it before writing a model), 'spec' (the normative specification), 'diagnostics' (every diagnostic code), 'feel' (expressions), 'cli' (the tok command). The same texts are resources tok://reference/TOPIC.

输入参数topic

版本历史

1
  1. v1.0.3最新Nov 3, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分