Yanshi 偃师
An AI native headless painting engine — a canvas where people and AI create together.
- Operations are atoms. Every edit is an atom appended to a log, and the picture is the fold of that log; undo and redo move a pointer.
- One kernel, two hosts. The same Rust kernel runs natively on the server and as WebAssembly in the browser, so local rendering and server rendering are one implementation, not two approximations.
- A package is self-contained. A
.yanshipackage carries the atom log and every blob it references, and importing it elsewhere reproduces the picture.
An MCP server and a web viewer sit on top of that engine, so an agent and a person work on the same document.
Install
Prebuilt binaries, no Rust toolchain needed — Linux x86_64 (static), Intel macOS and Apple Silicon:
curl -fsSL https://raw.githubusercontent.com/gradetwo/yanshi/main/scripts/install.sh | sh
The script resolves the release asset for your platform, verifies its SHA256 against the
published SHA256SUMS, unpacks it to ~/.local/share/yanshi/<version>, and drops thin
wrappers for yanshi-serve and yanshi-mcp into ~/.local/bin. The tarball is
self-contained: brushes, brush previews, mediums, palettes, textures and the WASM kernel are
inside, and the binaries find them through the package layout (bin/… beside
share/yanshi/…), so it runs wherever you unpack it.
yanshi-serve --root ~/paint --doc mydoc --bind 127.0.0.1:8080 # then open http://127.0.0.1:8080/
yanshi-mcp --root ~/paint --doc mydoc # stdio MCP server, for MCP clients
yanshi-mcp --list-tools --profiles core # just show the tool surface
Knobs: YANSHI_VERSION, YANSHI_PREFIX, YANSHI_BIN_DIR,
YANSHI_DRY_RUN=1. Platforms without a prebuilt package — Linux arm64 and Windows:
build from source (cargo build --release -p yanshi-http -p yanshi-mcp, or make release),
or unpack the Windows tarball from the releases page by hand.
Quick start
You need Rust (the stable toolchain pinned by rust-toolchain.toml, with rustfmt and clippy) and make.
For the browser kernel (client-side rendering) also add rustup target add wasm32-unknown-unknown and
wasm-bindgen-cli 0.2.129; without them the server still runs and the viewer renders on the server side.
git clone https://github.com/gradetwo/yanshi.git
cd yanshi
make dev # build the WASM kernel if the toolchain is present, build, serve ⇒ http://127.0.0.1:8110/
Data lives in ~/.local/share/yanshi/workspace by default. To change the port or the data root, pass
environment variables (make dev does not forward Make variables into its recipe, while
make serve passes --port explicitly):
PORT=9000 make dev
make serve PORT=9000
Run make check (format, lint, tests) before pushing; make help lists every target.
Current state
- Version 0.3.2, with prebuilt release packages for five platforms (one
curlline, see above); the source is on GitHub andmake releasestill packages it yourself. - The
semantictool group is reserved by decision and not implemented. - The browser-side kernel is a build artefact and a fresh clone does not have it; nothing fails without it and the viewer falls back to server-side rendering.
Where the name comes from
Yanshi is the artificer in the Liezi, "Questions of Tang", who builds a mechanical performer. The passage, in the original:
周穆王西巡狩,越昆侖,不至弇山。反還,未及中國,道有獻工人名偃師,穆王薦之,問曰:「若有何能?」偃師曰:「臣唯命所試。然臣已有所造,願王先觀之。」穆王曰:「日以俱來,吾與若俱觀之。」翌日,偃師謁見王。王薦之曰:「若與偕來者何人?」對曰:「臣之所造能倡者。」穆王驚視之,趨步俯仰,信人也。巧夫,顉其頤,則歌合律;捧其手,則舞應節。千變萬化,惟意所適。王以為實人也,與盛姬內御並觀之。技將終,倡者瞬其目而招王之左右侍妾。王大怒,立欲誅偃師。偃師大懾,立剖散倡者以示王,皆傅會革木膠漆白黑丹青之所為。王諦料之,內則肝膽心肺脾腎腸胃,外則筋骨支節皮毛齒髮,皆假物也,而無不畢具者。合會復如初見。王試廢其心,則口不能言;廢其肝,則目不能視;廢其腎,則足不能步。穆王始悅而歎曰:「人之巧乃可與造化者同功乎!」詔貳車載之以歸。夫班輸之雲梯,墨翟之飛鳶,自謂能之極也。弟子東門賈、禽滑釐聞偃師之巧以告二子,二子終身不敢語藝,而時執規矩。
After Chinese Text Project, Liezi, "Tang Wen"; transcribed here in simplified characters.
What is worth borrowing is not the cleverness but that the construction and the behaviour are separable: opened up, the figure that sings and dances is leather, wood, glue, lacquer and pigment; take away its heart, liver or kidney and it cannot speak, see or walk; put it back together and it is as it was.
The passage ends with the king marvelling that such craft could rival nature. We do not claim that. The project writes down how the tool is built, and what it cannot do as well as what it can.
Logo
The mark is a slingshot: a forked frame, two rubber bands and a red pellet. It takes its inspiration from a line in the film Who Cares (《谁说我不在乎》):
抽出裤衩里的猴皮筋,做成弹弓打你们家玻璃。
(Take the rubber band out of your underpants and make a slingshot to break your window.)
Clip on bilibili; the film's rights belong to its rights holders.
What it borrows is the gesture in a joke, making something usable out of whatever is at hand, which is the same attitude the project takes: write the construction down, use what works, and say so when it does not.
Contact and source
Bug reports and collaboration: yanshi@wangda.today. For security issues, please write to us rather than opening a public issue.
- Repository: github.com/gradetwo/yanshi · source download (zip): main.zip
- Documentation: README.md · guide · design document (authoritative, in Chinese): yanshi-v1.0-draft4.md
Work
Swipe sideways for more; click for the 4K original.


